Logo Lanfrica

bentheaya/NutriLogic-Expert-System

Domaine:

healthcare

Type de record:

software
Créateur:
ben
Hôte:
A hybrid Neuro-Symbolic Expert System for personalized nutrition and fitness in Kenya. It combines symbolic logic (Prolog) with a Django/React shell to provide explainable, culturally-sensitive health recommendations based on the MOH 2025 Kenya Nutrient Profile Model. # NutriLogic Expert System A **symbolic expert system** for personalised nutrition recommendations in Kenya. It combines SWI-Prolog inference (MOH 2025 Kenya Nutrient Profile Model rules) with a Django REST API and React UI. > Recommendations are driven by the **condition or symptoms** you submit. Profile fields (age, weight, county, etc.) are stored for the account but are **not** yet used by the inference engine. ## Architecture ``` React (Vite) → Django REST + JWT → pyswip → SWI-Prolog (prolog/kb.pl) ↓ SQLite / PostgreSQL (users, profiles, recommendation history) ``` | Layer | Path | Role | |-------|------|------| | Frontend | `frontend/` | SPA dashboard | | API | `backend/` | Auth, profile, history, gateway | | Domain constants | `backend/nutrition/domain.py` | Shared vocab for validation | | Services | `backend/nutrition/services.py` | Application orchestration | | Bridge | `backend/nutrition/prolog_bridge.py` | Thread-safe Prolog adapter | | Knowledge base | `prolog/kb.pl` | Facts + rules | ## Prerequisites - Python 3.12+ - Node.js 20+ - SWI-Prolog (for live inference; API tests mock it) ```bash # Debian/Ubuntu sudo apt-get install swi-prolog ``` ## Backend setup ```bash cd backend python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt # Optional: copy and edit env cp .env.example .env export DJANGO_DEBUG=True # default; allows dev SECRET_KEY fallback python manage.py migrate python manage.py runserver ``` API base: `localhost` ### Important environment variables | Variable | Notes | |----------|--------| | `DJANGO_SECRET_KEY` | **Required** when `DJANGO_DEBUG=False` | | `DJANGO_DEBUG` | Default `True` for local dev | | `DJANGO_ALLOWED_HOSTS` | Space-separated hosts | | `DJANGO_CORS_ORIGINS` | Comma-separated browser origins | | `DATABASE_URL` | Optional; enables PostgreSQL via `dj-database-url` | ## Frontend setup ```bash cd frontend npm install # optional: export VITE_API_URL=localhos

Licenses