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

Bug: Handle Empty RxNorm fields #1199

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/submission/submission-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,18 @@ export namespace operations {
);
errorsAccumulator = errorsAccumulator.concat(programIdError);

// special case for therapies where we need to populate the rxnorm Ids, only do this step
// if the record is valid so far to avoid spending alot of time here
if (errorsAccumulator.length == 0 && isRxNormTherapy(command.clinicalType)) {
// Records using alternate Drug DB fields should skip RxNorm validation
// Drug DB field validation is handled downstream in validation-clinical/therapy.ts
const { drug_database, drug_term, drug_id } = processedRecord;
const hasDrugDbFields = Boolean(drug_database || drug_id || drug_term);
Copy link
Member

Choose a reason for hiding this comment

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

This allows me to skip rxNormDB validation if I provide any one of these three properties.

Do you have a check elsewhere that ensures if I have one of these fields that i have all of these and none of the rxnorm fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is handled by a mix of Dictionary and Clinical validations

Dictionary enforces that either RxNorm or Drug Db are submitted:
https://github.com/icgc-argo/argo-dictionary/pull/437/files#diff-893b20bc0b00b45e9cb1df1d1a13b5cba5dcf4627f2f182f345762618077ac54

Clinical enforces that all 3 Drug Db fields are submitted when RxNorm is blank:
https://github.com/icgc-argo/argo-clinical/pull/1195/files#diff-57392d148ba45d8530fa1789680e51f9398e3b20e910bccf1fa0e95b78445a08R297


// Special case for therapies where we need to populate the rxnorm Ids
// Only do this step if the record is valid so far to avoid spending alot of time here
if (
errorsAccumulator.length == 0 &&
isRxNormTherapy(command.clinicalType) &&
!hasDrugDbFields
) {
const result = await validateRxNormFields(processedRecord, index, schemaName);
if (result.error != undefined) {
errorsAccumulator = errorsAccumulator.concat([result.error]);
Expand Down