Skip to main content
Trevor Grafton

PROJECT 03 / AI

RAG Database Research

A tested FastAPI, PostgreSQL and React learning playbook, plus a planned local RAG design for a healthcare referral system.

In development
  • FastAPI
  • PostgreSQL
  • pgvector
  • React
  • Local LLMs
  • Source private: not published

Type
AI
Source
Private
Role
Author of the playbook, working with Claude Code.
Built with
FastAPI, PostgreSQL, pgvector

01 / Overview

Overview

  1. Built: a learning playbook

    A 16-chapter FastAPI, PostgreSQL and React playbook, with chapters on LLM and RAG, auth, Redis caching and testing.

  2. Planned: one referral database

    Referrals from fax, phone and email would be centralized in one PostgreSQL database.

  3. Planned: local RAG for reporting

    A RAG pipeline with hybrid search and a reranker would automate the monthly reporting.

02 / Context and problem

Context and problem

This page keeps two things apart. Built is the learning playbook, my own project made with Claude Code. Planned is the referral system, which is a design only: there is no referral code, no reranker and no running system.

03 / My role

My role

Author of the playbook, working with Claude Code. The referral system is a plan, not shipped work.

04 / How it works

How it works

  1. Built: re-run the tutorial code in three stages

    The code was re-run with 9 tests (sync CRUD), then 11 (auth and relationships), then 14 (async, Redis and RAG).

  2. Built: tests ran on SQLite and fakeredis

    The Postgres-only SQL was compiled but not run on a live server, and no real model API was called.

Planned: one database

FastAPI and PostgreSQL with pgvector, holding the referrals that arrive by fax, phone and email.

Planned: hybrid search and reranker

Hybrid search is a planned playbook chapter. The reranker is part of the referral design only.

Planned: all local

A local embedding model and a local LLM, so the data never leaves internal servers.

05 / Results and numbers

Results and numbers

16

chapters in the Built playbook

Owner-confirmedplaybook index in my notes

9, 11, 14

tests per Built stage

Owner-confirmedplaybook index in my notes

06 / Limitations

Limitations

  • Built: SQLite passing does not prove Postgres works. The Postgres-only SQL was never run on a live server, and the React snippets were never compiled.
  • Planned: no referral code, no reranker and no results exist yet.

07 / What I learned

What I learned

  • SQLite passing does not prove Postgres works, and library versions drift under tutorials, so verify by running.

08 / What's next

What's next

  • Run the RAG code on real Postgres with pgvector.
  • Add chapters on roles, multi-turn chat and hybrid search.

09 / Next project

Next project

Networked ML and RL Algorithm →