Add an API endpoint to check codelists from study repos #1703
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.
Fixes #1702
See also https://github.com/orgs/opensafely-core/projects/13/views/1?pane=issue&itemId=42536167
This endpoint may be called from opensafely-cli or from job-server. It takes as POST parameters the content of a study repo's codelists.txt file (specifying the codelists that are to be used in the study), and a manifest (codelists.json) file, which is generated when
opensafely codelists update
is run. It checks that the hashed codelist data in the manifest file matches the content of the current codelist versions, if they were to be downloaded again.This is specifically intended to deal with dm+d codelists, which may change after they're downloaded into a study repo due to mapped VMPs.
Note opensafely-cli already has a codelists check command, which checks that the manifest file is consistent with the codelists in the study repo. However, dm+d codelists can change due to new VMP mappings, which get mapped into CSV downloads. Therefore a dm+d codelist that was downloaded into a study repo may need to be updated again, even if no changes have been made to the codelists.csv.