added all info

This commit is contained in:
Beau 2026-06-24 12:31:29 +02:00
commit e0c40da5d0
94 changed files with 5197859 additions and 0 deletions

View file

@ -0,0 +1,34 @@
"""Per-action ontology mask: True for rows whose assetType is invalid for the action."""
import pandas as pd
from ontology_guidance.get_onto_guidance_assets_per_action import get_ontology_info_assets_per_action
def build_invalid_row_mask(action_type, data):
"""Return a boolean Series over data.index, True where the row's assetType
is NOT in the valid set for action_type. Returns None when no penalty
applies (unknown action, no assetType columns, or every asset is valid).
get_ontology_info_assets_per_action returns None for an action that is unknown
to the ontology, which we treat as "no guidance signal" and skip."""
valid_assets = get_ontology_info_assets_per_action(action_type)
if valid_assets is None:
return None # action unknown to the ontology -> no guidance signal
asset_cols = [col for col in data.columns if col.startswith('assetType')]
if not asset_cols:
return None
# strip both sides: some asset columns carry a leading space (e.g.
# 'assetType_ Bambu Lab P1S Combo') that the dict keys don't, which would
# otherwise mis-flag a valid asset as a violation.
valid_norm = {a.strip() for a in valid_assets}
invalid_cols = [
col for col in asset_cols
if col.replace('assetType_', '').strip() not in valid_norm
]
if not invalid_cols:
return None
return data[invalid_cols].any(axis=1)