-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fhir: tooling to auto-generate an adaptor #801
Conversation
Refer to #812 for guidance on how to handle types. I don't think it's a copy and paste solution but it at least shows where we were going wrong. |
well, actually, there is a diff because the order changes unfortunately. But if you sort linesascending there is no diff
4400ab5
to
7246dd2
Compare
Here's the a no-diff diff from builders.js in a02d9c0
This depends on mappings file (because of course it does!), which I've temporarily checked in. It uses ordered generation too. Pretty pleased with this: I've externalised the tooling into a pretty elegant command. The commits from this point will start to diverge the code |
Auto-generated unit tests 😎 They don't do a lot, but they do verify that the generated code works and resources can be created
|
I am going to merge this soon and start building other things on top. I still want to do stuff like import fhir verbs from the base adaptor, generate base builders for v4, work out how to handle basic datatypes (how and where do we define and test those basic helpers? And how do we map across versions?) I still also need to add a couple of big features in value-set mapping, fixing a bug with typings in lightning, and handling extensions even better. But we can spin these out into issues and take them on later |
This comment was marked as resolved.
This comment was marked as resolved.
TODO: how do we handle |
- handle invalid property names - map types inline types
valuesets are now written to a file when the spec is downloaded and parsed
I'm gonna add a general initaliser function to the mapper. Maybe it goes in the overrides block, so you can set it on one resorce, profile, or all resources. This is free code which needs to get baked into the builder function (we we need to serialise or parse the mapping function and embed it in the code). It gets called with the resource at the end of the build process, when most of the resource is built. This is going to be useful for generating meta and text objects (both of which I think can maybe be complex). It's also a good catch all for free code and handling any wierd edge cases. |
Ok, before I merge, I either want to: a) generate a fhir-4 base adaptor which includes datatypes, and import those datatypes into the new adaptors This is a really important part of the strategy and does need thinking about If we generate fhir adaptor per version, then obviously we get very good support across fhir versions (presumably good for fhir-to-fhir migration). The mappings file would include the base version, defaulting to 4. Even within that, I don't know how much the datatypes change. Would the same set of builders map to all 5 fhir versions? Does each version hand-write its own, or is there some kind of common import with overrides/mutations to handle different versions? Maybe we shouldn't worry too much. Let's just start with a generated version 4, hand-write (and test) the builders, and import those builders into our generated adaptor. That gives me a good architecutral shape, which can be improved upon later. |
Closing this PR down because I'm going to merge and release the fhir-fr adaptor now. |
Summary
This PR adds tooling to auto-generate a FHIR adaptor from a FHIR spec.
Closes #798
Usage guide
First time (to generate
packages/fhir-jembi
):To rebuild from the same spec:
To update/redownload the spec:
To rebuild from the same spec:
Steps
pnpm generate-fhir
Later
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy