Package | who.ddcc |
Resource Type | StructureMap |
Id | SHCJWTtoDDCC |
FHIR Version | R4 |
Source | http://smart.who.int/ddcc/https://build.fhir.org/ig/WorldHealthOrganization/ddcc/StructureMap-SHCJWTtoDDCC.html |
URL | http://smart.who.int/ddcc/StructureMap/CertSHCtoDDCC |
Version | 1.0.0 |
Status | draft |
Date | 2025-06-24T09:07:32+00:00 |
Name | SHCJWTtoDDCC |
Realm | uv |
Authority | who |
No resources found
No resources found
Note: links and images are rebased to the (stated) source
Generated Narrative: StructureMap SHCJWTtoDDCC
map "http://smart.who.int/ddcc/StructureMap/CertSHCtoDDCC" = "SHCJWTtoDDCC" uses "http://smart.who.int/ddcc/StructureDefinition/CertSHC" alias JWTPayload as source uses "http://hl7.org/fhir/uv/shc/StructureDefinition/vc" alias VC as source uses "http://hl7.org/fhir/uv/shc/StructureDefinition/creadential-subject" alias CredentialSubject as source uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target group SHCtoDDCC(source src : JWTPayload, target bundle : Bundle) { src -> bundle.type = 'transaction' "set bundle type"; src -> bundle, bundle.entry as entry, entry.resource = create('Composition') as comp then { src -> bundle then ExtractCert(src, bundle, comp) "Certificate"; src -> bundle then ExtractComposition(src, comp) "Composition"; } "Patient and Composition Create"; } group ExtractCert(source src : JWTPayload, target bundle : Bundle, target comp : Composition) { src.vc as vc -> bundle, bundle.entry as entryOrg, entryOrg.resource = create('Organization') as org, uuid() as oid then { src -> org.id = oid "Organization ID"; src -> comp.author as author, author.reference = append('Organization/', oid) "Set org"; src.iss as iss -> org.identifier as identif, identif.value = iss "Set Organization name"; vc.credentialSubject as credentialSubject -> bundle then { credentialSubject.fhirBundle as fhirBundle -> bundle then { fhirBundle.entry as bundleEntrySHC then { bundleEntrySHC.resource : Patient first as patientSHC then { bundleEntrySHC.fullUrl as ref -> comp.subject as subj, subj.reference = append('Patient/', ref) "Set patient"; } "patient filter"; bundleEntrySHC.resource as anyRes -> bundle.entry as entry, entry.resource = anyRes "adding resource to bundle"; } "for each entry"; src where (fhirBundle.entry.resource.ofType(Immunization).exists()) -> comp.section as section then { src -> section.code as code, code.coding as coding, coding.system = 'http://loinc.org', coding.code = '11369-6', coding.display = 'History of Immunization Narrative' "Adding code to imm section"; src -> section.author as author, author.reference = append('Organization/', oid) "assing org entry to section"; fhirBundle.entry as bundleEntrySHC then { bundleEntrySHC.resource : Immunization as immunizationSHC then { bundleEntrySHC.fullUrl as ref -> section.entry as entry, entry.reference = append('Immunization/', ref) "add imm section"; } "assign immunization to composition"; } "Each entry"; } "SHC Immunization Section"; src where (fhirBundle.entry.resource.ofType(Observation).exists()) -> comp.section as section then { src -> section.code as code, code.coding as coding, coding.system = 'http://loinc.org', coding.code = '30954-2', coding.display = 'Results (Diagnostic findings)' "Adding code to obs section"; src -> section.author as author, author.reference = append('Organization/', oid) "assing org entry to section"; fhirBundle.entry as bundleEntrySHC then { bundleEntrySHC.resource : Observation as observationSHC then { bundleEntrySHC.fullUrl as ref -> section.entry as entry, entry.reference = append('Observation/', ref) "add obs section"; } "assign immunization to composition"; } "Entry Obs"; } "SHC Observation Section"; } "SHC FhirBundle"; } "SHC Credential Subject"; } "Org Create"; } group ExtractComposition(source src : Data, target composition : Composition) { src -> composition.title = 'International Certificate of Vaccination or Prophylaxis' "Title"; src -> composition.category as category, category.coding as coding then { src -> coding.code = 'ddcc-vs' "Category"; } "set category"; src -> composition.type as type, type.coding as coding then { src -> coding.system = 'http://loinc.org', coding.code = '82593-5', coding.display = 'Immunization summary report' "set type coding"; } "set type"; src -> composition.event as event, event.period = create('Period') as period then ExtractPeriod(src, period) "Extract Period"; } group ExtractPeriod(source src : JWTPayload, target tgt : Period) { src.nbf as nbf -> tgt.start = nbf "Start notBefore"; src.iat as iat -> tgt.start = iat "Start issuedAt"; src.exp as exp -> tgt.end = exp "End expiration"; }
{ "resourceType": "StructureMap", "id": "SHCJWTtoDDCC", "text": { "status": "generated", "div": "<!-- snip (see above) -->" }, "url": "http://smart.who.int/ddcc/StructureMap/CertSHCtoDDCC", "version": "1.0.0", "name": "SHCJWTtoDDCC", "status": "draft", "date": "2025-06-24T09:07:32+00:00", "publisher": "WHO", "contact": [ { "name": "WHO", "telecom": [ { "system": "url", "value": "http://who.int" } ] } ], "jurisdiction": [ { "coding": [ { "system": "http://unstats.un.org/unsd/methods/m49/m49.htm", "code": "001" } ] } ], "structure": [ { "url": "http://smart.who.int/ddcc/StructureDefinition/CertSHC", "mode": "source", "alias": "JWTPayload" }, { "url": "http://hl7.org/fhir/uv/shc/StructureDefinition/vc", "mode": "source", "alias": "VC" }, { "url": "http://hl7.org/fhir/uv/shc/StructureDefinition/creadential-subject", "mode": "source", "alias": "CredentialSubject" }, { "url": "http://hl7.org/fhir/StructureDefinition/Bundle", "mode": "target", "alias": "Bundle" } ], "group": [ { "name": "SHCtoDDCC", "typeMode": "none", "input": [ { "name": "src", "type": "JWTPayload", "mode": "source" }, { "name": "bundle", "type": "Bundle", "mode": "target" } ], "rule": [ { "name": "set bundle type", "source": [ { "context": "src" } ], "target": [ { "context": "bundle", "contextType": "variable", "element": "type", "transform": "copy", "parameter": [ { "valueString": "transaction" } ] } ] }, { "name": "Patient and Composition Create", "source": [ { "context": "src" } ], "target": [ { "context": "bundle", "contextType": "variable" }, { "context": "bundle", "contextType": "variable", "element": "entry", "variable": "entry" }, { "context": "entry", "contextType": "variable", "element": "resource", "variable": "comp", "transform": "create", "parameter": [ { "valueString": "Composition" } ] } ], "rule": [ { "name": "Certificate", "source": [ { "context": "src" } ], "target": [ { "context": "bundle", "contextType": "variable" } ], "dependent": [ { "name": "ExtractCert", "variable": [ "src", "bundle", "comp" ] } ] }, { "name": "Composition", "source": [ { "context": "src" } ], "target": [ { "context": "bundle", "contextType": "variable" } ], "dependent": [ { "name": "ExtractComposition", "variable": [ "src", "comp" ] } ] } ] } ] }, { "name": "ExtractCert", "typeMode": "none", "input": [ { "name": "src", "type": "JWTPayload", "mode": "source" }, { "name": "bundle", "type": "Bundle", "mode": "target" }, { "name": "comp", "type": "Composition", "mode": "target" } ], "rule": [ { "name": "Org Create", "source": [ { "context": "src", "element": "vc", "variable": "vc" } ], "target": [ { "context": "bundle", "contextType": "variable" }, { "context": "bundle", "contextType": "variable", "element": "entry", "variable": "entryOrg" }, { "context": "entryOrg", "contextType": "variable", "element": "resource", "variable": "org", "transform": "create", "parameter": [ { "valueString": "Organization" } ] }, { "contextType": "variable", "variable": "oid", "transform": "uuid" } ], "rule": [ { "name": "Organization ID", "source": [ { "context": "src" } ], "target": [ { "context": "org", "contextType": "variable", "element": "id", "transform": "copy", "parameter": [ { "valueId": "oid" } ] } ] }, { "name": "Composition.Set org", "source": [ { "context": "src" } ], "target": [ { "context": "comp", "contextType": "variable", "element": "author", "variable": "author" }, { "context": "author", "contextType": "variable", "element": "reference", "transform": "append", "parameter": [ { "valueString": "Organization/" }, { "valueId": "oid" } ] } ] }, { "name": "Set Organization name", "source": [ { "context": "src", "element": "iss", "variable": "iss" } ], "target": [ { "context": "org", "contextType": "variable", "element": "identifier", "variable": "identif" }, { "context": "identif", "contextType": "variable", "element": "value", "transform": "copy", "parameter": [ { "valueId": "iss" } ] } ] }, { "name": "SHC Credential Subject", "source": [ { "context": "vc", "element": "credentialSubject", "variable": "credentialSubject" } ], "target": [ { "context": "bundle", "contextType": "variable" } ], "rule": [ { "name": "SHC FhirBundle", "source": [ { "context": "credentialSubject", "element": "fhirBundle", "variable": "fhirBundle" } ], "target": [ { "context": "bundle", "contextType": "variable" } ], "rule": [ { "name": "for each entry", "source": [ { "context": "fhirBundle", "element": "entry", "variable": "bundleEntrySHC" } ], "rule": [ { "name": "patient filter", "source": [ { "context": "bundleEntrySHC", "type": "Patient", "element": "resource", "listMode": "first", "variable": "patientSHC" } ], "rule": [ { "name": "Composition.Set patient", "source": [ { "context": "bundleEntrySHC", "element": "fullUrl", "variable": "ref" } ], "target": [ { "context": "comp", "contextType": "variable", "element": "subject", "variable": "subj" }, { "context": "subj", "contextType": "variable", "element": "reference", "transform": "append", "parameter": [ { "valueString": "Patient/" }, { "valueId": "ref" } ] } ] } ] }, { "name": "adding resource to bundle", "source": [ { "context": "bundleEntrySHC", "element": "resource", "variable": "anyRes" } ], "target": [ { "context": "bundle", "contextType": "variable", "element": "entry", "variable": "entry" }, { "context": "entry", "contextType": "variable", "element": "resource", "transform": "copy", "parameter": [ { "valueId": "anyRes" } ] } ] } ] }, { "name": "SHC Immunization Section", "source": [ { "context": "src", "condition": "(fhirBundle.entry.resource.ofType(Immunization).exists())" } ], "target": [ { "context": "comp", "contextType": "variable", "element": "section", "variable": "section" } ], "rule": [ { "name": "Adding code to imm section", "source": [ { "context": "src" } ], "target": [ { "context": "section", "contextType": "variable", "element": "code", "variable": "code" }, { "context": "code", "contextType": "variable", "element": "coding", "variable": "coding" }, { "context": "coding", "contextType": "variable", "element": "system", "transform": "copy", "parameter": [ { "valueString": "http://loinc.org" } ] }, { "context": "coding", "contextType": "variable", "element": "code", "transform": "copy", "parameter": [ { "valueString": "11369-6" } ] }, { "context": "coding", "contextType": "variable", "element": "display", "transform": "copy", "parameter": [ { "valueString": "History of Immunization Narrative" } ] } ] }, { "name": "assing org entry to section", "source": [ { "context": "src" } ], "target": [ { "context": "section", "contextType": "variable", "element": "author", "variable": "author" }, { "context": "author", "contextType": "variable", "element": "reference", "transform": "append", "parameter": [ { "valueString": "Organization/" }, { "valueId": "oid" } ] } ] }, { "name": "Each entry", "source": [ { "context": "fhirBundle", "element": "entry", "variable": "bundleEntrySHC" } ], "rule": [ { "name": "assign immunization to composition", "source": [ { "context": "bundleEntrySHC", "type": "Immunization", "element": "resource", "variable": "immunizationSHC" } ], "rule": [ { "name": "add imm section", "source": [ { "context": "bundleEntrySHC", "element": "fullUrl", "variable": "ref" } ], "target": [ { "context": "section", "contextType": "variable", "element": "entry", "variable": "entry" }, { "context": "entry", "contextType": "variable", "element": "reference", "transform": "append", "parameter": [ { "valueString": "Immunization/" }, { "valueId": "ref" } ] } ] } ] } ] } ] }, { "name": "SHC Observation Section", "source": [ { "context": "src", "condition": "(fhirBundle.entry.resource.ofType(Observation).exists())" } ], "target": [ { "context": "comp", "contextType": "variable", "element": "section", "variable": "section" } ], "rule": [ { "name": "Adding code to obs section", "source": [ { "context": "src" } ], "target": [ { "context": "section", "contextType": "variable", "element": "code", "variable": "code" }, { "context": "code", "contextType": "variable", "element": "coding", "variable": "coding" }, { "context": "coding", "contextType": "variable", "element": "system", "transform": "copy", "parameter": [ { "valueString": "http://loinc.org" } ] }, { "context": "coding", "contextType": "variable", "element": "code", "transform": "copy", "parameter": [ { "valueString": "30954-2" } ] }, { "context": "coding", "contextType": "variable", "element": "display", "transform": "copy", "parameter": [ { "valueString": "Results (Diagnostic findings)" } ] } ] }, { "name": "assing org entry to section", "source": [ { "context": "src" } ], "target": [ { "context": "section", "contextType": "variable", "element": "author", "variable": "author" }, { "context": "author", "contextType": "variable", "element": "reference", "transform": "append", "parameter": [ { "valueString": "Organization/" }, { "valueId": "oid" } ] } ] }, { "name": "Entry Obs", "source": [ { "context": "fhirBundle", "element": "entry", "variable": "bundleEntrySHC" } ], "rule": [ { "name": "assign immunization to composition", "source": [ { "context": "bundleEntrySHC", "type": "Observation", "element": "resource", "variable": "observationSHC" } ], "rule": [ { "name": "add obs section", "source": [ { "context": "bundleEntrySHC", "element": "fullUrl", "variable": "ref" } ], "target": [ { "context": "section", "contextType": "variable", "element": "entry", "variable": "entry" }, { "context": "entry", "contextType": "variable", "element": "reference", "transform": "append", "parameter": [ { "valueString": "Observation/" }, { "valueId": "ref" } ] } ] } ] } ] } ] } ] } ] } ] } ] }, { "name": "ExtractComposition", "typeMode": "none", "input": [ { "name": "src", "type": "Data", "mode": "source" }, { "name": "composition", "type": "Composition", "mode": "target" } ], "rule": [ { "name": "Title", "source": [ { "context": "src" } ], "target": [ { "context": "composition", "contextType": "variable", "element": "title", "transform": "copy", "parameter": [ { "valueString": "International Certificate of Vaccination or Prophylaxis" } ] } ] }, { "name": "set category", "source": [ { "context": "src" } ], "target": [ { "context": "composition", "contextType": "variable", "element": "category", "variable": "category" }, { "context": "category", "contextType": "variable", "element": "coding", "variable": "coding" } ], "rule": [ { "name": "Category", "source": [ { "context": "src" } ], "target": [ { "context": "coding", "contextType": "variable", "element": "code", "transform": "copy", "parameter": [ { "valueString": "ddcc-vs" } ] } ] } ] }, { "name": "set type", "source": [ { "context": "src" } ], "target": [ { "context": "composition", "contextType": "variable", "element": "type", "variable": "type" }, { "context": "type", "contextType": "variable", "element": "coding", "variable": "coding" } ], "rule": [ { "name": "set type coding", "source": [ { "context": "src" } ], "target": [ { "context": "coding", "contextType": "variable", "element": "system", "transform": "copy", "parameter": [ { "valueString": "http://loinc.org" } ] }, { "context": "coding", "contextType": "variable", "element": "code", "transform": "copy", "parameter": [ { "valueString": "82593-5" } ] }, { "context": "coding", "contextType": "variable", "element": "display", "transform": "copy", "parameter": [ { "valueString": "Immunization summary report" } ] } ] } ] }, { "name": "Extract Period", "source": [ { "context": "src" } ], "target": [ { "context": "composition", "contextType": "variable", "element": "event", "variable": "event" }, { "context": "event", "contextType": "variable", "element": "period", "variable": "period", "transform": "create", "parameter": [ { "valueString": "Period" } ] } ], "dependent": [ { "name": "ExtractPeriod", "variable": [ "src", "period" ] } ] } ] }, { "name": "ExtractPeriod", "typeMode": "none", "input": [ { "name": "src", "type": "JWTPayload", "mode": "source" }, { "name": "tgt", "type": "Period", "mode": "target" } ], "rule": [ { "name": "Start notBefore", "source": [ { "context": "src", "element": "nbf", "variable": "nbf" } ], "target": [ { "context": "tgt", "contextType": "variable", "element": "start", "transform": "copy", "parameter": [ { "valueId": "nbf" } ] } ] }, { "name": "Start issuedAt", "source": [ { "context": "src", "element": "iat", "variable": "iat" } ], "target": [ { "context": "tgt", "contextType": "variable", "element": "start", "transform": "copy", "parameter": [ { "valueId": "iat" } ] } ] }, { "name": "End expiration", "source": [ { "context": "src", "element": "exp", "variable": "exp" } ], "target": [ { "context": "tgt", "contextType": "variable", "element": "end", "transform": "copy", "parameter": [ { "valueId": "exp" } ] } ] } ] } ] }