-1

I'm tasked with writing a FHIR API in .NET.

For an API/server to be FHIR compatible does it have to implement the HATEOAS/links part - for example, does an Encounter object have to have a link to its Patient object, or can it have the entire Patient object in the Encounter's subject field?

Thank you in advance!

2 Answers2

1

The answer is a little complicated. The Encounter.patient is a reference, and so you can't include the entire patient object in the subject field - it just contains a URL that references it (or sometimes, just an identifier if the URL can't be determined).

But there is a special case, which is that the patient object can be put in Encounter.contained, and then the reference from Encounter.subject is a relative reference (e.g. something like reference="#pat")

Grahame Grieve
  • 3,538
  • 3
  • 15
  • 17
  • great! thanks, that helps! am I correct in assuming that a FHIR server would also adhere to the HATEOAS principle? – milkshakes Feb 26 '20 at 00:05
  • well... partly that depends on quite what you mean. If you mean just what you asked about then, yes, it should adhere. But not all servers that claim to conform actually do – Grahame Grieve Feb 27 '20 at 00:10
0

Unless your task is a study exercise, please know that there is already a widely used, open-source .NET FHIR API out there: https://github.com/FirelyTeam/fhir-net-api/