WHO Digital Documentation of COVID-19 Certificates (DDCC)
1.0.0 - CI Build International flag

This is the continuous build for version 1.0.0. This version is based on the current content of https://github.com/WorldHealthOrganization/ddcc and changes regularly.

: CertSHCtoCoreDataSet - JSON Representation

Draft as of 2024-01-19

Raw json | Download


{
  "resourceType" : "StructureMap",
  "id" : "CertSHCtoCoreDataSet",
  "meta" : {
    "versionId" : "6",
    "lastUpdated" : "2023-02-07T17:09:07.618+00:00"
  },
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><pre>map &quot;http://smart.who.int/ddcc/StructureMap/CertSHCtoCoreDataSet&quot; = &quot;CertSHCtoCoreDataSet&quot;\r\n\r\n// Structure map transforming CertSHC logical model to bundle of Core Data Set logical model\r\n\r\nuses &quot;http://smart.who.int/ddcc/StructureDefinition/CertSHC&quot; alias JWTPayload as source\r\nuses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias DDCCBundle as target\r\nuses &quot;http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet&quot; alias DDCC as produced\r\nuses &quot;http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.VS&quot; alias DDCCVS as produced\r\n\r\nimports &quot;http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetVS&quot;\r\nimports &quot;http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetTR&quot;\r\n\r\ngroup CertSHCtoCoreDataSetBundle(source src : JWTPayload, target ddccBundle : Bundle) {\r\n  src.vc as vc then {\r\n    vc.credentialSubject as credentialSubject then {\r\n      credentialSubject.fhirBundle as fhirBundle then {\r\n        fhirBundle.entry as patientEntrySHC then {\r\n          patientEntrySHC.resource : Patient first as patient then {\r\n            fhirBundle.entry as entry then {\r\n              entry.resource : Immunization as immunization -&gt;  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.VS') as ddcc then {\r\n                immunization then PatientToDDCCVS(patient, ddcc) &quot;set patient&quot;;\r\n                immunization -&gt; ddcc.vaccination as vaccination then ImmunizationToDDCC(immunization, vaccination) &quot;set vaccination&quot;;\r\n                immunization then CertSHCtoCoreDataSet(src, ddcc) &quot;set ddcc&quot;;\r\n                immunization -&gt; outentry.resource = ddcc &quot;set outentry&quot;;\r\n              } &quot;immunizations&quot;;\r\n              entry.resource : Observation as lab -&gt;  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.TR') as ddcc then {\r\n                lab then PatientToDDCCTR(patient, ddcc) &quot;set patient&quot;;\r\n                lab -&gt; ddcc.test as test then LabToDDCC(lab, test) &quot;set test&quot;;\r\n                lab then CertSHCtoCoreDataSet(src, ddcc) &quot;set ddcc&quot;;\r\n                lab -&gt; outentry.resource = ddcc &quot;set outentry&quot;;\r\n              } &quot;labs&quot;;\r\n            } &quot;entries&quot;;\r\n          } &quot;get patient&quot;;\r\n        } &quot;find patient&quot;;\r\n      };\r\n    };\r\n  };\r\n}\r\n\r\ngroup CertSHCtoCoreDataSet(source src : JWTPayload, target ddcc : DDCC) {\r\n  src -&gt; ddcc.certificate as cert then {\r\n    src.iss -&gt; cert.issuer = create('Reference') as issuer then {\r\n      src.iss as iss -&gt; issuer.reference = iss &quot;set issuer&quot;;\r\n    } &quot;issuer&quot;;\r\n    src -&gt; cert.period = create('Period') as period then {\r\n      src then JwtToPeriod(src, period) &quot;set period&quot;;\r\n    } &quot;period&quot;;\r\n  } &quot;certificate&quot;;\r\n}\r\n\r\ngroup JwtToPeriod(source src : JWTPayload, target tgt : Period) {\r\n  src.nbf as nbf -&gt;  append(nbf, ' seconds') as epoch,  tgt.start = (@1970-01-01T00:00:00.000+00:00 + epoch.toQuantity()) &quot;set period start to notBefore&quot;;\r\n  src.iat as iat -&gt;  append(iat, ' seconds') as epoch,  tgt.start = (@1970-01-01T00:00:00.000+00:00 + epoch.toQuantity()) &quot;set period start to  issuedAt&quot;;\r\n  src.exp as exp -&gt;  append(exp, ' seconds') as epoch,  tgt.end = (@1970-01-01T00:00:00.000+00:00 + epoch.toQuantity()) &quot;set period end&quot;;\r\n}\r\n\r\n</pre></div>"
  },
  "url" : "http://smart.who.int/ddcc/StructureMap/CertSHCtoCoreDataSet",
  "version" : "1.0.0",
  "name" : "CertSHCtoCoreDataSet",
  "status" : "draft",
  "date" : "2024-01-19T16:18:21+00:00",
  "publisher" : "WHO",
  "contact" : [
    {
      "name" : "WHO",
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://who.int"
        }
      ]
    }
  ],
  "description" : "Structure map transforming CertSHC logical model to bundle of Core Data Set logical model",
  "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/StructureDefinition/Bundle",
      "mode" : "target",
      "alias" : "DDCCBundle"
    },
    {
      "url" : "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet",
      "mode" : "produced",
      "alias" : "DDCC"
    },
    {
      "url" : "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.VS",
      "mode" : "produced",
      "alias" : "DDCCVS"
    }
  ],
  "import" : [
    "http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetVS",
    "http://smart.who.int/ddcc/StructureMap/SHCToCoreDataSetTR"
  ],
  "group" : [
    {
      "name" : "CertSHCtoCoreDataSetBundle",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "JWTPayload",
          "mode" : "source"
        },
        {
          "name" : "ddccBundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "vc",
          "source" : [
            {
              "context" : "src",
              "element" : "vc",
              "variable" : "vc"
            }
          ],
          "rule" : [
            {
              "name" : "credentialSubject",
              "source" : [
                {
                  "context" : "vc",
                  "element" : "credentialSubject",
                  "variable" : "credentialSubject"
                }
              ],
              "rule" : [
                {
                  "name" : "fhirBundle",
                  "source" : [
                    {
                      "context" : "credentialSubject",
                      "element" : "fhirBundle",
                      "variable" : "fhirBundle"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "find patient",
                      "source" : [
                        {
                          "context" : "fhirBundle",
                          "element" : "entry",
                          "variable" : "patientEntrySHC"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "get patient",
                          "source" : [
                            {
                              "context" : "patientEntrySHC",
                              "type" : "Patient",
                              "element" : "resource",
                              "listMode" : "first",
                              "variable" : "patient"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "entries",
                              "source" : [
                                {
                                  "context" : "fhirBundle",
                                  "element" : "entry",
                                  "variable" : "entry"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "immunizations",
                                  "source" : [
                                    {
                                      "context" : "entry",
                                      "type" : "Immunization",
                                      "element" : "resource",
                                      "variable" : "immunization"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "ddccBundle",
                                      "contextType" : "variable",
                                      "element" : "entry",
                                      "variable" : "outentry"
                                    },
                                    {
                                      "contextType" : "variable",
                                      "variable" : "ddcc",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.VS"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "set patient",
                                      "source" : [
                                        {
                                          "context" : "immunization"
                                        }
                                      ],
                                      "dependent" : [
                                        {
                                          "name" : "PatientToDDCCVS",
                                          "variable" : [
                                            "patient",
                                            "ddcc"
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "set vaccination",
                                      "source" : [
                                        {
                                          "context" : "immunization"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "ddcc",
                                          "contextType" : "variable",
                                          "element" : "vaccination",
                                          "variable" : "vaccination"
                                        }
                                      ],
                                      "dependent" : [
                                        {
                                          "name" : "ImmunizationToDDCC",
                                          "variable" : [
                                            "immunization",
                                            "vaccination"
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "set ddcc",
                                      "source" : [
                                        {
                                          "context" : "immunization"
                                        }
                                      ],
                                      "dependent" : [
                                        {
                                          "name" : "CertSHCtoCoreDataSet",
                                          "variable" : [
                                            "src",
                                            "ddcc"
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "set outentry",
                                      "source" : [
                                        {
                                          "context" : "immunization"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "outentry",
                                          "contextType" : "variable",
                                          "element" : "resource",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueId" : "ddcc"
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "labs",
                                  "source" : [
                                    {
                                      "context" : "entry",
                                      "type" : "Observation",
                                      "element" : "resource",
                                      "variable" : "lab"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "ddccBundle",
                                      "contextType" : "variable",
                                      "element" : "entry",
                                      "variable" : "outentry"
                                    },
                                    {
                                      "contextType" : "variable",
                                      "variable" : "ddcc",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSet.TR"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "set patient",
                                      "source" : [
                                        {
                                          "context" : "lab"
                                        }
                                      ],
                                      "dependent" : [
                                        {
                                          "name" : "PatientToDDCCTR",
                                          "variable" : [
                                            "patient",
                                            "ddcc"
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "set test",
                                      "source" : [
                                        {
                                          "context" : "lab"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "ddcc",
                                          "contextType" : "variable",
                                          "element" : "test",
                                          "variable" : "test"
                                        }
                                      ],
                                      "dependent" : [
                                        {
                                          "name" : "LabToDDCC",
                                          "variable" : [
                                            "lab",
                                            "test"
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "set ddcc",
                                      "source" : [
                                        {
                                          "context" : "lab"
                                        }
                                      ],
                                      "dependent" : [
                                        {
                                          "name" : "CertSHCtoCoreDataSet",
                                          "variable" : [
                                            "src",
                                            "ddcc"
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "set outentry",
                                      "source" : [
                                        {
                                          "context" : "lab"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "outentry",
                                          "contextType" : "variable",
                                          "element" : "resource",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueId" : "ddcc"
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "CertSHCtoCoreDataSet",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "JWTPayload",
          "mode" : "source"
        },
        {
          "name" : "ddcc",
          "type" : "DDCC",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "certificate",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "certificate",
              "variable" : "cert"
            }
          ],
          "rule" : [
            {
              "name" : "issuer",
              "source" : [
                {
                  "context" : "src",
                  "element" : "iss"
                }
              ],
              "target" : [
                {
                  "context" : "cert",
                  "contextType" : "variable",
                  "element" : "issuer",
                  "variable" : "issuer",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "set issuer",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "iss",
                      "variable" : "iss"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "issuer",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "iss"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "period",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "cert",
                  "contextType" : "variable",
                  "element" : "period",
                  "variable" : "period",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "set period",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "JwtToPeriod",
                      "variable" : [
                        "src",
                        "period"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "JwtToPeriod",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "JWTPayload",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "Period",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set period start to notBefore",
          "source" : [
            {
              "context" : "src",
              "element" : "nbf",
              "variable" : "nbf"
            }
          ],
          "target" : [
            {
              "contextType" : "variable",
              "variable" : "epoch",
              "transform" : "append",
              "parameter" : [
                {
                  "valueId" : "nbf"
                },
                {
                  "valueString" : " seconds"
                }
              ]
            },
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "start",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "@1970-01-01T00:00:00.000+00:00 + epoch.toQuantity()"
                }
              ]
            }
          ]
        },
        {
          "name" : "set period start to  issuedAt",
          "source" : [
            {
              "context" : "src",
              "element" : "iat",
              "variable" : "iat"
            }
          ],
          "target" : [
            {
              "contextType" : "variable",
              "variable" : "epoch",
              "transform" : "append",
              "parameter" : [
                {
                  "valueId" : "iat"
                },
                {
                  "valueString" : " seconds"
                }
              ]
            },
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "start",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "@1970-01-01T00:00:00.000+00:00 + epoch.toQuantity()"
                }
              ]
            }
          ]
        },
        {
          "name" : "set period end",
          "source" : [
            {
              "context" : "src",
              "element" : "exp",
              "variable" : "exp"
            }
          ],
          "target" : [
            {
              "contextType" : "variable",
              "variable" : "epoch",
              "transform" : "append",
              "parameter" : [
                {
                  "valueId" : "exp"
                },
                {
                  "valueString" : " seconds"
                }
              ]
            },
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "end",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "@1970-01-01T00:00:00.000+00:00 + epoch.toQuantity()"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}