FHIR Chat · Creating My own resource · implementers

Stream: implementers

Topic: Creating My own resource


view this post on Zulip Aditya Joshi (Sep 26 2016 at 09:35):

Is it fine if someone can create their own resource? like Z messages/Trigger events. If yes, then can anybody please provide some examples or implementations creating their own resource.

view this post on Zulip Grahame Grieve (Sep 26 2016 at 09:46):

at this time, creating your own resources is not supported. It's something that we've thought about, but there hasn't been enough time to figure out how that would work

view this post on Zulip Aditya Joshi (Sep 26 2016 at 09:55):

Thanks Grahame for clarification. Someone told me that we can create our own FHIR resources by using HAPI api. Is there any fact inside this statement? May be @James Agnew or someone else please clarify.

view this post on Zulip Lloyd McKenzie (Sep 26 2016 at 20:35):

@Aditya Joshi I'd be surprised if HAPI supported this, but even if they did, you would be non-conformant and wouldn't interoperate with other FHIR systems.

view this post on Zulip David Hay (Sep 27 2016 at 00:03):

@Aditya Joshi you aren't thinking of extensions to existing resource types are you?

view this post on Zulip Aditya Joshi (Sep 27 2016 at 08:41):

Hi David, no, I know extensions and that is always the best choice if something not able to map FHIR element. Was just thinking what if not able to find even a suitable resource. like we create Z segments and if required can create Z trigger or message itself. But got point of you from you guys on this matter.

view this post on Zulip Brian Postlethwaite (Sep 27 2016 at 12:25):

You can always extend tube basic resource that is supported in most ref servers.

view this post on Zulip James Agnew (Sep 27 2016 at 20:45):

For what it's worth- HAPI actually will allow you to create your own custom resource types if you want.

As Lloyd mentions, there are disadvantages to doing this since it means you won't be interoperable with other FHIR systems unless they also use your custom resources, so it's almost always a better idea to use extensions on existing resources.

That said, if you need to, you can create Java classes with your own types and HAPI will use them like it would any of the built in types. You need to follow the same patterns as the existing resources (e.g. @ResourceDef annotation on the class, @Child on the fields, etc.) but as long as you do this HAPI's parser will pick up the definitions and use them.


Last updated: Apr 12 2022 at 19:14 UTC