Logo Lanfrica

malvina404/HOMEPHARMA

Domain:

healthcare

Record type:

software
Creator:
mal
Host:
this is a medication avialability tracking system for cameroon pharmacies with crowdsourced data and sms alert for chronic patient # MediTrack Cameroon — Node.js + Express Backend ## Quick Start ### 1. Prerequisites - Node.js ≥ 18 - MySQL 8.x running locally (or remote) - Your `medtracker` database created from the provided SQL schema ### 2. Install Dependencies ```bash npm install ``` ### 3. Configure Environment ```bash cp .env.example .env # Edit .env with your MySQL credentials ``` `.env` contents: ``` PORT=3000 DB_HOST=localhost DB_PORT=3306 DB_USER=root DB_PASSWORD=your_password DB_NAME=medtracker NODE_ENV=development ``` ### 4. Start the Server ```bash npm start # production npm run dev # with nodemon (auto-reload) ``` Server runs at: `localhost` ### 5. Run Tests ```bash npm test ``` > Tests require a live MySQL connection. They create real records and verify full round-trips. --- ## API Reference ### Health | Method | Endpoint | Description | |--------|-----------|-------------| | GET | `/health` | Server health check | --- ### Users & Roles | Method | Endpoint | Description | |--------|---------------------------------|-------------| | GET | `/api/users` | List all users | | GET | `/api/users/:id` | Get user by ID | | POST | `/api/users` | Register base user | | POST | `/api/users/patients` | Register patient (with chronic diseases) | | GET | `/api/users/patients/:id` | Get patient profile | | POST | `/api/users/providers` | Register provider (pharmacist/nurse) | | GET | `/api/users/providers/:id` | Get provider profile | | PATCH | `/api/users/:id/trust-score` | Update user trust score | **Register a Patient — example body:** ```json { "phone_number": "+237677100001", "preferred_language": "FR", "city": "Yaoundé", "region": "Centre", "gps_latitude": 3.8667, "gps_longitude": 11.5167, "default_search_radius_km": 10, "chronic_diseases": ["Type 2 Diabetes", "Hypertension"] } ``` --- ### Facilities | Method | Endpoint …