Skip to content

Commit

Permalink
Fixed a typo in the code metadata schema and the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcdermott committed Jul 30, 2024
1 parent 94d4ce9 commit d962dac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/meds/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def code_metadata(custom_per_code_properties=[]):
[
("code", pa.string()),
("description", pa.string()),
("parent_codes", pa.list(pa.string())),
("parent_codes", pa.list_(pa.string())),
] + custom_per_code_properties
)

Expand Down
12 changes: 6 additions & 6 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_data_schema():
Test that mock data follows the data schema.
"""
# Each element in the list is a row in the table
data = [
raw_data = [
{
"patient_id": 123,
"time": datetime.datetime(2020, 1, 1, 12, 0, 0),
Expand All @@ -25,15 +25,15 @@ def test_data_schema():

schema = data([("text_value", pa.string())])

table = pa.Table.from_pylist(data, schema=schema)
table = pa.Table.from_pylist(raw_data, schema=schema)
assert table.schema.equals(schema), "Patient schema does not match"

def test_code_metadata_schema():
"""
Test that mock code metadata follows the schema.
"""
# Each element in the list is a row in the table
data = [
code_metadata = [
{
"code": "some_code",
"description": "foo",
Expand All @@ -43,22 +43,22 @@ def test_code_metadata_schema():

schema = code_metadata()

table = pa.Table.from_pylist(data, schema=schema)
table = pa.Table.from_pylist(code_metadata, schema=schema)
assert table.schema.equals(schema), "Code metadata schema does not match"

def test_patient_split_schema():
"""
Test that mock data follows the data schema.
"""
# Each element in the list is a row in the table
data = [
patient_split_data = [
{"patient_id": 123, "split": train_split},
{"patient_id": 123, "split": tuning_split},
{"patient_id": 123, "split": held_out_split},
{"patient_id": 123, "split": "special"},
]

table = pa.Table.from_pylist(data, schema=patient_split)
table = pa.Table.from_pylist(patient_split_data, schema=patient_split)
assert table.schema.equals(patient_split), "Patient split schema does not match"

def test_label_schema():
Expand Down

0 comments on commit d962dac

Please sign in to comment.