Skip to content

jberaunm/midwAIfe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Midwaife - Pregnancy Tracking Application

A comprehensive pregnancy tracking application with personalized meal planning, nutrition tracking, and an AI companion powered by LLMs.

image

Features

🍎 Meal Planning

  • Weekly meal planner with breakfast, lunch, dinner, and snacks
  • "Eat the Rainbow" tracking with visual progress
  • Daily nutrient summary
  • Food safety warnings for pregnancy - UK NHS compliant.
  • Drag-and-drop interface for easy meal management

πŸ€– AI Companion

  • Conversational AI assistant powered by LLMs.
  • Natural language food and meal logging
  • Sleep and symptom tracking via conversation
  • Personalized pregnancy advice and milestone information
  • Context-aware responses based on your pregnancy week

πŸ“Š Health Tracking

  • Sleep hours and quality logging
  • Symptom tracking (nausea, fatigue, etc.)
  • Daily health summaries
  • Visual indicators integrated into meal planner

🎨 User Experience

  • Light/Dark mode toggle
  • Responsive design
  • Real-time updates
  • Intuitive drag-and-drop interactions

Tech Stack

Backend

  • FastAPI - Modern Python web framework
  • PostgreSQL - Primary database
  • Google ADK - AI agent framework
  • Claude API (Anthropic) - AI conversation engine

Frontend

  • Next.js 15 - React framework
  • TypeScript - Type-safe JavaScript
  • CSS Variables - Theme system

Local Development

Backend

cd app
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload --port 8000

Frontend

cd frontend
npm install
cp .env.local.example .env.local
# Edit .env.local with your settings
npm run dev

Project Structure

midwaife/
β”œβ”€β”€ app/                      # FastAPI backend
β”‚   β”œβ”€β”€ main.py              # Application entry point
β”‚   β”œβ”€β”€ db/                  # Database connections and migrations
β”‚   β”œβ”€β”€ meals/               # Meal planning routes and services
β”‚   β”œβ”€β”€ users/               # User management
β”‚   β”œβ”€β”€ daily_logs/          # Sleep and symptom tracking
β”‚   └── midwaife/            # AI agent implementation
β”‚       β”œβ”€β”€ agent.py         # Claude agent configuration
β”‚       └── tools/           # AI agent tools
β”œβ”€β”€ frontend/                # Next.js frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   β”œβ”€β”€ components/  # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ context/     # React context (theme)
β”‚   β”‚   β”‚   β”œβ”€β”€ lib/         # API client and utilities
β”‚   β”‚   β”‚   └── globals.css  # Global styles
β”‚   └── package.json
β”œβ”€β”€ database/                # Database schemas and migrations
β”‚   β”œβ”€β”€ schema_postgresql_local.sql
β”‚   └── migrations/
β”œβ”€β”€ docker-compose.yml       # Docker orchestration
β”œβ”€β”€ .env.example            # Environment variables template
└── README.md               # This file

API Endpoints

Meals

  • GET /api/meals/foods - List all foods
  • GET /api/meals/foods?q={query} - Search foods
  • POST /api/meals/upsert - Create/update meal
  • DELETE /api/meals/{meal_id} - Delete meal

Daily Logs

  • GET /api/daily-logs/{user_id}/{date} - Get daily log
  • POST /api/daily-logs/upsert - Create/update daily log
  • DELETE /api/daily-logs/{user_id}/{date} - Delete daily log

AI Agent

  • POST /api/agent/chat - Send message to AI companion
  • GET /api/agent/greeting/{user_id} - Get daily greeting
  • GET /api/agent/messages/{user_id} - Get conversation history

Database Schema

Main Tables

  • users - User profiles and pregnancy information
  • foods - Food database with nutritional info
  • nutrients - Nutrient definitions
  • food_nutrients - Food-nutrient relationships
  • meals - User meals
  • meal_items - Meal-food relationships
  • daily_logs - Sleep and symptom tracking
  • chat_messages - AI conversation history

Environment Variables

Required

  • ANTHROPIC_API_KEY - Claude API key

Features in Detail

AI Agent Tools

The AI companion has access to specialized tools:

  • get_user_info_tool - Retrieve user profile and pregnancy week
  • get_current_week_meals_tool - View current meal plan
  • get_rainbow_summary_tool - Check rainbow color consumption
  • log_sleep_tool - Log sleep data from conversation
  • log_symptoms_tool - Log symptoms from conversation
  • get_daily_log_tool - Retrieve health logs

Meal Planning

  • Supports 5 meal types: breakfast, lunch, dinner, snacks, supplements
  • Automatic nutrient aggregation per day
  • Rainbow color tracking (5 color categories)
  • Food safety indicators for pregnancy
  • Weekly milestones and nutrition tips

Dark Mode

  • System preference detection
  • Manual toggle with persistent storage
  • Smooth theme transitions
  • Accessible contrast ratios

Acknowledgments

  • Built with Claude Code (Anthropic)
  • Powered by Claude AI
  • Nutrition data sourced from USDA and pregnancy nutrition research

About

AI companion app to track pregnancy nutrition, symptons and baby development

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors