How arn101/publichealthmap works
Purpose and Topology
PublicHealthMap is a Bangladesh critical-disease registry. It combines a React/Vite single-page client, Express API, and local Oracle Database with PL/SQL for transactional registry operations, surveillance aggregation, and research exports. Root development orchestration is run-dev.js; API and client run on ports 5000 and 3000 respectively.
Application Entry Points
• Backend HTTP service: backend/server.js
• React bootstrap and application shell: frontend/src/main.jsx, frontend/src/App.jsx
• Database connection layer: backend/db.js
• Authentication and role enforcement: backend/auth.js
The frontend communicates with the Express API; the API owns Oracle access and does not expose database connectivity to clients.
Role-Separated Workflows
The system has three privileged operating domains:
• Hospital staff locate/create patients and submit disease-specific cases through frontend/src/pages/HospitalPortal.jsx.
• Researchers request filtered, anonymized data exports through frontend/src/pages/ResearcherPortal.jsx.
• Ministry administrators approve organizations, manage diseases, and configure forms through frontend/src/pages/AdminPortal.jsx.
Authentication is JWT/credential-based and Oracle-backed, with environment-provided Oracle and JWT/admin secrets via backend/.env.template.
Registry and Validation Boundary
Patient identity validation is implemented on both sides of the API boundary: backend/patient-validation.js and frontend/src/lib/patientValidation.js. This supports Bangladesh NID, birth-certificate, and mobile formats while preserving server-side enforcement. Disease and field catalogs centralize registry/form definitions in backend/disease-catalog.js and backend/field-catalog.js; the hospital workflow renders disease-specific case capture from these definitions and database form setup.
Oracle Schema and PL/SQL Layer
Oracle is a material part of application behavior, not merely persistence. Schema bootstrap begins at schema.sql and is operationalized by:
• backend/scripts/create-tables.js
• backend/scripts/create-triggers.js
• backend/scripts/create-compound-trigger.js
• backend/scripts/create-indexes.js
Packages and procedures establish database-owned case handling, surveillance statistics, and researcher export behavior: backend/scripts/setup-case-pkg.js, backend/scripts/setup-stats-proc.js, and backend/scripts/setup-research-pkg.js. Triggers and packages form the integrity/aggregation boundary beneath Express.
Surveillance and Public Presentation
The client includes public disease surveillance with category, disease, and geographic filters, choropleth visualization, charts, and rankings. Geographic assets are bundled locally, notably frontend/src/data/bgd_adm1.geojson, frontend/src/data/_cand.geojson, and frontend/src/data/bangladeshDivisions.js. Visualization components reside in frontend/src/components/Charts.jsx; API-backed aggregate results are expected to originate from Oracle statistics procedures.
Provisioning, Migration, and Demo Data
Database setup is script-driven and ordered for a fresh Oracle schema. Domain taxonomy/forms and body imagery are provisioned by backend/scripts/setup-disease-taxonomy.js, backend/scripts/setup-disease-forms.js, and backend/scripts/setup-body-images.js. Data/image and approval evolution are handled through backend/scripts/migrate-images-to-blob.js and backend/scripts/migrate-hospital-approval.js. backend/scripts/seed-demo-data.js populates district hospitals, patients, skewed disease cases, research organizations, and refreshed statistics.
Main entry points: server.js HTTP API · schema.sql Oracle database · App.jsx Application shell · HospitalPortal.jsx Hospital case workflow
Components 21
React client
- Client bootstrap
frontend/src/main.jsx - Application shell
frontend/src/App.jsx - Hospital case workflow · Finds patients and submits disease-specific cases.
frontend/src/pages/HospitalPortal.jsx - Research export workflow · Requests filtered anonymized exports.
frontend/src/pages/ResearcherPortal.jsx - Administration workflow · Manages approvals, diseases, and forms.
frontend/src/pages/AdminPortal.jsx - Client identity validation
frontend/src/lib/patientValidation.js - Public surveillance UI · Filters and visualizes aggregate disease statistics.
frontend/src/components/Charts.jsx - Bangladesh geography
frontend/src/data/bgd_adm1.geojson
Express API
- HTTP API · Owns all client access to Oracle.
backend/server.js - Authentication and roles · Oracle-backed credentials enforce privileged domains.
backend/auth.js - Server identity validation · Enforces NID, birth-certificate, and mobile formats.
backend/patient-validation.js - Disease and field catalogs · Centralizes disease and form-field definitions.
backend/disease-catalog.js - Oracle connection layer
backend/db.js
Oracle registry
- Oracle database · Stores identities, cases, organizations, forms, and aggregates.
schema.sql - Case integrity package · Database-owned case handling and integrity boundary.
backend/scripts/setup-case-pkg.js - Surveillance statistics · Produces aggregate results for surveillance.
backend/scripts/setup-stats-proc.js - Research export package · Produces filtered anonymized researcher exports.
backend/scripts/setup-research-pkg.js
Database provisioning
- Schema and trigger setup · Creates tables, triggers, compound trigger, and indexes.
backend/scripts/create-tables.js - Domain form provisioning · Provisions taxonomy, disease forms, and body imagery.
backend/scripts/setup-disease-taxonomy.js - Migrations and demo seed · Migrates images and approvals, then seeds demo registry data.
backend/scripts/seed-demo-data.js
Other components
- Development runner · Starts the API and Vite client.
run-dev.js
Connections 25
- Development runner → Client bootstrap: starts client
- Development runner → HTTP API: starts API
- Client bootstrap → Application shell: mounts
- Application shell → Hospital case workflow: routes to
- Application shell → Research export workflow: routes to
- Application shell → Administration workflow: routes to
- Hospital case workflow → Client identity validation: validates identity
- Hospital case workflow → HTTP API: patient and case requests
- Research export workflow → HTTP API: export requests
- Administration workflow → HTTP API: management requests
- Public surveillance UI → Bangladesh geography: renders geography
- Public surveillance UI → HTTP API: aggregate queries
- HTTP API → Authentication and roles: authorizes
- HTTP API → Server identity validation: enforces validation
- HTTP API → Disease and field catalogs: uses definitions
- HTTP API → Oracle connection layer: queries through
- Oracle connection layer → Oracle database: connects to
- Oracle database → Case integrity package: executes
- Oracle database → Surveillance statistics: executes
- Oracle database → Research export package: executes
- Schema and trigger setup → Oracle database: bootstraps schema
- Domain form provisioning → Oracle database: provisions forms
- Migrations and demo seed → Oracle database: evolves and populates
- Surveillance statistics → Public surveillance UI: aggregate results
- Research export package → Research export workflow: anonymized exports