From 07dccab678e7ab68e865c1c03fda8daf59e05046 Mon Sep 17 00:00:00 2001 From: kghoreshi Date: Wed, 26 Oct 2022 13:19:44 -0400 Subject: [PATCH 1/2] add case for MedicationStatement references --- src/App.jsx | 2 +- .../QuestionnaireForm/QuestionnaireForm.jsx | 6 ++--- .../buildPopulatedResourceBundle.js | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index fb92f96e..bf1aed98 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -273,7 +273,7 @@ export default class App extends Component { }); } }); - console.log(fullBundle); + console.log(allLibrariesResults); this.setState({ bundle: fullBundle, cqlPrepopulationResults: allLibrariesResults, diff --git a/src/components/QuestionnaireForm/QuestionnaireForm.jsx b/src/components/QuestionnaireForm/QuestionnaireForm.jsx index f08db2b6..f992e25c 100644 --- a/src/components/QuestionnaireForm/QuestionnaireForm.jsx +++ b/src/components/QuestionnaireForm/QuestionnaireForm.jsx @@ -668,9 +668,9 @@ export default class QuestionnaireForm extends Component { system = "RxNorm" } - if (system.length > 0) { - displayText = displayText + ' - ' + system + ' - ' + v.code - } + // if (system.length > 0) { + // displayText = displayText + ' - ' + system + ' - ' + v.code + // } } return { diff --git a/src/elmExecutor/buildPopulatedResourceBundle.js b/src/elmExecutor/buildPopulatedResourceBundle.js index eccc28db..f0a049ea 100644 --- a/src/elmExecutor/buildPopulatedResourceBundle.js +++ b/src/elmExecutor/buildPopulatedResourceBundle.js @@ -80,6 +80,23 @@ function doSearch(smart, type, fhirVersion, request, callback) { // unknown version break; } + break; + case "MedicationStatement": + smart.patient.request(type, {resolveReferences: 'medicationReference', flat: true, graph: false}).then((result) =>{ + console.log("med statement result"); + console.log(result); + let finalResult = [] + // TODO: This system should be untangled, reference resolution and resource gathering shouldn't be done separately + if(result && result.data){ + if(result.references) { + Object.keys(result.references).forEach((e)=>{ + finalResult.push(result.references[e]) + }) + } + callback(finalResult); + } + }) + break; } // If this is for Epic, there are some specific modifications needed for the queries to work properly @@ -126,10 +143,15 @@ function doSearch(smart, type, fhirVersion, request, callback) { Object.keys(q).forEach((parameter)=>{ query.set(parameter, q[parameter]); }); + if( usePatient ) { + console.log("we're going in again patient") + console.log(type) smart.patient.request(`${type}?${query}`) .then(processSuccess(smart, [], callback), processError(smart, callback)); } else if(q._id){ + console.log("we're going in again") + console.log(type) smart.request(`${type}?${query}`) .then(processSuccess(smart, [], callback), processError(smart, callback)); } From 3ca880262a98c628d628587f557f752e95d6d546 Mon Sep 17 00:00:00 2001 From: kghoreshi Date: Wed, 26 Oct 2022 14:01:59 -0400 Subject: [PATCH 2/2] remove console logs --- src/elmExecutor/buildPopulatedResourceBundle.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/elmExecutor/buildPopulatedResourceBundle.js b/src/elmExecutor/buildPopulatedResourceBundle.js index f0a049ea..ef7b2442 100644 --- a/src/elmExecutor/buildPopulatedResourceBundle.js +++ b/src/elmExecutor/buildPopulatedResourceBundle.js @@ -83,8 +83,6 @@ function doSearch(smart, type, fhirVersion, request, callback) { break; case "MedicationStatement": smart.patient.request(type, {resolveReferences: 'medicationReference', flat: true, graph: false}).then((result) =>{ - console.log("med statement result"); - console.log(result); let finalResult = [] // TODO: This system should be untangled, reference resolution and resource gathering shouldn't be done separately if(result && result.data){ @@ -145,13 +143,9 @@ function doSearch(smart, type, fhirVersion, request, callback) { }); if( usePatient ) { - console.log("we're going in again patient") - console.log(type) smart.patient.request(`${type}?${query}`) .then(processSuccess(smart, [], callback), processError(smart, callback)); } else if(q._id){ - console.log("we're going in again") - console.log(type) smart.request(`${type}?${query}`) .then(processSuccess(smart, [], callback), processError(smart, callback)); }