FHIR © HL7.org  |  Server Home  |  XIG Home  |  XIG Stats  |  Server Source  |  FHIR  

FHIR IG Statistics: StructureMap/ResourcesToVSCoreDataSet

Packagewho.ddcc
Resource TypeStructureMap
IdResourcesToVSCoreDataSet
FHIR VersionR4
Sourcehttp://smart.who.int/ddcc/https://build.fhir.org/ig/WorldHealthOrganization/ddcc/StructureMap-ResourcesToVSCoreDataSet.html
URLhttp://smart.who.int/ddcc/StructureMap/ResourcesToVSCoreDataSet
Version1.0.0
Statusdraft
Date2025-06-24T09:07:32+00:00
NameResourcesToVSCoreDataSet
Realmuv
Authoritywho

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: StructureMap ResourcesToVSCoreDataSet

map "http://smart.who.int/ddcc/StructureMap/ResourcesToVSCoreDataSet" = "ResourcesToVSCoreDataSet"

uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as source
uses "http://hl7.org/fhir/StructureDefinition/HumanName" alias HumanName as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCPatient" alias DDCCPatient as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCImmunization" alias DDCCImmunization as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCImmunizationRecommendation" alias DDCCImmunizationRecommendation as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCVSComposition" alias DDCCVSComposition as source
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVSPoV" alias DDCCPoV as target

group ResourcesToCoreDataSet(source bundle : Bundle, target ddcc : DDCCPoV) {
  bundle ->  ddcc.vaccination as vaccination,  ddcc.certificate as certificate then {
    bundle.link first as link -> certificate.hcid as hcid then {
      // There's got to be a better way to do this
      link.url as url -> hcid.value = (url.replaceMatches('[Uu][Rr][Nn]:[Hh][Cc][Ii][Dd]:', '')) "set hcid value";
    } "set hcid";
    bundle.id as id ->  certificate.ddccid as ddccid,  ddccid.value = id "set ddcc id value";
    bundle.entry as entry then {
      entry.resource : Patient first as patient then PatientToDDCCVS(patient, ddcc) "set patient details";
      entry.resource : Immunization first as immunization then ImmunizationToDDCCVS(immunization, vaccination, certificate) "set immunization";
      entry.resource : ImmunizationRecommendation first as immRec then ImmRecToDDCCVS(immRec, vaccination) "set immunization recommendation";
      entry.resource : Composition first as composition then CompositionToDDCCVS(composition, certificate) "set composition";
    } "set header from patient";
  } "setup ddcc";
// // 	     entry.resource : DDCCPatient as patient                  entry.resource : Patient as patient            then  Decode-Patient-To-QR(patient,qr) "Patient";       };
// bundle as src then QRespToHeader( src, ddcc ) "set header content";   bundle as src -> ddcc.vaccination as vaccination then QRespToVaccination( src, vaccination ) "set vaccination content";   bundle as src -> ddcc.certificate as certificate then QRespToCertificate( src, certificate ) "set certificate content";
// then {     a as item where linkId = 'name' -> ddcc.name = item "set name";    } "items";
}

group CompositionToDDCCVS(source composition : DDCCVSComposition, target certificate) {
  composition -> certificate.version = 'RC2' "set version";
  composition.event first as event then {
    event.period as period -> certificate.period as tPeriod then {
      period.start as start -> tPeriod.start = start "set period start";
      period.end as end -> tPeriod.end = end "set period end";
    } "set period";
  } "set certificate period";
}

group PatientToDDCCVS(source patient : DDCCPatient, target ddcc : DDCCPoV) {
  patient.name as name then NameToText(name, ddcc) "set name";
  patient.birthDate as bday -> ddcc.birthDate = bday "set birth date";
  patient.id as id ->  ddcc.identifier as identifier,  identifier.value = id "set identifier from id";
  // this will override what was set from id if it exists
  patient.identifier first as sId -> ddcc.identifier as identifier then {
    sId.value as id -> identifier.value = id "set identifier value";
  } "set identifier from identifier";
  patient.gender as gender -> ddcc.sex = gender "set sex";
}

group NameToText(source name : HumanName, target ddcc) {
  // annoying because append doesn't work until ddcc.name is set
  name.given first as given -> ddcc.name = (given.replaceMatches('