diff --git a/src/components/Summary.js b/src/components/Summary.js index 5e3c4784d..d04200525 100644 --- a/src/components/Summary.js +++ b/src/components/Summary.js @@ -13,6 +13,7 @@ import { getErrorMessageString, isEmptyArray, isReportEnabled, + isNumber } from "../helpers/utility"; import ChartIcon from "../icons/ChartIcon"; @@ -353,7 +354,7 @@ export default class Summary extends Component { ...formatterArguments ); } - return value + return value || isNumber(value) ? value : headerKey.default ? headerKey.default diff --git a/src/config/report_config.js b/src/config/report_config.js index 251f2ef8f..4409a1c89 100644 --- a/src/config/report_config.js +++ b/src/config/report_config.js @@ -60,6 +60,7 @@ const reportConfig = [ { id: "CIRG-PainTracker-GE", key: GE_DATA_KEY, + useDefaultELMLib: true }, ], //status: "inactive", @@ -380,6 +381,7 @@ const reportConfig = [ { id: "CIRG-PainTracker-TRT", key: TRT_DATA_KEY, + useDefaultELMLib: true }, ], icon: (props) => ( diff --git a/src/styles/components/_Summary.scss b/src/styles/components/_Summary.scss index 23d076d16..9f2be193c 100644 --- a/src/styles/components/_Summary.scss +++ b/src/styles/components/_Summary.scss @@ -403,9 +403,10 @@ height: 100%; width: 100%; display: flex; - align-items: center; + align-items: flex-start; justify-content: center; font-size: 1.1em; + line-height: 1.35; } } @media (min-width: 992px) { diff --git a/src/utils/executeELM.js b/src/utils/executeELM.js index 6bfc052c8..1aacb6a1f 100644 --- a/src/utils/executeELM.js +++ b/src/utils/executeELM.js @@ -152,33 +152,35 @@ async function executeELM(collector, oResourceTypes) { if (!evalResults[PATIENT_SUMMARY_KEY]) { evalResults[PATIENT_SUMMARY_KEY] = {}; } - Promise.allSettled([ - executeELMForReport(patientBundle), - ...elmLibs, - ]).then( - (results) => { - evalResults[PATIENT_SUMMARY_KEY]["ReportSummary"] = - results[0].status !== "rejected" ? results[0].value : null; - const evaluatedSurveyResults = executeELMForInstruments( - results.slice(1), - patientBundle - ); - evalResults[PATIENT_SUMMARY_KEY]["SurveySummary"] = - evaluatedSurveyResults; - //debug - console.log( - "final evaluated CQL results including surveys ", - evalResults - ); - resolve(evalResults); - }, - (e) => { - console.log(e); - reject( - "Error occurred executing report library logics. See console for detail" - ); - } - ); + Promise.allSettled([executeELMForReport(patientBundle), ...elmLibs]) + .then( + (results) => { + evalResults[PATIENT_SUMMARY_KEY]["ReportSummary"] = + results[0].status !== "rejected" ? results[0].value : null; + const evaluatedSurveyResults = executeELMForInstruments( + results.slice(1), + patientBundle + ); + evalResults[PATIENT_SUMMARY_KEY]["SurveySummary"] = + evaluatedSurveyResults; + //debug + console.log( + "final evaluated CQL results including surveys ", + evalResults + ); + resolve(evalResults); + }, + (e) => { + console.log(e); + reject( + "Error occurred executing report library logics. See console for detail" + ); + } + ) + .catch((e) => { + console.log("Error processing instrument ELM: ", e); + reject("error processing instrument ELM. See console for details."); + }); }); }); resolve(finalResults); @@ -193,12 +195,15 @@ async function executeELMForReport(bundle) { console.log("Issue occurred loading ELM lib for reoirt", e); r4ReportCommonELM = null; }); - + if (!r4ReportCommonELM) return null; - let reportLib = new cql.Library(r4ReportCommonELM, new cql.Repository({ - FHIRHelpers: r4HelpersELM, - })); + let reportLib = new cql.Library( + r4ReportCommonELM, + new cql.Repository({ + FHIRHelpers: r4HelpersELM, + }) + ); const reportExecutor = new cql.Executor( reportLib, new cql.CodeService(valueSetDB) @@ -274,8 +279,11 @@ function getLibraryForInstruments() { return INSTRUMENT_LIST.map((item) => (async () => { let elmJson = null; + const libPrefix = item.useDefaultELMLib + ? "Default" + : item.key.toUpperCase(); elmJson = await import( - `../cql/r4/survey_resources/${item.key.toUpperCase()}_LogicLibrary.json` + `../cql/r4/survey_resources/${libPrefix}_LogicLibrary.json` ) .then((module) => module.default) .catch((e) => { @@ -287,6 +295,7 @@ function getLibraryForInstruments() { ); elmJson = null; }); + if (!elmJson) { elmJson = await import( `../cql/r4/survey_resources/Default_LogicLibrary.json`