Generate ERD for entities in use
# support
s
Hi team, please educate me if there is a way to generate an ERD for the fhir resources that been populated. manually tracking what entities and fields are being used doesn't seem to scale.
r
How @s_w_abc , I'm not familiar with the term ERD - would you mind sharing an example?
m
ERD is entity relationship diagram. so something like

https://developer.nhs.uk/apis/gpconnect-1-2-8/images/appointments/appointment-fhir-resources-slot.png

r
Thanks @mrconnerton.encore ! @s_w_abc , have you checked out the official FHIR spec documentation? They have UML diagrams for each resource. However, these are usually within, rather than between resource types
s
thanks for your reply, @rahul1 ! yes we've checked them but they are not really useful for us. In our case, we are using certain fields in a resource but not other fields, and it'd be great if there's a way to generate an ERD which only has fields being used, so we don't need to manually maintain a diagram on our end. Manually maintain the diagram is both time-consuming and error-prone, with the team and project scaling, it becomes an unreliable approach.
r
@s_w_abc , while this doesn't address your diagram problem directly, you might want to consider writing some FHIR Profiles (https://www.medplum.com/docs/fhir-datastore/profiles). This is a way to define a specialization of FHIR resources (kind of like subclass). One way you can specialize a resource is to reduce the cardinality of fields you are not using (e.g. set the max cardinality to 0)
While this doesn't generate a diagram in-and-of-itself, it has some benefits: 1. You can have the Medplum server enforce these constraints - instead of relying on your whole team having read the documentation 2. You can use this as a basis for generating an ERD