tempor.clinic.field_def module

tempor.clinic.field_def.get_widget_st_key(field_def: FieldDef) str[source]
class tempor.clinic.field_def.FieldDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None)[source]

Bases: BaseModel, ABC

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

data_type : ClassVar[Literal[int] | Literal[float] | Literal[categorical] | Literal[binary] | Literal[str] | Literal[date]]
is_time_index : ClassVar[bool] = False
is_computed : ClassVar[bool] = False
data_modality : Literal[static] | Literal[temporal] | Literal[event]
feature_name : str
readable_name : str
units : str | None
default_value : Any
timestep_default_mode : Literal[no_action] | Literal[take_previous]
formatting : str | None
info : str | None
transform_input_to_db : Callable | None
transform_db_to_input : Callable | None
get_default_value(modality: Literal[static] | Literal[temporal] | Literal[event], data_sample: DataSample | Literal[first_step] | None = None) Any[source]
get_full_label() str[source]
get_formatting() str[source]
render_edit_widget(value: Any) Any[source]
process_db_to_input(value: Any) Any[source]
process_input_to_db(value: Any) Any[source]
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.FieldDefsCollection(static, temporal, event)[source]

Bases: tuple

Create new instance of FieldDefsCollection(static, temporal, event)

static : dict[str, FieldDef]

Alias for field number 0

temporal : dict[str, FieldDef]

Alias for field number 1

event : dict[str, FieldDef]

Alias for field number 2

class tempor.clinic.field_def.IntDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: int | None = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: int | None = None, max_value: int | None = None, step: int | None = None)[source]

Bases: FieldDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

data_type : ClassVar[Literal[int] | Literal[float] | Literal[categorical] | Literal[binary] | Literal[str] | Literal[date]] = 'int'
default_value : int | None
min_value : int | None
max_value : int | None
step : int | None
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Union[int, NoneType], required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[int, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[int, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'step': FieldInfo(annotation=Union[int, NoneType], required=False), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.FloatDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: float | None = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: float | None = None, max_value: float | None = None, step: float | None = None)[source]

Bases: FieldDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

data_type : ClassVar[Literal[int] | Literal[float] | Literal[categorical] | Literal[binary] | Literal[str] | Literal[date]] = 'float'
default_value : float | None
min_value : float | None
max_value : float | None
step : float | None
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Union[float, NoneType], required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[float, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[float, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'step': FieldInfo(annotation=Union[float, NoneType], required=False), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.CategoricalDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: str | None = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, options: list[str])[source]

Bases: FieldDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

data_type : ClassVar[Literal[int] | Literal[float] | Literal[categorical] | Literal[binary] | Literal[str] | Literal[date]] = 'categorical'
default_value : str | None
options : list[str]
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Union[str, NoneType], required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'options': FieldInfo(annotation=List[str], required=True), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.BinaryDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: bool = False, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None)[source]

Bases: FieldDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

data_type : ClassVar[Literal[int] | Literal[float] | Literal[categorical] | Literal[binary] | Literal[str] | Literal[date]] = 'binary'
default_value : bool
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=bool, required=False, default=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.StrDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: str = '', timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None)[source]

Bases: FieldDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

data_type : ClassVar[Literal[int] | Literal[float] | Literal[categorical] | Literal[binary] | Literal[str] | Literal[date]] = 'str'
default_value : str
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=str, required=False, default=''), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.DateDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: datetime | None = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: date | None = None, max_value: date | None = None)[source]

Bases: FieldDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

data_type : ClassVar[Literal[int] | Literal[float] | Literal[categorical] | Literal[binary] | Literal[str] | Literal[date]] = 'date'
default_value : datetime | None
min_value : date | None
max_value : date | None
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Union[datetime, NoneType], required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[date, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[date, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.TimeIndexDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None)[source]

Bases: FieldDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

is_time_index : ClassVar[bool] = True
abstract get_next(value: Any) Any[source]
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.IntTimeIndexDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: int | None = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: int | None = None, max_value: int | None = None, step: int | None = None)[source]

Bases: IntDef, TimeIndexDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

get_next(value: int) int[source]
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Union[int, NoneType], required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[int, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[int, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'step': FieldInfo(annotation=Union[int, NoneType], required=False), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

default_value : int | None
min_value : int | None
max_value : int | None
step : int | None
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
class tempor.clinic.field_def.FloatTimeIndexDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: float | None = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: float | None = None, max_value: float | None = None, step: float | None = None)[source]

Bases: FloatDef, TimeIndexDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

get_next(value: float) float[source]
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Union[float, NoneType], required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[float, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[float, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'step': FieldInfo(annotation=Union[float, NoneType], required=False), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

default_value : float | None
min_value : float | None
max_value : float | None
step : float | None
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
class tempor.clinic.field_def.DateTimeIndexDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: datetime | None = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: date | None = None, max_value: date | None = None)[source]

Bases: DateDef, TimeIndexDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

get_next(value: date) date[source]
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Union[datetime, NoneType], required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[date, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[date, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

default_value : datetime | None
min_value : date | None
max_value : date | None
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
class tempor.clinic.field_def.ComputedDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, computation: Callable[[DataSample, date | float | int], Any], hide_computed_icon: bool = False)[source]

Bases: FieldDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

is_computed : ClassVar[bool] = True
computation : Callable[[DataSample, date | float | int], Any]
hide_computed_icon : bool
compute(data_sample: DataSample, current_timestep: date | float | int) Any[source]

Make whatever computation the field requires and return the computed value.

Note

The computation cascades from static data, to time series data, to event data.

Parameters:
data_sample : DataSample

Sample data object, before computation.

current_timestep : TimeStep

The currently selected time step.

Returns:

The resultant computed value.

Return type:

Any

get_full_label() str[source]
model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'computation': FieldInfo(annotation=Callable[[tempor.clinic.const.DataSample, Union[datetime.date, float, int]], Any], required=True), 'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'hide_computed_icon': FieldInfo(annotation=bool, required=False, default=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class tempor.clinic.field_def.IntComputedDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: int | None = None, max_value: int | None = None, step: int | None = None, computation: Callable[[DataSample, date | float | int], Any], hide_computed_icon: bool = False)[source]

Bases: ComputedDef, IntDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'computation': FieldInfo(annotation=Callable[[tempor.clinic.const.DataSample, Union[datetime.date, float, int]], Any], required=True), 'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'hide_computed_icon': FieldInfo(annotation=bool, required=False, default=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[int, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[int, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'step': FieldInfo(annotation=Union[int, NoneType], required=False), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

computation : Callable[[DataSample, date | float | int], Any]
hide_computed_icon : bool
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
default_value : Any
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
class tempor.clinic.field_def.FloatComputedDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: float | None = None, max_value: float | None = None, step: float | None = None, computation: Callable[[DataSample, date | float | int], Any], hide_computed_icon: bool = False)[source]

Bases: ComputedDef, FloatDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'computation': FieldInfo(annotation=Callable[[tempor.clinic.const.DataSample, Union[datetime.date, float, int]], Any], required=True), 'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'hide_computed_icon': FieldInfo(annotation=bool, required=False, default=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[float, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[float, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'step': FieldInfo(annotation=Union[float, NoneType], required=False), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

computation : Callable[[DataSample, date | float | int], Any]
hide_computed_icon : bool
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
default_value : Any
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
class tempor.clinic.field_def.CategoricalComputedDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, options: list[str], computation: Callable[[DataSample, date | float | int], Any], hide_computed_icon: bool = False)[source]

Bases: ComputedDef, CategoricalDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'computation': FieldInfo(annotation=Callable[[tempor.clinic.const.DataSample, Union[datetime.date, float, int]], Any], required=True), 'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'hide_computed_icon': FieldInfo(annotation=bool, required=False, default=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'options': FieldInfo(annotation=List[str], required=True), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

computation : Callable[[DataSample, date | float | int], Any]
hide_computed_icon : bool
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
default_value : Any
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
class tempor.clinic.field_def.BinaryComputedDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, computation: Callable[[DataSample, date | float | int], Any], hide_computed_icon: bool = False)[source]

Bases: ComputedDef, BinaryDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'computation': FieldInfo(annotation=Callable[[tempor.clinic.const.DataSample, Union[datetime.date, float, int]], Any], required=True), 'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'hide_computed_icon': FieldInfo(annotation=bool, required=False, default=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

computation : Callable[[DataSample, date | float | int], Any]
hide_computed_icon : bool
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
default_value : Any
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
class tempor.clinic.field_def.StrComputedDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, computation: Callable[[DataSample, date | float | int], Any], hide_computed_icon: bool = False)[source]

Bases: ComputedDef, StrDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'computation': FieldInfo(annotation=Callable[[tempor.clinic.const.DataSample, Union[datetime.date, float, int]], Any], required=True), 'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'hide_computed_icon': FieldInfo(annotation=bool, required=False, default=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

computation : Callable[[DataSample, date | float | int], Any]
hide_computed_icon : bool
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
default_value : Any
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
class tempor.clinic.field_def.DateComputedDef(*, data_modality: Literal[static] | Literal[temporal] | Literal[event], feature_name: str, readable_name: str, units: str | None = None, default_value: Any = None, timestep_default_mode: Literal[no_action] | Literal[take_previous] = 'no_action', formatting: str | None = None, info: str | None = None, transform_input_to_db: Callable | None = None, transform_db_to_input: Callable | None = None, min_value: date | None = None, max_value: date | None = None, computation: Callable[[DataSample, date | float | int], Any], hide_computed_icon: bool = False)[source]

Bases: ComputedDef, DateDef

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

model_config : ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields : ClassVar[dict[str, FieldInfo]] = {'computation': FieldInfo(annotation=Callable[[tempor.clinic.const.DataSample, Union[datetime.date, float, int]], Any], required=True), 'data_modality': FieldInfo(annotation=Literal['static', 'temporal', 'event'], required=True), 'default_value': FieldInfo(annotation=Any, required=False), 'feature_name': FieldInfo(annotation=str, required=True), 'formatting': FieldInfo(annotation=Union[str, NoneType], required=False), 'hide_computed_icon': FieldInfo(annotation=bool, required=False, default=False), 'info': FieldInfo(annotation=Union[str, NoneType], required=False), 'max_value': FieldInfo(annotation=Union[date, NoneType], required=False), 'min_value': FieldInfo(annotation=Union[date, NoneType], required=False), 'readable_name': FieldInfo(annotation=str, required=True), 'timestep_default_mode': FieldInfo(annotation=Literal['no_action', 'take_previous'], required=False, default='no_action'), 'transform_db_to_input': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'transform_input_to_db': FieldInfo(annotation=Union[Callable, NoneType], required=False), 'units': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

computation : Callable[[DataSample, date | float | int], Any]
hide_computed_icon : bool
data_modality : DataModality
feature_name : str
readable_name : str
units : str | None
default_value : Any
timestep_default_mode : TimestepDefaultMode
formatting : str | None
info : str | None
transform_input_to_db : collections.abc.Callable | None
transform_db_to_input : collections.abc.Callable | None
tempor.clinic.field_def.parse_field_defs(field_defs_raw: dict[Literal[static] | Literal[temporal] | Literal[event], Any]) FieldDefsCollection[source]
tempor.clinic.field_def.get_default(field_defs: dict[str, FieldDef], modality: Literal[static] | Literal[temporal] | Literal[event], data_sample: DataSample | Literal[first_step] | None = None) dict[str, dict][source]
tempor.clinic.field_def.get_default_computed(field_defs: dict[str, FieldDef], modality: Literal[static] | Literal[temporal] | Literal[event], data_sample_before_computation: DataSample, current_timestep: date | float | int) dict[str, dict][source]
tempor.clinic.field_def.update(field_defs: dict[str, FieldDef], session_state: Any, modality: Literal[static] | Literal[temporal] | Literal[event], data_sample: DataSample, current_timestep: date | float | int, computed_only: bool = False) dict[str, dict][source]
tempor.clinic.field_def.process_db_to_input(field_defs: dict[str, FieldDef], data: dict) dict[source]
tempor.clinic.field_def.process_input_to_db(field_defs: dict[str, FieldDef], data: dict) dict[source]