Skip to content

Commit

Permalink
Adds a new test case with a full Smart Immunization's IG (#2261)
Browse files Browse the repository at this point in the history
* Adds a new test case from Smart Immunizations

* Spotless

* updates test name

* Fix for multiple ids with the same name but with different resourceTypes

* Tests the KnowledgeManager inside an Android runtime

* Fixes References to Patient

* Updates to test cases after last merge

* Updates the Ids to match Android and Roboelectric test cases.

* Spotless

* Adds a null check to install

---------

Co-authored-by: Jing Tang <[email protected]>
Co-authored-by: Omar Ismail <[email protected]>
  • Loading branch information
3 people authored Jul 12, 2024
1 parent c0414d2 commit 3c13c53
Show file tree
Hide file tree
Showing 117 changed files with 68,511 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ internal constructor(
suspend fun install(fhirNpmPackage: FhirNpmPackage, rootDirectory: File) {
// TODO(ktarasenko) copy files to the safe space?
val igId = knowledgeDao.insert(fhirNpmPackage.toEntity(rootDirectory))
rootDirectory.listFiles()?.forEach { file ->
rootDirectory.listFiles()?.sorted()?.forEach { file ->
try {
val resource = jsonParser.parseResource(FileInputStream(file))
if (resource is Resource) {
Expand Down
2 changes: 2 additions & 0 deletions workflow/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ dependencies {
testImplementation(Dependencies.jsonAssert)
testImplementation(Dependencies.robolectric)
testImplementation(Dependencies.xmlUnit)
testImplementation(libs.androidx.room.room)
testImplementation(libs.androidx.room.runtime)
testImplementation(libs.androidx.test.core)
testImplementation(libs.junit)
testImplementation(libs.truth)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"resourceType" : "ActivityDefinition",
"id" : "IMMZD2DTMeaslesMR",
"meta" : {
"profile" : ["http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-immunizationactivity"]
},
"text" : {
"status" : "extensions",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: ActivityDefinition</b><a name=\"IMMZD2DTMeaslesMR\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource ActivityDefinition &quot;IMMZD2DTMeaslesMR&quot; </p><p style=\"margin-bottom: 0px\">Profile: <a href=\"https://build.fhir.org/ig/HL7/cqf-recommendations//StructureDefinition-cpg-immunizationactivity.html\">CPG Immunization Activity</a></p></div><p><b>CPG Knowledge Capability Extension</b>: computable</p><p><b>url</b>: <code>http://fhir.org/guides/who/smart-immunization/ActivityDefinition/IMMZD2DTMeaslesMR</code></p><p><b>version</b>: 0.1.0</p><p><b>name</b>: IMMZD2DTMeaslesMR</p><p><b>title</b>: IMMZ.D2.DT.Measles.MR</p><p><b>status</b>: draft</p><p><b>experimental</b>: false</p><p><b>date</b>: 2023-10-03</p><p><b>publisher</b>: World Health Organization (WHO)</p><p><b>contact</b>: World Health Organization (WHO): <a href=\"https://www.who.int\">https://www.who.int</a></p><p><b>description</b>: Provide measles immunization</p><p><b>jurisdiction</b>: Global (Whole world) <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (m49.htm#001)</span></p><p><b>library</b>: <a href=\"Library-IMMZD2DTMeasles.html\">IMMZD2DTMeasles</a></p><p><b>kind</b>: MedicationRequest</p><p><b>profile</b>: <a href=\"https://build.fhir.org/ig/HL7/cqf-recommendations//StructureDefinition-cpg-immunizationrequest.html\">CPG Immunization Request</a></p><p><b>intent</b>: proposal</p><p><b>doNotPerform</b>: false</p><p><b>product</b>: Measles vaccines <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (icd-11#XM28X5)</span></p><blockquote><p><b>dynamicValue</b></p><p><b>path</b>: status</p><h3>Expressions</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Language</b></td><td><b>Expression</b></td></tr><tr><td style=\"display: none\">*</td><td>text/cql</td><td>'draft'</td></tr></table></blockquote><blockquote><p><b>dynamicValue</b></p><p><b>path</b>: intent</p><h3>Expressions</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Language</b></td><td><b>Expression</b></td></tr><tr><td style=\"display: none\">*</td><td>text/cql</td><td>'proposal'</td></tr></table></blockquote><blockquote><p><b>dynamicValue</b></p><p><b>path</b>: dispenseRequest.validityPeriod.start</p><h3>Expressions</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Description</b></td><td><b>Language</b></td><td><b>Expression</b></td></tr><tr><td style=\"display: none\">*</td><td>Due date of the dose</td><td>text/cql-identifier</td><td>Schedule Due Date for MCV dose</td></tr></table></blockquote><blockquote><p><b>dynamicValue</b></p><p><b>path</b>: dispenseRequest.validityPeriod.end</p><h3>Expressions</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Description</b></td><td><b>Language</b></td><td><b>Expression</b></td></tr><tr><td style=\"display: none\">*</td><td>Expiration date for MCV dose</td><td>text/cql-identifier</td><td>Expiration Date for MCV dose</td></tr></table></blockquote></div>"
},
"extension" : [{
"url" : "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability",
"valueCode" : "computable"
}],
"url" : "http://fhir.org/guides/who/smart-immunization/ActivityDefinition/IMMZD2DTMeaslesMR",
"version" : "0.1.0",
"name" : "IMMZD2DTMeaslesMR",
"title" : "IMMZ.D2.DT.Measles.MR",
"status" : "draft",
"experimental" : false,
"date" : "2023-10-03",
"publisher" : "World Health Organization (WHO)",
"contact" : [{
"name" : "World Health Organization (WHO)",
"telecom" : [{
"system" : "url",
"value" : "https://www.who.int"
}]
}],
"description" : "Provide measles immunization",
"jurisdiction" : [{
"coding" : [{
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"code" : "001"
}]
}],
"library" : ["http://fhir.org/guides/who/smart-immunization/Library/IMMZD2DTMeasles"],
"kind" : "MedicationRequest",
"profile" : "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-immunizationrequest",
"intent" : "proposal",
"doNotPerform" : false,
"productCodeableConcept" : {
"coding" : [{
"system" : "http://hl7.org/fhir/sid/icd-11",
"code" : "XM28X5",
"display" : "Measles vaccines"
}]
},
"dynamicValue" : [{
"path" : "status",
"expression" : {
"language" : "text/cql",
"expression" : "'draft'"
}
},
{
"path" : "intent",
"expression" : {
"language" : "text/cql",
"expression" : "'proposal'"
}
},
{
"path" : "dispenseRequest.validityPeriod.start",
"expression" : {
"description" : "Due date of the dose",
"language" : "text/cql-identifier",
"expression" : "Schedule Due Date for MCV dose"
}
},
{
"path" : "dispenseRequest.validityPeriod.end",
"expression" : {
"description" : "Expiration date for MCV dose",
"language" : "text/cql-identifier",
"expression" : "Expiration Date for MCV dose"
}
}]
}
123 changes: 123 additions & 0 deletions workflow/sampledata/smart-imm/ig/CodeSystem-IMMZ.C.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"resourceType" : "CodeSystem",
"id" : "IMMZ.C",
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>This case-insensitive code system <code>http://fhir.org/guides/who/smart-immunization/CodeSystem/IMMZ.C</code> defines the following codes:</p><table class=\"codes\"><tr><td style=\"white-space:nowrap\"><b>Code</b></td><td><b>Display</b></td><td><b>Definition</b></td></tr><tr><td style=\"white-space:nowrap\">DE1<a name=\"IMMZ.C-DE1\"> </a></td><td>Unique identifier</td><td>Unique identifier for the client, according to the policies applicable to each country. There can be more than one unique identifier used to link records (e.g. national ID, health ID, immunization information system ID, medical record ID).</td></tr><tr><td style=\"white-space:nowrap\">DE2<a name=\"IMMZ.C-DE2\"> </a></td><td>Name</td><td>The full name of the client</td></tr><tr><td style=\"white-space:nowrap\">DE3<a name=\"IMMZ.C-DE3\"> </a></td><td>First name</td><td>Client's first name or given name</td></tr><tr><td style=\"white-space:nowrap\">DE4<a name=\"IMMZ.C-DE4\"> </a></td><td>Family name</td><td>Client's family name or last name</td></tr><tr><td style=\"white-space:nowrap\">DE5<a name=\"IMMZ.C-DE5\"> </a></td><td>Sex</td><td>Documentation of a specific instance of sex information for the client</td></tr><tr><td style=\"white-space:nowrap\">DE6<a name=\"IMMZ.C-DE6\"> </a></td><td>Male</td><td>Client's biological sex is male</td></tr><tr><td style=\"white-space:nowrap\">DE7<a name=\"IMMZ.C-DE7\"> </a></td><td>Female</td><td>Client's biological sex is female</td></tr><tr><td style=\"white-space:nowrap\">DE8<a name=\"IMMZ.C-DE8\"> </a></td><td>Biological sex not specified</td><td>Client's biological sex is not specified</td></tr><tr><td style=\"white-space:nowrap\">DE9<a name=\"IMMZ.C-DE9\"> </a></td><td>Intersex</td><td>Client's biological sex is intersex</td></tr><tr><td style=\"white-space:nowrap\">DE10<a name=\"IMMZ.C-DE10\"> </a></td><td>Date of birth</td><td>Client's date of birth (DOB) if known; if unknown, use assigned DOB for administrative purposes</td></tr><tr><td style=\"white-space:nowrap\">DE13<a name=\"IMMZ.C-DE13\"> </a></td><td>Age</td><td>The client's calculated age (presented as number of years, months, days) based on the date of birth (DOB) and the visit date</td></tr><tr><td style=\"white-space:nowrap\">DE14<a name=\"IMMZ.C-DE14\"> </a></td><td>Caregivers (multiple)</td><td>The client's caregiver (person) which could be next of kin (e.g. partner, husband, mother, sibling, etc.)</td></tr><tr><td style=\"white-space:nowrap\">DE15<a name=\"IMMZ.C-DE15\"> </a></td><td>Caregiver's full name</td><td>The full name of the client's caregiver</td></tr><tr><td style=\"white-space:nowrap\">DE16<a name=\"IMMZ.C-DE16\"> </a></td><td>Caregiver's first name</td><td>First or given name of the client's caregiver</td></tr><tr><td style=\"white-space:nowrap\">DE17<a name=\"IMMZ.C-DE17\"> </a></td><td>Caregiver's family name</td><td>Family name or last name of the client's caregiver</td></tr><tr><td style=\"white-space:nowrap\">DE18<a name=\"IMMZ.C-DE18\"> </a></td><td>Contact phone number</td><td>Client's phone number</td></tr><tr><td style=\"white-space:nowrap\">DE19<a name=\"IMMZ.C-DE19\"> </a></td><td>Administrative area</td><td>The name of the city/municipality/town/village of where the client lives</td></tr><tr><td style=\"white-space:nowrap\">DE20<a name=\"IMMZ.C-DE20\"> </a></td><td>Active health worker</td><td>Is the client an active and participating health worker. This data element is used mainly for reporting and indicators purposes.</td></tr></table></div>"
},
"url" : "http://fhir.org/guides/who/smart-immunization/CodeSystem/IMMZ.C",
"version" : "0.1.0",
"name" : "IMMZ_C",
"title" : "IMMZ.C CodeSystem for Data Elements",
"status" : "draft",
"experimental" : false,
"date" : "2023-10-12T09:43:25-04:00",
"publisher" : "World Health Organization (WHO)",
"contact" : [{
"name" : "World Health Organization (WHO)",
"telecom" : [{
"system" : "url",
"value" : "https://www.who.int"
}]
}],
"description" : "CodeSystem for IMMZ.C Data Elements",
"jurisdiction" : [{
"coding" : [{
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"code" : "001"
}]
}],
"caseSensitive" : false,
"content" : "complete",
"count" : 18,
"concept" : [{
"code" : "DE1",
"display" : "Unique identifier",
"definition" : "Unique identifier for the client, according to the policies applicable to each country. There can be more than one unique identifier used to link records (e.g. national ID, health ID, immunization information system ID, medical record ID)."
},
{
"code" : "DE2",
"display" : "Name",
"definition" : "The full name of the client"
},
{
"code" : "DE3",
"display" : "First name",
"definition" : "Client's first name or given name"
},
{
"code" : "DE4",
"display" : "Family name",
"definition" : "Client's family name or last name"
},
{
"code" : "DE5",
"display" : "Sex",
"definition" : "Documentation of a specific instance of sex information for the client"
},
{
"code" : "DE6",
"display" : "Male",
"definition" : "Client's biological sex is male"
},
{
"code" : "DE7",
"display" : "Female",
"definition" : "Client's biological sex is female"
},
{
"code" : "DE8",
"display" : "Biological sex not specified",
"definition" : "Client's biological sex is not specified"
},
{
"code" : "DE9",
"display" : "Intersex",
"definition" : "Client's biological sex is intersex"
},
{
"code" : "DE10",
"display" : "Date of birth",
"definition" : "Client's date of birth (DOB) if known; if unknown, use assigned DOB for administrative purposes"
},
{
"code" : "DE13",
"display" : "Age",
"definition" : "The client's calculated age (presented as number of years, months, days) based on the date of birth (DOB) and the visit date"
},
{
"code" : "DE14",
"display" : "Caregivers (multiple)",
"definition" : "The client's caregiver (person) which could be next of kin (e.g. partner, husband, mother, sibling, etc.)"
},
{
"code" : "DE15",
"display" : "Caregiver's full name",
"definition" : "The full name of the client's caregiver"
},
{
"code" : "DE16",
"display" : "Caregiver's first name",
"definition" : "First or given name of the client's caregiver"
},
{
"code" : "DE17",
"display" : "Caregiver's family name",
"definition" : "Family name or last name of the client's caregiver"
},
{
"code" : "DE18",
"display" : "Contact phone number",
"definition" : "Client's phone number"
},
{
"code" : "DE19",
"display" : "Administrative area",
"definition" : "The name of the city/municipality/town/village of where the client lives"
},
{
"code" : "DE20",
"display" : "Active health worker",
"definition" : "Is the client an active and participating health worker. This data element is used mainly for reporting and indicators purposes."
}]
}
Loading

0 comments on commit 3c13c53

Please sign in to comment.