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

Flexporter - Update randomCode fn to take output type as an optional second param #1527

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dehall
Copy link
Contributor

@dehall dehall commented Nov 8, 2024

Updates to address flexporter issues identified by @elsaperelli :

  1. I realized the randomCode function was improperly named since technically it produces a Coding not a code. Rather than rename it and break backwards compatibility, this gives it an optional second parameter for "return type". This can be "code" to return a string, "Coding" to return a Coding (ie {system, code, display}), or "CodeableConcept" to return a CodeableConcept. Default if unspecified is Coding, for backwards compatibility.

  2. Adds support for defining custom ValueSets in a flexporter mapping file, so that you can select a randomCode from your handpicked set of codes rather than having to use a terminology server and pre-existing VS. The syntax is a YAML version of the ValueSet resource, to minimize inventing new things. There are some quirks to this though so I'm open to suggestions here:

    • Our YAML parser doesn't work with the HAPI FHIR model classes, so this uses a roundabout way of loading that parses the YAML to Map<String,Object>, serializes that to JSON, then parses the JSON as FHIR. The alternative here would be to define a custom new model to represent a VS, or to re-implement the ValueSet class.
    • The ValueSets need to be loaded once per mapping file, so I added a new function to be called in the main flexporter entrypoints (App and RunFlexporter). Trying to load them multiple times wouldn't break anything but I don't want to do that (YAML) -> (JSON) -> (FHIR classes) sequence multiple times unnecessarily.
  3. Added some extra error handling for the value set $expand operation, to assist in debugging when it returns an OperationOutcome

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 43.47826% with 13 lines in your changes missing coverage. Please review.

Project coverage is 77%. Comparing base (df8ed77) to head (e83ae2f).
Report is 173 commits behind head on master.

Files with missing lines Patch % Lines
...org/mitre/synthea/helpers/RandomCodeGenerator.java 15% 10 Missing and 1 partial ⚠️
...a/org/mitre/synthea/export/flexporter/Actions.java 80% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             master   #1527     +/-   ##
==========================================
  Coverage        77%     77%             
- Complexity     3710    4005    +295     
==========================================
  Files           170     178      +8     
  Lines         24077   25169   +1092     
  Branches       3351    3591    +240     
==========================================
+ Hits          18618   19485    +867     
- Misses         4418    4557    +139     
- Partials       1041    1127     +86     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@elsaperelli elsaperelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Great new feature

@dehall
Copy link
Contributor Author

dehall commented Nov 12, 2024

Update: I'm converting this to draft and will add the ability to define custom value sets within a flexporter mapping. It's a little roundabout but it will allow for choosing from just a small set of codes rather than forcing the user to use a terminology service and real VS

@dehall dehall marked this pull request as draft November 12, 2024 15:32
@dehall dehall marked this pull request as ready for review November 12, 2024 19:16
Copy link

@elsaperelli elsaperelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This custom value set functionality is awesome! Tested out with our qpp qicore mapping file to split the MedicationDispense status ValueSet and it worked very easily!

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

Successfully merging this pull request may close these issues.

2 participants