Skip to content

Commit 4f49e50

Browse files
authored
Merge pull request #11 from openstates/update-event-model
Revert change to event model
2 parents 50b05c3 + f8a3748 commit 4f49e50

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

models/event.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ MODEL (
1515
SELECT
1616
name::TEXT AS name,
1717
all_day::BOOLEAN AS all_day,
18-
NULLIF(start_date, NULL)::TIMESTAMP AS start_date,
19-
NULLIF(end_date, NULL)::TIMESTAMP AS end_date,
18+
NULLIF(start_date, '')::TIMESTAMP AS start_date,
19+
NULLIF(end_date, '')::TIMESTAMP AS end_date,
2020
status::TEXT AS status,
2121
classification::TEXT AS classification,
2222
description::TEXT AS description,

models/vote_event.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ SELECT
2121
identifier::TEXT AS identifier,
2222
motion_text::TEXT AS motion_text,
2323
motion_classification::TEXT[] AS motion_classification,
24-
NULLIF(start_date, NULL)::TIMESTAMP AS start_date,
24+
CASE
25+
WHEN CAST("start_date" AS VARCHAR) = '' THEN NULL
26+
ELSE STRPTIME(CAST("start_date" AS VARCHAR), '%Y-%m-%d')
27+
END AS start_date,
2528
result::TEXT AS result,
2629
organization::TEXT AS organization,
2730
legislative_session::TEXT AS legislative_session,

schema.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
name: TEXT
3030
all_day: BOOLEAN
3131
start_date: TIMESTAMP
32-
end_date: TEXT
32+
end_date: TIMESTAMP
3333
status: TEXT
3434
classification: TEXT
3535
description: TEXT
@@ -61,4 +61,6 @@
6161
counts: STRUCT(option TEXT, value INTEGER)[]
6262
sources: STRUCT(url TEXT, note TEXT)[]
6363
extras: JSON
64+
jurisdiction: STRUCT(id TEXT, name TEXT, classification TEXT, division_id TEXT)
65+
scraped_at: TIMESTAMP
6466
_id: UUID

0 commit comments

Comments
 (0)