Stream: implementers
Topic: Creating profiled resources with JS & testing validity
Clotaire Delanchy (Apr 22 2021 at 16:56):
Hello everyone,
I'm new to FHIR and I have to test a FHIR server for a French national interoperability use case ("Cahier de Liaison" / Communication diary). For this, the national interoperability agency has created FHIR profiles based on basic FHIR resources: the profiles are "BundleCreationNodeCdL" and "DocumentReferenceCdL" and are available on Simplifier. They use other profiles made by a big french interoperability association (interopsanté), which are FrPatient, FrOrganization, FrPractioner.
I read a lot of FHIR documentation these last days (which is really nice and clear) but I don't find answers or examples on how to do this actions:
-
I want to be able to generate FHIR JSON of resources for testing purposes, like "BundleCreationNoteCdL" (base on the resource Bundle), "FrPatient" and so on... I am working with nodejs/JavaScript. I want to be able to create the resources (like patient) with randomly generated fake values. Do I have to build myself each JSON or is there some kind of library/tool that can facilitate this resource creation (for bundles for example, a tool that can agregate the different resources in one bundle)?
-
I also want to validate this newly created testing resource against the profiles given by the specification: DocumentReferenceCdL, FrPatient, etc. How can I do that? I tested with launching an HAPI FHIR server in local but it doesn't seem I can tell him to check the validity with the said profiles: it always validate with the FHIR "basic" resource... Same question for the HL7 FHIR Validator jar which allows to validate against the resources & profiles availables on the FHIR website & registry but not other custom profile (from simplifier in this case). Is there a way to do this easily? I want to be sure that my testing "home-made" resources are valid against the profiles of the use case...
-
The specification also gives me a bunch of XML but I don't understand how I can use them to validate my testing data. I have 3 CapabilityStatement XML, and one ImplementationGuide XML for the "Cahier de Liaison" and some StructureDefinitions XML. I think I understand what they are because I've read the documentation but I don't get how I can use them to create custom resource from a profile (point 1) or to validate my custom resource against them (point 2). The IG XML seems promising at first, but I found a validator project that requires a .tar.gz of ImplementationGuide and I have only an XML, so it doesn't work. And I haven't found how to go from one format (IG XML) to the other (IG tar.gz)...
I am discovering FHIR, which seems a great thing, but I have the feeling I understand the theory without having the capability/knowing how to put them in practice. I don't know where to start for these 3 basics questions (creating resources/validating them).
I really would appreciate some help or hints for these subjects. If I'm posting in the wrong channels, I'm sorry: don't hesitate to tell me that this is not the appropriate place (but there are so many channels :D).
Thank you in advance (sorry for the long post!).
Lloyd McKenzie (Apr 22 2021 at 19:52):
-
Google for Synthea fhir - that's the most robust 'fake data' mechanism I'm aware of. Out of the box, it's tuned for U.S. use, but a number of users have adapted the configuration files to work elsewhere. FHIR Shorthand won't generate your data randomly, but has some nice features about manually creating a lot of data pretty quickly. We've talked about some other ideas, but I'm not aware of anything else currently available for use.
-
When you invoke the validator from the commandline, you can pass the profile URL you want to validate against. I know you can do the same within HAPI, but don't remember exactly how. If it's not obvious after 15 minutes of digging into the code (and checking to see how the commandline launcher does it), then ask on the #hapi stream
-
Simplifier should be providing the tgz file the validator needs. In fact, because you're using simplifier, all you should need to do with the validator is specify the canonical URL of the IG and the validator should go grab the package definition from the HL7 package registry. The tgz file will contain all the computable information needed. (The actual IG publisher should be producing both XML and JSON representations of all the computable resources. The tgz file just contains the JSON because they're a bit more compact.
Hope that helps. And welcome to the community!
Grahame Grieve (Apr 22 2021 at 20:50):
There's some code in both java and pascal to create example resources from profiles but it's very crude at this point
Clotaire Delanchy (Apr 23 2021 at 08:20):
Hi @Lloyd McKenzie and @Grahame Grieve
Thanks a lot for your answers :) It is really helpful! :)
- I will check out the Syntea project and look how I can tune it to generate French patients. I'll also take a look at FHIR Shorthand.
- I will try with the FHIR validator to validate my resource against custom profiles. I'll ask to the hapi stream :)
- The national agency hasn't put the IG on Simplifier (only the CapabilityStatements), so I don't have a canonical URL of this resource on Simplifier. In the IG XML file, I do have an "url" property with value "http://esante.gouv.fr/ci-sis/fhir/ImplementationGuides/CI-SIS.CahierDeLiaison" but it seems to point to nothing (HTTP serveur response is "Moved permanently"). I will still test with this URL but I do think I will have to find another way...
Thank you again for your answers, It really helps!
Last updated: Apr 12 2022 at 19:14 UTC