Skip to content

Conversation

@dragonejt
Copy link
Contributor

Summary: Add SQLModel database models and Alembic migrations for committee meeting data

Resolves #78 : Implement Library for Data Warehouse

Description

This change introduces the foundational data layer for the committee meeting data platform using SQLModel ORM and Alembic for database migrations.

Models Added

  • Committee - Congressional committees with chamber designation (Senate/House)
  • CommitteeMeeting - Meeting events with timestamps and committee relationships
  • Recording - Video recordings from platforms like YouTube
  • Transcript - Text transcripts with source tracking (automated, YouTube, official)

Infrastructure

  • Alembic migration setup with SQLModel integration
  • Centralized database connection logic via get_database_url() supporting DATABASE_URL env var with SQLite fallback
  • Initial schema migration generated and ready to apply

Testing

Run migrations locally:

# make database migrations since last version
turbo run @ct/committee-meeting#makemigrations
# run migrations against database
turbo run @ct/committee-meeting#migrate

@dragonejt dragonejt requested a review from agurvich February 1, 2026 23:46
@dragonejt dragonejt self-assigned this Feb 1, 2026
Copilot AI review requested due to automatic review settings February 1, 2026 23:46
@dragonejt dragonejt added the enhancement New feature or request label Feb 1, 2026
@dragonejt dragonejt added the dependencies Pull requests that update a dependency file label Feb 1, 2026
@dragonejt dragonejt linked an issue Feb 1, 2026 that may be closed by this pull request
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements a foundational data layer for a committee meeting data platform using SQLModel ORM and Alembic for database migrations. It introduces database models for committees, meetings, recordings, and transcripts, along with the infrastructure to manage schema changes.

Changes:

  • Added four SQLModel database models (Committee, CommitteeMeeting, Recording, Transcript) with relationships and enum types
  • Configured Alembic migration system with initial schema migration
  • Implemented database connection utilities with environment variable support and SQLite fallback
  • Updated build configuration to support migration tasks

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
packages/committee_meeting/src/committee_meeting/committee.py Defines Committee model with Chamber enum for congressional committees
packages/committee_meeting/src/committee_meeting/committee_meeting.py Defines CommitteeMeeting model for tracking meeting events
packages/committee_meeting/src/committee_meeting/recording.py Defines Recording model with RecordingType enum for video recordings
packages/committee_meeting/src/committee_meeting/transcript.py Defines Transcript model with TranscriptSource enum for meeting transcripts
packages/committee_meeting/src/committee_meeting/connection.py Provides database connection utilities with URL configuration
packages/committee_meeting/src/committee_meeting/init.py Exports public API for the package
packages/committee_meeting/src/committee_meeting/migrations/env.py Configures Alembic environment for SQLModel integration
packages/committee_meeting/src/committee_meeting/migrations/versions/6ca51869ca35_initial_schema.py Initial database schema migration with table definitions
packages/committee_meeting/src/committee_meeting/migrations/script.py.mako Template for generating future migration scripts
packages/committee_meeting/src/committee_meeting/alembic.ini Alembic configuration file
packages/committee_meeting/pyproject.toml Adds dependencies for alembic and sqlmodel
packages/committee_meeting/package.json Adds npm scripts for migration commands
packages/committee_meeting/turbo.json Configures Turborepo tasks for migrations
packages/committee_meeting/src/committee_meeting/main.py Removed placeholder main.py file
.gitignore Adds pattern to ignore local SQLite database files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

end_time: Optional[datetime] = Field(default=None)
committee_id: Optional[str] = Field(default=None, foreign_key="committee.committee_id")
committee: Optional["Committee"] = Relationship(back_populates="meetings")
recordings: list["Recording"] = Relationship(back_populates="meeting")
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CommitteeMeeting model's relationship with Recording is defined as One-to-Many (line 32: recordings: list["Recording"]), but the README documentation describes this as a One-to-One relationship (line 98: "each meeting has exactly one recording"). Additionally, the README shows recording_id as a foreign key in CommitteeMeeting (line 28, 71), but the implementation has meeting_id as a foreign key in Recording instead. This is a significant architectural discrepancy. Clarify whether meetings can have multiple recordings or just one, and update either the code or documentation accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines 36 to 38
video_id: str = Field(default=None)
video_title: str = Field(default=None)
upload_date: datetime = Field(default=None)
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Recording model defines non-Optional fields with default=None, which creates an inconsistency between the model definition and database schema. Fields like video_id, video_title, and upload_date are typed as non-Optional (str and datetime) but have default=None. This means:

  1. The migration correctly interprets these as nullable=False in the database
  2. But the Python code will allow None values to be set, which will fail at database insertion time

Either make these fields Optional[str] and Optional[datetime] to match the default=None, or remove the default=None to enforce required values.

Suggested change
video_id: str = Field(default=None)
video_title: str = Field(default=None)
upload_date: datetime = Field(default=None)
video_id: str = Field()
video_title: str = Field()
upload_date: datetime = Field()

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

Implement Library for Data Warehouse

1 participant