A simulation API for food tracking that generates realistic data based on different user profiles.
- Clone the repository:
git clone https://github.com/YGueguen16u/sensor_api
cd sensor_api- Create a Python virtual environment:
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate- Install dependencies:
pip install -r requirements.txtsensor_api/
├── app.py # API entry point
├── requirements.txt # Project dependencies
├── fake_data/ # Data generation module
│ ├── __init__.py # Initialization and instance creation
│ ├── app_tracker.py # Meal tracking management
│ ├── sensor.py # User type classes
│ └── *.XLSX # Data files for each profile
├── tests/ # Unit tests
└── data/ # Data folder
- Start the server:
uvicorn app:app --reload- Access the API:
- Base URL:
http://localhost:8000 - Swagger Documentation:
http://localhost:8000/docs
curl "http://localhost:8000/?user_id=4&year=2024&month=07&day=18&meal_id=1"- Standard: 4 meals/day (300-800 cal/meal)
- MeatLover: Meat enthusiast (400-900 cal/meal)
- Vegetarian: Plant-based with dairy (300-700 cal/meal)
- Vegan: Strictly plant-based (250-700 cal/meal)
- Fasting: Intermittent fasting (2 meals/day, 800-1200 cal/meal)
- Random: Random eating pattern (1 meal/day, 900-4500 cal)
- Data available only from 2024 onwards
- No future data available
- Number of meals varies by user profile
- Caloric factor based on gender (1.2 for male)
Run the tests:
python -m pytest tests/- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.