New script to update code displays #1407
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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
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.