Conversation
3c2990d to
6afd52e
Compare
packages/utils/lib/fhir/billing.ts
Outdated
| copay = parseObjectsToCopayBenefits(benefitList).filter( | ||
| (benefit) => benefit.coverageCode === 'A' || benefit.coverageCode === 'B' | ||
| ); | ||
| deductible = parseObjectsToCopayBenefits(benefitList).filter((benefit) => benefit.coverageCode === 'C'); |
There was a problem hiding this comment.
We can use a const to calculate parseObjectsToCopayBenefits(benefitList) once, and use an IIFE or reduce to filter data within one iteration.
| (copay) => | ||
| copay.code === '30' && copay.coverageCode === 'C' && copay.levelCode === 'IND' && copay.periodCode === '29' | ||
| )?.amountInUSD; | ||
|
|
There was a problem hiding this comment.
Let's move this to a helper function. It can use useGetPatientAccount and useGetPatientCoverages under the hood to provide a useful abstraction and to avoid using low-level logic in high-level components.
Signed-off-by: Jonathan Saewitz <48358905+saewitz@users.noreply.github.com>
Signed-off-by: Jonathan Saewitz <48358905+saewitz@users.noreply.github.com>
| export interface InsuranceCheckStatusWithDate { | ||
| status: InsuranceEligibilityCheckStatus; | ||
| dateISO: string; | ||
| copay?: PatientPaymentBenefit[]; |
There was a problem hiding this comment.
Don't you have stronger types you can use here? There is a "CopayBenefit" in the union type "PatientPaymentBenefit", and likewise with "DeductibleBenefit", but then the "copay" and "deductible" fields can both include their titular type, plus any others in the union. If there is a good reason for this it would be nice to have a comment because this was all reading very clearly to me until i got to this last interface.
No description provided.