Skip to content

Instantly share code, notes, and snippets.

@aduane
Last active January 25, 2021 13:49
Show Gist options
  • Save aduane/b9c8521c17f41a561171179466335cbe to your computer and use it in GitHub Desktop.
Save aduane/b9c8521c17f41a561171179466335cbe to your computer and use it in GitHub Desktop.
NextGen / Mirth Connect FHIR Extension CapabilityStatement Quirks
  • A CapabilityStatement is generated automagically by a channel that has a "FHIR Listener" source connector.
  • The default CapabilityStatement does not conform to the requirements laid out in https://www.hl7.org/fhir/capabilitystatement.html
  • CapabilityStatement.rest.resource.searchParams are not specified
  • CapabilityStatement.status is not specified
  • CapabilityStatement.implementation is not specified
  • CapabilityStatement.document is not required, is specified, but is invalid (missing the profile element)

To remedy these issues or just otherwise customize the CapabilityStatement:

  • Find the "Capability Statement Template" option in the FHIR Listener source connector configuration screen.

  • Paste in CapabilityStatement xml with the elements you wish to override.
  • Example:
<?xml version="1.0"?>
<CapabilityStatement xmlns="http://hl7.org/fhir">
  <status value="active"/>
  <implementation>
    <description value="FHIR API for Canvas Medical EHR installations."/>
  </implementation>
  <rest>
    <mode value="server"/>
    <resource>
      <type value="Patient"/>
      <interaction>
        <code value="read"/>
      </interaction>
      <interaction>
        <code value="search-type"/>
      </interaction>
      <searchParam>
        <name value="_id"/>
        <definition value="http://hl7.org/fhir/SearchParameter/Patient-identifier"/>
        <type value="token"/>
        <documentation value="A patient identifier"/>
      </searchParam>
      <searchParam>
        <name value="identifier"/>
        <definition value="http://hl7.org/fhir/SearchParameter/Patient-identifier"/>
        <type value="token"/>
        <documentation value="A patient identifier"/>
      </searchParam>
      <searchParam>
        <name value="name"/>
        <definition value="http://hl7.org/fhir/SearchParameter/individual-given"/>
        <type value="string"/>
        <documentation value="The name of the patient"/>
      </searchParam>
      <searchParam>
        <name value="birthdate"/>
        <definition value="http://hl7.org/fhir/SearchParameter/individual-birthdate"/>
        <type value="date"/>
        <documentation value="The patient's date of birth"/>
      </searchParam>
      <searchParam>
        <name value="gender"/>
        <definition value="http://hl7.org/fhir/SearchParameter/individual-gender"/>
        <type value="token"/>
        <documentation value="Gender of the patient"/>
      </searchParam>
    </resource>
  </rest>
  <document/>
</CapabilityStatement>
  • In the above example, we only specify the resource that we have modified. Mirth will merge the autogenerated resource definitions with our overrides here. Note that <mode value="server"/>must be specified in our override, even though it is part of the generated CapabilityStatement, and you would expect it to be merged in. The channel will fail to deploy without it. I have no idea why this occurs. It is weird.
  • Also in the above example, we remove the document element (which is optional, but by default is provided in an invalid, incomplete form) by specifying a self-closing document tag. (<document/>) This fix was stumbled upon. Unsure if the behavior is intentional, but it sure works.

When specifying the CapabilityStatement.rest.resource.searchParams, the generated CapabilityStatement.text will reflect them, but will use the <u> tag in the markup, which is not considered valid by the ONC's Inferno testing program.

To remedy this, edit the extensions/fhir/narratives/CapabilityStatement.html file and change the <u> tag to something that is recognized as valid (We chose <span>).

NOTE: if you run Mirth in a docker container with an ephemeral filesystem, like we do, you'll need to incorporate this edit into your container build, or else it will be overwritten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment