Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Chen authored and Amy Chen committed Mar 6, 2024
1 parent 510c2ad commit ab2f22a
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 15 deletions.
15 changes: 9 additions & 6 deletions src/components/Landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,19 @@ export default class Landing extends Component {
return item.error;
});
collectorErrors.forEach((item) => {
this.setError(`[${item.type}] ${item.error}`);
const sourceType = item.type??item.url;
const sourceTypeText = sourceType ? `[${sourceType}]` : "";
this.setError(`${sourceTypeText} ${item.error}`);
});
}
//compile error(s) related to MME calculations
processSummaryErrors(summary) {
if (!summary) return false;
let errors = [];
//PDMP medications
let pdmpMeds = summary["PDMPMedications"];
if (pdmpMeds && pdmpMeds["PDMPMedications"]) {
let o = pdmpMeds["PDMPMedications"];
let errors = [];
let errorItems = [];
o.forEach((item) => {
//do not report medication that has been reported
Expand Down Expand Up @@ -1002,7 +1004,7 @@ export default class Landing extends Component {
}

getAnalyticsData(endpoint, apikey, summary) {
const meetsInclusionCriteria = summary.Patient.MeetsInclusionCriteria;
const meetsInclusionCriteria = summary.Patient ? summary.Patient.MeetsInclusionCriteria : false;
const applicationAnalytics = {
meetsInclusionCriteria,
};
Expand Down Expand Up @@ -1182,12 +1184,13 @@ export default class Landing extends Component {
}

renderHeader(summary, patientResource, PATIENT_SEARCH_URL) {
const summaryPatient = summary.Patient ?? {};
return (
<Header
patientName={summary.Patient.Name}
patientName={summaryPatient.Name}
patientDOB={datishFormat(this.state.result, patientResource.birthDate)}
patientGender={summary.Patient.Gender}
meetsInclusionCriteria={summary.Patient.MeetsInclusionCriteria}
patientGender={summaryPatient.Gender}
meetsInclusionCriteria={summaryPatient.MeetsInclusionCriteria}
patientSearchURL={PATIENT_SEARCH_URL}
siteID={getEnv("REACT_APP_SITE_ID")}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ export default class Summary extends Component {

render() {
const { summary, collector } = this.props;
const meetsInclusionCriteria = summary.Patient.MeetsInclusionCriteria;
const meetsInclusionCriteria = summary.Patient ? !!summary.Patient.MeetsInclusionCriteria : false;
const {
EducationMaterials,
PatientRiskOverview_graph,
Expand Down
3 changes: 1 addition & 2 deletions src/components/graph/SurveyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,7 @@ export default class SurveyGraph extends Component {
/>
<div className="scale">
{arrNum.map((item, index) => {
const nextItem = arrNum[index + 1];
const rotateLabelFlag = nextItem && nextItem - item < 0.5;
const rotateLabelFlag = inYears && item < 1;
return (
<span
key={`scale_${index}`}
Expand Down
10 changes: 10 additions & 0 deletions src/styles/components/_Summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
color: $color-white;
padding: 56px 0 32px 0px;
width: $summary-nav-width;
&:empty {
width: 0;
overflow: hidden;
}
z-index: 1;
transition: opacity 450ms ease 100ms;

Expand Down Expand Up @@ -140,6 +144,12 @@
min-height: calc(100vh - 100px);
width: 48px;
min-width: 48px;
&:has(.summary__nav:empty) {
width: 0;
overflow: hidden;
background-color: transparent;
min-width: 0;
}
background-color: $color-gray-dark;
transition: all 350ms ease-in-out;
position: relative;
Expand Down
4 changes: 2 additions & 2 deletions src/styles/elements/_slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ input[type="range"] {
font-weight: 900;
}
&.rotate {
top: 8px;
top: 4px;
&:first-of-type {
top: 24px;
top: 16px;
}
transform: rotate(-90deg);
&:not(:first-of-type) {
Expand Down
24 changes: 20 additions & 4 deletions src/utils/executeELM.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,29 @@ async function executeELM(collector, oResourceTypes) {
//debugging
console.log("bundle loaded? ", bundle);
patientSource.loadBundles([bundle]);
const results = executor.exec(patientSource);
let results;
try {
results = executor.exec(patientSource);
} catch (e) {
console.log("Error occurred executing CQL ", e);
if (collector) {
collector.forEach((item) => {
if (
item.data &&
String(item.data.resourceType).toLowerCase() === "bundle"
)
item.error = "Unable to process data. Please see console for detail.";
});
}
results = null;
}
//debugging
console.log("CQL execution results ", results);

let evalResults = results.patientResults
? results.patientResults[Object.keys(results.patientResults)[0]]
: {};
let evalResults =
results && results.patientResults
? results.patientResults[Object.keys(results.patientResults)[0]]
: {};

if (!INSTRUMENT_LIST) return evalResults;

Expand Down

0 comments on commit ab2f22a

Please sign in to comment.