Relate person to multiple patients - hl7-fhir

I would like to have multiple patients related to a person (e.g. some children and their father/mother).
As the RelatedPerson has only a 1..1 cardinality, what's the best way to achieve that?
Making a resource for a parent and linking that to a RelatedPerson per patient/child resource seems inappropriate.

You can use the Person resource to link multiple RelatedPersons together to indicate that they're the same human being. RelatedPerson is intended to represent an actor who can act on behalf of the patient. As such, it's essential that there be a link to exactly one Patient so you know on who's behalf they're acting.

Related

How to deal with "Foreign Key" in microservice architecture?

Quick question on Foreign key in Microservices. I already tried looking for answer. But, they did not give me the exact answer I was looking for.
Usecase : Every blog post will have many comments. Traditional monolith will have comments table with foreign key to blog post. However in microservice, we will have two services.
Service 1 : Post Microservie with these table fields (PostID, Name, Content)
Service 2 : Comments Microservie with these table fields (CommentID, PostID, Cpmment)
The question is, Do we need "PostID" in service 2 (Comments Microservice) ? I guess the answer is yes, as we need to know which comment belongs to which post. But then, it will create tight coupling? I mean if I delete service 1(Blog post service), it will impact service 2(Comments service) ?
I'm going to use another example I'm more familiar with to explain how I believe most people would do this.
Consider an Order Management System (OMS) and an Inventory Management System (IMS).
When a customer places an order in the company web site, we ask the OMS to create an order entry in the backend (e.g. via an HTTP endpoint).
The OMS system then broadcasts an event e.g. OrderPlaced containing all the details of the customer order. We may have a pub/sub (e.g. Redis), or a queue (e.g. RabbitMQ), or an event stream (e.g. Kafka) where we place the event (although this can be done in many other ways).
The thing is that we have one or more subscribers interested in this event. One of those could be the IMS, which has the responsibility of assigning the best inventory available every time an order is placed.
We can expect that the IMS will keep a copy of the relevant order information it received when it processed the OrderPlaced event such that it does not ask every little detail of the order to the OMS all the time. So, if the IMS needed a join with the order, instead of calling an endpoint in the Order API, it would probably just do a join with its local copy of the orders table.
Say now that our customer called to cancel her order. A customer service representative then cancelled it in the OMS Web User Interface. At that point an event OrderCanceled is broadcast. Guess who is listening for that event? Correct, the IMS receives notification and acts accordingly reversing the inventory assignation and probably even deleting the order record because it is no longer necessary on this domain.
So, as you can see, the best way to do this is by using events and making copies of the relevant details on the other domain.
Since events need time to get broadcast and processed by interested parties, we say that the order data in the IMS is eventually consistent.
Followup Questions
Q: So, if I understood right in microservises we prefer to duplicate data and get better performance? That is the concept? I mean I know the concept is scaling and flexibility but when we must share data we will just duplicate it?
Not really. That´s definitively not what I meant although it may have sounded like that due to my poor choice of words in the original explanation. It appears to me that at the heart of your question lies a lack of sufficient understanding of the concept of a bounded context.
In my explanation I meant to indicate that the OMS has a domain concept known as the order, but so does the IMS. Therefore, they both have an entity within their domain that represents it. There is a good chance that the order entity in the OMS is much richer than the corresponding representation of the same concept in the IMS.
For example, if the system I was describing was not for retail, but for wholesale, then the same concept of a "sales order" in our system corresponds to the concept of a "purchase order" in that of our customers. So you see, the same data, mapped under a different name, simply because under a different bounded context the data may have a different perspective and meaning.
So, this is the realization that a given concept from our model may be represented in multiple bounded contexts, perhaps from a different perspective and names from our ubiquitous language.
Just to give another example, the OMS needs to know about the customer, but the representation of the idea of a customer in the OMS is probably different than the same representation of such a concept or entity in the CRM. In the OMS the customer's name, email, shipping and billing addresses are probably enough representation of this idea, but for the CRM the customer encompasses much more.
Another example: the IMS needs to know the shipping address of the customer to choose the best inventory (e.g. the one in a facility closest to its final destination), but probably does not care much about the billing address. On the other hand, the billing address is fundamental for the Payment Management System (PMS). So, both the IMS and PMS may have a concept of an "order", it is just that it is not exactly the same, neither it has the same meaning or perspective, even if we store the same data.
One final example: the accounting system cares about the inventory for accounting purposes, to be able to tell how much we own, but perhaps accounting does not care about the specific location of the inventory within the warehouse, that's a detail only the IMS cares about.
In conclusion, I would not say this is about "copying data", this is about appropriately representing a fundamental concept within your bounded context and the realization that some concepts from the model may overlap between systems and have different representations, sometimes even under different names and levels of details. That's why I suggested that you investigate the idea of context mapping some more.
In other words, from my perspective, it would be a mistake to assume that the concept of an "order" only exists in the OMS. I could probably say that the OMS is the master of record of orders and that if something happens to an order we should let other interested systems know about those events since they care about some of that data because those other systems could have mapping concepts related to orders and when reacting to the changes in the master of record, they probably want to change their data as well.
From this point of view, copying some data is a side effect of having a proper design for the bounded context and not a goal in itself.
I hope that answers your question.

How to get grouped data from a microservice?

Let's say we have a system to store appointments. Each appointment has multiple resources (e.g. trainers, rooms, etc.). We have decided to move all appointment data into an Appointment Service and all resources into a Resources Service.
Now we need a UI that shows filters for the appointments, to filter by trainer. Usually, you only want to display checkboxes for trainers that actually have appointments and not all trainers.
That means we can't really use the Resource Service to get all trainers, instead, we would have to ask the Appointment Service to get a grouped view of all trainers that have at least one appointment. Then we would have to call the Resource Service to get more info about each trainer.
So how do you get grouped data from a microservice?
Edit: Each system has it's own database. We also use RabbitMQ to sync data between services.
This is an interesting question with many possible solutions. #Welbog comment makes a good point about it depending on the scale of the application. Denormalized databases are obviously a possibility.
Getting grouped data is one of the challenges of implementing microservices, and this challenge becomes greater the more granular our services get. What does your database setup look like? I'm assuming your two services are using different databases otherwise your question would have a simple solution.
Without knowing the ins and outs of your system, I would assume that denormalizing your db's would be the path of least resistance.
You could possible explore the idea that maybe these two services should in fact be a single service. Nanoservices are not what we are after, and sometimes it just makes more logical sense for two services to actually be together. Things that must change together, should be contained together. I'm not saying this is applicable in your case, I'm just saying it's worth considering.
I'm certain others will have other ideas, but based on what little I know about the entirety of your system, it's hard to say; however I think this is an interesting question that I will follow to see what other peoples proposed solutions are.

Reference to FHIR Questionnaire in DiagnosticOrder or CarePlan

I have sort of the same question as Access and scheduling of FHIR Questionnaire resource, but I'm having difficulties seeing the picture how DiagnosticOrder or CarePlan can be of help, which are mentioned as ways to do this in the related question.
I want to support the use case that an practitioner can choose a Questionnaire to be filled in by a patient, so for a certain patient I want to create an event or resource so the patient app knows there is something to fill in. I could simply create an empty QuestionnaireResponse but I don't know if that's the correct way to do it.
I looked at the DiagnosticOrder and CarePlan resource, but can't really see how to reference a Questionnaire from the DiagnosticOrder resource, should it be done using the Item field? Also, where in DiagnosticOrder can the scheduling be realized? I can't find a field like 'dateScheduled' for example or some other field which denotes before which date the Questionnaire should be filled in. In CarePlan, there's an activity, but as I see it, that's more of a 'our next evaluation is scheduled next week' in stead of 'Please fill this in before next week'.
I was very surprised to find that DiagnosticOrder doesn't have an element to capture the timing over which the order should be fulfilled. That seems like a pretty clear omission to me, given that DiagnosticOrder covers lab, vitals, imaging, requests for assessments, etc. most of which will need to indicate at minimum an effective period for the order, and many will need to indicate timing frequency as well. Please submit a change request (Propose a change link at the bottom of each spec page).
As for identifying what questionnaire to complete, that could be handled by Observation.code, thought the granularity might not be what's needed. There should probably be a standard extension that allows you to identify the specific Questionnaire to be completed. That would be a useful change request as well.

FHIR appointment book

Has anyone modelled a primary care appointment book using FHIR resources?
I'm wanting to model a book which allows slots to be held by more than one Practitioner (e.g. doctor and nurse), and a Location to be held against each Slot.
Currently I can't see a way of representing this, as a Schedule (and Slot by inference) can only be linked to one actor (Practitioner/Location etc).
Or if we create a seperate Schedule for each actor, how do you bundle the Practitioner and Location Slots together to create a single bookable entity?
You do this using a healthcare resource as the placeholder that the practitioners are associated with.
And yes I would expect that each of the resources would have their own schedule and slots. This way you can detect conflicts for the individual resources when allocating practitioners to the apointment.
Depends on your business rules.
Will be doing this shortly too, and will share the learning's. Will be for a community clinic, then for gp services.
Brian

Multiple Addresses for a FHIR resource Practitioner

In the resource definition of a practitioner (http://hl7.org/implement/standards/fhir/practitioner.htm), only one address can be set.
These is a problem for managing physicians with a national identifier (RPPS in France). A physician can have several addresses, they can work in a public hospital and a private organization in the same time, for instance. Some physicians have more than 10 active addresses.
How to deal with that ?
Thanks in advance.
If you only want to have a single resource, you can also use extensions to send additional address repetitions (or any other element you need or don't have enough repetitions for in the core resource). The premise for only allowing 1 reptition in the "core" resource is that the majority of systems will only support one, so we didn't want to try forcing multiple repetitions. But with extensions, you're in no way limited to the cardinality indicated.
In the near future (though probably after the publication of the first DSTU), we'll probably go through all the resources and identify elements with maxOccurs=1 where it would theoretically be possible to have more than one and define standard extensions for sending extra repetitions (just so everyone who encounters this common use-case has a standard extension to rely on)
It is perfectly alright to have more than one Practitioner instance for every role an individual physician can perform. So, you get one Practitioner instance for the professional working in his role within a public hospital, one for that same person working in a private organization etcetera.
For each instance you can give the practitioner qualifications for that specific role, specify a period the professional is allowed to be in that role, give telecom details specific to that role etcetera.
See also the last paragraph in the Practitioner resource
Practitioner performs different roles within the same or even different organizations. Depending on jurisdiction and custom, it may be necessary to maintain a specific Practitioner Resource for each such role or have a single Practitioner with multiple roles. The role can be limited to a specific period, after which authorization for this role ends. Note that the represented organization need not necessarily be the (direct) employer of a Practitioner.
It looks like the value for address is an array with address object/s inside of it meaning you should be able to add as many address objects as you want in the value.
"address" : [{ Address }], // Address(es) of the practitioner that are not role specific (typically hom

Resources