From c26cf3ec18c43cc389d04d3b31b80c25c700ffae Mon Sep 17 00:00:00 2001 From: Jesse Mortenson Date: Fri, 21 Mar 2025 17:55:48 -0500 Subject: [PATCH 1/3] Bill Versions: expose classification property --- api/db/models/bills.py | 1 + api/schemas.py | 1 + 2 files changed, 2 insertions(+) diff --git a/api/db/models/bills.py b/api/db/models/bills.py index b41644f..444ef75 100644 --- a/api/db/models/bills.py +++ b/api/db/models/bills.py @@ -167,6 +167,7 @@ class BillDocument(DocVerBase, Base): class BillVersion(DocVerBase, Base): __tablename__ = "opencivicdata_billversion" + classification = Column(String) links = relationship("BillVersionLink", back_populates="version") diff --git a/api/schemas.py b/api/schemas.py index da19841..0615602 100644 --- a/api/schemas.py +++ b/api/schemas.py @@ -294,6 +294,7 @@ class BillDocumentOrVersion(BaseModel): id: UUID = Field(..., example="f0049138-1ad8-4506-a2a4-f4dd1251bbba") note: str = Field(..., example="Latest Version") date: str = Field(..., example="2020-10-01") + classification: str = Field(..., example="amendment") links: List[BillDocumentLink] class Config: From 774268115a80a05f10c19c7dfb4cd90288db79ee Mon Sep 17 00:00:00 2001 From: Jesse Mortenson Date: Fri, 21 Mar 2025 17:58:42 -0500 Subject: [PATCH 2/3] Upgrade actions-cache action --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf20861..336ef71 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,7 @@ jobs: - name: install Poetry uses: snok/install-poetry@v1.3.3 - name: cache Poetry virtualenv - uses: actions/cache@v2 + uses: actions/cache@v4 id: cache with: path: ~/.virtualenvs/ From 2667670a79222e6f0219fae1fd01499e3021b19c Mon Sep 17 00:00:00 2001 From: Jesse Mortenson Date: Fri, 21 Mar 2025 18:28:16 -0500 Subject: [PATCH 3/3] Also expose classification on Documents since code is intermingled --- api/db/models/bills.py | 1 + api/tests/fixtures.py | 4 ++-- api/tests/test_bills.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/db/models/bills.py b/api/db/models/bills.py index 444ef75..dfadd39 100644 --- a/api/db/models/bills.py +++ b/api/db/models/bills.py @@ -161,6 +161,7 @@ class DocumentLinkBase(PrimaryUUID): class BillDocument(DocVerBase, Base): __tablename__ = "opencivicdata_billdocument" + classification = Column(String) links = relationship("BillDocumentLink", back_populates="document") diff --git a/api/tests/fixtures.py b/api/tests/fixtures.py index 1f6e488..4978666 100644 --- a/api/tests/fixtures.py +++ b/api/tests/fixtures.py @@ -91,13 +91,13 @@ def create_test_bill( for n in range(sources): yield BillSource(bill=b, url="https://example.com/source", note="") for n in range(versions): - bv = BillVersion(bill=b, note=f"Version {n}", date="2020") + bv = BillVersion(bill=b, note=f"Version {n}", date="2020", classification="") yield bv yield BillVersionLink( version=bv, url=f"https://example.com/{n}", media_type="text/html" ) for n in range(documents): - bd = BillDocument(bill=b, note=f"Version {n}", date="2020") + bd = BillDocument(bill=b, note=f"Version {n}", date="2020", classification="") yield bd yield BillDocumentLink( document=bd, url=f"https://example.com/{n}", media_type="text/html" diff --git a/api/tests/test_bills.py b/api/tests/test_bills.py index f82f78f..3253bea 100644 --- a/api/tests/test_bills.py +++ b/api/tests/test_bills.py @@ -210,6 +210,7 @@ def test_bills_include_documents_versions(client): "note": "Version 0", "date": "2020", "links": [{"media_type": "text/html", "url": "https://example.com/0"}], + "classification": "", } for doc in b["documents"]: