Skip to content

theAkscode/MediQuery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🩺 MediQuery

A natural language interface for querying CDC chronic disease health data. Ask questions in plain English and get AI-powered answers backed by real data.

Features

  • Natural language to SQL — Type any health-related question and the app generates SQLite SQL automatically
  • Plain English answers — Results are summarized into a clear 1-2 sentence response
  • Auto charts — Bar charts are generated automatically when numeric data is returned
  • Example questions sidebar — One-click preset questions to get started quickly
  • Raw data & SQL viewer — Expandable sections to inspect the underlying data and query

Tech Stack

Layer Technology
Frontend Streamlit
Database SQLite (health.db)
LLM Qwen/Qwen2.5-72B-Instruct via Hugging Face
Data U.S. CDC Chronic Disease Indicators

Project Structure

mediquery/
├── app.py                              # Main Streamlit app
├── setup_db.py                         # Script to load CSV into SQLite
├── health.db                           # SQLite database
├── U.S._Chronic_Disease_Indicators.csv # Source dataset
├── .env                                # Environment variables (not committed)
└── README.md

Setup

1. Clone / download the project

cd mediquery

2. Install dependencies

pip install streamlit pandas requests python-dotenv transformers huggingface_hub torch

3. Add your Hugging Face token

Create a .env file in the project root:

HF_TOKEN=hf_your_token_here

Get your token at: https://huggingface.co/settings/tokens (READ permission is sufficient)

4. Set up the database

python setup_db.py

5. Run the app

python -m streamlit run app.py

Open your browser at http://localhost:8501

Example Questions

  • Which state has the highest obesity rate?
  • What is the diabetes prevalence by state?
  • Which state has the most cancer cases?
  • Show alcohol-related indicators by state
  • What are the top 5 states for asthma rates?
  • Compare mental health indicators across states

Data Source

U.S. Chronic Disease Indicators (CDI) — CDC Open Data

About

MediQuery is an AI-powered health analytics app that converts plain English health questions into SQL, runs them on a 1M+ row CDC SQLite database, and displays clean results tables. Built with Python, Streamlit, SQLite, and the Anthropic Claude API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages