|
| 1 | +# CHO Microservice Health Check Dependency Matrix |
| 2 | + |
| 3 | +Each service exposes three standard health check endpoints via `CloudHealthOffice.Infrastructure`: |
| 4 | + |
| 5 | +| Endpoint | Purpose | Behavior | |
| 6 | +|------------------|------------------|-----------------------------------------------| |
| 7 | +| `/health` | All checks | Runs every registered check | |
| 8 | +| `/health/live` | Liveness probe | Returns `Healthy` if the process is running | |
| 9 | +| `/health/ready` | Readiness probe | Checks all downstream dependencies | |
| 10 | + |
| 11 | +## Dependency Checklist by Service |
| 12 | + |
| 13 | +| Service | MongoDB | Cosmos DB | Redis | HTTP Dependencies | Notes | |
| 14 | +|----------------------------|---------|-----------|-------|--------------------------------|--------------------------------------| |
| 15 | +| claims-service | X | X | | | Uses shared infra (`AddChoInfrastructure`) | |
| 16 | +| benefit-plan-service | X | X | X | claims-service `/health/live` | Redis for accumulator cache | |
| 17 | +| payment-service | X | X | | claims-service `/health/live` | 835 ERA processing | |
| 18 | +| eligibility-service | X | X | | | 270/271 eligibility | |
| 19 | +| member-service | X | X | | | Member demographics | |
| 20 | +| provider-service | X | X | | | Provider directory | |
| 21 | +| enrollment-import-service | X | X | | | X12 834 import | |
| 22 | +| authorization-service | X | X | | | 278 prior auth | |
| 23 | +| coverage-service | X | X | | | Member-Sponsor-Plan linkage | |
| 24 | +| sponsor-service | X | X | | | Employer/group sponsors | |
| 25 | +| encounter-service | X | X | | | 837 encounter submission | |
| 26 | +| risk-adjustment-service | X | X | | | HCC risk scoring | |
| 27 | +| premium-billing-service | X | X | | | Premium invoicing | |
| 28 | +| smart-auth-service | X | | | | SMART on FHIR OIDC server (MongoDB only) | |
| 29 | +| fhir-service | X | | | | FHIR R4 API (MongoDB only) | |
| 30 | +| attachment-service | X | X | | | 275 clinical attachments | |
| 31 | +| appeals-service | X | X | | | Claim appeals | |
| 32 | +| rfai-service | X | X | | | Request for Additional Info | |
| 33 | +| reference-data-service | | | | | PostgreSQL (NpgSql health check) | |
| 34 | +| trading-partner-service | X | X | | | EDI trading partners | |
| 35 | +| tenant-service | X | X | | | SaaS tenant management | |
| 36 | + |
| 37 | +> **Note:** Most services support both MongoDB and Cosmos DB. The health check auto-detects which database is configured — only the active datastore is checked at runtime. |
| 38 | +
|
| 39 | +## How Health Checks Are Configured |
| 40 | + |
| 41 | +All services use `CloudHealthOffice.Infrastructure.HealthChecks.AddChoHealthChecks()`: |
| 42 | + |
| 43 | +```csharp |
| 44 | +// Dual-database service (most services — auto-detects active datastore) |
| 45 | +builder.Services.AddChoHealthChecks(options => |
| 46 | +{ |
| 47 | + options.MongoDbConnectionString = builder.Configuration["MongoDb:ConnectionString"]; |
| 48 | + options.CosmosDbConnectionString = builder.Configuration["CosmosDb:ConnectionString"]; |
| 49 | + options.CosmosDbEndpoint = builder.Configuration["CosmosDb:Endpoint"]; |
| 50 | + options.CosmosDbKey = builder.Configuration["CosmosDb:Key"]; |
| 51 | +}); |
| 52 | + |
| 53 | +// Service with Redis + HTTP dependency (benefit-plan-service) |
| 54 | +builder.Services.AddChoHealthChecks(options => |
| 55 | +{ |
| 56 | + options.MongoDbConnectionString = builder.Configuration["MongoDb:ConnectionString"]; |
| 57 | + options.CosmosDbConnectionString = builder.Configuration["CosmosDb:ConnectionString"]; |
| 58 | + options.CosmosDbEndpoint = builder.Configuration["CosmosDb:Endpoint"]; |
| 59 | + options.CosmosDbKey = builder.Configuration["CosmosDb:Key"]; |
| 60 | + options.RedisConnectionString = builder.Configuration["Redis:ConnectionString"]; |
| 61 | + options.HttpDependencies["claims-service"] = "http://claims-service:8080/health/live"; |
| 62 | +}); |
| 63 | +``` |
| 64 | + |
| 65 | +Health check endpoint mapping: |
| 66 | +```csharp |
| 67 | +app.MapChoHealthChecks(); // Maps /health, /health/live, /health/ready |
| 68 | +``` |
| 69 | + |
| 70 | +## Docker HEALTHCHECK |
| 71 | + |
| 72 | +All Dockerfiles use the liveness probe: |
| 73 | +```dockerfile |
| 74 | +HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ |
| 75 | + CMD curl -f http://localhost:8080/health/live || exit 1 |
| 76 | +``` |
| 77 | + |
| 78 | +## Kubernetes Probe Configuration (Recommended) |
| 79 | + |
| 80 | +```yaml |
| 81 | +livenessProbe: |
| 82 | + httpGet: |
| 83 | + path: /health/live |
| 84 | + port: 8080 |
| 85 | + initialDelaySeconds: 10 |
| 86 | + periodSeconds: 30 |
| 87 | +readinessProbe: |
| 88 | + httpGet: |
| 89 | + path: /health/ready |
| 90 | + port: 8080 |
| 91 | + initialDelaySeconds: 5 |
| 92 | + periodSeconds: 10 |
| 93 | +``` |
0 commit comments