Microsoft fhir server extensibility

Hi, we are trying out microsoft azure fhir server which uses Hl7.Fhir.STU3 by Ewout Kramer. We need to extend its default implementation. What would be the best practice? Create our own solution that derives from Hl7.Fhir.STU3, add our data elements and then reference this solution from azure fhir server?

Thank you in advance for your help!

Can you explain what you mean by “extend”? With the built in extension capabilities of FHIR and the Basic resource, you should be able to represent any structure you like while remaining compliant and just leveraging the base STU3 model.

I am new to this so bear with me please. Let’s take Patient resource. Say it has 100 properties. I need to add 5 more. I was thinking of creating new class (e.g. MemberPatient) that derives from Patient and add 5 properties I need. Then I will serialize it and post to the server. Then when I query, i get MemberPatient back with my 5 custom properties.

Doing that is non-compliant. What you should do is use the built-in ‘extension’ elements to convey your additional properties. Check out If you serialize that way, everyone will be able to consume your instances and you’ll be able to work with other software. If you change the syntax to add extra elements, you’re not actually using the standard and won’t work with other implementers or public test servers, reference implementations, etc.


Thank you Lloyd. It makes sense. What about resources that don’t exist? Something that specific to our organization (at least for now). Is there a built-in capability for that? We are just trying to decide whether we can get away with using out-of-the-box server or get the source code and build new resources there.

The Basic resource is intended for that purpose - it’s a generic structure where you can define a code to say what it is and use extensions to define the properties.

Note that if you find something that you feel FHIR can’t do, it’s always best to raise a question on because it’s possible the requirement is supported by a mechanism you didn’t recognize or there might already be a ‘standard’ extension defined for the purpose.

1 Like

So what you are saying is that I don’t need to make any customizations to default fhir server. And just like with extending existing resources, I can create new resources w/o any changes to default source code. If so, then when is default implementation is not enough?

The default implementation isn’t going to enforce any business rules or authorization rules. That’s where changes are typically needed. However, in principle, the data structures shouldn’t need to be changed. That doesn’t mean that they can’t be, but any data that you’re going to share with external systems should only use the defined resources and should leverage the Basic and extension mechanisms to satisfy needs specific to your implementation environment.

1 Like

Thanks @lloyd for adding clarity.