"""
nutriguard_api/
│
├── main.py # Application entry point
├── config.py # Configuration settings
├── database.py # Database connection
├── requirements.txt # Python dependencies
├── .env # Environment variables
│
├── models/ # Pydantic models
│ ├── patient.py
│ ├── recipe.py
│ ├── meal_plan.py
│ ├── ingredient.py
│ ├── safety.py
│ ├── nutrition.py
│ └── ai.py
│
├── routers/ # API routes
│ ├── patients.py
│ ├── recipes.py
│ ├── meal_plans.py
│ ├── inventory.py
│ ├── safety.py
│ ├── compliance.py
│ ├── nutrition.py
│ ├── alerts.py
│ ├── ai.py
│ └── system.py
│
├── services/ # Business logic
│ ├── patient_service.py
│ ├── recipe_service.py
│ ├── meal_plan_service.py
│ ├── safety_service.py
│ ├── nutrition_service.py
│ └── ai_service.py
│
└── utils/ # Utilities
├── enums.py
└── helpers.py
- Clone the repository
git clone <repository-url>
cd nutriguard_api- Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\\Scripts\\activate- Install dependencies
pip install -r requirements.txt- Configure environment
cp .env.example .env
# Edit .env with your database credentials- Run the application
python main.pyAccess the interactive API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
POST /patients- Register new patientGET /patients/{id}- Get patient detailsPOST /patients/{id}/dietary-restrictions- Update restrictionsGET /patients/{id}/nutrition-history- View nutrition timelineGET /patients/{id}/meal-plan- Get current meal plan
POST /meal-plans/generate- AI generates meal planPOST /meal-plans/{id}/images- Generate visual meal cards
GET /recipes/search- Search recipesPOST /recipes- Create new recipePOST /recipes/{id}/modify- AI modifies recipe
POST /inventory/ingredients- Log ingredient delivery
POST /safety/temperature-logs- Record temperaturePOST /safety/inspections- Log safety inspection
GET /compliance/reports- Generate compliance report
POST /nutrition/intake- Log meal consumptionGET /nutrition/analytics/{patient_id}- Get nutrition insightsPOST /nutrition/analyze-correlation- AI analyzes health outcomes
GET /alerts/dietary-violations- Get compliance alerts
POST /ai/recommend-meals- Get meal recommendationsPOST /ai/assess-risks- Assess food safety risksPOST /ai/predict-outcomes- Predict health outcomesPOST /ai/optimize-recipe- Optimize recipe for health goals
GET /- API root informationGET /health- Health checkGET /stats- System statistics
Run the development server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000