Skip to content

Commit

Permalink
add testing for IND40
Browse files Browse the repository at this point in the history
  • Loading branch information
costateixeira committed Mar 22, 2024
1 parent ada3382 commit ba7d4ec
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 5 deletions.
10 changes: 6 additions & 4 deletions input/fsh/examples/Immunization1.fsh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
Instance: Immunization1
InstanceOf: SGImmunization
Description: "Immunization record"
* vaccineCode = $ICD11#XM28X5
Description: "Immunization record - 1st MMMR vaccine"
* vaccineCode = $ICD11#XM8TF3
* lotNumber = "lot123"
* expirationDate = "2023-10-01"
* expirationDate = "2024-06-30"
//* extension[administeredProduct].valueReference = Reference(Measlesprod1)
* extension[administeredProduct].valueCodeableConcept = VaccineProducts#20009060/2
* patient.reference = "Patient/P123456"
* status = #completed
* occurrenceDateTime = "2023-08-05"
* location.display = "Vaccination site"
* occurrenceDateTime = "2023-02-05"
* protocolApplied.doseNumberPositiveInt = 1
13 changes: 13 additions & 0 deletions input/fsh/examples/Immunization2.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Instance: Immunization2
InstanceOf: SGImmunization
Description: "Immunization record - 2nd MMR vaccine"
* vaccineCode = $ICD11#XM8TF3
* lotNumber = "lot123"
* expirationDate = "2024-06-30"
//* extension[administeredProduct].valueReference = Reference(Measlesprod1)
* extension[administeredProduct].valueCodeableConcept = VaccineProducts#20009060/2
* patient.reference = "Patient/P123456"
* status = #completed
* location.display = "Vaccination site"
* occurrenceDateTime = "2023-06-02"
* protocolApplied.doseNumberPositiveInt = 1
2 changes: 1 addition & 1 deletion input/fsh/examples/P123456.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Usage: #example
* family = "Patient"
* given = "Test"
* gender = #female
* birthDate = "2023-03-02"
* birthDate = "2022-02-02"
130 changes: 130 additions & 0 deletions input/fsh/testscripts/measles-ind40-d2.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
Alias: $restful-interaction = http://hl7.org/fhir/restful-interaction

Instance: testscript-evaluate-measure-ind-40
InstanceOf: TestScript
Usage: #example
* url = "http://smart.who.int/immunizations/TestScript/testscript-smart-immunizations-measles-ind08-d2"
* version = "1.0"
* name = "TestScriptEvaluateIND40"
* title = "TestScript - Evaluate Measure - IND40"
* status = #draft
* experimental = true
* date = "2017-01-18"

* description = "TestScript for Measles IND 40"

* purpose = "Test Measles immmunization indicator 40"
* copyright =2024+"
* metadata
* capability

//* extension[http://hl7.org/fhir/5.0/StructureDefinition/extension-TestScript.scope.artifact] = Reference(IMMZIND08Measles)

* fixture[+]
* id = "patient-P123456"
* autocreate = true
* autodelete = false
* resource = Reference(Patient/P123456) "Patient P123456"
* fixture[+]
* id = "Immunization1"
* autocreate = true
* autodelete = false
* resource = Reference(Immunization/Immunization1) "Patient P123456 - first measles immunization"
* fixture[+]
* id = "Immunization2"
* autocreate = true
* autodelete = false
* resource = Reference(Immunization/Immunization2) "Patient P123456 - second measles immunization"


* variable[+]
* name = "femaleCountExpression"
* description = "Evaluate the returned total of females with the expected vaccine coverage"
* expression = "MeasureReport.group.stratifier.where(id='IMMZ.IND.08.S2').stratum.where(value.text='female').population.where(id='IMMZ.IND.08.N').count.toInteger()"


* variable[+]
* name = "cqlserverbase"
* description = "URL for the CQL server"
* defaultValue = "http://localhost:8080/fhir"

* variable[+]
* name = "expectedCount"
* description = "Expected patient count for mealles immunization indicator 40"
* defaultValue = "1"



* setup
* action[0]
* operation
* type = $restful-interaction#post
* resource = #Patient
* description = "POST resources to server."
* accept = #json
* encodeRequestUrl = true
* sourceId = "patient-P123456"
* assert
* description = "Confirm that results were POSTed OK."
* response = #created
* warningOnly = false

* action[+]
* operation
* type = $restful-interaction#post
* resource = #Immunization
* description = "POST resources to server."
* accept = #json
* encodeRequestUrl = true
* sourceId = "Immunization1"
* assert
* description = "Confirm that results was POSTed OK."
* response = #created
* warningOnly = false

* action[+]
* operation
* type = $restful-interaction#post
* resource = #Immunization
* description = "POST resources to server."
* accept = #json
* encodeRequestUrl = true
* sourceId = "Immunization2"
* assert
* description = "Confirm that results was POSTed OK."
* response = #created
* warningOnly = false





* test[0]
* id = "01-Evaluate"
* name = "Evaluate the measure"
* description = "Evaluate the measure."
* action[0]
* operation
* type = http://hl7.org/fhir/restful-interaction#evaluate // note there's an issue in the R4 spec example?. Should not be $evaluate

// * resource = #
* description = "Send the request for the Measure evaluation."
* accept = #json
* contentType = #json
* encodeRequestUrl = true
* responseId = "PatientCreateResponse"
* sourceId = "fixture-patient-create"

* url = "${cqlserverbase}/Measure/IMMZIND40/$evaluate-measure?periodStart=2000-01-01&periodEnd=2024-12-31"


* assert
* description = "Confirm that the returned HTTP status is 201(Created)."
* response = #okay
* warningOnly = false

* action[+].assert
* description = "Confirm that the returned result evaluates to the expected value"
* expression = "${femaleCountExpression}=$#{expectedCount}"
* warningOnly = false

8 changes: 8 additions & 0 deletions input/fsh/testscripts/testDataBundle.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Instance: TestDataBundle-ind08
InstanceOf: Bundle
Usage: #example
* type = #collection

* entry[+].resource = P123456
* entry[+].resource = Immunization1
* entry[+].resource = Immunization2

0 comments on commit ba7d4ec

Please sign in to comment.