Enterprise SoftwareValidated reference implementationHealthcare InsuranceNo runtime AI
Member Eligibility Verification
A contract-first reference implementation that lets a Provider Relations representative verify current member coverage in Salesforce while a reusable FastAPI service owns the eligibility decision.
Scope: Version 1 uses synthetic JSON data, a local FastAPI process, no production authentication, and a temporary tunnel for one live end-to-end demonstration. It is not a production deployment.
- Domain
- Provider Relations and Member Eligibility
- AI-assisted engineering
- Yes
- Runtime AI
- None
- Content reviewed
- 2026-08-08

Business problem
Context
A healthcare provider contacts an insurer to confirm whether a member has active coverage before care is delivered. A Provider Relations representative receives the Member ID and is expected to provide a timely, consistent answer.
Workflow Insurance is the fictional organization used for this reference implementation. The member and coverage records are synthetic.
Existing Workflow
The representative typically must:
- locate the member;
- retrieve coverage information;
- compare effective and termination dates with the current date;
- apply eligibility rules;
- communicate the outcome to the provider.
Each step is straightforward, but the workflow is repetitive, relies on institutional knowledge, and can produce inconsistent decisions when performed manually across multiple systems.
Intended Outcomes
- reduce repeated navigation and manual comparison;
- return a decision within the representative’s Salesforce workflow;
- apply the same eligibility rules for every request;
- make the decision capability reusable by future applications;
- retain a clear boundary between user experience, integration, business logic, and data access.
Version 1 Scope
Version 1 accepts one Member ID, retrieves one synthetic member and coverage record, evaluates current eligibility, and returns a clear result. Claims, benefits, deductibles, prior authorization, provider search, multiple coverage records, historical eligibility, runtime AI, and production deployment are outside scope.
Solution
Overview
The reference implementation keeps Provider Relations representatives in Salesforce while delegating eligibility decisions to a reusable backend service. Salesforce collects the Member ID and presents the result. The FastAPI service retrieves synthetic member and coverage data, evaluates coverage dates, and returns the decision through an OpenAPI-defined contract.
User Flow
- The representative opens Member Eligibility Verification in the Salesforce Provider Relations application.
- The representative enters a Member ID and selects Verify Eligibility.
- The Lightning Web Component validates the input and calls an Apex controller.
- The Apex integration service sends
POST /api/v1/eligibility/verifythrough a Named Credential. - FastAPI retrieves the member and coverage records.
- The eligibility service evaluates the coverage window for the current date.
- Salesforce displays the returned status, reason, member information, coverage information when available, and request information.
Supported Outcomes
| Condition | Result |
|---|---|
| Current date falls within the effective and termination dates, inclusive | ELIGIBLE |
| Current date is before the effective date | INELIGIBLE — Coverage Not Yet Effective |
| Current date is after the termination date | INELIGIBLE — Coverage Terminated |
| Coverage information is unavailable | UNABLE_TO_DETERMINE |
| Member ID does not match a member | HTTP 404 structured error |
| Request is missing or invalid | HTTP 400 structured error |
| Unexpected service failure | HTTP 500 structured error |
Responsibility Boundary
Salesforce owns presentation, input handling, callout orchestration, and result rendering. It does not compare coverage dates or determine eligibility. FastAPI is the only component that applies business rules, which prevents duplicated decisions across channels.
Demonstrated Scope
The working implementation includes a Salesforce Lightning experience, Apex integration, Named Credential configuration, FastAPI API and service layers, synthetic JSON repositories, an OpenAPI 3.1 contract, automated tests, architecture documentation, and a single live eligible end-to-end validation.
Architecture
Architecture Summary
The solution separates the Salesforce user experience from eligibility decision-making. Salesforce is a presentation and integration client. FastAPI exposes the contract-defined API and owns all eligibility rules. Repository classes isolate the synthetic JSON data source so it can be replaced without moving business logic into the client.
Provider Relations Representative
→ Salesforce Lightning Web Component
→ Apex Controller
→ Apex Integration Service
→ Salesforce Named Credential
→ FastAPI Eligibility API
→ Eligibility Service
→ Member and Coverage Repositories
→ Synthetic JSON Data
Component Responsibilities
| Component | Responsibility |
|---|---|
| Salesforce Lightning Web Component | Collect Member ID; show loading, result, empty, and error states. |
| Apex Controller | Provide the Lightning-callable boundary and reject blank input. |
| Apex Integration Service | Build the HTTP request, call the Named Credential, deserialize responses, and translate failures. |
| Named Credential | Externalize the backend endpoint from Apex source. |
| FastAPI API | Implement the contract endpoint and map request, response, and error models. |
| Eligibility Service | Apply all coverage-window business rules. |
| Member and Coverage Repositories | Read synthetic records without making eligibility decisions. |
| OpenAPI Contract | Define the integration boundary, schemas, examples, and status codes. |
Principal Decisions
- API first: the OpenAPI contract was defined before backend and Salesforce implementation.
- Single business-rule owner: eligibility logic exists only in the backend service.
- Thin clients and routes: Salesforce and the FastAPI route orchestrate; neither duplicates domain decisions.
- Repository isolation: JSON is a deliberate Version 1 source behind repository boundaries, not a permanent database choice.
- Contract-alignment testing: automated backend tests compare the generated OpenAPI document with the authoritative contract.
- Externalized endpoint: Apex uses a Named Credential rather than hardcoding a URL or secret.
- No invented production controls: Version 1 does not claim authentication, cloud hosting, database infrastructure, or observability that was not built.
Security and Deployment Boundary
The OpenAPI contract defines no security scheme, and Version 1 uses a No Authentication Named Credential for trusted demonstration communication. The FastAPI process ran locally; a temporary Cloudflare Tunnel made it reachable for one live Salesforce validation. This is demonstration infrastructure, not a target production architecture.
Before production use, the architecture would require explicit authentication and authorization, persistent hosting, managed data storage, secrets management, audit and operational telemetry, resilience controls, privacy review, and environment-specific deployment design.
Architecture Views
- System Context — actor and system boundary.
- Container Architecture — deployable and logical containers.
- Request Sequence — successful and error runtime paths.
- Version 1 Deployment — what was actually exercised.
This view shows the Provider Relations user, the Salesforce application, the Member Eligibility Service, and the synthetic data boundary.
Text alternative
A healthcare provider asks a Provider Relations representative to verify current eligibility. The representative enters a Member ID in the Salesforce Provider Relations application. Salesforce calls the FastAPI Member Eligibility Service through the contract-defined endpoint. The service reads synthetic member and coverage JSON, makes the eligibility decision, and returns the result to Salesforce. The representative communicates the result to the provider.
Boundary
Salesforce provides the user experience but does not determine eligibility. The FastAPI service owns the business decision. Workflow Insurance and all records shown are fictional.
This view shows the Salesforce, FastAPI, contract, and data containers and makes the business-rule boundary explicit.
Text alternative
The representative uses a Salesforce Lightning Web Component. The component calls an Apex controller, which delegates to an Apex integration service and Named Credential. That path calls the FastAPI eligibility endpoint. The FastAPI route delegates to the Eligibility Service, which owns all coverage-window rules and reads synthetic member and coverage data through separate repositories. The OpenAPI contract defines both sides of the integration. The returned outcome is displayed by Salesforce without re-evaluating it.
Key Decision
No eligibility business rule is duplicated in Salesforce. Replacing the JSON data source should affect repository implementation, not the Salesforce client or eligibility rules.
This view shows what happens after a representative submits a Member ID, including supported business and technical outcomes.
Text alternative
The Lightning Web Component validates the Member ID and calls the Apex controller. The controller delegates to the Apex integration service, which sends the contract request through a Named Credential to FastAPI. The Eligibility Service looks up the member. An unknown member returns a structured 404 that Salesforce displays as Member Not Found. For a known member, the service retrieves coverage, applies eligibility rules, and returns Eligible, Ineligible, or Unable to Determine. Invalid requests and technical failures are translated into user-safe errors.
Decision Point
The only eligibility decision occurs inside the FastAPI Eligibility Service. Salesforce transports the request and renders the returned result.
This view represents the environment used for the documented live validation. It is not a target production architecture.
Text alternative
The Provider Relations application, Lightning Web Component, Apex code, and Named Credential run in Salesforce Cloud. For the documented live validation, the Named Credential sent an HTTPS request through a temporary Cloudflare Tunnel to a FastAPI process on a developer machine. That local process ran the eligibility service, repositories, synthetic JSON data, and Swagger UI. The response returned through the same path and was displayed in Salesforce.
Explicit Exclusions
Version 1 has no persistent cloud backend, database, API gateway, load balancer, container platform, production authentication, centralized monitoring, or infrastructure as code. The temporary tunnel is validation scaffolding and must not appear as a production recommendation.
Implementation
Contract-First Delivery
The OpenAPI 3.1 contract defines one operation: POST /api/v1/eligibility/verify. It specifies request validation, the three successful business statuses, structured errors, nullable coverage fields, examples, and the supported HTTP responses. Backend and Salesforce models trace to this contract.
FastAPI Backend
The Python 3.13 backend uses FastAPI and Pydantic v2. Its layers are deliberately small:
- the API route accepts and returns contract models;
- dependency providers assemble repositories and the eligibility service;
- the eligibility service owns business rules;
- member and coverage repositories read synthetic JSON data;
- exception handlers produce consistent 400, 404, and 500 responses with correlation identifiers;
- OpenAPI post-processing removes FastAPI’s default 422 response because runtime validation is deliberately translated to 400.
The backend is a local reference service, not a deployed production service.
Salesforce Client
The Salesforce implementation uses a Lightning Web Component, Apex controller, Apex integration service, request and response wrappers, structured integration exceptions, and a Named Credential. The user experience includes an instructional empty state, loading and duplicate-submit handling, keyboard submission, eligible and ineligible presentations, unable-to-determine behavior, member-not-found handling, and generic technical-error handling.
Salesforce applies no eligibility date logic. Status-to-label and status-to-icon mappings are presentation concerns for values already determined by the backend.
AI-Assisted Engineering
AI assisted specification refinement, contract design, code generation, testing, documentation, architecture packaging, and review. Reusable FastAPI and Salesforce development skills, together with task-specific prompts, made the work traceable and repeatable.
Human review and real execution remained the quality gates. Contract tests, local test suites, Salesforce deployment, Apex tests, user-interface refinement, and live integration exposed defects that generation or static review alone did not reveal.
There is no runtime AI, AI application, or AI agent in the delivered eligibility capability.
Engineering Artifacts
The authoritative repository includes:
- six product and architecture specifications;
- one OpenAPI contract;
- backend source and unit, integration, and contract tests;
- Salesforce source, Apex tests, and LWC Jest tests;
- Salesforce configuration guides;
- two reusable Claude Code skills and their references;
- thirteen project and reusable-skill creation prompts;
- seven engineering journals;
- four Mermaid architecture views;
- screenshots, demo material, and a walkthrough.
The website package copies only the public API contract, selected screenshots, and adapted architecture diagrams. Application source remains in GitHub.
Validation evidence
Evidence Summary
| Area | Current evidence | Scope |
|---|---|---|
| Backend lint | Ruff passed on 2026-08-08 | Current website-preparation review. |
| Backend tests | 19 passed on 2026-08-08 | 7 unit cases, 6 API integration tests, and 6 contract-alignment tests. |
| LWC Jest | 10 passed on 2026-08-08 | Current component test file after UI refinement. |
| Salesforce deployment | Successful | Documented source deployment and compilation in the authorized Salesforce org. |
| Apex tests | 12 passed | Documented org run covering controller and integration-service behavior. |
| Apex coverage | 100% for classes with executable logic | Field-only DTO classes contain no executable lines. |
| Live integration | One eligible scenario passed | M100234 traveled from Salesforce through the temporary tunnel to FastAPI and back. |
Backend Coverage
The backend suite verifies:
- unknown-member behavior;
- eligible coverage including effective and termination boundary dates;
- not-yet-effective and terminated coverage;
- unable-to-determine behavior when coverage is absent;
- 200, 400, 404, and 500 HTTP handling;
- rejection of missing, empty, and unexpected request fields;
- path, operation, response-code, request-field, enum, and required-field alignment between generated OpenAPI and the source contract.
Salesforce Coverage
The Apex suite covers successful and nullable responses, 400, 404, and 500 responses, missing backend error messages, malformed bodies, undocumented status codes, callout exceptions, controller success, blank input, and translated errors.
The current LWC Jest suite covers initial, loading, and duplicate-submit states; eligible, ineligible, and unable-to-determine outcomes; Enter-key submission; member-not-found behavior; backend errors; and generic error fallback.
Live End-to-End Validation
One manual live scenario was exercised:
Salesforce LWC
→ Apex Controller
→ Apex Integration Service
→ Named Credential
→ Temporary Cloudflare Tunnel
→ Local FastAPI Service
→ Eligibility Service
→ Synthetic JSON Repositories
→ Contract Response
→ Salesforce Result
Synthetic Member ID M100234 returned Eligible, Medical coverage, and member name Sarah Johnson in Salesforce. The tunnel was temporary and the backend remained local.
Evidence Boundaries
- The ineligible, unable-to-determine, 400, 404, and 500 paths are covered at component boundaries but were not each exercised through the complete live Salesforce-to-FastAPI path.
- The deployment was a Salesforce org plus a developer-machine backend, not a persistent production environment.
- No load, penetration, disaster-recovery, privacy-compliance, or production-operability test is claimed.
- No production authentication or authorization was implemented.
- All demonstrated member and coverage data is synthetic.
Historical Count Reconciliation
The Salesforce generation journal records six LWC Jest tests at that milestone. Later UI refinement expanded the current suite to ten tests. Website content must use the current total and may describe the earlier total only as historical evidence.
Screenshots



All member and coverage data shown is synthetic; Workflow Insurance is a fictional organization.
API contract
Member Eligibility Verification API
- Specification
- OpenAPI 3.1.0
- Contract version
- 1.0.0
- Operation
POST /api/v1/eligibility/verify
Download the OpenAPI contract (YAML, 10 KB)
The contract defines no security scheme and no live endpoint is offered; it documents a reference implementation, not a production service.
Lessons learned
Contract Tests Expose Integration Drift
Automated comparison between the FastAPI-generated schema and the source OpenAPI contract found two issues before release: nullable coverage fields were initially treated as required, and FastAPI documented a 422 response even though runtime validation returned 400. The fixes kept documentation and behavior aligned.
Real Execution Finds Different Defects
The first Salesforce deployment revealed that Jest files needed to be excluded from metadata deployment. LWC test execution then exposed a module-resolution mismatch and a validation guard that treated the test stub’s undefined return value as invalid. These defects were not apparent from source review alone.
One Owner for Business Rules Reduces Risk
Keeping coverage-date comparisons in the backend avoided two implementations of the same rule. Salesforce remained responsible for the user workflow and integration, making the service reusable by future channels.
Presentation Quality Is an Engineering Concern
The working Salesforce component required a focused refinement pass to become a credible enterprise demonstration. Information hierarchy, state differentiation, spacing, keyboard behavior, error messages, and domain-aligned application naming materially improved usability without changing the architecture.
Validation Claims Need Precise Scope
Component tests, org compilation, org tests, and live end-to-end verification are different evidence types. Recording them separately prevents a single successful scenario from being interpreted as proof of production readiness or complete branch coverage.
AI-Assisted Engineering Still Requires Governance
Prompts and reusable skills accelerated delivery, but specifications, explicit authority boundaries, traceability, human review, and executable tests determined what was accepted. AI-generated output was treated as a candidate engineering artifact, not proof of correctness.
Reference Implementations Benefit From Honest Constraints
Synthetic data, a local backend, a temporary tunnel, and absent production authentication are deliberate Version 1 boundaries. Making them visible strengthens the implementation as a learning asset and defines the work required for production evolution.
Reusable technical assets
The implementation repository contains more than application source. These assets can support the website, future engineering work, and technical walkthroughs without copying the application itself.
Product and Architecture Specifications
| Source asset | Reusable value | Website treatment |
|---|---|---|
docs/01-business-discovery.md |
Business context, actor, process, goals, scope, and exclusions. | Summarized in Business Problem. |
docs/02-functional-requirements.md |
Capabilities, business rules, non-functional requirements, and traceability. | Summarized across Solution and Validation. |
docs/03-architecture.md |
Architecture principles, responsibilities, decisions, alternatives, and evolution. | Summarized in Architecture. |
docs/04-implementation-design.md |
Layer responsibilities, domain model, validation, error handling, and coding expectations. | Summarized in Implementation. |
docs/05-api-design.md |
API style, models, status codes, errors, security scope, and versioning. | Published through the API summary and contract. |
docs/06-end-to-end-architecture.md |
Integrated Salesforce-to-FastAPI architecture and evidence boundaries. | Adapted into the website diagrams. |
API Contract
contracts/member-eligibility.yaml is a reusable OpenAPI 3.1 contract with request, success, error, enum, nullable-field, example, and status-code definitions. A verified copy is included at api/member-eligibility.yaml with provenance in api/README.md.
Architecture Diagrams
The source repository contains four Mermaid views:
- system context;
- container architecture;
- runtime request sequence;
- validated Version 1 deployment.
Concise website adaptations are included under diagrams/. Mermaid source should remain available so future content builds can render responsive SVG or PNG derivatives.
Screenshots
The source contains five screenshots. Three are copied because they provide direct product or API evidence:
- empty Salesforce verification workflow;
- eligible result in Salesforce;
- Swagger/OpenAPI interface.
The project-structure and repository-README screenshots are not copied because they duplicate information better represented by live GitHub links and become stale quickly. See screenshots/README.md.
Engineering Journals
Seven journals record backend generation, Salesforce integration, architecture packaging, UI refinement and live validation, README productization, sequence-diagram design, and deployment-diagram design. They are indexed in engineering-journal.md.
Reusable Claude Code Skills
The repository contains two project-independent skills:
fastapi-application-developer— specification validation, layered FastAPI implementation, Pydantic modeling, error handling, security basics, testing, and traceability templates;salesforce-integration-developer— explicit execution modes, target-org safety, contract-driven Apex and LWC integration, Named Credentials, testing, error handling, UI guidance, and project templates.
These should be linked as engineering assets if the website later publishes reusable skills. They are not copied into the showcase package because they are versioned implementation tooling rather than page media.
Prompt Assets
The repository contains eleven task prompts covering contract design, backend generation, Salesforce generation, skill refinement, architecture packaging, Salesforce UI refinement, README productization, and four architecture views. Two additional prompts define the reusable FastAPI and Salesforce skills.
Prompts are evidence of the AI-assisted engineering workflow. They should be linked from technical journal content, not presented as runtime application components.
Salesforce Configuration Guides
Three guides document Named Credential setup, why no External Credential is needed for Version 1, and permission-set requirements. They are valuable migration references but must not be presented as deployable production security configuration.
Test and Traceability Assets
- backend unit tests for coverage-date business rules;
- backend API integration tests for request and error behavior;
- OpenAPI contract-alignment tests;
- Apex callout, parsing, translation, and controller tests;
- LWC state, result, keyboard, and error tests;
- generated Salesforce coverage artifacts;
- requirement-to-artifact traceability recorded in engineering journals.
Test source remains in GitHub. The website publishes current evidence and limitations in Validation, not copied test code or coverage reports.
Demonstration and Publishing Assets
The source also includes a case study, website showcase draft, demo script, seven narration clips, LinkedIn draft, NotebookLM walkthrough guide, and enterprise showcase standard. These are useful editorial inputs but are not copied because this package replaces them with concise, specification-aligned website content.
Engineering journal
The authoritative repository contains seven engineering journal entries. Together they record generation inputs, architectural decisions, actual validation, defects, corrections, assumptions, and reusable lessons. The website should present the summaries below and link to the source entries rather than duplicate their full content.
Backend Implementation
FastAPI Backend Generation
Records the contract-driven backend structure, requirement traceability, and the original 19-test validation. Contract-alignment tests caught incorrect required-field behavior for nullable coverage data and removed an inaccurate generated 422 response.
Salesforce Integration
Salesforce Integration Generation
Documents the Lightning Web Component, Apex controller and integration service, contract-shaped wrappers, Named Credential guidance, Salesforce deployment, Apex test execution, LWC Jest execution, architecture decisions, and resolved defects. It also distinguishes metadata-only, connected-validation, and deployment evidence.
Salesforce UI Polish
Explains how the existing working component was refined into a clearer Provider Relations experience without altering the integration architecture. It records state presentation, accessibility improvements, Salesforce application packaging, and the single live eligible end-to-end validation.
Architecture and Validation
Architecture Documentation Packaging
Describes how technical architecture evidence was simplified for executive and website use, which validation claims were retained, and which claims were excluded because evidence did not support them.
Sequence Diagram
Records the decisions behind the runtime sequence view, including success, member-not-found, and technical-failure branches and the explicit FastAPI business-logic boundary.
Deployment Diagram
Records the actual Version 1 runtime boundaries: Salesforce Cloud, HTTPS communication, and a local developer-machine backend using synthetic JSON. It excludes invented production infrastructure.
Productization and Lessons Learned
README Productization
Explains how the repository landing page was structured for technical leaders, which business and validation claims were included, which unsupported claims were omitted, and how scope constraints were made visible.
Cross-Journal Findings
- Contract-first development provided a stable integration boundary.
- Real execution found issues that static review did not.
- Eligibility logic remained isolated in the backend.
- Salesforce deployment and testing required explicit environment authorization.
- User-interface refinement improved demonstration quality without changing architecture.
- Validation language is most credible when it states evidence type and limitations.
- Reusable prompts and skills capture process knowledge beyond the application source.
Source and walkthrough
- View the repository on GitHub (external)
- Watch the video walkthrough on YouTube (external)
- Reviewed source commit 4ca20305 (external)
Source reviewed from branch main on 2026-08-06; website content reviewed 2026-08-08.