Skip to content

Commit

Permalink
TOML config and schema files that replace the YAML versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lawrie authored and Lawrie committed Feb 12, 2021
1 parent 5e19d04 commit 49ed9d0
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/config/construct_spine_from_influenza_cases.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
projectname = "influenza-cases-spine"
description = "Construct a spine containing only people who have had influenza"
output_directory = "output" # During testing this expands to: /path/to/SpineBasedRecordLinkage.jl/test/output/
spine = {datafile = "", schemafile = "schema/spine.toml"}
append_to_spine = true
construct_entityid_from = ["firstname", "lastname", "birthdate"]
tables = [{tablename = "influenza_cases", datafile = "data/influenza_cases.csv", schemafile = "schema/influenza_cases.toml"}]

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", middlename = "middlename", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", birthdate = "birthdate"}
approxmatch = [{datacolumn = "lastname", spinecolumn = "lastname", distancemetric = "levenshtein", threshold = 0.3}]

[[criteria]]
tablename = "influenza_cases"
exactmatch = {lastname = "lastname", birthdate = "birthdate"}
approxmatch = [{datacolumn = "firstname", spinecolumn = "firstname", distancemetric = "levenshtein", threshold = 0.5}]
45 changes: 45 additions & 0 deletions test/config/link_all_health_service_events.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
projectname = "health-service-usage"
description = "Construct a spine from 3 health service usage tables and link the tables to the spine."
output_directory = "output" # During testing this expands to: /path/to/SpineBasedRecordLinkage.jl/test/output/
spine = {datafile = "", schemafile = "schema/spine.toml"}
append_to_spine = true
construct_entityid_from = ["firstname", "lastname", "birthdate"]
tables = [
{tablename = "hospital_admissions", datafile = "data/hospital_admissions.csv", schemafile = "schema/hospital_admissions.toml"},
{tablename = "emergency_presentations", datafile = "data/emergency_presentations.csv", schemafile = "schema/emergency_presentations.toml"},
{tablename = "influenza_cases", datafile = "data/influenza_cases.csv", schemafile = "schema/influenza_cases.toml"}
]

[[criteria]]
tablename = "hospital_admissions"
exactmatch = {firstname = "firstname", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "emergency_presentations"
exactmatch = {firstname = "firstname", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "emergency_presentations"
exactmatch = {birthdate = "birthdate"}
approxmatch = [
{datacolumn = "firstname", spinecolumn = "firstname", distancemetric = "levenshtein", threshold = 0.3},
{datacolumn = "lastname", spinecolumn = "lastname", distancemetric = "levenshtein", threshold = 0.3}
]

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", middlename = "middlename", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", birthdate = "birthdate"}
approxmatch = [{datacolumn = "lastname", spinecolumn = "lastname", distancemetric = "levenshtein", threshold = 0.3}]

[[criteria]]
tablename = "influenza_cases"
exactmatch = {lastname = "lastname", birthdate = "birthdate"}
approxmatch = [{datacolumn = "firstname", spinecolumn = "firstname", distancemetric = "levenshtein", threshold = 0.5}]
44 changes: 44 additions & 0 deletions test/config/link_influenza_cases_to_events.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
projectname = "influenza-cases-link"
description = "Link the emergencies, admissions and influenza tables to the spine that was constructed from the influenza cases table."
output_directory = "output" # During testing this expands to: /path/to/SpineBasedRecordLinkage.jl/test/output/
spine = {datafile = "output/spine.tsv", schemafile = "schema/spine.toml"}
append_to_spine = false
tables = [
{tablename = "hospital_admissions", datafile = "data/hospital_admissions.csv", schemafile = "schema/hospital_admissions.toml"},
{tablename = "emergency_presentations", datafile = "data/emergency_presentations.csv", schemafile = "schema/emergency_presentations.toml"},
{tablename = "influenza_cases", datafile = "data/influenza_cases.csv", schemafile = "schema/influenza_cases.toml"}
]

[[criteria]]
tablename = "emergency_presentations"
exactmatch = {firstname = "firstname", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "emergency_presentations"
exactmatch = {birthdate = "birthdate"}
approxmatch = [
{datacolumn = "firstname", spinecolumn = "firstname", distancemetric = "levenshtein", threshold = 0.3},
{datacolumn = "lastname", spinecolumn = "lastname", distancemetric = "levenshtein", threshold = 0.3}
]

[[criteria]]
tablename = "hospital_admissions"
exactmatch = {firstname = "firstname", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", middlename = "middlename", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", lastname = "lastname", birthdate = "birthdate"}

[[criteria]]
tablename = "influenza_cases"
exactmatch = {firstname = "firstname", birthdate = "birthdate"}
approxmatch = [{datacolumn = "lastname", spinecolumn = "lastname", distancemetric = "levenshtein", threshold = 0.3}]

[[criteria]]
tablename = "influenza_cases"
exactmatch = {lastname = "lastname", birthdate = "birthdate"}
approxmatch = [{datacolumn = "firstname", spinecolumn = "firstname", distancemetric = "levenshtein", threshold = 0.5}]
13 changes: 13 additions & 0 deletions test/schema/emergency_presentations.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name = "emergency_presentations"
description = "Each row specifies a presentation at a hospital emergency department"
primarykey = ["hospitalid", "campusid", "presentationdate", "patientid"]
columns = [
{name = "hospitalid", description = "Hospital ID", datatype = "Int", iscategorical = false, isrequired = true, isunique = false, validvalues = "1:9999"},
{name = "campusid", description = "Campus ID", datatype = "Int", iscategorical = false, isrequired = true, isunique = false, validvalues = "1:9999"},
{name = "patientid", description = "Patient ID", datatype = "Int", iscategorical = false, isrequired = true, isunique = false, validvalues = "Int"},
{name = "presentationdate", description = "Presentation date", datatype = "Date", iscategorical = false, isrequired = true, isunique = false, validvalues = "Date"},
{name = "firstname", description = "First name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "middlename", description = "Middle name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "lastname", description = "Last name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "birthdate", description = "Birth date", datatype = "Date", iscategorical = false, isrequired = false, isunique = false, validvalues = "Date"}
]
14 changes: 14 additions & 0 deletions test/schema/hospital_admissions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name = "hospital_admissions"
description = "Each row specifies an admission to a hospital"
primarykey = ["hospitalid", "campusid", "admissiondate", "dischargedate", "patientid"]
columns = [
{name = "hospitalid", description = "Hospital ID", datatype = "Int", iscategorical = false, isrequired = true, isunique = false, validvalues = "1:9999"},
{name = "campusid", description = "Campus ID", datatype = "Int", iscategorical = false, isrequired = true, isunique = false, validvalues = "1:9999"},
{name = "patientid", description = "Patient ID", datatype = "Int", iscategorical = false, isrequired = true, isunique = false, validvalues = "Int"},
{name = "admissiondate", description = "Date of admission", datatype = "Date", iscategorical = false, isrequired = true, isunique = false, validvalues = "Date"},
{name = "dischargedate", description = "Date of discharge", datatype = "Date", iscategorical = false, isrequired = true, isunique = false, validvalues = "Date"},
{name = "firstname", description = "First name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "middlename", description = "Middle name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "lastname", description = "Last name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "birthdate", description = "Birth date", datatype = "Date", iscategorical = false, isrequired = false, isunique = false, validvalues = "Date"}
]
12 changes: 12 additions & 0 deletions test/schema/influenza_cases.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name = "influenza_cases"
description = "Each row specifies report of a case of influenza"
primarykey = "reportid"
columns = [
{name = "reportid", description = "Report ID", datatype = "Int", iscategorical = false, isrequired = true, isunique = true, validvalues = "Int"},
{name = "reportdate", description = "Date of case notification", datatype = "Date", iscategorical = false, isrequired = true, isunique = false, validvalues = "Date"},
{name = "firstname", description = "First name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "middlename", description = "Middle name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "lastname", description = "Last name", datatype = "String", iscategorical = false, isrequired = false, isunique = false, validvalues = "String"},
{name = "birthdate", description = "Birth date", datatype = "Date", iscategorical = false, isrequired = false, isunique = false, validvalues = "Date"},
{name = "patient_postcode", description = "Postcode of the patient's residential address", datatype = "Int", iscategorical = false, isrequired = true, isunique = false, validvalues = "3000:3999"}
]
11 changes: 11 additions & 0 deletions test/schema/spine.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name = "spine"
description = "Linkage spine. Each row specifies a person"
primarykey = "EntityId"
columns =[
{name = "EntityId", description = "Entity ID", datatype = "UInt", iscategorical = false, isrequired = true, isunique = true, validvalues = "UInt"},
{name = "firstname", description = "First name", datatype = "String", iscategorical = false, isrequired = true, isunique = false, validvalues = "String"},
{name = "middlename", description = "Middle name", datatype = "String", iscategorical = false, isrequired = true, isunique = false, validvalues = "String"},
{name = "lastname", description = "Last name", datatype = "String", iscategorical = false, isrequired = true, isunique = false, validvalues = "String"},
{name = "birthdate", description = "Birth date", datatype = "Date", iscategorical = false, isrequired = true, isunique = false, validvalues = "Date"},
{name = "patient_postcode", description = "Postcode of the patient's residential address", datatype = "Int", iscategorical = false, isrequired = true, isunique = false, validvalues = "3000:3999"}
]

0 comments on commit 49ed9d0

Please sign in to comment.