Skip to content

Commit 7b226de

Browse files
spicyfalafelclaude
andcommitted
viewer: preset member dropdown, eligible/not-eligible outcomes, clearer steps
Form: a scenario dropdown (eligible / not eligible) with read-only member fields instead of free-text input. Backend: thread an 'eligible' flag through $kickoff -> workflow -> eligibility so the synthesized CoverageEligibilityResponse is either in-force (copay) or not in force. Viewer: a colored verdict banner on the result, kickoff restored as step 01 with browser/Aidbox location chips, the link+QR shown as their own block above 'Behind the scenes', manifest panel shows the full poll history, and plainer step copy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ef32060 commit 7b226de

5 files changed

Lines changed: 125 additions & 85 deletions

File tree

aidbox-integrations/smart-health-link/src/handlers/shl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export class ShlHandler {
4848
payerName,
4949
memberId: memberId ?? 'unknown',
5050
passcode: params.passcode,
51+
// Optional demo control: pass eligible=false to synthesize a not-eligible result.
52+
eligible: params.eligible !== 'false',
5153
});
5254

5355
return json({

aidbox-integrations/smart-health-link/src/server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const server = Bun.serve({
7171
payerName?: string;
7272
memberId?: string;
7373
passcode?: string;
74+
eligible?: boolean;
7475
};
7576
try {
7677
body = (await req.json()) as typeof body;
@@ -89,6 +90,7 @@ const server = Bun.serve({
8990
payerName: body.payerName,
9091
memberId: body.memberId ?? 'unknown',
9192
passcode: body.passcode,
93+
eligible: body.eligible,
9294
});
9395
return Response.json({
9496
shlinkId: result.shlinkId,

aidbox-integrations/smart-health-link/src/services/eligibility-workflow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class EligibilityWorkflow {
3333
payerName: string;
3434
memberId: string;
3535
passcode?: string;
36+
eligible?: boolean;
3637
}): Promise<{ shlinkId: string; shlink: string; payload: SHLPayload }> {
3738
const minted = await this.shl.mintLink({
3839
label: `Eligibility result for ${input.memberName}`,
@@ -47,7 +48,7 @@ export class EligibilityWorkflow {
4748

4849
private async runJob(
4950
shlinkId: string,
50-
input: { memberName: string; payerName: string; memberId: string }
51+
input: { memberName: string; payerName: string; memberId: string; eligible?: boolean }
5152
): Promise<void> {
5253
try {
5354
await new Promise((resolve) =>

aidbox-integrations/smart-health-link/src/services/eligibility.ts

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,47 @@ export class EligibilityService {
1818
memberName: string;
1919
payerName: string;
2020
memberId: string;
21+
eligible?: boolean;
2122
}): Promise<{ id: string; resource: Record<string, unknown> }> {
22-
// No registered patient or stored Coverage yet — the prospective member is
23+
const isEligible = input.eligible !== false;
24+
// No registered patient or stored Coverage yet: the prospective member is
2325
// pre-registration. We carry the coverage and the originating request as
2426
// contained resources so the response validates while staying self-contained.
27+
const insurance = isEligible
28+
? [
29+
{
30+
coverage: { reference: '#coverage' },
31+
inforce: true,
32+
item: [
33+
{
34+
category: {
35+
coding: [
36+
{
37+
system: 'http://terminology.hl7.org/CodeSystem/ex-benefitcategory',
38+
code: '30',
39+
display: 'Health Benefit Plan Coverage',
40+
},
41+
],
42+
},
43+
benefit: [
44+
{
45+
type: {
46+
coding: [
47+
{
48+
system: 'http://terminology.hl7.org/CodeSystem/benefit-type',
49+
code: 'copay',
50+
display: 'Copayment per service',
51+
},
52+
],
53+
},
54+
allowedMoney: { value: 0, currency: 'USD' },
55+
},
56+
],
57+
},
58+
],
59+
},
60+
]
61+
: [{ coverage: { reference: '#coverage' }, inforce: false }];
2562
const resource: Record<string, unknown> = {
2663
resourceType: 'CoverageEligibilityResponse',
2764
status: 'active',
@@ -50,42 +87,11 @@ export class EligibilityService {
5087
created: new Date().toISOString(),
5188
request: { reference: '#request' },
5289
outcome: 'complete',
53-
disposition: `Member ${input.memberName} is eligible for services under ${input.payerName}.`,
90+
disposition: isEligible
91+
? `Member ${input.memberName} is eligible for services under ${input.payerName}.`
92+
: `Member ${input.memberName} is not eligible for services under ${input.payerName}.`,
5493
insurer: { display: input.payerName },
55-
insurance: [
56-
{
57-
coverage: { reference: '#coverage' },
58-
inforce: true,
59-
item: [
60-
{
61-
category: {
62-
coding: [
63-
{
64-
system: 'http://terminology.hl7.org/CodeSystem/ex-benefitcategory',
65-
code: '30',
66-
display: 'Health Benefit Plan Coverage',
67-
},
68-
],
69-
},
70-
benefit: [
71-
{
72-
type: {
73-
coding: [
74-
{
75-
system:
76-
'http://terminology.hl7.org/CodeSystem/benefit-type',
77-
code: 'copay',
78-
display: 'Copayment per service',
79-
},
80-
],
81-
},
82-
allowedMoney: { value: 0, currency: 'USD' },
83-
},
84-
],
85-
},
86-
],
87-
},
88-
],
94+
insurance,
8995
};
9096

9197
const created = await this.fhir.create<{ id: string }>(

0 commit comments

Comments
 (0)