fhir-crucible / fhir_models

FHIR Resource Models
Apache License 2.0
87 stars 26 forks source link

Generating Narrative Div's #72

Open BillyYarosh-WellSky opened 4 years ago

BillyYarosh-WellSky commented 4 years ago

Is there any tooling or recommendation on how to generate a Narrative div for specific resources?

arscan commented 4 years ago

Could you elaborate a little more on what you are trying to do?

BillyYarosh-WellSky commented 4 years ago

So a Patient resource has a Narrative ('text') section. I was wondering if there was a method for generating those divs like in this example:

{
  "resourceType" : "Patient",
  "id" : "example",
  "meta" : {
    "profile" : [
      "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
    ]
  },
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<p>\n\t\t\t\t<b>Generated Narrative with Details</b>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<b>id</b>: example</p>\n\t\t\t<p>\n\t\t\t\t<b>identifier</b>: Medical Record Number = 1032702 (USUAL)</p>\n\t\t\t<p>\n\t\t\t\t<b>active</b>: true</p>\n\t\t\t<p>\n\t\t\t\t<b>name</b>: Amy V. Shaw </p>\n\t\t\t<p>\n\t\t\t\t<b>telecom</b>: ph: 555-555-5555(HOME), amy.shaw@example.com</p>\n\t\t\t<p>\n\t\t\t\t<b>gender</b>: </p>\n\t\t\t<p>\n\t\t\t\t<b>birthsex</b>: Female</p>\n\t\t\t<p>\n\t\t\t\t<b>birthDate</b>: Feb 20, 2007</p>\n\t\t\t<p>\n\t\t\t\t<b>address</b>: 49 Meadow St Mounds OK 74047 US </p>\n\t\t\t<p>\n\t\t\t\t<b>race</b>: White, American Indian or Alaska Native, Asian, Shoshone, Filipino</p>\n\t\t\t<p>\n\t\t\t\t<b>ethnicity</b>: Hispanic or Latino, Dominican, Mexican</p>\n\t\t</div>"
  },
  ...
}

This is something that is needed for a CCDS document, and was wondering if this library supports a method for generating that xhtml text in a narrative from the model?

arscan commented 4 years ago

We do not have any helper functionality to generate narratives based on the content of a resource. That would be a useful thing for the library to do though, I think.