0

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.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567

1 Answers1

1

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

Grahame Grieve
  • 3,538
  • 3
  • 15
  • 17
  • Thanks a lot for your answer. So downloading from http://hl7.org/fhir/extension-valueset-replacedby is the right thing to do? I didn't think of the content-type header. It's still not entirely clear to me how to proceed. Please see my updated question. – Günter Zöchbauer Aug 25 '16 at 04:04
  • So it seems the problem is that there is no official registry yet (http://community.fhir.org/t/what-is-the-process-of-registering-my-own-extension/113) Any hint how other code generators handle this. I searched a few repositories but wasn't yet able to find the code that handles this. – Günter Zöchbauer Aug 25 '16 at 07:29
  • There's no link between http://hl7.org/fhir/extension-valueset-replacedby.json and http://hl7.org/fhir/StructureDefinition/structuredefinition-regex, and I'm not sure why you think there is. The code generators work by downloading all the definitions from the downloads page (look in extensions.[x] in the xml or json download) – Grahame Grieve Aug 26 '16 at 01:51
  • This is probably why I got carried away. I wasn't able to find the extension definitions in the downloads. Maybe I'm looking for something that's not necessary anyway, but from the code snippet in my question I found the extension URLs but no further details, then I found these parts online and tried to figure out how to connect these two. Can you give me a pointer where to find them in the downloads? I actually found them in examples-json.zip but that didn't seem to be the right location to me. – Günter Zöchbauer Aug 26 '16 at 04:45
  • extension-definitions in validation.json.zip from the downloads page – Grahame Grieve Aug 26 '16 at 12:02
  • Thanks a lot! I found it there. I feel a bit stupid because I thought I downloaded and investigated everything already. – Günter Zöchbauer Aug 26 '16 at 12:34
  • 1
    No problem. you found a bug with the website anyway... good work – Grahame Grieve Aug 26 '16 at 20:45