Skip to content

Commit 603ea14

Browse files
achen2401Amy Chen
and
Amy Chen
authored
update guideline text function, styling fix (#53)
Co-authored-by: Amy Chen <[email protected]>
1 parent 2dacfd2 commit 603ea14

File tree

3 files changed

+56
-34
lines changed

3 files changed

+56
-34
lines changed

src/components/Landing.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class Landing extends Component {
3939
/*
4040
* passed down via fhir.js
4141
*/
42-
let patientBundle = (this.state.collector).filter(item => item.data && item.data.resourceType.toLowerCase() === "patient");
42+
let patientBundle = (this.state.collector).filter(item => item.data && item.data.resourceType && item.data.resourceType.toLowerCase() === "patient");
4343
if (patientBundle.length) {
4444
this.setState({
4545
patientId: patientBundle[0].data.id
@@ -61,7 +61,7 @@ export default class Landing extends Component {
6161
response => {
6262
//set result from data from EPIC
6363
let EPICData = response[0];
64-
result['Summary'] = {...EPICData['Summary']};
64+
result['Summary'] = EPICData ? {...EPICData['Summary']} : {};
6565
const { sectionFlags, flaggedCount } = this.processSummary(result.Summary);
6666
this.setState({ result, sectionFlags, flaggedCount });
6767
this.setPatientId();

src/components/Summary.js

+23-14
Original file line numberDiff line numberDiff line change
@@ -143,25 +143,34 @@ export default class Summary extends Component {
143143
return flagged;
144144
}
145145

146-
renderNoEntries(section, subSection) {
146+
renderGuideLine(subSection) {
147+
if (!subSection) return "";
147148
let guidelineElement = subSection["guideline"] ? subSection["guideline"]: null;
149+
if (!guidelineElement) return "";
148150
let guidelineContent = "";
149-
if (guidelineElement) {
150-
guidelineContent = guidelineElement.map( (item, index) => {
151-
return <div key={`guideline_${index}`} className={`flag-no-entry ${item.type}`}>
152-
{/* <FontAwesomeIcon
153-
className="flag"
154-
icon="exclamation-circle"
155-
tabIndex={0}
156-
/> <span className="text">{item.text}</span> */}
157-
<span className="text"><b className="title">{item.title}</b>: {item.text}</span>
158-
</div>
159-
});
160-
}
151+
guidelineContent = (<div className="guideline-wrapper">
152+
{
153+
guidelineElement.map( (item, index) => {
154+
return <div key={`guideline_${index}`} className={`${item.type}`}>
155+
{/* <FontAwesomeIcon
156+
className="flag"
157+
icon="exclamation-circle"
158+
tabIndex={0}
159+
/> <span className="text">{item.text}</span> */}
160+
<span className="text"><b className="title">{item.title}</b>: {item.text}</span>
161+
</div>
162+
})
163+
}
164+
</div>);
165+
return guidelineContent;
166+
}
167+
168+
renderNoEntries(section, subSection) {
161169
const { sectionFlags } = this.props;
162170
let subSectionFlags = sectionFlags[section]? sectionFlags[section][subSection.dataKey] : null;
163171
let flagEntries = [];
164172
let flagContent = "";
173+
let guidelineContent = this.renderGuideLine(subSection);
165174
if (subSectionFlags) {
166175
flagEntries = subSectionFlags.map((flag) => {
167176
return flag.flagText;
@@ -421,7 +430,6 @@ export default class Summary extends Component {
421430
>more info</span>
422431
</div>
423432
}</span>
424-
425433
</h3>
426434

427435
{panels && this.renderPanel(section, panels)}
@@ -430,6 +438,7 @@ export default class Summary extends Component {
430438
{hasEntries && subSection.tables.map((table, index) =>
431439
this.renderTable(table, entries, section, subSection, index))
432440
}
441+
{hasEntries && this.isSubsectionFlagged(section, subSection.dataKey) && this.renderGuideLine(subSection)}
433442
</div>
434443
);
435444
});

src/styles/components/_Summary.scss

+31-18
Original file line numberDiff line numberDiff line change
@@ -461,17 +461,18 @@
461461
color: $color-gold;
462462
font-size: 0.95em;
463463
}
464+
.guideline-wrapper {
465+
margin-left: 0;
466+
padding-bottom: 0;
467+
}
464468
.flag-guideline-content {
465469
.flag {
466470
color: $color-red;
467471
}
468472
margin-top: 12px;
469473
.guideline-content {
470-
margin-top: 16px;
474+
margin-top: 12px;
471475
font-style: normal;
472-
.title {
473-
font-weight: 600;
474-
}
475476
// .CDC .text {
476477
// color: $color-orange;
477478
// }
@@ -480,20 +481,6 @@
480481
// }
481482
}
482483
}
483-
.flag-no-entry {
484-
margin-right: 12px;
485-
font-size: 1em;
486-
&.CDC {
487-
.flag {
488-
color: $color-orange-light;
489-
}
490-
}
491-
&.WA {
492-
.flag {
493-
color: $color-red-darker;
494-
}
495-
}
496-
}
497484
}
498485

499486
&.sub-section-notitle {
@@ -579,6 +566,32 @@
579566
}
580567
}
581568

569+
.flag-no-entry {
570+
margin-right: 12px;
571+
font-size: 1em;
572+
// &.CDC {
573+
// .flag {
574+
// color: $color-orange-light;
575+
// }
576+
// }
577+
// &.WA {
578+
// .flag {
579+
// color: $color-red-darker;
580+
// }
581+
// }
582+
}
583+
.sub-section {
584+
.guideline-wrapper {
585+
margin-left: 40px;
586+
padding-bottom: 20px;
587+
font-size: 0.95em;
588+
line-height: 1.5;
589+
.title {
590+
font-weight: 600;
591+
}
592+
}
593+
}
594+
582595
.cdc-disclaimer {
583596
margin: 10px 40px 0 40px;
584597
&.data-source {

0 commit comments

Comments
 (0)