Skip to content

Commit

Permalink
add test cases for validating references
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Grieve committed Jan 14, 2025
1 parent d8b9c77 commit 4c37e4f
Show file tree
Hide file tree
Showing 11 changed files with 352 additions and 0 deletions.
31 changes: 31 additions & 0 deletions validator/resolution/Organization-first.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>

<Organization xmlns="http://hl7.org/fhir">
<id value="1"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">

<p> Clinical Laboratory @ Acme Hospital. ph: +1 555 234 1234, email:
<a href="mailto:[email protected]">[email protected]</a>
</p>

</div>
</text>
<!-- Clinical Lab at Acme Hospital -->
<identifier>
<system value="http://www.acme.org.au/units"/>
<value value="ClinLab"/>
</identifier>
<name value="Clinical Lab"/>
<telecom>
<system value="phone"/>
<value value="+1 555 234 1234"/>
<use value="work"/>
</telecom>
<telecom>
<system value="email"/>
<value value="[email protected]"/>
<use value="work"/>
</telecom>
</Organization>
25 changes: 25 additions & 0 deletions validator/resolution/Patient-example-newborn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"resourceType": "Patient",
"id": "newborn",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: newborn</p><p><b>gender</b>: male</p><p><b>birthDate</b>: 05/09/2017</p><p><b>multipleBirth</b>: 2</p></div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
"valueString": "Everywoman"
}
],
"gender": "male",
"birthDate": "2017-09-05",
"_birthDate": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
"valueDateTime": "2017-05-09T17:11:00+01:00"
}
]
},
"multipleBirthInteger": 2
}
28 changes: 28 additions & 0 deletions validator/resolution/StructureDefinition-Observation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"resourceType": "StructureDefinition",
"id": "ObservationReference",
"url": "http://hl7.org/fhir/test/StructureDefinition/ObservationReference",
"name": "ObservationReference",
"title": "Observation Reference",
"status": "active",
"date": "2021-12-22T18:52:24+11:00",
"description": "Makes a rule on subject that requires Patient to be checked",
"fhirVersion": "4.0.1",
"kind": "resource",
"abstract": false,
"type": "Observation",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
"derivation": "constraint",
"differential": {
"element": [
{
"id": "Observation.subject",
"path": "Observation.subject",
"type" : [{
"code" : "Reference",
"targetProfile" : ["http://hl7.org/fhir/test/StructureDefinition/PatientRule"]
}]
}
]
}
}
25 changes: 25 additions & 0 deletions validator/resolution/StructureDefinition-Patient.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"resourceType": "StructureDefinition",
"id": "PatientRule",
"url": "http://hl7.org/fhir/test/StructureDefinition/PatientRule",
"version": "0.1.0",
"title": "Patient Rule",
"status": "active",
"date": "2021-12-22T18:52:24+11:00",
"description": "Makes a rule about patient that has to be tested by fetching the resource. R4 patient-example meeds the rule, Patient-example-newborn does not",
"fhirVersion": "4.0.1",
"kind": "resource",
"abstract": false,
"type": "Patient",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
"derivation": "constraint",
"differential": {
"element": [
{
"id": "Patient.active",
"path": "Patient.active",
"min" : 1
}
]
}
}
13 changes: 13 additions & 0 deletions validator/resolution/absolute-url-error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resourceType" : "Observation",
"meta" : {
"profile" : ["http://hl7.org/fhir/test/StructureDefinition/ObservationReference"]
},
"status" : "final",
"code" : {
"text" : "nothing"
},
"subject" : {
"reference" : "http://hl7x.org/fhir/R4/Patient/Patient/example-newborn"
}
}
13 changes: 13 additions & 0 deletions validator/resolution/absolute-url-invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resourceType" : "Observation",
"meta" : {
"profile" : ["http://hl7.org/fhir/test/StructureDefinition/ObservationReference"]
},
"status" : "final",
"code" : {
"text" : "nothing"
},
"subject" : {
"reference" : "https://hl7.org/fhir/R4/patient-example-newborn.json"
}
}
13 changes: 13 additions & 0 deletions validator/resolution/absolute-url-valid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resourceType" : "Observation",
"meta" : {
"profile" : ["http://hl7.org/fhir/test/StructureDefinition/ObservationReference"]
},
"status" : "final",
"code" : {
"text" : "nothing"
},
"subject" : {
"reference" : "https://hl7.org/fhir/R4/patient-example.json"
}
}
165 changes: 165 additions & 0 deletions validator/resolution/patient-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"resourceType": "Patient",
"id": "example",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<table>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Name</td>\n\t\t\t\t\t\t<td>Peter James \n <b>Chalmers</b> (&quot;Jim&quot;)\n </td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Address</td>\n\t\t\t\t\t\t<td>534 Erewhon, Pleasantville, Vic, 3999</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Contacts</td>\n\t\t\t\t\t\t<td>Home: unknown. Work: (03) 5555 6473</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Id</td>\n\t\t\t\t\t\t<td>MRN: 12345 (Acme Healthcare)</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>"
},
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06"
},
"assigner": {
"display": "Acme Healthcare"
}
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers",
"given": [
"Peter",
"James"
]
},
{
"use": "usual",
"given": [
"Jim"
]
},
{
"use": "maiden",
"family": "Windsor",
"given": [
"Peter",
"James"
],
"period": {
"end": "2002"
}
}
],
"telecom": [
{
"use": "home"
},
{
"system": "phone",
"value": "(03) 5555 6473",
"use": "work",
"rank": 1
},
{
"system": "phone",
"value": "(03) 3410 5613",
"use": "mobile",
"rank": 2
},
{
"system": "phone",
"value": "(03) 5555 8834",
"use": "old",
"period": {
"end": "2014"
}
}
],
"gender": "male",
"birthDate": "1974-12-25",
"_birthDate": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
"valueDateTime": "1974-12-25T14:35:45-05:00"
}
]
},
"deceasedBoolean": false,
"address": [
{
"use": "home",
"type": "both",
"text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
}
],
"contact": [
{
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
}
]
}
],
"name": {
"family": "du Marché",
"_family": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/humanname-own-prefix",
"valueString": "VV"
}
]
},
"given": [
"Bénédicte"
]
},
"telecom": [
{
"system": "phone",
"value": "+33 (237) 998327"
}
],
"address": {
"use": "home",
"type": "both",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
},
"gender": "female",
"period": {
"start": "2012"
}
}
],
"managingOrganization": {
"reference": "Organization/1"
}
}
13 changes: 13 additions & 0 deletions validator/resolution/relative-url-error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resourceType" : "Observation",
"meta" : {
"profile" : ["http://hl7.org/fhir/test/StructureDefinition/ObservationReference"]
},
"status" : "final",
"code" : {
"text" : "nothing"
},
"subject" : {
"reference" : "patient/example-newborn-x"
}
}
13 changes: 13 additions & 0 deletions validator/resolution/relative-url-invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resourceType" : "Observation",
"meta" : {
"profile" : ["http://hl7.org/fhir/test/StructureDefinition/ObservationReference"]
},
"status" : "final",
"code" : {
"text" : "nothing"
},
"subject" : {
"reference" : "Patient/example-newborn"
}
}
13 changes: 13 additions & 0 deletions validator/resolution/relative-url-valid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resourceType" : "Observation",
"meta" : {
"profile" : ["http://hl7.org/fhir/test/StructureDefinition/ObservationReference"]
},
"status" : "final",
"code" : {
"text" : "nothing"
},
"subject" : {
"reference" : "Patient/example"
}
}

0 comments on commit 4c37e4f

Please sign in to comment.