Skip to content

Commit

Permalink
Update schema.py
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanSteinberg authored May 1, 2024
1 parent ae31fde commit f116c57
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/meds/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@
birth_code = "SNOMED/184099003"
death_code = "SNOMED/419620001"

# 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(
[
pa.field("time", pa.timestamp("us"), nullable=False),
pa.field("time", pa.timestamp("us")), # Static events will have a null timestamp
pa.field("code", pa.string(), nullable=False),
pa.field("text_value", pa.string()),
pa.field("numeric_value", pa.float32()),
Expand All @@ -40,7 +37,7 @@ def patient_schema(per_event_properties_schema=pa.null()):
patient = pa.schema(
[
pa.field("patient_id", pa.int64(), nullable=False),
pa.field("events", pa.list_(event), nullable=False), # Require ordered by time
pa.field("events", pa.list_(event), nullable=False), # Require ordered by time, nulls must be first
]
)

Expand Down

0 comments on commit f116c57

Please sign in to comment.