ts_ids_core.base.ids_field module¶
- IS_RAW_DATA = 'is_raw_data'¶
JSON Schema key that marks a field of untransformed data; see
IdsField().
- IdsField(default: Any = IdsUndefined, primary_key: str | None = None, is_raw_data: bool = False, **kwargs: Any) Any[source]¶
Wrap the
pydantic.Field()function such that, fields default to a sentinel value for undefined (a.k.a. unknown or missing) values. As such, the field definition is compatible with schema defined usingts_ids_core.base.ids_element.IdsElement.- Parameters:
default – The default value to use for the field. Default set to a global instance of
ts_ids_core.base.ids_undefined_type.IdsUndefinedTypethat’s intended to be used as a singleton.primary_key – A JSON pointer to the primary key which this foreign key links to. For example, IdsField(primary_key=”/properties/samples/items/properties/pk”) would be used to define a foreign key which points to samples[*].pk. This pointer is validated when the IdsElement.schema method is called, validation fails if the target primary key field is not in the schema.
is_raw_data – Whether the field and everything under it record data as written in the primary data, so that conventions for standardized values do not apply. For example, a datacubes_raw list beside the standard datacubes keeps the instrument’s own axes and values before any conversion, so its quantities use ValueUnit and do not add raw_value and raw_unit. When true, the field’s JSON Schema has “is_raw_data”: true, and the ts-ids-validator raw unit check skips the field and everything under it. Set it on the field, not inside the component the field uses, so that a shared component needs no change.
kwargs – All other keyword arguments are passed to
pydantic.Field().
- Returns:
The resulting
pydantic.fields.FieldInfoproduced bypydantic.Field().