0

We are building a web-app for careplan creation and management.

We decided to build our app in this fashion:

  • Main plan (CarePlan)
    • section 1 (CarePlan)
    • section 2 (CarePlan)
    • ...
    • section n (CarePlan)

Reasoning behind this approach is any of our sections - for example "Diet"-section - can have multiple goals and multiple activities to reach those goals. It's also possible to edit each section separately.

In our app we know the id of the Main plan and need to retrieve all sub-plans pointing to this Main plan in their partOf-reference.

How I can achieve this?

We are testing our app with http://hapi.fhir.org/ -server.

Here're some examples of our FHIR-resources

  1. Main CarePlan: http://hapi.fhir.org/baseR4/CarePlan/1958874
  2. Section CarePlan: http://hapi.fhir.org/baseR4/CarePlan/1955871

And related searches:

  1. http://hapi.fhir.org/baseR4/CarePlan?_id=1958874 Works.
  2. http://hapi.fhir.org/baseR4/CarePlan?_id=1958874&_include=CarePlan:subject Works.
  3. http://hapi.fhir.org/baseR4/CarePlan?_id=1958874&_revinclude=* Works but not really useful.
  4. http://hapi.fhir.org/baseR4/CarePlan?_id=1958874&_revinclude=CarePlan:partOf Doesn't work. Why?
sleizy
  • 3
  • 3
  • Side-note: When I look at the 1955871 example, there seem to be a lot of 'contained' resources that seem like they should have independent existence. Reminder that 'contained' is only for data that has no independent existence from the containing resource (can't search for it, not meaningful except in the context of the container). – Lloyd McKenzie Mar 22 '21 at 14:46
  • This is a fair point. We've been back and forth on this subject within the team also. The reasoning with containing goals and activities was that we didn't think of cases where this info would be needed or would be relevant if taken out of the context of the CarePlan (at least for now). You'd suggest building independent Goals and Activities just in case we end up needing these in some other context anyway? – sleizy Mar 22 '21 at 15:15
  • If you're confident that both sender and receiver are going to see them as intrinsically contained and having no independent existence/identity, then that's ok. Goals as contained would be more understandable than activities as contained - activities almost always have an independent existence? CarePlan might point to them, but you usually need to be able to see that actions occurred without looking inside CarePlans for them? – Lloyd McKenzie Mar 22 '21 at 20:52

1 Answers1

0

Try http://hapi.fhir.org/baseR4/CarePlan?_id=1958874&_revinclude=CarePlan:part-of

When you specify _revinclude, you must specify the search parameter, not the element name. The search parameter for partOf is part-of (as listed here: https://build.fhir.org/careplan#search)

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10
  • I see, thanks! I had completely ignored the Search Parameters -section. The search is working as I needed it to with this correction. – sleizy Mar 22 '21 at 15:06