-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eligibility check sample bot #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Reshma, added a couple of comments! I went ahead and looked back at the opkit bot code and cleaned things up quite a bit and posted them up as comments.
Let me know if these comments makes sense. Happy to hop if you need some more context.
src/eligibility-check-opkit.ts
Outdated
const coverageEligibilityRequest = await medplum.createResource({ | ||
resourceType: 'CoverageEligibilityRequest', | ||
identifier: [{ | ||
system: 'www.opkit.co/id', //You should choose this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The system should be 'https://api.opkit.co/v1/eligibility_inquiries/{id}'
src/eligibility-check-opkit.ts
Outdated
resourceType: 'CoverageEligibilityRequest', | ||
identifier: [{ | ||
system: 'www.opkit.co/id', //You should choose this | ||
value: 'opkit-identifier1234' //Ideally something like opkitRequest.subscriber? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be opkitRequest.id!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opkitRequest doesn't have an id (see line 30)?
src/eligibility-check-opkit.ts
Outdated
{ | ||
focal: true, | ||
coverage: createReference(coverage), | ||
businessArrangement: 'opkit-identifier1234' //If there is some kind of contract number? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the Eligibility responses from insurance companies don't expose contract numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted
src/eligibility-check-opkit.ts
Outdated
outcome: 'complete', | ||
purpose: ['validation', 'benefits'], | ||
request: createReference(coverageEligibilityRequest), | ||
disposition: 'Policy is currently in-force.', //Won't this come from opkit? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I originally just hardcoded this to see if I could properly create the coverageEligibilityResponse
.
Here is the additional code I would add to check for active/inforce insurance:
const isPlanActive = (opkitResult.plan.benefits) => {
const activeStatusBenefit = benefitFeatures.find(
(benefit) =>
benefit.type === "active_coverage" &&
benefit.service === "health_benefit_plan_coverage",
);
return !!activeStatusBenefit;
};
And then we could do something like
disposition: isPlanActive ? "Policy is currently in-force" : "Policy is currently not in-force";
services: serviceTypes, | ||
}; | ||
|
||
const result: any = await fetch('https://api.opkit.co/v1/eligibility_inquiries', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codyebberson - what do you think about having a convenience wrapper around medplum.post
to call out to apis. Thinking it could:
- accept a mime type, but default to JSON
- do the JSON wrapping / unwrapping
- accept a param for {authType, authKey}
in_network: 'in', | ||
}; | ||
|
||
const coverageToBenefitUnitMap: Record<string, string> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Down the road, it feels like all these maps are probably good candidates for the FHIR Mapping Language functionality (or ConceptMaps, I'm not sure which)
No description provided.