Skip to content

Instantly share code, notes, and snippets.

@niquola
Last active December 10, 2023 09:45
Show Gist options
  • Save niquola/b7bce73d581425f147bad4a6f674a363 to your computer and use it in GitHub Desktop.
Save niquola/b7bce73d581425f147bad4a6f674a363 to your computer and use it in GitHub Desktop.
FHIR & OpenAPI questions

FHIR to OpenAPI translation

FHIR specify set of Resources with dataelements with specific datatype as informational model - StructureDefinition resource. So we have to convert StructureDefinition into JSON schema.

Also FHIR has specification of REST API by convention - http://hl7.org/fhir/http.html, and ability to extend API by custom Operations - http://hl7.org/fhir/operationslist.html

So we could generate swagger document from http://hl7.org/fhir/capabilitystatement.html and list of operations.

JSON schema

Convertion of Primitives

FHIR has set of primitive and complex types - http://hl7.org/fhir/datatypes.html

Polymorphic/Union types (Choice in terms of FHIR)

FHIR has the notion of union types (choice).

Current representation in JSON is postfix notation:

http://build.fhir.org/formats.html#choice

Terminology bindings

Operations

Primitive Extensions

References

Operations / REST API

@fizxmike
Copy link

I see this doc was unfinished... did you ever find a good way to convert FHIR Conformance/StructureDefinition to OpenAPI/Swagger spec? Or perhaps I am missing something obvious?

@radver
Copy link

radver commented Jan 11, 2019

I'm also looking for a tool/converter for converting FHIR structure definitions (in JSON) to Swagger YAML format (to be fed to api connect)... no luck so far.
I do have capability statement JSON and perhaps if it can be converted or used to solve the purpose. Any ideas/suggestions? :)

thank you!

@mmorrey
Copy link

mmorrey commented Apr 30, 2020

@niquola
Copy link
Author

niquola commented Apr 30, 2020

We implemented JSON schema generation in our aidbox fhir server.

@niquola
Copy link
Author

niquola commented Apr 30, 2020

We added couple of extensions to json schema to make it work.

@swapnilbjadhav
Copy link

Hey @niquola what extensions you have added to the capability statement json schema to work? Can you share it even i am trying to incroporate it in my FHIR server itself

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