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

New script to update code displays #1407

Merged
merged 3 commits into from
Feb 15, 2024
Merged

Conversation

dehall
Copy link
Contributor

@dehall dehall commented Dec 21, 2023

This PR introduces a new script to automatically update code displays when they do not match the preferred value for the code system. Originally I intended this process to be part of the Concepts java class, but writing changes back to the JSON file would have involved too much refactoring so instead I created a new JavaScript ... script.

To try to minimize the number of display changes, and standardize code displays across modules, this script takes a 2-pass approach:

  1. Iterate over all the modules and keep an inventory of the codes/displays
  2. Fetch the preferred display for each code. Keep a dictionary of code -> display
    i. If a module already uses the preferred display somewhere, store that
    ii. If the current display is allowed but not necessarily the preferred, store that (to reduce changes)
    iii. Otherwise, store the preferred display
  3. Iterate over all the modules again and update any displays that don't match the value in the dictionary
    There's also special handling for SNOMED codes to try to avoid flip-flopping between "Code" and "Code (tag)"

The modules are updated in-place and I recommend using git add -p src/main/resources to iterate over them and review each change separately before committing.

The script will also print errors when a code is not valid for the given system. We use some US-specific SNOMED codes which this will complain about but it will also reveal typos which I'm fixing as well.

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (336e3d8) 77% compared to head (bd60c04) 76%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #1407    +/-   ##
=========================================
- Coverage        77%     76%    -1%     
- Complexity     3861    3900    +39     
=========================================
  Files           178     178            
  Lines         25002   25225   +223     
  Branches       3536    3618    +82     
=========================================
+ Hits          19261   19419   +158     
- Misses         4615    4681    +66     
+ Partials       1126    1125     -1     

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

@dehall dehall changed the title WIP: New script to update code displays New script to update code displays Dec 28, 2023
@dehall dehall marked this pull request as ready for review December 28, 2023 19:32
@jawalonoski jawalonoski merged commit 6fa1b4b into master Feb 15, 2024
@jawalonoski jawalonoski deleted the update_codedisplay_script_js branch February 15, 2024 20:27
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