w3c / hcls-fhir-rdf

Sketching out an RDF representation for FHIR
39 stars 15 forks source link

content model of DomainResource.contained #101

Closed ericprud closed 11 months ago

ericprud commented 2 years ago

A typical MedicationRequest has contained Resources:

JSON:

  "contained": [
    { "resourceType": "Medication",
      "id": "med0310",
      "code": {
        "coding": [
          { "system": "http://snomed.info/sct", "code": "430127000" }
        ]
    } },
    { "resourceType": "Provenance",
      "id": "signature",
      "target": [ { "reference": "ServiceRequest/physiotherapy" } ],
      "recorded": "2017-02-01T17:23:07Z"
    }
  ],

RDVch (R4):

  fhir:DomainResource.contained [
     a fhir:Medication;
     fhir:index 0;
     fhir:Resource.id [ fhir:value "med0310" ];
     fhir:Medication.code [
       fhir:CodeableConcept.coding [
         fhir:index 0;
         a sct:430127000;
         fhir:Coding.system [ fhir:value "http://snomed.info/sct" ];
         fhir:Coding.code [ fhir:value "430127000" ];
  ] ] ], [
     a fhir:Provenance;
     fhir:index 1;
     fhir:Resource.id [ fhir:value "signature" ];
     fhir:Provenance.target [
       fhir:index 0;
       fhir:link <http://hl7.org/fhir/ServiceRequest/physiotherapy>;
       fhir:Reference.reference [ fhir:value "ServiceRequest/physiotherapy" ]
     ];
     fhir:Provenance.recorded [ fhir:value "2017-02-01T17:23:07Z"^^xsd:dateTime ];
  ];

rdvCH:

  fhir:contained ([
     a fhir:Medication;
     fhir:id "med0310";
     fhir:code ([
       fhir:coding [
         a sct:430127000;
         fhir:system "http://snomed.info/sct";
         fhir:code "430127000" ]
     ])
  ], [
     a fhir:Provenance;
     fhir:id [ fhir:value "signature" ];
     fhir:target ([
       fhir:link <http://hl7.org/fhir/ServiceRequest/physiotherapy>;
       fhir:reference "ServiceRequest/physiotherapy"
     ]);
     fhir:Provenance.recorded "2017-02-01T17:23:07Z"^^xsd:dateTime;
  ]);

So what's properties are allowed in a .contained element? AFAICT, it's every top-level property in every Resource.

previous work

The statically-generated context files don't address this. medicationrequest.context has:

    "contained": {
      "@id": "fhir:DomainResource.contained",
      "@context": "resource.context.jsonld"
    },

and resource.context has only base properties that come from Resource:

{
  "@context": {
    "@version": 1.1,
    "@vocab": "http://example.com/UNKNOWN#",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "fhir": "http://hl7.org/fhir/",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "id": {
      "@id": "fhir:Resource.id",
      "@context": "string.context.jsonld"
    },
    "meta": {
      "@id": "fhir:Resource.meta",
      "@context": "meta.context.jsonld"
    },
    "implicitRules": {
      "@id": "fhir:Resource.implicitRules",
      "@context": "uri.context.jsonld"
    },
    "language": {
      "@id": "fhir:Resource.language",
      "@context": "string.context.jsonld"
    },
    "index": {
      "@id": "fhir:index",
      "@type": "http://www.w3.org/2001/XMLSchema#integer"
    }
  }
}

which means that (a preprocessed version of) the above JSON data would correctly handle on the .ids; the rest (e.g. .code, .target, .recorded) would be unrecognized, as well as any nested data structures like .coding and .reference.

dbooth-boston commented 11 months ago

Implemented in R5