Skip to content

Commit

Permalink
fix(ApeReportViewer.vue): update property names to access test inform…
Browse files Browse the repository at this point in the history
…ation correctly

fix(EncounterPage.vue): log diagnosticOrders result for debugging purposes
fix(PrintReport.vue): update property names to access test information correctly
fix(pme.js): remove commented out code and fix object spread syntax
The changes in ApeReportViewer.vue, PrintReport.vue, and pme.js involve updating property names to access test information correctly. This ensures that the correct properties are being accessed and compared when filtering laboratory tests based on keywords. The changes in EncounterPage.vue involve logging the diagnosticOrders result for debugging purposes.
  • Loading branch information
jofftiquez committed Oct 25, 2023
1 parent 2b29626 commit 965b7ef
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 39 deletions.
41 changes: 22 additions & 19 deletions src/components/pme/ApeReportViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,23 @@ export default {
}
// Laboratory Block
console.warn('encounterDiagnosticOrders', encounterDiagnosticOrders.value);
const laboratoryOrders = encounterDiagnosticOrders.value?.filter(order => {
return order.type === 'laboratory';
}) || [];
const allLaboratoryTests = laboratoryOrders.reduce((acc, order) => {
return [...acc, ...order.diagnosticOrderTests];
}, []);
console.warn('allLaboratoryTests', allLaboratoryTests);
if (allLaboratoryTests.length) {
const diagnosticHepatitisBGroupRegex = new RegExp(UI_COMPONENT_GROUP_DIAGNOSTIC_HEPATITIS_B_ID, 'gi');
const hepatitisBKeywords = ['hepatitis b', 'hepatitis-b', 'hepatitisb'];
const hepatitisBTests = allLaboratoryTests.filter(test => {
const hepatitisBTests = allLaboratoryTests.filter((test) => {
return hepatitisBKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticHepatitisBGroupRegex.test(report) && hepatitisBTests.length) {
Expand All @@ -202,11 +204,12 @@ export default {
const hematologyKeywords = ['hematology', 'cbc', 'complete blood count'];
const hematologyTests = allLaboratoryTests.filter(test => {
return hematologyKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
console.warn('hematologyTests', hematologyTests);
if (diagnosticHematologyGroupRegex.test(report) && hematologyTests.length) {
report = replaceDiagnosticGroupUIValue({
id: UI_COMPONENT_GROUP_DIAGNOSTIC_HEMATOLOGY_ID,
Expand All @@ -219,9 +222,9 @@ export default {
const urinalysisKeywords = ['urinalysis', 'urine'];
const urinalysisTests = allLaboratoryTests.filter(test => {
return urinalysisKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticUrinalysisGroupRegex.test(report) && urinalysisTests.length) {
Expand All @@ -236,9 +239,9 @@ export default {
const fecalysisKeywords = ['fecalysis', 'stool'];
const fecalysisTests = allLaboratoryTests.filter(test => {
return fecalysisKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticFecalysisGroupRegex.test(report) && fecalysisTests.length) {
Expand All @@ -253,9 +256,9 @@ export default {
const pregnancyKeywords = ['pregnancy', 'pregnancy test'];
const pregnancyTests = allLaboratoryTests.filter(test => {
return pregnancyKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticPregnancyGroupRegex.test(report) && pregnancyTests.length) {
Expand All @@ -270,9 +273,9 @@ export default {
const hepatitisAKeywords = ['hepatitis a', 'hepatitis-a', 'hepatitisa'];
const hepatitisATests = allLaboratoryTests.filter(test => {
return hepatitisAKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticHepatitisAGroupRegex.test(report) && hepatitisATests.length) {
Expand Down
1 change: 1 addition & 0 deletions src/pages/pme/EncounterPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ export default {
try {
loading.value = true;
const result = await getPmeEncounter({ id: encounterId });
console.warn('result.diagnosticOrders', result.diagnosticOrders);
encounter.value = result.encounter;
encounterApeReport.value = result.apeReport;
encounterFacility.value = result.facility;
Expand Down
36 changes: 18 additions & 18 deletions src/pages/pme/PrintReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ export default {
const hepatitisBKeywords = ['hepatitis b', 'hepatitis-b', 'hepatitisb'];
const hepatitisBTests = allLaboratoryTests.filter(test => {
return hepatitisBKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticHepatitisBGroupRegex.test(report) && hepatitisBTests.length) {
Expand All @@ -112,9 +112,9 @@ export default {
const hematologyKeywords = ['hematology', 'cbc', 'complete blood count'];
const hematologyTests = allLaboratoryTests.filter(test => {
return hematologyKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticHematologyGroupRegex.test(report) && hematologyTests.length) {
Expand All @@ -129,9 +129,9 @@ export default {
const urinalysisKeywords = ['urinalysis', 'urine'];
const urinalysisTests = allLaboratoryTests.filter(test => {
return urinalysisKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticUrinalysisGroupRegex.test(report) && urinalysisTests.length) {
Expand All @@ -146,9 +146,9 @@ export default {
const fecalysisKeywords = ['fecalysis', 'stool'];
const fecalysisTests = allLaboratoryTests.filter(test => {
return fecalysisKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticFecalysisGroupRegex.test(report) && fecalysisTests.length) {
Expand All @@ -163,9 +163,9 @@ export default {
const pregnancyKeywords = ['pregnancy', 'pregnancy test'];
const pregnancyTests = allLaboratoryTests.filter(test => {
return pregnancyKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticPregnancyGroupRegex.test(report) && pregnancyTests.length) {
Expand All @@ -180,9 +180,9 @@ export default {
const hepatitisAKeywords = ['hepatitis a', 'hepatitis-a', 'hepatitisa'];
const hepatitisATests = allLaboratoryTests.filter(test => {
return hepatitisAKeywords.some(keyword => {
return test.testName?.toLowerCase().includes(keyword) ||
test.section?.toLowerCase().includes(keyword) ||
test.tags?.some(tag => tag.toLowerCase().includes(keyword));
return test.test?.name?.toLowerCase().includes(keyword) ||
test.test?.section?.toLowerCase().includes(keyword) ||
test.test?.tags?.some(tag => tag.toLowerCase().includes(keyword));
});
});
if (diagnosticHepatitisAGroupRegex.test(report) && hepatitisATests.length) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/pme.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ export const getPmeEncounter = async (opts) => {
*/
const diagnosticOrders = encounter.$populated?.diagnosticOrders?.map((order) => {
return {
// ...omit(order, ['$populated']),
...omit(order, ['$populated']),
...order?.$populated,
diagnosticOrderTests: order?.$populated.diagnosticOrderTests?.map((test) => {
const results = test.results?.map((result) => {
const measure = test.$populated?.measures?.find((measure) => measure.id === result.measure);
return {
// ...omit(result, ['$populated']),
...omit(result, ['$populated']),
...result?.$populated,
measure,
};
Expand Down

0 comments on commit 965b7ef

Please sign in to comment.