ApplyDatasetSchemaUnit
Rename the dataset's columns and cast them to their declared types.
Takes the type declaration from the context (inferred_types) rather than
from its own configuration, so a single path feeds it whether the types were
inferred upstream or handed in by whoever set up the run. Renaming and
casting are one unit because a rename has to carry the declared types with
it: the type declared for Species has to end up on Variety, not be
re-inferred from the data.
validate rejects a declaration that names columns the dataset does not
have. Without that check the mismatch is silent — the underlying transform
passes unknown columns through untouched — so a stale declaration would
quietly leave columns with inferred types instead of the requested ones.
Note the deliberate asymmetry: the unit does not republish a renamed
inferred_types. After a rename that key describes column names that no
longer exist, and republishing it would invite a second consumer to trust a
declaration that no longer matches the dataset. Whoever needs types after
this unit reads them off the dataset.
Parameters
- column_renames, default=
None - Mapping of current column name to new name, applied before the types are cast. Columns not mentioned keep their name. The resulting names have to stay unique.
Methods
execute(self, ctx: DashAI.back.units.context.ExecutionContext) -> None
ApplyDatasetSchemaUnitDo the unit's work, reading from and writing to the context.
Parameters
- ctx : ExecutionContext
- The shared execution context.
validate(self, ctx: DashAI.back.units.context.ExecutionContext) -> None
ApplyDatasetSchemaUnitCheck preconditions without executing the unit.
Parameters
- ctx : ExecutionContext
- The shared execution context.
get_credential(self, name: str)
ConfigObjectResolve a registered credential component by name.
Parameters
- name : str
- Credential component class name (e.g. "HuggingFaceCredential").
Returns
- BaseCredential
- An instance of the requested credential component.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.
Parameters
- raw_data : dict
- A dictionary with the data provided by the user to initialize the model.
Returns
- dict
- A validated dictionary with the necessary objects.