Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 60 additions & 62 deletions client/src/components/c4dic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export type CoverageInfo = {
startDate: string,
endDate: string,
payer: string,
payerId: string,
status: string,
medicaidEligibility: string,
referenceYear: string,
Expand Down Expand Up @@ -60,7 +59,6 @@ export default function InsuranceCard() {
return {
coverageClass: c.coverageClass,
payer: c.payer,
payerId: c.payerId,
contractId: c.contractId,
startDate: c.startDate,
endDate: c.endDate,
Expand Down Expand Up @@ -122,129 +120,129 @@ export default function InsuranceCard() {
var backgroundColor = insInfo?.coverages[0]?.colorPalette.background
var highlightColor = insInfo?.coverages[0]?.colorPalette.highlight
var textColor = insInfo?.coverages[0]?.colorPalette.foreground
const primaryStyle = {
backgroundColor: backgroundColor,
color: textColor
const root = document.documentElement;
if (backgroundColor != null) {
root.style.setProperty('--c4dic-backgroundColor', backgroundColor);
}
const highlightStyle = {
backgroundColor: highlightColor,
color: textColor
if (highlightColor != null) {
root.style.setProperty('--c4dic-highlightColor', highlightColor);
}
if (textColor != null) {
root.style.setProperty('--c4dic-textColor', textColor);
}
const medicaidEligibility = (insInfo?.coverages[0]?.medicaidEligibility != null) ?
(
<div>
<text className="field-label">Medicaid Eligibility</text>
<br/>
<div className="bb-c-c4dic-badge-container">
<div className="bb-c-c4dic-badge">{insInfo?.coverages[0]?.medicaidEligibility}</div>
</div>
</div>
) : null
return (
<div className="ins-c4dic-card" style={primaryStyle}>
<div className="ins-c4dic-card">
<div className="bb-c-c4dic-card-header">
<img src={insInfo?.coverages[0]?.logo} alt="C4DIC Logo" height="48px"/>
<h3>{insInfo?.coverages[0]?.payer}</h3>
</div>
<div className="pii-sec bb-c-c4dic-card-pii-area">
<div className="ins-fld-text patient-name">
<div>
<text className="field-label">NAME</text>
<text className="field-label">Name</text>
<br/>
<text className="field-value">{insInfo?.name||""}</text>
</div>
</div>
<div className="ins-fld-text patient-info">
<div>
<text className="field-label">MEDICARE NUMBER</text>
<text className="field-label">Medicare Number</text>
<br/>
<text className="field-value">{insInfo?.identifier||""}</text>
</div>
<div>
<text className="field-label">PAYER ID</text>
<br/>
<text className="field-value">{insInfo?.coverages[0]?.payerId||""}</text>
</div>
<div>
<text className="field-label">MEDICAID ELIGIBILITY</text>
<br/>
<text className="field-value">{insInfo?.coverages[0]?.medicaidEligibility||"TBD"}</text>
</div>
{medicaidEligibility}
</div>
</div>

<div className="coverage-sec bb-c-c4dic-card-coverages-area">
<hr/>
<h6>Benefits</h6>
{insInfo?.coverages.map(c => {
const startDateDiv = (c.startDate != null && c.startDate != "") ?
(
<div>
<text className="field-label">Start Date</text>
<br/>
<text className="field-value">{c.startDate}</text>
</div>
) : null
switch (c.coverageClass) {
case "Part A":
return (
<div className="bb-c-c4dic-coverage">
<div>
<text className="field-label">COVERAGE</text>
<br/>
<text className="field-value">{c.coverageClass}</text>
</div>
<div className="bb-c-c4dic-coverage-a">
<div>
<text className="field-label">START DATE</text>
<text className="field-label">Coverage</text>
<br/>
<text className="field-value">{c.startDate}??? ?, ????</text>
<text className="field-value">Hospital<br/>{c.coverageClass}</text>
</div>
{startDateDiv}
<div>
<text className="field-label">ENTITLEMENT REASON</text>
<text className="field-label">Entitlement Reason</text>
<br/>
<text className="field-value">{c.contractId}</text>
</div>
</div>
)
case "Part B":
return (
<div className="bb-c-c4dic-coverage" style={highlightStyle}>
<div className="bb-c-c4dic-coverage-b">
<div>
<text className="field-label">COVERAGE</text>
<text className="field-label">Coverage</text>
<br/>
<text className="field-value">{c.coverageClass}</text>
</div>
<div>
<text className="field-label">START DATE</text>
<br/>
<text className="field-value">{c.startDate}??? ?, ????</text>
<text className="field-value">Medical<br/>{c.coverageClass}</text>
</div>
{startDateDiv}
</div>
)
case "Part C":
const partCTypeDiv = (c.coverageClass != null) ?
(
<div>
<text className="field-label">Type</text>
<br/>
<text className="field-value">{c.coverageClass}</text>
</div>
) : null
return (
<div className="bb-c-c4dic-coverage">
<div className="bb-c-c4dic-coverage-c">
<div>
<text className="field-label">COVERAGE</text>
<text className="field-label">Coverage</text>
<br/>
<text className="field-value">{c.coverageClass}</text>
<br/>
<text className="field-label">TYPE</text>
<br/>
<text className="field-value">{c.coverageClass}</text>
<text className="field-value">Advantage<br/>{c.coverageClass}</text>
{partCTypeDiv}
</div>
<div>
<text className="field-label">PLAN #</text>
<text className="field-label">Plan #</text>
<br/>
<text className="field-value">{c.contractId}</text>
<br/>
<text className="field-label">ORGANIZATION</text>
<text className="field-label">Organization</text>
<br/>
<text className="field-value">{c.payer}</text>
</div>
</div>
)
case "Part D":
return (
<div className="bb-c-c4dic-coverage" style={highlightStyle}>
<div>
<text className="field-label">COVERAGE</text>
<br/>
<text className="field-value">{c.coverageClass}</text>
</div>
<div className="bb-c-c4dic-coverage-d">
<div>
<text className="field-label">START DATE</text>
<br/>
<text className="field-value">{c.startDate}??? ?, ????</text>
<text className="field-label">Coverage</text>
<br/>
<text className="field-label">PLAN #</text>
<br/>
<text className="field-value">{c.contractId}</text>
<text className="field-value">Rx<br/>{c.coverageClass}</text>
</div>
<div>
<text className="field-label">COST SHARE</text>
{startDateDiv}
<div>
<text className="field-label">Plan #</text>
<br/>
<text className="field-value">{c.contractId}</text>
</div>
Expand All @@ -257,7 +255,7 @@ export default function InsuranceCard() {
<hr/>
<h6>Contact</h6>

<text className="field-label">CUSTOMER SERVICE</text>
<text className="field-label">Customer Service</text>
<br/>
<div className="contact-list">
{insInfo?.coverages[0]?.contacts.map(contact => {
Expand Down
70 changes: 65 additions & 5 deletions client/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ $image-path: "~@cmsgov/design-system/dist/images";
position: relative;
transition: all .3s;
padding: 1rem;
background-color: var(--c4dic-backgroundColor);
color: var(--c4dic-textColor);
::selection {
background: var(--c4dic-highlightColor);
}
}

label {
Expand Down Expand Up @@ -156,14 +161,25 @@ input[type=number]::-webkit-input-placeholder {
.field-label {
font-size: 10px;
font-weight: lighter;
text-transform: uppercase;
}

.field-value {
font-size: 18px;
}

h6 {
margin: 0px;
font-size: 10px;
font-style: normal;
font-weight: 700;
line-height: normal;
margin: 0px
}

hr {
border: none;
background-color: var(--c4dic-textColor);
height: 4px;
}
}

Expand All @@ -175,6 +191,29 @@ input[type=number]::-webkit-input-placeholder {
text-wrap: pretty;
}

.bb-c-c4dic-badge-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 5px;
}

.bb-c-c4dic-badge {
display: flex;
width: fit-content;
padding: 4px 8px;
justify-content: center;
align-items: center;
gap: 10px;
border-radius: 9999px;
border: 0.5px solid;

font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 150%; /* 21px */
}

.bb-c-c4dic-card-pii-area {
background-color: transparent;
position: relative;
Expand All @@ -183,8 +222,8 @@ input[type=number]::-webkit-input-placeholder {
}

.patient-info {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
display: flex;
gap: 15px;
}
}

Expand All @@ -193,10 +232,31 @@ input[type=number]::-webkit-input-placeholder {
position: relative;
}

.bb-c-c4dic-coverage {
.bb-c-c4dic-coverage-a {
display: grid;
grid-template-columns: 1fr 1fr 2fr;
padding: 10px;
}

.bb-c-c4dic-coverage-b {
display: grid;
grid-template-columns: 1fr 1fr 2fr;
padding: 10px;
border-top: 0.5px solid
}

.bb-c-c4dic-coverage-c {
display: grid;
grid-template-columns: 1fr 3fr;
padding: 10px;
border-top: 0.5px solid
}

.bb-c-c4dic-coverage-d {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-columns: 1fr 1fr 2fr;
padding: 10px;
border-top: 0.5px solid
}

.bb-c-c4dic-card-org-contact {
Expand Down
19 changes: 13 additions & 6 deletions server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from jsonpath_ng import jsonpath
from jsonpath_ng.ext import parse as ext_parse
from cms_bluebutton.cms_bluebutton import BlueButton
from datetime import datetime

C4DIC_COLOR_PALETTE_EXT = "http://hl7.org/fhir/us/insurance-card/StructureDefinition/C4DIC-ColorPalette-extension"
C4DIC_COLOR_BG = "http://hl7.org/fhir/us/insurance-card/StructureDefinition/C4DIC-BackgroundColor-extension"
Expand Down Expand Up @@ -208,9 +209,10 @@ def get_patient_insurance():
## 7. other info such as: DIB, ESRD etc. can be added as needed
pt = dic_patient['entry']
patient = pt[0]
# TODO: format the mbi with dashes
pt_id = lookup_1_and_get("$.resource.identifier[?(@.system=='http://hl7.org/fhir/sid/us-mbi')]", "value", patient)
insurance['identifier'] = pt_id
mbi = lookup_1_and_get("$.resource.identifier[?(@.system=='http://hl7.org/fhir/sid/us-mbi')]", "value", patient)
if len(mbi) == 11:
mbi = mbi[0:4] + '-' + mbi[4:7] + '-' + mbi[7:]
insurance['identifier'] = mbi
# TODO: handle wider variety of given/family names
pt_name = patient['resource']['name'][0]['given'][0] + " " + patient['resource']['name'][0]['family']
insurance['name'] = pt_name
Expand All @@ -223,15 +225,21 @@ def get_patient_insurance():
coverage['coverageClass'] = c_coverageClass if c_coverageClass else "Null"
c_status = c['resource']['status']
coverage['status'] = c_status
c_period = c['resource'].get('period') ## Part C seems not have period
c_medicaidEligibility = "FULL"
coverage['medicaidEligibility'] = c_medicaidEligibility
c_period = c['resource'].get('period')
c_start = c_period.get('start') if c_period else ""
try:
c_start_date = datetime.strptime(c_start, '%Y-%m-%d').date()
c_start = c_start_date.strftime("%b %d, %Y")
except ValueError:
pass # Some room for improvement here, but for now, we'll just use the original value from FHIR
coverage['startDate'] = c_start if c_start else ""
c_end = c_period.get('end') if c_period else ""
coverage['endDate'] = c_end if c_end else ""
c_payer = c['resource']['payor'][0]
c_payer_org = "TO BE RESOLVED"
c_contacts = []
c_payer_id = "TO BE RESOLVED"
if c_payer:
## BFD C4DIC Coverage response: payer is a reference to the contained Organization
ref_payer_org = c_payer['reference']
Expand All @@ -247,7 +255,6 @@ def get_patient_insurance():
c_contacts.append(t['value'])

coverage['payer'] = c_payer_org
coverage['payerId'] = c_payer_id
coverage['contacts'] = c_contacts
c_contract_id = "" ## Part A and Part B does not have contract number
if c_coverageClass == "Part C":
Expand Down