onconova.core.history.schemas
HistoryEvent
¶
Bases: Schema
Schema representing a history event within the system.
Attributes:
Name | Type | Description |
---|---|---|
id |
Any
|
The unique identifier of the history event. |
resourceId |
Any
|
The unique identifier of the tracked resource. |
category |
HistoryEventCategory
|
The type of history event. |
timestamp |
datetime
|
Timestamp of the history event. |
user |
Nullable[str]
|
Username of the user that triggered the event, if applicable. |
url |
Nullable[str]
|
Endpoint URL through which the event was triggered, if applicable. |
resource |
Nullable[str]
|
Resource involved in the event, if applicable. |
snapshot |
Dict
|
Data snapshot at the time of the event. |
differential |
Nullable[Dict]
|
Data changes introduced by the event, if applicable. |
context |
Nullable[Dict]
|
Context surrounding the event. |
category
class-attribute
instance-attribute
¶
context
class-attribute
instance-attribute
¶
differential
class-attribute
instance-attribute
¶
id
class-attribute
instance-attribute
¶
resource
class-attribute
instance-attribute
¶
resourceId
class-attribute
instance-attribute
¶
snapshot
class-attribute
instance-attribute
¶
timestamp
class-attribute
instance-attribute
¶
url
class-attribute
instance-attribute
¶
user
class-attribute
instance-attribute
¶
bind_schema(schema)
classmethod
¶
Dynamically bind a specific Pydantic schema to the history event.
This allows resolving snapshot and differential data using the target schema for automatic foreign key resolution and data validation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Type[Schema]
|
The target Pydantic schema. |
required |
Returns:
Type | Description |
---|---|
Type[HistoryEvent]
|
A new HistoryEvent schema subclass with schema-bound resolvers. |
Source code in onconova/core/history/schemas.py
resolve_category(obj)
staticmethod
¶
Resolve the event category from its label.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Any
|
The history event object. |
required |
Returns:
Type | Description |
---|---|
HistoryEventCategory | None
|
The corresponding event category. |
Source code in onconova/core/history/schemas.py
resolve_differential(obj)
staticmethod
¶
resolve_resource(obj)
staticmethod
¶
resolve_snapshot(obj)
staticmethod
¶
resolve_url(obj)
staticmethod
¶
HistoryEventCategory
¶
Enumeration of possible categories for history events.
Attributes:
Name | Type | Description |
---|---|---|
CREATE |
Represents the creation of an entity. |
|
UPDATE |
Represents the update of an entity. |
|
DELETE |
Represents the deletion of an entity. |
|
EXPORT |
Represents the export of data. |
|
IMPORT |
Represents the import of data. |
|
DOWNLOAD |
Represents the download of data. |