Skip to content

Commit

Permalink
Update schema.py
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanSteinberg authored Apr 30, 2024
1 parent 21410c2 commit 4ed6bc7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/meds/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,22 @@
# We define static events as always occurring on January 1st, 1 AD
static_event_time = datetime.datetime(1, 1, 1)


def patient_schema(per_event_properties_schema=pa.null()):
# Return a patient schema with a particular per event metadata subschema
event = pa.struct(
[
("time", pa.timestamp("us")),
("code", pa.string()),
("text_value", pa.string()),
("numeric_value", pa.float32()),
("properties", per_event_properties_schema),
pa.field("time", pa.timestamp("us"), nullable=False),
pa.field("code", pa.string(), nullable=False),
pa.field("text_value", pa.string()),
pa.field("numeric_value", pa.float32()),
pa.field("properties", per_event_properties_schema),
]
)

patient = pa.schema(
[
("patient_id", pa.int64()),
("events", pa.list_(event)), # Require ordered by time
pa.field("patient_id", pa.int64(), nullable=False),
pa.field("events", pa.list_(event), nullable=False), # Require ordered by time
]
)

Expand Down

0 comments on commit 4ed6bc7

Please sign in to comment.