Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
CynthiaKamau committed Nov 7, 2024
1 parent bef29e9 commit e77e0b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/processors/encounter/encounter-processor-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ export async function hydrateRepeatField(
}

const unMappedDiagnoses = encounter.diagnoses.filter((diagnosis) => {
return !assignedDiagnosesIds.includes(diagnosis?.diagnosis?.coded.uuid);
return (
!assignedDiagnosesIds.includes(diagnosis?.diagnosis?.coded.uuid) &&
diagnosis.formFieldPath.startsWith(`rfe-forms-${field.id}_`)
);
});

const sortedDiagnoses = unMappedDiagnoses
Expand Down Expand Up @@ -381,5 +384,6 @@ function transformNestedObsGroups(field: FormField, value: any): any {
function prepareDiagnosis(fields: FormField[]) {
return fields
.filter((field) => field.type === 'diagnosis' && hasSubmission(field))
.map((field) => field.meta.submission.newValue);
.flatMap((field) => [field.meta.submission.newValue, field.meta.submission.voidedValue])
.filter((d) => d);
}
6 changes: 1 addition & 5 deletions src/transformers/default-schema-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,7 @@ function handleDiagnosis(question: FormField) {
question.questionOptions.datasource = {
name: 'problem_datasource',
config: {
class: [
'8d4918b0-c2cc-11de-8d13-0010c6dffd0f',
'8d492954-c2cc-11de-8d13-0010c6dffd0f',
'8d492b2a-c2cc-11de-8d13-0010c6dffd0f',
],
class: '8d4918b0-c2cc-11de-8d13-0010c6dffd0f',
},
};
delete question.questionOptions['dataSource'];
Expand Down

0 comments on commit e77e0b3

Please sign in to comment.