ChatDB
A natural-language interface to an NBA database. I built the data preparation pipeline, SQL generation, and a Streamlit interface that shows the query alongside its explanation.
View source on GitHubThe question
How can someone explore an NBA database without knowing its schema or writing SQL? ChatDB connects conversational requests to a structured dataset while showing the database query behind the answer.
From box scores to a database
The data pipeline collects and cleans traditional and advanced box scores, removes duplicate columns and rows, and merges the results into tables with primary keys. Preparing that structure gives query generation a concrete schema to work against.
Making generated queries inspectable
A regex-based intent classifier separates query, exploration, and modification requests. The language model receives table, column, and example-query context, then generates SQL with an explanation. The Streamlit interface keeps that translation visible rather than presenting an answer without its source.
Treating writes differently
Modification queries receive additional safety validation. A read and a destructive operation have different consequences, so routing them separately is an important part of the design. This remains a project implementation, not a guarantee that model-generated SQL is safe for arbitrary production databases.