FHIR Chat · Creating profiles with complex elements · hapi

Stream: hapi

Topic: Creating profiles with complex elements


view this post on Zulip Andrew Broadbent (Jun 07 2017 at 14:50):

Hi all, I'm currently trying to create a profile which contains zero or more complex types (each element has a name, a date, and a boolean). How do I model this?

I think I'm supposed to create an extension to represent the complex type, then have a reference to that from the profile, however I cannot find an example of this; the only examples are profiles which have an element linking to any extension (which I don't want, I need to limit it to my type). The only other thing I can find similar to this is the backbone element. All profiles I've seen on simplifier use backbone elements, but I'm not sure if these are something that I actually define myself.

Could someone point me in the right direction as to how I'm supposed to model this?

view this post on Zulip Eric Haas (Jun 07 2017 at 19:05):

could you be more specific..."I'm currently trying to create a profile which contains zero or more complex types" complex types of what? extensions? here is an example of this

view this post on Zulip Andrew Broadbent (Jun 09 2017 at 09:40):

@Eric Haas Ok to be more specific; I'm writing a system which turns tabular data into fhir profiles. To do this, users create a sort of proto resource, which is essentially a resource, but it can also link to column data in a table. I have a program which evaluates this resources for every row, and fills in the blanks from the rows. So for example I could have a table of patients, I create a proto resource which sets all the constant information, like what hospital they belong to, etc, and then I supply the variable data from a table.

To cut a long story short, I'm trying to keep as much of the metadata about this process in fhir as well, the reason for doing this is that we also have an indexing system, and users will want to view groups of resources based on which proto resource created them. I'm trying to create a profile which represents the class of proto resource, and the list of complex types I want contains information about how to map from a table to a resource. It would contain something like that column name, the xpath into the target resource, and a few other conversion factors.

The problem I'm having is; I could create a profile which says it has to have a list of extensions, what I can't find is an example of a profile which says it must have a list of specific extensions. For example, I would create an extension for my complex type (lets call it MappingInfo), I wouldn't want users to assign any old extension to that field.

The way this works with resource types (as far as I can tell), is they have a backbone element which contains the items my extension would.

view this post on Zulip Grahame Grieve (Jun 09 2017 at 21:19):

@Bryn Rhodes - this is a pattern we've discussed before - can you quickly describe your current take on this?

view this post on Zulip Bryn Rhodes (Jun 09 2017 at 21:44):

Yeah, we did this with the CQF resources as a profile on basic, but I'm not sure I understand what the problem is? Specifically, I don't understand this: "I wouldn't want users to assign any old extension to that field", why does it matter?

view this post on Zulip Grahame Grieve (Jun 09 2017 at 21:45):

note: I don't do this with a resource. I do this with some scripting language. Here's 2 examples:

view this post on Zulip Grahame Grieve (Jun 09 2017 at 21:46):

<?xml version="1.0" encoding="UTF-8"?>
<Bundle xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://hl7.org/fhir ../../schema/bundle.xsd">
  <id value="b0a5e4277-83c4-4adb-87e2-e3efe3369b6f"/>
  <meta>
    <lastUpdated value="2012-05-29T23:45:32Z"/> 
  </meta> 
  <type value="collection"/> [%loop count=70%]
  <entry>
    <fullUrl value="http://hl7.org/fhir/Patient/[%count%]"/>
    <resource>
      <Patient>
        <id value="[%count%]"/>
        <meta>
          <lastUpdated value="2012-06-03T23:45:32Z"/>
        </meta>
        <text>
          <status value="generated"/>
          <div xmlns="http://www.w3.org/1999/xhtml">[%last name%], [%first name%]. MRN:
          [%patient_id%]</div>
        </text>
        <identifier>
          <type>
            <coding>
              <system value="http://hl7.org/fhir/v2/0203"/>
              <code value="SS"/>
            </coding>
          </type>
          <system value="https://github.com/projectcypress/cypress/patient"/>
          <value value="[%patient_id%]"/>
        </identifier>
        <active value="true"/>
        <name>
          <use value="official"/>
          <family value="[%last name%]"/>
          <given value="[%first name%]"/>
        </name>
        <gender value="[%gender%]" />
        <birthDate value="[%birthdate%]"/>
        <managingOrganization>
          <reference value="Organization/[%organization%]"/>
        </managingOrganization>
      </Patient>
    </resource>
  </entry> [%endloop%] 
</Bundle>

view this post on Zulip Grahame Grieve (Jun 09 2017 at 21:46):

and

view this post on Zulip Grahame Grieve (Jun 09 2017 at 21:49):

{
  "resourceType" : "PractitionerRole",
  "identifier" : [
    {
      "system" : "xx",
      "value" : "{provider no}"
    }
  ],
  "active" : {current},
  "specialty" : [
    {
      "text" : "{speciality}"
    }
  ],
  "telecom" : [
    {
      "system" : "phone",
      "value" : "{Phone}",
      "use" : "work"
    },
    {
      "system" : "fax",
      "value" : "{Fax}",
      "use" : "work"
    },
    {
      "system" : "phone",
      "value" : "{Mobile}",
      "use" : "mobile"
    },
    {
      "system" : "email",
      "value" : "{Email}",
      "use" : "work"
    }
  ]
}

view this post on Zulip Eric Haas (Jun 10 2017 at 02:00):

I'm curious - What happens if the field is blank?

view this post on Zulip Grahame Grieve (Jun 10 2017 at 02:01):

can't be in those cases.


Last updated: Apr 12 2022 at 19:14 UTC