How shin201005/medical-ledger works
Medical Ledger is a role-based medical-record and product-management application, with a separate AI service for identity, image, and product analysis. The user-facing flow runs from the browser through its shared API client to backend domain endpoints; AI capabilities are also exposed as HTTP endpoints. The excerpts show client requests and several internal calls, but do not show backend application wiring or most service-to-service calls, so those links are omitted. Unexcerpted domain modules are represented by their exact module directories.
Main entry points: api.ts API client · main.tsx Browser application · errors.js Error responses · routes.js Products and packages
Components 31
Web application
- Browser application
frontend/src/main.tsx - Authentication session
frontend/src/features/auth/Session.tsx - API client
frontend/src/services/api.ts - Medical records UI
frontend/src/features/records/Records.tsx - eKYC UI
frontend/src/features/ekyc/Ekyc.tsx - Product management UI
frontend/src/features/products/Products.tsx - Image lab UI
frontend/src/features/image-lab/ImageLab.tsx
Medical Ledger backend
- Application database
backend/src/config/db.js - Request security
backend/src/middlewares/security.js - Authentication and wallets
backend/src/modules/auth - Patient management
backend/src/modules/patients - Care organizations
backend/src/modules/doctors - Identity verification
backend/src/modules/ekyc - Medical records
backend/src/modules/medical-records/controller.js - Record consent
backend/src/modules/consent - Products and packages
backend/src/modules/products/routes.js - Laboratory workflows
backend/src/modules/laboratories - Public verification
backend/src/modules/verification - Blockchain operations
backend/src/modules/blockchain/controller.js - Audit trail
backend/src/modules/audit - Error responses
backend/src/utils/errors.js
AI services
- AI HTTP service
ai_medical_service/main.py - Identity matching
ai_medical_service/identity.py - Image processing lab
ai_medical_service/image_lab.py - Product label search
ai_medical_service/product_search.py - Package image search
ai_medical_service/package_search.py - Laboratory CSV cleaning
ai_medical_service/csv_service.py
External systems
- Blockchain network
- IPFS storage
- AI endpoint
Other components
- Staff and patients
Connections 33
- Staff and patients → Browser application: uses
frontend/src/main.tsx - Browser application → Authentication session: provides session
frontend/src/main.tsx - Browser application → Medical records UI: routes to
frontend/src/main.tsx - Browser application → eKYC UI: routes to
frontend/src/main.tsx - Browser application → Product management UI: routes to
frontend/src/main.tsx - Browser application → Image lab UI: routes to
frontend/src/main.tsx - Authentication session → API client: requests
frontend/src/features/auth/Session.tsx - Medical records UI → API client: requests
frontend/src/features/records/Records.tsx - eKYC UI → API client: requests
frontend/src/features/ekyc/Ekyc.tsx - Product management UI → API client: requests
- Image lab UI → API client: requests
frontend/src/features/image-lab/ImageLab.tsx - API client → AI endpoint: HTTP requests
frontend/src/services/api.ts - API client → Error responses: formats failures
- Request security → Application database: loads session and user
backend/src/middlewares/security.js - Request security → Error responses: raises errors
backend/src/middlewares/security.js - Authentication and wallets → Request security: uses authentication
backend/src/modules/auth/routes.js - Authentication and wallets → Error responses: wraps responses
backend/src/modules/auth/routes.js - Medical records → Application database: reads records
backend/src/modules/medical-records/controller.js - Medical records → Error responses: returns responses
backend/src/modules/medical-records/controller.js - Products and packages → Request security: uses role checks
backend/src/modules/products/routes.js - Products and packages → Error responses: wraps responses
backend/src/modules/products/routes.js - Products and packages → Product label search: runs image search
- Products and packages → Package image search: searches packages
- AI HTTP service → Identity matching: verifies identity
ai_medical_service/main.py - AI HTTP service → Image processing lab: processes images
ai_medical_service/main.py - AI HTTP service → Product label search: analyzes labels
ai_medical_service/main.py - AI HTTP service → Laboratory CSV cleaning: cleans CSV
ai_medical_service/main.py - Identity matching → Image processing lab: uses imaging
ai_medical_service/identity.py - Product label search → Identity matching: uses identity helpers
ai_medical_service/product_search.py - Product label search → Image processing lab: uses image helpers
ai_medical_service/product_search.py - Package image search → Image processing lab: uses image helpers
ai_medical_service/package_search.py - Blockchain operations → Blockchain network: submits transactions
- Medical records → IPFS storage: stores documents