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

💊 Feat/1194 Drug Info Validation #1195

Merged
merged 18 commits into from
Sep 27, 2024

Conversation

demariadaniel
Copy link
Contributor

@demariadaniel demariadaniel commented Sep 19, 2024

Link to Issue

#1194

Description

  • Relevant (chemo, immuno, hormone) Therapy record drug fields are validated when there is no RxNorm data
  • RxNorm validations are unchanged -- handled on submission
  • Adds unit tests, 3 failure cases (1 per treatment type) and 1 success case
  • Some reorg -- import updates, variable name updates for consistency

Test files are included in ticket

Checklist

Type of Change

  • Bug
  • Refactor
  • New Feature
  • Release Candidate

Checklist before requesting review:

  • Check branch (code change PRs go to develop not master)
  • Check copyrights for new files
  • Manual testing
  • Regression tests completed and passing (double check number of tests).
  • Spelling has been checked.
  • Updated swagger docs accordingly (check it's still valid)
  • Set validationDependency in meta tag for Argo Dictionary fields used in code

import { entities as dictionaryEntities } from '@overturebio-stack/lectern-client';
import { DeepReadonly } from 'deep-freeze';
Copy link
Contributor Author

@demariadaniel demariadaniel Sep 19, 2024

Choose a reason for hiding this comment

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

Several alphabetized imports auto-updated

| RadiationFieldsEnum
| SurgeryFieldsEnum
| CommonTherapyFields
| CommonTherapyFieldsEnum
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Standardize variable names

@demariadaniel demariadaniel changed the title WIP: Feat/1194 Drug Info Validation 💊 Feat/1194 Drug Info Validation Sep 26, 2024
@@ -19,26 +19,28 @@

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main validation logic here

Comment on lines 312 to 321
for (const [drugKey, drugValue] of Object.entries(drugFields)) {
if (!drugValue) {
const data = { [drugKey]: drugValue };
missingFields.push(data);
}
}

missingFields.forEach((field) => {
const [drugKey] = Object.entries(field)[0];
const fieldName = drugKey as ClinicalFields;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not 100% clear why missingField is getting an object if the drugValue is falsy
Later on the missingFields iterator, drugValue isn't used.
drugValue could still be a string "" or number 0 and be falsey

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@demariadaniel demariadaniel Sep 27, 2024

Choose a reason for hiding this comment

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

I think both comments can be addressed by condensing the logic: Condense validation
(passes unit tests)

This is just a block that was not optimized and cleaned up. Extra verbose logic from working out the solution.

Thanks!

}

missingFields.forEach((field) => {
const [drugKey] = Object.entries(field)[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just name this fieldName instead of new var assignment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above

@demariadaniel demariadaniel merged commit 27d2c9a into develop Sep 27, 2024
@demariadaniel demariadaniel deleted the feat/1154-drug-name-validation branch September 27, 2024 18:54
@demariadaniel demariadaniel mentioned this pull request Sep 27, 2024
11 tasks
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