Skip to content
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

Support for Profiles #7

Open
axelv opened this issue Jun 4, 2023 · 2 comments
Open

Support for Profiles #7

axelv opened this issue Jun 4, 2023 · 2 comments

Comments

@axelv
Copy link
Contributor

axelv commented Jun 4, 2023

No description provided.

@axelv
Copy link
Contributor Author

axelv commented Jun 4, 2023

It would be very powerful if the typegen is also able to generate models for FHIR Profiles. I tried to generate models for mcode and had moderate success while generating the Pydantic models.

FYI: #6 is an issue I encountered while generating mcode profiles but it is not specific to it.

An overview of what is necessary to have minimal FHIR Profile support:

  • Ignore ElementDefinitions for slices. I think slicing is quite involved for the first minimal version of FHIR Profiles. So I would just ignore them.
  • Use the StructureDefinition.name for the model name of the resource instead of the id. It is meant for code generation as mentioned here. However, I expect we'll need some checks on valid characters or reserved keywords in order to have completely safe class names. In the case of mcode this played out well. name is always in PascalCase while id is mostly kebab-case.
    ex:
id: "mcode-karnofsky-performance-status"
name: "KarnofskyPerformanceStatus
  • Support for URI's in "contentReference". Profiles use a complete uri to reference BackboneElements ex: "http://hl7.org/fhir/StructureDefinition/Observation#Observation.referenceRange
  • Skip profiles in the construction of AnyResource. The current code generates the AnyResource two times when combining the generation of r4 types, r4 resources and mcode profiles. I don't think it makes sense to add Profiles to AnyResource.

Let me think what you think about generating Profiles and what a first version might look like. Happy to assist with some PRs.

@petrarca
Copy link

petrarca commented Mar 13, 2024

Thank you for your great work here first. I also would like to find a way to support FHIR profiles. The base is already there with the StructureDefintion and related resources. Due the dynamic nature, generation of classes is IMHO not needed, but validation and pre/filling of resources based on a given profile (StructureDefinition) would be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants