PostgreSQL Database Management for US Supreme Court Data

github repo

A Java-based project to set up and manage a PostgreSQL database for US Supreme Court data. This repository includes SQL schema files, Java code for database creation and table setup, and Docker configurations for running PostgreSQL and Adminer.


Features

  • Automated creation of PostgreSQL database and tables using Java and Maven
  • SQL schema files for key Supreme Court related tables (CallNumbers, Contributors, Items, Resources, Subjects)
  • Docker Compose setup for PostgreSQL and Adminer for easy local development and management
  • Java utility class to execute SQL files and perform basic database operations

Tech Stack

  • Java 11
  • Maven for build and dependency management
  • PostgreSQL as the relational database
  • Docker and Docker Compose for containerized database and Adminer
  • Adminer for web-based database management

Getting Started

Prerequisites

  • Java 11 or higher installed
  • Maven installed
  • Docker and Docker Compose installed

Setup

  1. Clone the repository
git clone https://github.com/justin-napolitano/sup-court-postgres.git
cd sup-court-postgres
  1. Start PostgreSQL and Adminer containers
docker-compose up -d
  1. Build the Java project
mvn clean package
  1. Run the Java application to create the database and tables
mvn exec:java -Dexec.mainClass="com.createdb.Main"

Project Structure

β”œβ”€β”€ docker-compose.yml          # Docker Compose config for PostgreSQL and Adminer
β”œβ”€β”€ pom.xml                    # Maven project descriptor
β”œβ”€β”€ readme.md                  # This README file
β”œβ”€β”€ index.md                   # Notes and initial thoughts
β”œβ”€β”€ sql/                       # SQL schema files for table creation
β”‚   β”œβ”€β”€ CallNumbers.sql
β”‚   β”œβ”€β”€ Contributors.sql
β”‚   β”œβ”€β”€ Items.sql
β”‚   β”œβ”€β”€ Resources.sql
β”‚   β”œβ”€β”€ Subjects.sql
β”‚   └── Users.sql (assumed for future use)
β”œβ”€β”€ src/                       # Java source code
β”‚   └── main/java/com/createdb/
β”‚       β”œβ”€β”€ DatabaseClient.java # Utility for executing SQL and DB operations
β”‚       └── Main.java           # Main entry point for DB setup
└── target/                    # Maven build output

Future Work / Roadmap

  • Implement web server (e.g., Flask) to serve data from the PostgreSQL database
  • Develop frontend UI for browsing and querying Supreme Court data
  • Add orchestration and scaling features for production deployment
  • Expand database schema to include additional entities and relationships
  • Integrate machine learning workflows for data analysis
  • Improve error handling and logging in Java code

This project is a foundational step towards building an open-source graph of US Jurisprudence accessible via the web.

hjkl / arrows Β· / search Β· :family Β· :tag Β· :datefrom Β· :dateto Β· ~/entries/slug Β· Ctrl+N/Ctrl+P for suggestions Β· Ctrl+C/Ctrl+G to cancel
entries 201/201 Β· entry -/-
:readyentries 201/201 Β· entry -/-