4

I have a set of fhir resources in the following form:

<Basic>
    <meta>
      <versionId value="1.0"/>
      <lastUpdated value="2016-11-18T10:26:51Z"/>
      <profile value="http://stelar.org/StructureDefinition/stelar/profile/anthropometry"/>
    </meta>
    <text>
      <status value="generated"/>
    </text>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/const-sourceIdentifier">
      <cohortName value="TEST"/>
      <datasetName value="SEATONJEAug14A1"/>
      <archetypeName value="Abdo20wks"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/const-resourceTags">
      <valueString value="SEATON"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/anthropometryType">
      <valueCoding value="AnthropometricMeasure"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/subjectNo">
      <valueString value="5375"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/methodOfFollowUp">
      <valueCoding value="FollowUpMethod.ClinicVisit"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/followUp">
      <valueCoding value="FollowUp.SNRecruitment"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/variableLabel">
      <valueString value="Abdominal girth 20 week fetal scan (mm)"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/AIW">
      <valueDouble value="1841.0"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/subject">
      <valueCoding value="Person.StudySubject"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/clinicalType">
      <valueCoding value="ClinicalMeasurement.AnthropometricMeasure"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/dataSource">
      <valueCoding value="DataSource.ClinicalMeasurement"/>
    </extension>
    <extension url="http://stelar.org/StructureDefinition/stelar/extension/dataAnthropometricMeasure"/>
</Basic>

I have many similarly structured resources where a few constants change on them, such as the value of http://stelar.org/StructureDefinition/stelar/extension/dataSource. How would I go about constructing a query to search for resources which had a dataSource of 'DataSource.ClinicalMeasurement'.

I've read the documentation about searching, however there doesn't seem to be any mention of searching extensions.

As a side note I've had to base all of my data around the Basic resource type and use extensions for reasons that are a bit too unrelated to bring up here.

Andy
  • 3,228
  • 8
  • 40
  • 65
  • Your resource is not constructed correctly. A valueCoding consists of one or more fields, so should look like , preferably with the system value filled in as well. Also in the very first extension, you have added field names that are not FHIR compliant. See http://www.hl7.org/fhir/extensibility.html for the correct construction. Also Double is not a FHIR datatype, so you cannot have valueDouble. And the last extension is empty, which is not allowed. I would suggest you read the specification, or come to a FHIR training course – Mirjam Baltus Nov 21 '16 at 09:43
  • Hi Mirjam, thanks for the heads up. Is there anyway to validate that my extensions/profile is correct? I've read the specification but the scope of what can go wrong is quite wide. I've uploaded them to simplifier which validates them as correct, when I upload them to HAPI it also creates them correctly. I just deleted a url node (which is required) from a structure definition and uploaded it successfully, so I can only assume HAPI does no validation on StructureDefinitions by default. – Andy Nov 21 '16 at 10:57
  • Usually the HAPI server did perform a basic validation, but it seems it doesn't work right now. I believe Grahame has pointed you to a Java validator in another question, but that was for STU3. Look at http://www.hl7.org/fhir/downloads.html under Validator for the DSTU2 version. You could use that to validate your resources. Or you could try and upload the resource to spark.furore.com/fhir, which does do some basic validation. Or look at http://hapifhir.io/doc_validation.html to build validation in your Java application. – Mirjam Baltus Nov 21 '16 at 12:48

1 Answers1

5

You can define your own SearchParameter instance that defines how to query using any element or combination of element - extension or core. And you can use your server's Conformance resource to identify the SearchParameters you support and what names should be used for those search parameters.

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10
  • Thanks for the response, are the any examples of how to do this? I've notice a few sources now state how important extensibility is, and that extensions are 1st class citizens in fhir, but I haven't seen any of the documentation talk about searching by extension value, or any examples. Am I looking at the problem incorrectly? – Andy Jan 19 '17 at 15:58
  • There are example instances of SearchParameter and examples of Conformance/CapabilityStatement referencing SearchParameter, but none that show SearchParameter searching against an extension that I'm aware of in either the HL7 core spec or in any of the IGs we publish - it just hasn't come up. (I haven't had a need yet in any of my non-HL7 IGs yet either.) Feel free to submit a change request advocating for such an example to be included in the spec. – Lloyd McKenzie Jan 19 '17 at 19:31
  • Ok thanks, I've just had a go at doing that, but I can't seem to upload SearchParameters. I'm doing a POST to {{URL}}/SearchParameter on an out of the box hapi install, and I get a 403 response. Is there some different way to add SearchParameters to a fhir server? – Andy Jan 24 '17 at 12:03
  • Posting a SearchParameter doesn't automatically generate code support (at least not for most servers). Without more details, hard to diagnose the 403 in terms of why it won't let you *store* the search parameter. If you want to know how to customize HAPI to support a custom search parameter, I'd ask on the HAPI stream on chat.fhir.org (https://chat.fhir.org/#narrow/stream/hapi) – Lloyd McKenzie Jan 24 '17 at 16:26