Skip to content

Commit 2514091

Browse files
committed
Added in structure maps for client registration.
1 parent da369d8 commit 2514091

7 files changed

+197
-1
lines changed

input/fsh/profiles/IMMZPatient.fsh

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Id: IMMZ.Patient
44
Title: "SMART Guidelines Immunizations Patient"
55
Description: "Patient Profile for the Immunizations SMART Guidelines. From IMMZ.C Client Registration for IMMZ.C4.Create client record OR IMMZ.C5.3.Update client details."
66

7+
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
8+
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
9+
710
* identifier 1..*
811
* identifier.value 1..1
912

input/fsh/profiles/IMMZRelatedPerson.fsh

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Id: IMMZ.Caregiver
44
Title: "SMART Guidelines Immunizations Caregiver (RelatedPerson)"
55
Description: "Caregiver (RelatedPerson) Profile for the Immunizations SMART Guidelines. From IMMZ.C Client Registration for IMMZ.C4.Create client record OR IMMZ.C5.3.Update client details."
66

7+
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
8+
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
79

810
* relationship 1..1
911
* relationship = http://terminology.hl7.org/5.1.0/CodeSystem-v3-RoleClass.html#CAREGIVER

input/fsh/questionnaires/QIMMZCClientregistration.fsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Usage: #definition
4141
* code[+] = IMMZ.C#DE10
4242
* code[+] = $LNC#21112-8 "Birth date"
4343
* code[+] = $SCT#184099003 "Date of birth (observable entity)"
44-
* insert Question(age, Age, integer, false, false)
44+
* insert Question(age, Age, string, false, false)
4545
* item[=]
4646
* code[+] = IMMZ.C#DE13
4747
* code[+] = $LNC#63900-5 "Current age or age at death"

input/maps/IMMZCLMToPatient.fml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
map "http://smart.who.int/immunizations/StructureMap/IMMZCLMToPatient" = "IMMZCLMToPatient"
2+
// Immunization Client Registry - Transform Logical Model to Patient resources
3+
4+
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZCClientregistration" alias IMMZC as source
5+
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target
6+
// uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as produced
7+
// uses "http://hl7.org/fhir/StructureDefinition/RelatedPerson" alias RelatedPerson as produced
8+
9+
group IMMZCToPatient (source immzc : IMMZC, target bundle: Bundle) {
10+
11+
immzc -> bundle.type = "transaction" "SetBundleType";
12+
13+
immzc -> uuid() as pid,
14+
bundle.entry as entry,
15+
entry.fullUrl = append("urn:uuid:", pid),
16+
entry.request as request,
17+
request.method = "PUT",
18+
request.url = append("Patient/", pid),
19+
entry.resource = create("Patient") as patient
20+
then {
21+
22+
immzc -> patient.id = pid "SetId";
23+
24+
immzc.uniqueId as id -> patient.identifier as identifier then {
25+
id -> identifier.value = id "SetIdentifierValue";
26+
} "SetIdentifier";
27+
28+
immzc -> patient.name as pname then {
29+
immzc.name as fullName -> pname.text = fullName "SetFullName";
30+
immzc.firstName as firstName -> pname.given = firstName "SetFirstName";
31+
immzc.familyName as familyName -> pname.family = familyName "SetFamilyName";
32+
}"SetName";
33+
34+
immzc.sex as sex -> patient.gender = translate(sex, 'http://smart.who.int/immunizations/ConceptMap/IMMZ.C.ConceptMap', 'code') "SetGender";
35+
36+
immzc.dateOfBirth as birthDate -> patient.birthDate = birthDate "SetBirthDate";
37+
38+
immzc.contactPhoneNumber as phone -> patient.telecom as telecom then {
39+
phone as content -> telecom.value = content, telecom.system = 'phone' "SetPhoneValue";
40+
} "SetPhone";
41+
42+
immzc.address as address -> patient.address as taddress then {
43+
address as content -> taddress.text = content "SetAddressText";
44+
} "SetAddress";
45+
46+
immzc.caregiversMultiple as caregiver -> uuid() as rpid,
47+
bundle.entry as entry,
48+
entry.fullUrl = append("urn:uuid:", rpid),
49+
entry.request as request,
50+
request.method = "PUT",
51+
request.url = append("RelatedPerson/", rpid),
52+
entry.resource = create("RelatedPerson") as person
53+
then {
54+
caregiver -> person.id = rpid "SetId";
55+
caregiver -> person.patient as patient, patient.reference = append("Patient/", pid ) "setPatient";
56+
caregiver -> person.name as pname then {
57+
caregiver.caregiversFullName as fullName -> pname.text = fullName "SetFullName";
58+
caregiver.caregiversFirstName as firstName -> pname.given = firstName "SetFirstName";
59+
caregiver.caregiversFamilyName as familyName -> pname.family = familyName "SetFamilyName";
60+
} "SetCaregiverName";
61+
} "CreateRelatedPerson";
62+
63+
} "CreatePatient";
64+
65+
}

input/maps/IMMZCQRToLM.fml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
map "http://smart.who.int/immunizations/StructureMap/IMMZCQRToLM" = "IMMZCQRToLM"
2+
// Immunization Client Registry - Transform QuestionnaireResponse to Logical Model
3+
4+
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
5+
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZCClientregistration" alias IMMZC as target
6+
7+
group QRespToIMMZC ( source qr : QResp, target immzc : IMMZC) {
8+
qr.item as item then {
9+
10+
item.answer first as answer where item.linkId = 'uniqueIdentifier' then {
11+
answer.value as content -> immzc.uniqueIdentifier = content "SetIdentifier";
12+
} "FirstAnswerForIdentifier";
13+
14+
item.answer first as answer where item.linkId = 'name' then {
15+
answer.value as content -> immzc.name = content "SetFullName";
16+
} "FirstAnswerForFullName";
17+
18+
item.answer first as answer where item.linkId = 'firstName' then {
19+
answer.value as content -> immzc.firstName = content "SetFirstName";
20+
} "FirstAnswerForFirstName";
21+
22+
item.answer first as answer where item.linkId = 'familyName' then {
23+
answer.value as content -> immzc.familyName = content "SetFamilyName";
24+
} "FirstAnswerForFamilyName";
25+
26+
item.answer first as answer where item.linkId = 'sex' then {
27+
answer.value as coding then {
28+
coding.code as content -> immzc.sex = content "SetSex";
29+
} "ProcessCoding";
30+
} "FirstAnswerForIdentifier";
31+
32+
item.answer first as answer where item.linkId = 'dateOfBirth' then {
33+
answer.value as content -> immzc.dateOfBirth = content "SetBirthDate";
34+
} "FirstAnswerForBirthDate";
35+
36+
item.answer first as answer where item.linkId = 'age' then {
37+
answer.value as content -> immzc.age = content "SetAge";
38+
} "FirstAnswerForAge";
39+
40+
item as caregiver where item.linkId = 'caregiversMultiple' -> immzc.caregiversMultiple as caretgt then {
41+
caregiver.item as cgitem then {
42+
cgitem.answer first as answer where cgitem.linkId = 'caregiversFullName' then {
43+
answer.value as content -> caretgt.caregiversFullName = content "SetFullName";
44+
} "FirstAnswerForFullName";
45+
46+
cgitem.answer first as answer where cgitem.linkId = 'caregiversFirstName' then {
47+
answer.value as content -> caretgt.caregiversFirstName = content "SetFirstName";
48+
} "FirstAnswerForFirstName";
49+
50+
cgitem.answer first as answer where cgitem.linkId = 'caregiversFamilyName' then {
51+
answer.value as content -> caretgt.caregiversFamilyName = content "SetFamilyName";
52+
} "FirstAnswerForFamilyName";
53+
} "caregiverItems";
54+
} "AnswerForCaregiverMultiple";
55+
56+
item.answer first as answer where item.linkId = 'contactPhoneNumber' then {
57+
answer.value as content -> immzc.contactPhoneNumber = content "SetPhone";
58+
} "FirstAnswerForPhone";
59+
60+
item.answer first as answer where item.linkId = 'address' then {
61+
answer.value as content -> immzc.address = content "SetAddress";
62+
} "FirstAnswerForAddress";
63+
64+
} "processItems";
65+
66+
}

input/maps/IMMZCQRToPatient.fml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
map "http://smart.who.int/immunizations/StructureMap/IMMZCQRToPatient" = "IMMZCQRToPatient"
2+
// Immunization Client Registry - Transform QuestionnaireResponse to Patient resources
3+
4+
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QResp as source
5+
uses "http://smart.who.int/immunizations/StructureDefinition/IMMZCClientregistration" alias IMMZC as source
6+
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target
7+
8+
imports "http://smart.who.int/immunizations/StructureMap/IMMZCQRToLM"
9+
imports "http://smart.who.int/immunizations/StructureMap/IMMZCLMToPatient"
10+
11+
group QRestToIMMZC (
12+
source qr : QResp,
13+
target bundle: BUndle
14+
) {
15+
qr -> create("http://smart.who.int/immunizations/StructureDefinition/IMMZCClientregistration") as model
16+
then{
17+
qr -> model then QRespToIMMZC( qr, model) "QRtoLM";
18+
qr -> bundle then IMMZCToPatient( model, bundle ) "LMtoPatient";
19+
} "QRtoPatient";
20+
}
21+

tools/maps.http

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@host = http://localhost:8080/matchboxv3/fhir
2+
3+
### Post the StructureMap with transform included
4+
PUT {{host}}/StructureMap/IMMZCQRToLM HTTP/1.1
5+
Accept: application/fhir+json;fhirVersion=4.0
6+
Content-Type: text/fhir-mapping
7+
8+
< ../input/maps/IMMZCQRToLM.fml
9+
10+
### Post the StructureMap with transform included
11+
PUT {{host}}/StructureMap/IMMZCLMToPatient HTTP/1.1
12+
Accept: application/fhir+json;fhirVersion=4.0
13+
Content-Type: text/fhir-mapping
14+
15+
< ../input/maps/IMMZCLMToPatient.fml
16+
17+
### Post the StructureMap with transform included
18+
PUT {{host}}/StructureMap/IMMZCQRToPatient HTTP/1.1
19+
Accept: application/fhir+json;fhirVersion=4.0
20+
Content-Type: text/fhir-mapping
21+
22+
< ../input/maps/IMMZCQRToPatient.fml
23+
24+
### Test Transform of QR to LM
25+
### after running _getonce
26+
POST {{host}}/StructureMap/$transform?source=http://smart.who.int/immunizations/StructureMap/IMMZCQRToLM
27+
Accept: application/fhir+json;fhirVersion=4.0
28+
Content-Type: application/fhir+json;fhirVersion=4.0
29+
30+
< ../output/QuestionnaireResponse-Example.IMMZ.C.QuestionnaireResponse.1.json
31+
32+
### Test Transform of QR to LM
33+
### after running _genonce
34+
POST {{host}}/StructureMap/$transform?source=http://smart.who.int/immunizations/StructureMap/IMMZCQRToPatient
35+
Accept: application/fhir+json;fhirVersion=4.0
36+
Content-Type: application/fhir+json;fhirVersion=4.0
37+
38+
< ../output/QuestionnaireResponse-Example.IMMZ.C.QuestionnaireResponse.1.json
39+

0 commit comments

Comments
 (0)