Skip to content

About

A Django application that ingests Federal Register regulatory documents (e.g., EPA rules), auto-embeds them, and enables semantic Q&A search over them using MongoDB Atlas Vector Search.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Regulations QA

A Django application that ingests Federal Register regulatory documents (e.g., EPA rules), auto-embeds them, and enables semantic Q&A search over them using MongoDB Atlas Vector Search.

Documents are stored as plain text, MongoDB Atlas automatically generates and manages the embeddings for the abstract field via Atlas vector search index's built-in embedding model, so there's no separate embedding service or API call to maintain.

Requirements

Setup

  1. Clone the repo and create a virtual environment:

    python -m venv .venv
    source .venv/bin/activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Create a .env file in the project root with the following variables:

    SECRET_KEY=your-django-secret-key
    MONGODB_URI="mongodb+srv://<username>:<password>@<cluster>.mongodb.net/?appName=documents"
    DB_NAME=your-database-name
    VECTOR_INDEX_NAME=your-vector-index-name
  4. Apply migrations:

    python manage.py migrate

Usage

Ingest documents

Fetch regulatory documents from the Federal Register API and save them to MongoDB:

python manage.py ingest_federal_register --agency environmental-protection-agency --limit 100
  • --agency: Federal Register agency slug (default: environmental-protection-agency)
  • --limit: maximum number of documents to save

No embedding step is required here because once documents land in the collection, MongoDB Atlas's vector search index auto-embeds the abstract field in the background.

Search documents

Run a plain-text semantic search over the ingested documents:

python manage.py search_docs "What are the emissions standards for diesel engines?"

The question text is passed directly to $vectorSearch — MongoDB auto-embeds the query using the index, so no query vector or external embedding call is needed. Results are ranked by vector search score and show the document number and title.

Project structure

NB: The Data used comes from the Federal Register, which publishes US government documents. This project is independent and not affiliated with or endorsed by the Federal Register.

About

A Django application that ingests Federal Register regulatory documents (e.g., EPA rules), auto-embeds them, and enables semantic Q&A search over them using MongoDB Atlas Vector Search.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages