Search code examples
hl7-fhir

Get definition JSON for extension from profile-types.json


I'm writing a code generator that parses profiles-types.json and generates resource classes.

When I encounter something like

"extension": [
  {
    "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-regex",
    "valueString": "-?([0]|([1-9][0-9]*))"
  }
],

how can I get the JSON that specifies this extension?

I found http://hl7.org/fhir/extension-valueset-replacedby.json but I don't know how to map from the url value above to this actual URL.

Update

I wonder what are the steps to get from http://hl7.org/fhir/StructureDefinition/structuredefinition-regex to http://hl7.org/fhir/extension-valueset-replacedby. It doesn't seem to be too complicated but I assumed extension URLs should be directly downloadable.

How do I then get a downloadable URL for extensions that are provided by someone else than hl7.org?

From https://www.hl7.org/fhir/extensibility.html

The url is a mandatory attribute / property and identifies a retrievable extension definition that defines the content and meaning of the extension.

but that doesn't seem to be the case.


Solution

  • if you request /fhir/extension-structuredefinition-regex on the hl7.org server, you'll get redirected to the correct definition - in html.

    If you request /fhir/extension-structuredefinition-regex on the hl7.org server with an accept type of application/fhir+json (or application/json+fhir or application/json) you get redirected to http://hl7.org/fhir/extension-structuredefinition-regex.json, which is what you're looking for.

    But if you ask for that using one of those json headers, you'll get html (error), and if you ask for html, you'll get json. Configuration problem on the server - I'll try and get it fixed