removed LegislatorBillScore

This commit is contained in:
2026-04-21 22:48:13 -04:00
parent 1426b797e5
commit 51d6240690
6 changed files with 147 additions and 451 deletions
@@ -7,7 +7,6 @@ from pipelines.orm.data_science_dev.congress.bill import (
BillTopicPosition,
)
from pipelines.orm.data_science_dev.congress.legislator import (
LegislatorBillScore,
Legislator,
LegislatorScore,
LegislatorSocialMedia,
@@ -20,7 +19,6 @@ __all__ = [
"BillTopic",
"BillTopicPosition",
"Legislator",
"LegislatorBillScore",
"LegislatorScore",
"LegislatorSocialMedia",
"Vote",
@@ -12,7 +12,6 @@ from sqlalchemy.orm import Mapped, mapped_column, relationship
from pipelines.orm.data_science_dev.base import DataScienceDevTableBase
if TYPE_CHECKING:
from pipelines.orm.data_science_dev.congress.legislator import LegislatorBillScore
from pipelines.orm.data_science_dev.congress.vote import Vote
@@ -64,11 +63,6 @@ class Bill(DataScienceDevTableBase):
back_populates="bill",
cascade="all, delete-orphan",
)
legislator_bill_scores: Mapped[list[LegislatorBillScore]] = relationship(
"LegislatorBillScore",
back_populates="bill",
cascade="all, delete-orphan",
)
class BillText(DataScienceDevTableBase):
@@ -93,6 +87,7 @@ class BillText(DataScienceDevTableBase):
bill: Mapped[Bill] = relationship("Bill", back_populates="bill_texts")
# suport multipu summary prer bill
class BillTopic(DataScienceDevTableBase):
"""One bill stance on one topic used to score roll-call votes."""
@@ -120,8 +115,3 @@ class BillTopic(DataScienceDevTableBase):
)
bill: Mapped[Bill] = relationship("Bill", back_populates="topics")
legislator_bill_scores: Mapped[list[LegislatorBillScore]] = relationship(
"LegislatorBillScore",
back_populates="bill_topic",
cascade="all, delete-orphan",
)
@@ -11,7 +11,6 @@ from sqlalchemy.orm import Mapped, mapped_column, relationship
from pipelines.orm.data_science_dev.base import DataScienceDevTableBase
if TYPE_CHECKING:
from pipelines.orm.data_science_dev.congress.bill import Bill, BillTopic
from pipelines.orm.data_science_dev.congress.vote import VoteRecord
@@ -56,11 +55,6 @@ class Legislator(DataScienceDevTableBase):
back_populates="legislator",
cascade="all, delete-orphan",
)
bill_scores: Mapped[list[LegislatorBillScore]] = relationship(
"LegislatorBillScore",
back_populates="legislator",
cascade="all, delete-orphan",
)
class LegislatorSocialMedia(DataScienceDevTableBase):
@@ -102,40 +96,3 @@ class LegislatorScore(DataScienceDevTableBase):
score: Mapped[float]
legislator: Mapped[Legislator] = relationship(back_populates="scores")
class LegislatorBillScore(DataScienceDevTableBase):
"""Per-bill source score used to maintain aggregate legislator scores."""
__tablename__ = "legislator_bill_score"
__table_args__ = (
UniqueConstraint(
"bill_topic_id",
"legislator_id",
"year",
name="uq_legislator_bill_score_bill_topic_id_legislator_id_year",
),
Index("ix_legislator_bill_score_year_topic", "year", "topic"),
)
bill_id: Mapped[int] = mapped_column(
ForeignKey("main.bill.id", ondelete="CASCADE"),
index=True,
)
bill_topic_id: Mapped[int] = mapped_column(
ForeignKey("main.bill_topic.id", ondelete="CASCADE"),
index=True,
)
legislator_id: Mapped[int] = mapped_column(
ForeignKey("main.legislator.id", ondelete="CASCADE"),
index=True,
)
year: Mapped[int]
topic: Mapped[str]
score: Mapped[float]
bill: Mapped[Bill] = relationship(back_populates="legislator_bill_scores")
bill_topic: Mapped[BillTopic] = relationship(
back_populates="legislator_bill_scores",
)
legislator: Mapped[Legislator] = relationship(back_populates="bill_scores")