0

I am new to FHIR, and am unable to understand the concept of compartment search.I have read compartment is a group of similar resources, but when we do compartment search we provide the following path: /[compartment]/[id]/?[parameters] '/[compartment]/[id]/[type]?[parameters]' '/[compartment]/id/condition '

Can anyone please give reasons why we are using ID as a parameter in each request, and also please give one one example of each request.

Onkaar Singh
  • 10,187
  • 3
  • 14
  • 26

1 Answers1

2

You can do this: /Patient/1/$everything, however that's not really a compartment based search. It's a resource-instance specific operation that depends on the existence of compartments to function - it says "find me everything in this patient's compartment"

For compartment based search, you'll either have this: /[compartment]/[id]/[type] (e.g. /Patient/1/Condition) if you want all records of the specified type within the compartment

or this /[compartment]/[id]/[type]?[parameters] (e.g. /Patient/1/Condition?category=diagnosis) if you want to further filter the records.

id isn't a parameter, it's identify the compartment. In the example above, you're saying "I want the conditions that belong to patient 1". There's no difference between the following two queries: /Patient/1/Condition /Condition?patient=1

The only reason we support compartments is that some systems like to do logic or security based on URL. Nesting queries beneath a selected Patient or Practitioner, etc. lets them do that.

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10
  • Thanks for the explanation. I'm having problems understanding compartments. So, should the following return all Observations related to a patient with id 1032702, or do I need something more? : http://fhir.example.com/Patient/1032702/Observation – Larsie Sep 03 '15 at 08:31
  • That should do it - provided the server at fhir.example.com supports compartments :) – Lloyd McKenzie Sep 03 '15 at 13:12