FHIR Chat · Doctors hierarchy · hapi

Stream: hapi

Topic: Doctors hierarchy


view this post on Zulip Dexter (Mar 09 2021 at 11:26):

Is there a way in which I can store a hierarchy of doctors (independent of the patient)? There's CareTeam, but that's in context of a patient.

view this post on Zulip Pétur Valdimarsson (Mar 09 2021 at 11:30):

Do you need an actual hierarchy or a flat list? If it's a hierarchy, what should the relation be based on? Who answers to who?

view this post on Zulip Dexter (Mar 09 2021 at 11:40):

Perhaps a tree-like one, each with n-nodes. Yeah who answers to who would be great to have!

view this post on Zulip Pétur Valdimarsson (Mar 09 2021 at 11:44):

I would probably go with a Group (or List) resource as container and add an extension to Practitioner to point out "superior". Then resolve the hierarchy on consumption of the resource.

view this post on Zulip Dexter (Mar 09 2021 at 11:45):

I'll also probably need to search for people within hierarchies. Will that mean extension search support will need modifications to the server code?

view this post on Zulip Pétur Valdimarsson (Mar 09 2021 at 11:56):

Basically, in the case I described, you will always be searching among a flat Practitioner list. Each practitioner has an extension defining a superior.

From your last question, I'm guessing you are using the HAPI JPA Server?

In order to perform searches such as finding all "descendants" of a Practitioner, a series of reverse chaining searches would need to be performed, or some alterations of the server code. But since I haven't used the JPA server in quite some time, I'm a bit unsure what it supports "out of the box" when it comes to searching.

Someone else might be of more help there.

view this post on Zulip Pétur Valdimarsson (Mar 09 2021 at 12:09):

Dexter said:

Is there a way in which I can store a hierarchy of doctors (independent of the patient)? There's CareTeam, but that's in context of a patient.

I hope I'm not rambling. But another way of handling it is to use Groups containing Practitioners and Groups, skipping the extension part. It might become a bit tedious to maintain though.

view this post on Zulip Dexter (Mar 09 2021 at 12:11):

I'm guessing you are using the HAPI JPA Server

Yeah

I hope I'm not rambling

No no you're not! Thanks for your pointers! I'm pretty new to HAPI and FHIR, so any help is really helpful! I'll try extensions, but I had issues previously defining a SearchParameter on it and getting it to work. I'll take a jab at it again and report back. I'll test out groups too! Thank you again!

view this post on Zulip Dexter (Mar 10 2021 at 12:21):

Group seems to fit me well for the usecase. But there's one issue I'm not sure how to tackle. Each doctor must manage only one group, and each member in a group cannot be a member of another group. While creating a new group, how do I enforce the above 2 conditions?

Condition 1 (no other group with this managing doctor is fairly straightforward) I must use ifNoneExist: managing-entity=ID.
Condition 2 (member not in any other group) I must use ifNoneExist: member=ID1, ID2, ID3, ....

Combining these both, my POST request would be something like this

{
    "resourceType": "Bundle",
    "type": "transaction",
    "entry": [
        {
            "resource": { /* Group Data */ },
            "request": {
                "method": "POST",
                "ifNoneExist": "managing-entity=ID&member=ID1, ID2, ID3"
            }
        }
    ]
}

I was also asked to ensure that there's only one level of 'hierarchy' for now. Now, this means that given a member A of a group G, they cannot be the managinEntity of any other group B. I thought of putting this restriction as a comma-separated values for the managing-entity, but that doesn't seem to work, nor does repeating the item in the request.

Example, given 2 to be the managing-entity of a new group, and 4, 5, 6, 7 its members, I tried this ifNoneExist.

ifNoneExist: managing-entity=2,3 & member=2, 4, 5, 6, 7
ifNoneExist: managing-entity=2 & managing-entity=3 & member=2, 4, 5, 6, 7
(spaces b/w & for ease of reading)

Last updated: Apr 12 2022 at 19:14 UTC