This repository contains a Proof of Concept (POC) for tracking therapy progress, designed as part of the Machine Learning Engineer assignment. The project aims to provide an intuitive interface and a robust AI-driven backend to analyze therapy sessions and assess a patient's progress over time.
- A simple, user-friendly web interface built with FastAPI and Jinja2 templates.
- Allows therapists to:
- Create and manage client profiles.
- Upload structured therapy session data in JSON format.
- Compare sessions to assess progress.
- Employs advanced AI techniques to:
- Analyze session data.
- Generate meaningful insights into therapy progress.
- Present results in a structured and actionable format.
- Based on predefined therapy templates: GAD-7, PHQ-9, BDI-II, HADS, PSS, WHO-5, PANSS, PSQI, AUDIT, CGI-S, Y-BOCS, BAI, MADRS, SF-36
- Leverages LangChain, LangFuse, and OpenAI GPT models for assessing and tracking client progress.
| Component | Technology |
|---|---|
| Backend Framework | FastAPI |
| Database | PostgreSQL (via SQLModel) |
| AI Tools | LangChain, LangGraph, LangFuse, OpenAI GPT |
| Frontend | Jinja2 Templates, Vanilla JS, CSS |
| Containerization | Docker, Docker Compose |
- Tabs:
- Manage Sessions: Create clients, upload sessions, and view session details.
- Compare Progress: Select two sessions and generate progress insights.
- Interactive Forms:
- Client creation.
- Session upload.
- Session comparison.
- Dynamic Features:
- Fetch and display client sessions.
- Display detailed session summaries and clinical assessments.
- Agents:
- An
Agentclass implemented as a singleton to ensure efficient and consistent AI interactions. - Uses a state graph to manage AI workflows.
- An
- Session Comparison:
- Extracts and compares session data to identify trends in symptom severity and frequency.
- Produces structured outputs, including a progress summary and reasoning.
progress_tracker/
├── app/
│ ├── core/ # Core application logic
│ │ ├── agent/ # AI Agents and State Management
│ │ ├── settings.py # Environment settings
│ ├── models/ # Database models
│ ├── routes/ # FastAPI routes
│ ├── schemas/ # Data validation schemas
│ ├── static/ # JavaScript and CSS
│ ├── templates/ # HTML templates
│ ├── dependencies.py # Dependency injections
│ ├── main.py # Application entry point
├── .dockerignore # Docker ignore file
├── Dockerfile # Docker build configuration
├── pyproject.toml # Project dependencies
├── docker-compose.yml # Docker Compose configuration
git clone https://github.com/your-private-repo/therapy-tracker.git
cd therapy-tracker- Create a
.envfile in the root directory with the following: - Create a
progress_tracker.envfile in theprogress_tracker/directory with the following:
Use Docker Compose to build and start the application.
docker-compose up --buildVisit http://localhost:8000 in your browser.
- Create a new client.
- Upload structured JSON files for client sessions.
- View details of all uploaded sessions.
- Select a client and two of their sessions.
- Submit the comparison form to generate progress insights.
- Session Analysis:
- Decomposes session data into meaningful components using LangChain and LangGraph.
- Scores symptom metrics (e.g., severity, frequency).
- Progress Evaluation:
- Analyzes trends across sessions using predefined templates and prompts.
- Outputs progress assessments with reasoning.
- State Management:
- Implements a state graph for structured workflow execution.
- Node Functions:
process_sessions: Prepares session data for analysis.generate_score: Computes symptom scores.compare_progress: Synthesizes insights into overall progress.
- Implements tab-based navigation for simplicity.
- Employs dynamic session rendering with JavaScript.
For any questions or feedback, please reach out to:
- Andreas Sapountzis
- Email: sapountzis.andreas@gmail.com
This project is for evaluation purposes only and is not intended for production use.