Skip to content

AI-assisted intake and review workflow for managing invention disclosures. Inventors upload PDF documents, the backend extracts structured fields with Google Gen AI, and in-house counsel review disclosures through a tailored dashboard.

Notifications You must be signed in to change notification settings

tejas-rkd/patent-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patent AI Disclosure Platform

AI-assisted intake and review workflow for managing invention disclosures. Inventors upload PDF documents, the backend extracts structured fields with Google Gen AI, and in-house counsel review disclosures through a tailored dashboard.

Stack

  • Frontend: React + TypeScript (Vite), React Query, React Router
  • Backend: Express + TypeScript, Prisma ORM, Multer, pdf-parse, Google Generative AI SDK
  • Database: PostgreSQL

Getting Started

Prerequisites

  • Node.js 20+
  • npm 9+
  • PostgreSQL 15+
  • Google AI Studio API key (for Gemini extraction)

Repository Layout

backend/   # Express API, Prisma schema, PDF + GenAI services
frontend/  # React SPA with inventor and counsel workspaces
docs/      # Planning and design notes

Environment Setup

  1. Create backend environment file:

    cd backend
    cp .env.example .env

    Update DATABASE_URL and Google Gen AI variables. To run without Gen AI, set ENABLE_GENAI=false.

  2. Create frontend environment file:

    cd frontend
    cp .env.example .env

    Adjust VITE_API_BASE_URL if the backend runs on a different host/port.

Database Migration

cd backend
npm install
npx prisma migrate dev --name init

This generates the Prisma client and applies schema changes to your PostgreSQL instance.

Backend

cd backend
npm install               # already run in repo, repeat if needed
npm run dev               # start API with ts-node-dev (port 4000)
npm run build             # type-check and emit JS to dist

The API exposes:

  • POST /api/disclosures – upload PDF (multipart), generate docket number, persist extracted data
  • GET /api/disclosures – list disclosures (counsel role only)
  • GET /api/disclosures/:id – retrieve single disclosure
  • PATCH /api/disclosures/:id – update status/notes

Supply the caller role via x-user-role header (inventor or counsel). Uploaded PDFs are stored under backend/storage/uploads and served at /files/<filename>.

Frontend

cd frontend
npm install     # already run, repeat if needed
npm run dev     # Vite dev server (port 5173 by default)

The SPA offers:

  • Inventor workspace (/inventor): PDF upload form, dynamic inventor list, AI-generated preview.
  • Counsel dashboard (/counsel): filterable docket table, detail panel with status + notes, PDF download.

Set VITE_API_BASE_URL to match the backend (include protocol, no trailing slash). React Query handles client-side caching and refetch after mutations.

AI Extraction

The backend uses the @google/generative-ai SDK with API key authentication (Gemini models). Required env vars:

  • GOOGLE_GENAI_API_KEY
  • GOOGLE_GENAI_MODEL (default gemini-1.5-pro)
  • ENABLE_GENAI (true by default). Set to false to use deterministic fallback extraction for local development.

Generate an API key in Google AI Studio, store it securely (e.g., in .env), and ensure outbound HTTPS to generativelanguage.googleapis.com.

Testing & Verification

  • Backend type-check/build: npm run build inside backend.
  • Prisma client generation: npx prisma generate (runs automatically with migrations).
  • Frontend type-check/build: npm run build inside frontend.

Consider adding automated tests (Jest/Vitest) for docket number generation and form validation as follow-up work.

Next Steps

  • Integrate authentication (SSO or JWT) and role management.
  • Move file storage to cloud (S3/GCS) with signed URL access.
  • Add email notifications on status changes.
  • Expand analytics/reporting for disclosure throughput.

Detailed Solution & Production Readiness

For a comprehensive overview of assumptions, technical decisions, trade-offs, and the roadmap to production hardening, see SOLUTION.md.

About

AI-assisted intake and review workflow for managing invention disclosures. Inventors upload PDF documents, the backend extracts structured fields with Google Gen AI, and in-house counsel review disclosures through a tailored dashboard.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published