Spaces:
Running
Running
Commit ยท
d91d152
1
Parent(s): d171100
update Space readme
Browse files
README.md
CHANGED
|
@@ -1,169 +1,21 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
-
|
| 10 |
-
|
| 11 |
-
## Purpose
|
| 12 |
-
|
| 13 |
-
This backend supports a maternal health application focused on:
|
| 14 |
-
- Early warning awareness for high blood pressure disorders in pregnancy
|
| 15 |
-
- Care escalation based on objective measurements
|
| 16 |
-
- Educational content delivery
|
| 17 |
-
- Connection to healthcare providers
|
| 18 |
-
|
| 19 |
-
## Non-Diagnostic Design Principles
|
| 20 |
-
|
| 21 |
-
This system is built with strict clinical safety constraints:
|
| 22 |
-
|
| 23 |
-
1. **No Diagnosis**: The system never diagnoses conditions
|
| 24 |
-
2. **No Medical Advice**: No treatment recommendations or medical guidance
|
| 25 |
-
3. **No Risk Scoring**: No probability calculations or risk percentages
|
| 26 |
-
4. **Data Minimization**: Only essential data is collected
|
| 27 |
-
5. **Escalation Bias**: When uncertain, always escalate to higher priority
|
| 28 |
-
6. **Template-Only Messaging**: No dynamic medical text generation
|
| 29 |
-
|
| 30 |
-
## Architecture
|
| 31 |
-
|
| 32 |
-
### Modular Domain-Driven Design
|
| 33 |
-
|
| 34 |
-
```
|
| 35 |
-
src/
|
| 36 |
-
โโโ auth/ # Authentication (minimal PII)
|
| 37 |
-
โโโ user-profile/ # User profile (data minimization)
|
| 38 |
-
โโโ blood-pressure/ # BP readings (neutral storage)
|
| 39 |
-
โโโ symptoms/ # Symptom tracking (atomic, non-scored)
|
| 40 |
-
โโโ care-priority/ # Care priority engine (rule-based)
|
| 41 |
-
โโโ notifications/ # Alerts (template-only)
|
| 42 |
-
โโโ education/ # Educational content
|
| 43 |
-
```
|
| 44 |
-
|
| 45 |
-
### Technology Stack
|
| 46 |
-
|
| 47 |
-
- **Framework**: NestJS with TypeScript (strict mode)
|
| 48 |
-
- **Database**: PostgreSQL (to be configured in STEP 2)
|
| 49 |
-
- **Authentication**: JWT-based
|
| 50 |
-
- **Validation**: class-validator with strict settings
|
| 51 |
-
|
| 52 |
-
## Getting Started
|
| 53 |
-
|
| 54 |
-
### Prerequisites
|
| 55 |
-
|
| 56 |
-
- Node.js 18+
|
| 57 |
-
- PostgreSQL 14+
|
| 58 |
-
- npm or yarn
|
| 59 |
-
|
| 60 |
-
### Installation
|
| 61 |
-
|
| 62 |
-
```bash
|
| 63 |
-
# Install dependencies
|
| 64 |
-
npm install
|
| 65 |
-
|
| 66 |
-
# Copy environment template
|
| 67 |
-
cp .env.example .env
|
| 68 |
-
|
| 69 |
-
# Edit .env with your configuration
|
| 70 |
-
# (Database credentials, JWT secrets, etc.)
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
### Development
|
| 74 |
-
|
| 75 |
-
```bash
|
| 76 |
-
# Start in development mode with hot reload
|
| 77 |
-
npm run start:dev
|
| 78 |
-
|
| 79 |
-
# Build for production
|
| 80 |
-
npm run build
|
| 81 |
-
|
| 82 |
-
# Start production server
|
| 83 |
-
npm run start:prod
|
| 84 |
-
```
|
| 85 |
-
|
| 86 |
-
### Testing
|
| 87 |
-
|
| 88 |
-
```bash
|
| 89 |
-
# Run unit tests
|
| 90 |
-
npm test
|
| 91 |
-
|
| 92 |
-
# Run tests in watch mode
|
| 93 |
-
npm test:watch
|
| 94 |
-
|
| 95 |
-
# Generate coverage report
|
| 96 |
-
npm test:cov
|
| 97 |
-
```
|
| 98 |
-
|
| 99 |
-
## Deployment
|
| 100 |
-
|
| 101 |
-
For persistent background tasks and cron jobs, the backend is optimized for deployment on **Hugging Face Spaces** using Docker.
|
| 102 |
-
|
| 103 |
-
- [Deployment Guide](./DEPLOYMENT.md)
|
| 104 |
-
- [Health Check API](http://localhost:3000/api/v1/health) (when running locally)
|
| 105 |
-
|
| 106 |
-
## Implementation Status
|
| 107 |
-
|
| 108 |
-
This project follows a 12-step implementation process:
|
| 109 |
-
|
| 110 |
-
### Phase 1: Foundation
|
| 111 |
-
- [x] **STEP 1**: Project Bootstrap & Architecture โ
|
| 112 |
-
- [ ] **STEP 2**: Database & ORM Setup
|
| 113 |
-
- [ ] **STEP 3**: Authentication Module
|
| 114 |
-
|
| 115 |
-
### Phase 2: Core Data Modules
|
| 116 |
-
- [ ] **STEP 4**: User Profile Module (Data Minimization)
|
| 117 |
-
- [ ] **STEP 5**: Blood Pressure Module (Neutral Handling)
|
| 118 |
-
- [ ] **STEP 6**: Symptom Module (Atomic, Non-Scored)
|
| 119 |
-
|
| 120 |
-
### Phase 3: Care Logic & Safety
|
| 121 |
-
- [ ] **STEP 7**: Care Priority Engine (Most Critical)
|
| 122 |
-
- [ ] **STEP 8**: Care Priority API Endpoint
|
| 123 |
-
- [ ] **STEP 9**: Notifications & Alerts
|
| 124 |
-
|
| 125 |
-
### Phase 4: Support & Security
|
| 126 |
-
- [ ] **STEP 10**: Education Content Module
|
| 127 |
-
- [ ] **STEP 11**: Security, Logging & Rate Limiting
|
| 128 |
-
- [ ] **STEP 12**: Final Safety Audit
|
| 129 |
-
|
| 130 |
-
## API Documentation
|
| 131 |
-
|
| 132 |
-
Once running, API documentation will be available at:
|
| 133 |
-
- Development: `http://localhost:3000/api/v1`
|
| 134 |
-
- Swagger docs: (to be added in later steps)
|
| 135 |
-
|
| 136 |
-
## Clinical Safety Commitments
|
| 137 |
-
|
| 138 |
-
Every module in this system adheres to:
|
| 139 |
-
|
| 140 |
-
1. **Deterministic Logic**: No AI/ML for medical decisions
|
| 141 |
-
2. **Transparent Rules**: All escalation rules are documented
|
| 142 |
-
3. **Conservative Defaults**: Favor care-seeking when uncertain
|
| 143 |
-
4. **Audit Trail**: All decisions are logged (without PII)
|
| 144 |
-
5. **No Diagnostic Language**: Careful wording throughout
|
| 145 |
-
|
| 146 |
-
## Regulatory Considerations
|
| 147 |
-
|
| 148 |
-
This system is designed for:
|
| 149 |
-
- NGO deployments
|
| 150 |
-
- Public health pilots
|
| 151 |
-
- Clinical partnerships
|
| 152 |
-
- Research studies
|
| 153 |
-
|
| 154 |
-
**Not intended for**:
|
| 155 |
-
- Direct-to-consumer medical diagnosis
|
| 156 |
-
- Replacement of clinical judgment
|
| 157 |
-
- Unsupervised medical decision-making
|
| 158 |
-
|
| 159 |
-
## License
|
| 160 |
-
|
| 161 |
-
ISC
|
| 162 |
-
|
| 163 |
-
## Support
|
| 164 |
|
| 165 |
-
|
| 166 |
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: MaternAlert Backend
|
| 3 |
+
emoji: ๐ฅ
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# MaternAlert Backend
|
| 12 |
|
| 13 |
+
This is the persistent backend for the MaternAlert clinical support tool.
|
| 14 |
+
It handles:
|
| 15 |
+
- ๐ **Scheduled Tasks**: Daily BP reminders and 5-day inactivity checks.
|
| 16 |
+
- ๐ **Trend Analysis**: 7-day clinical pattern detection.
|
| 17 |
+
- ๐ **Notifications**: Push alerts via Expo and high-trust HTML emails.
|
| 18 |
|
| 19 |
+
## Monitoring
|
| 20 |
+
- **Health Check**: `https://huggingface.co/spaces/Auspicious14/MaternAlert/api/v1/health`
|
| 21 |
+
- **Logs**: View the "Logs" tab in this Space to see cron job execution.
|