Related Persons
This page discusses the manner in which FHIR RelatedPerson resources are handled and the various caveats of how those relate to the iCDR relationships.
CDR Relationships
The CDR storage model support robust linkages between patients and persons. Some SanteDB services such as the Immunization Management Service (IMS) represent relationships between non-patient persons as a direct relationship between an instance of a Patient entity and a Person entity with a relationship type.
This example illustrates a simple non-patient entity (Sarah Smith) is the mother of a Patient (Baby Joe Smith).
Additionally, the CDR also supports the direct linking of patient entities to other patient entities in relationships. The illustration below illustrates a patient entity (Sarah Smith) is the mother of Patient (Baby Joe Smith).
This relationship works because in SanteDB a Patient is a Person.
FHIR Relationships
In FHIR, the RelatedPerson
resource is used to represent a related person. Unlike SanteDB's RIM model, FHIR's RelatedPerson
maps to one of the following internal concepts in SanteDB:
A combination of
Person
andEntityRelationship
where thePerson
may only contain one relationship to onePatient
, orAn
EntityRelationship
only, where only the relationship type is expressed.
A RelatedPerson
represents a combination of Person
and EntityRelationship
when it is expressed as:
This condition is described in the section Simple Relationships on this page. However, a RelatedPerson
is only an EntityRelationship
when it is represented as:
The behavior of the iCDR is described in Complex Relationships in this page.
Simple Relationships
The manner in which HL7 FHIR views patient relationships is reversed from the CDR's view of relationships. Primarily, HL7 FHIR would represent a non-patient person relationship to a patient as.
In effect, the FHIR resource RelatedPerson
is a mashup of a Person
and an EntityRelationship
, as the RelatedPerson
contains elements of both objects.
The CDR handles these relationship types automatically. When querying from FHIR with _revInclude=RelatedPerson:patient
, the CDR will interpret either of these relationships and will construct the appropriate response messages for broadcasts and searches.
The CDR will treat the target of the personal relationship as a Person. Since the CDR support hierarchy and Patient is a Patient, this translation is transparent to the FHIR interface. The CDR treats the instance of RelatedPerson
as the EntityRelationship
instance between the two entities. The CDR's FHIR plugin will reverse the relationship to ensure that the FHIR RelatedPerson
references is correctly associated.
The reason the RelatedPerson is linked to the EntityRelationship is a single Person may have multiple relationships (for example, a mother of two children). However, in FHIR a RelatedPerson may only have a single relationship between a Person and a Patient.
This behaviour matches the HL7 processor when an NK1 segment is present. For example, this HL7 message
And this FHIR message
Will both result in this structure in the database.
Complex Relationships
Relationships between Patients in FHIR are slightly more complex, take for example, a scenario where a Sarah Smith is a patient and is related to Baby Joe Smith. In FHIR the structure of this message would be as follows.
The HL7 FHIR processor on a read will not reproduce this when a patient is read from the database and is directly related to another patient. Instead the simple case of representation is performed on a query.
When creating or updating a related person in this manner the following structure is created in the RIM structure.
This structure is also created from the HL7v2 process when an NK1 segment points at a previously registered PID segment. For example, the following HL7v2 structure also creates a similar structure as the FHIR interface.
This structure will indicate that a patient is admitted to hospital (Sarah Smith) and then is linked to Baby Joe Smith as a next of kin. In FHIR this structure is represented as.
Special Implementation Notes for Related Person
When querying a patient which has a relationship with another patient (for example, querying for
?identifier=HL7-3
) you can use_revInclude=RelatedPerson:patient
to join a RelatedPerson instance, however the includedRelatedPerson
instance will be represented as a simple relationship rather than a complex relationship.It is not possible to perform a
_revInclude=Patient:link
on order to retrieve patient information about theRelatedPerson
, this is because there is no relationship or link per-se between thePerson
andPatient
, in SanteDB they are the same resourceThe
id
andfullUrl
of theRelatedPerson
is theid
property of theEntityRelationship
rather than thePerson
. This is because in FHIR aRelatedPerson
can have exactly one relationship to exactly onePatient
, however in SanteDB RIM aPerson
can have infinite relationships to infinitePatient
resources.When querying directly for a
Patient
instance on the FHIR interface, you may see one or morelink
properties such as listed below, this link information is provided to indicate there exists a relationship where the patient is a target of a relationship.
When MDM is enabled, the Master/Golden record is returned on queries, since no relationships can exists between a local to a master the master results will not return seealso links to RelatedPerson instances (since they are not pointed at data).
Last updated