Skip to content

sudharshanreddyt/schema_forge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SchemaForge

Run the script to create the database

⁠ bash python scripts/main.py

or

Test Link - https://schema-forge.onrender.com/docs#/

Clone the repository

git clone https://github.com/sudharshanreddyt/schema_forge.git
cd schema_forge

Create a virtual environment

python -m venv venv
source venv/bin/activate

Install dependencies

pip install -r requirements.txt

Create .env file

Replace the values in the .env file with your own values

PG_DB=<db_name>
PG_USER=<db_user>
PG_PASSWORD=<db_password>
PG_HOST=<db_host>
PG_PORT=<db_port>

Project Settings

PROJECT_NAME=<project_name>

How to Run

Run the following command from the root directory of the project:

python -m uvicorn app.main:app --host 127.0.0.1 --port 8000

It will start the server at http://localhost:8000 and the API documentation at http://localhost:8000/docs

API Reference

This document provides a comprehensive overview of the available API endpoints for the SchemaForge Legal Database, including detailed example inputs for every single route.

Base URL

The API is served at: http://localhost:8000/docs


πŸ›οΈ Jurisdictions

Manage legal jurisdictions (States, Federal, International).

List Jurisdictions

  • Endpoint: GET /jurisdictions/
  • Description: Retrieve a list of jurisdictions.
  • Example Usage: GET /jurisdictions/?skip=0&limit=5

Create Jurisdiction

  • Endpoint: POST /jurisdictions/
  • Example Input:
{
  "court_name": "Supreme Court of California",
  "jurisdiction_type": "U.S. State",
  "jurisdiction_name": "California"
}

Get Jurisdiction Detail

  • Endpoint: GET /jurisdictions/{id}
  • Example Usage: GET /jurisdictions/1

βš–οΈ Cases

The core entity representing legal cases.

List Cases

  • Endpoint: GET /cases/
  • Description: Retrieve a list of cases. Skip is the number of records to skip and limit is the number of records to retrieve.
  • Example Usage: GET /cases/?skip=0&limit=3

Search/Filter Cases

  • Endpoint: GET /cases/search/
  • Description: Filter cases by various fields (case_id, slug, caption, filing_date, etc.).
  • Example Usage: GET /cases/search/?case_id=323&caption=Smith

Create Case

  • Endpoint: POST /cases/
  • Example Input:
{
  "slug": "smith-v-jones-2024",
  "record_number": 123456,
  "caption": "John Smith v. Jane Jones",
  "brief_description": "A landmark case regarding AI ethics and liability.",
  "filing_date": "2024-01-15",
  "status_disposition": "Pending",
  "published_opinion_flag": true,
  "class_action_status": "Individual",
  "researcher": "Dr. Alice Brown",
  "summary_of_significance": "First case to address algorithmic bias directly.",
  "summary_facts_activity": "Facts regarding the deployment of the biased algorithm...",
  "most_recent_activity": "Initial hearing held.",
  "most_recent_activity_date": "2024-02-10",
  "date_added": "2024-01-20",
  "last_update": "2024-02-11",
  "jurisdiction_id": 129,
  "area_ids": [129],
  "issue_ids": [129, 129],
  "cause_ids": [129],
  "algorithm_ids": [129],
  "organization_ids": [129]
}

Get Case Detail

  • Endpoint: GET /cases/{id}
  • Example Usage: GET /cases/1
  • Note: Returns nested objects for jurisdiction, dockets, documents, and taxonomy associations.

Update Case

  • Endpoint: PUT /cases/{id}
  • Example Input:
{
  "status_disposition": "Resolved",
  "most_recent_activity": "Case dismissed with prejudice.",
  "last_update": "2024-03-01",
  "area_ids": [1, 2, 3]
}

Delete Case

  • Endpoint: DELETE /cases/{id}
  • Example Usage: DELETE /cases/1
  • Warning: This will also delete all associated dockets, documents, and secondary sources due to CASCADE delete.

πŸ“‚ Dockets

Court dockets associated with cases.

List Dockets

  • Endpoint: GET /dockets/
  • Example Usage: GET /dockets/

Search Dockets

  • Endpoint: GET /dockets/search/
  • Example Usage: GET /dockets/search/?case_id=1&court=Superior

Create Docket

  • Endpoint: POST /dockets/
  • Example Input:
{
  "case_id": 1,
  "court": "California Superior Court",
  "docket_number": "CIV-2024-456",
  "link": "https://court-portal.ca.gov/case/123"
}

Get Docket Detail

  • Endpoint: GET /dockets/{id}
  • Example Usage: GET /dockets/1

Update Docket

  • Endpoint: PUT /dockets/{id}
  • Example Input:
{
  "docket_number": "CIV-2024-456-AMENDED",
  "link": "https://court-portal.ca.gov/case/123-revised"
}

Delete Docket

  • Endpoint: DELETE /dockets/{id}
  • Example Usage: DELETE /dockets/1

πŸ“„ Documents

Legal documents linked to dockets.

List Documents

  • Endpoint: GET /documents/
  • Example Usage: GET /documents/

Search Documents

  • Endpoint: GET /documents/search/
  • Example Usage: GET /documents/search/?document_type=Complaint

Create Document

  • Endpoint: POST /documents/
  • Example Input:
{
  "docket_id": 1,
  "document_type": "Complaint",
  "filing_date": "2024-01-15",
  "link": "https://storage.ca.gov/docs/complaint.pdf",
  "citation": "2024 Cal. Super. LEXIS 123"
}

Get Document Detail

  • Endpoint: GET /documents/{id}
  • Example Usage: GET /documents/1

Update Document

  • Endpoint: PUT /documents/{id}
  • Example Input:
{
  "document_type": "Amended Complaint",
  "link": "https://storage.ca.gov/docs/complaint_v2.pdf"
}

Delete Document

  • Endpoint: DELETE /documents/{id}
  • Example Usage: DELETE /documents/1

πŸ”— Secondary Sources

External sources and citations related to cases.

List Secondary Sources

  • Endpoint: GET /secondary-sources/
  • Example Usage: GET /secondary-sources/

Search Secondary Sources

  • Endpoint: GET /secondary-sources/search/
  • Example Usage: GET /secondary-sources/search/?title=Analysis

Create Secondary Source

  • Endpoint: POST /secondary-sources/
  • Example Input:
{
  "case_id": 1,
  "title": "Analysis of Smith v. Jones: AI Liability Trends",
  "link": "https://lawreview.edu/articles/ai-liability"
}

Get Secondary Source Detail

  • Endpoint: GET /secondary-sources/{id}
  • Example Usage: GET /secondary-sources/1

Update Secondary Source

  • Endpoint: PUT /secondary-sources/{id}
  • Example Input:
{
  "title": "Comprehensive Analysis of Smith v. Jones",
  "link": "https://lawreview.edu/articles/ai-liability-v2"
}

Delete Secondary Source

  • Endpoint: DELETE /secondary-sources/{id}
  • Example Usage: DELETE /secondary-sources/1

🏷️ Taxonomies

Manage categorizations for legal analytics. These categories are linked to Cases.

Areas of Application

  • GET /taxonomies/areas/: List all areas.
  • POST /taxonomies/areas/: Create area.
    { "name": "Consumer Protection" }

Issues

  • GET /taxonomies/issues/: List all issues.
  • POST /taxonomies/issues/: Create issue.
    { "name": "Algorithmic Bias" }

Causes of Action

  • GET /taxonomies/causes/: List all causes.
  • POST /taxonomies/causes/: Create cause.
    { "name": "Negligence" }

Algorithms

  • GET /taxonomies/algorithms/: List all algorithms.
  • POST /taxonomies/algorithms/: Create algorithm.
    { "name": "Predictive Policing Model v1" }

Organizations

  • GET /taxonomies/organizations/: List all organizations.
  • POST /taxonomies/organizations/: Create organization.
    { "name": "Tech Corp Inc." }
  • GET /taxonomies/organizations/search/: Search organizations by name.

πŸš€ Deployment

πŸ› οΈ Developer Tools

About

Modernizing the Database of AI Litigation (DAIL) Backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages