From de74a6d0284dd013cebcf32ba4eeeaf3c8e02fd7 Mon Sep 17 00:00:00 2001 From: Tori Champagne Date: Mon, 6 Apr 2026 21:10:40 -0400 Subject: [PATCH 1/3] Update CreateTables.py to include fed reg docs --- postgres/CreateTables.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/postgres/CreateTables.py b/postgres/CreateTables.py index 3c470ef..fac4d4f 100644 --- a/postgres/CreateTables.py +++ b/postgres/CreateTables.py @@ -131,6 +131,33 @@ def create_documents_table(conn: psycopg.Connection): """ _create_table(conn, query, "documents") +def create_federal_register_docs_table(conn: psycopg.Connection): + query = """ + CREATE TABLE federal_register_documents ( + document_number VARCHAR(50) NOT NULL PRIMARY KEY, + document_id VARCHAR(50), + document_title TEXT, + document_type VARCHAR(50), + abstract TEXT, + publication_date DATE, + effective_on DATE, + docket_ids TEXT[], + agency_id VARCHAR(20), + agency_names TEXT[], + topics TEXT[], + significant BOOLEAN, + regulation_id_numbers TEXT[], + html_url VARCHAR(2000), + pdf_url VARCHAR(2000), + json_url VARCHAR(2000), + start_page INTEGER, + title VARCHAR(50), + cfrpart VARCHAR(50), + end_page INTEGER + ); + """ + _create_table(conn, query, "federal_register_documents") + def main(): load_dotenv() @@ -155,6 +182,7 @@ def main(): create_dockets_table(conn) create_documents_table(conn) create_comments_table(conn) + create_federal_register_docs_table(conn) conn.close() From 9d67bbdb62d4c22e2cae1968a6fbf5c9c72a2e34 Mon Sep 17 00:00:00 2001 From: Tori Champagne Date: Mon, 6 Apr 2026 21:17:14 -0400 Subject: [PATCH 2/3] Update DropTables.py to include fed reg docs table --- postgres/DropTables.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/postgres/DropTables.py b/postgres/DropTables.py index aa9c84e..8c5f204 100644 --- a/postgres/DropTables.py +++ b/postgres/DropTables.py @@ -43,6 +43,9 @@ def drop_dockets_table(conn: psycopg.Connection): def drop_documents_table(conn: psycopg.Connection): _drop_table(conn, "documents") +def drop_fed_reg_docs_table(conn: psycopg.Connection): + _drop_table(conn, "federal_register_documents") + def main(): load_dotenv() @@ -69,6 +72,7 @@ def main(): drop_comments_table(conn) drop_dockets_table(conn) drop_documents_table(conn) + drop_fed_reg_docs_table(conn) conn.close() From df8786dccb126d42484864aafc3776783e697e95 Mon Sep 17 00:00:00 2001 From: Tori Champagne Date: Tue, 7 Apr 2026 21:02:57 -0400 Subject: [PATCH 3/3] Update name of documents table to match prod --- postgres/CreateTables.py | 11 ++++++++--- postgres/DropTables.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/postgres/CreateTables.py b/postgres/CreateTables.py index fac4d4f..8e027cc 100644 --- a/postgres/CreateTables.py +++ b/postgres/CreateTables.py @@ -84,7 +84,7 @@ def create_dockets_table(conn: psycopg.Connection): def create_documents_table(conn: psycopg.Connection): query = """ - CREATE TABLE documents ( + CREATE TABLE documentsWithFRDoc ( document_id VARCHAR(50) NOT NULL PRIMARY KEY, document_api_link VARCHAR(2000) NOT NULL UNIQUE, address1 VARCHAR(200), @@ -126,10 +126,15 @@ def create_documents_table(conn: psycopg.Connection): document_title VARCHAR(500), topics VARCHAR(250)[], is_withdrawn BOOLEAN DEFAULT FALSE, - postal_code VARCHAR(10) + postal_code VARCHAR(10), + frdocnum VARCHAR(50), + attachments_self_link VARCHAR(2000), + attachments_related_link VARCHAR(2000), + file_formats JSONB, + display_properties JSONB ); """ - _create_table(conn, query, "documents") + _create_table(conn, query, "documentsWithFRDoc") def create_federal_register_docs_table(conn: psycopg.Connection): query = """ diff --git a/postgres/DropTables.py b/postgres/DropTables.py index 8c5f204..78eb7ad 100644 --- a/postgres/DropTables.py +++ b/postgres/DropTables.py @@ -41,7 +41,7 @@ def drop_dockets_table(conn: psycopg.Connection): def drop_documents_table(conn: psycopg.Connection): - _drop_table(conn, "documents") + _drop_table(conn, "documentsWithFRDoc") def drop_fed_reg_docs_table(conn: psycopg.Connection): _drop_table(conn, "federal_register_documents")