CouncilDataProject / cdptools_v2

Tools you can use to interact with and run Council Data Project instances.
Other
7 stars 9 forks source link

admin/add-role-and-seat-collection #132

Closed tohuynh closed 4 years ago

tohuynh commented 4 years ago

Role and Seat collections proposal For Role: title can be Council Member, Council President, Chair, Vice Chair, Member, Alternate

For Seat: name can be Position 1-9 electoral_area can be District 1-7, or Citywide electoral_type can be district or at-large

Example of what it could look like: example, without the created field. The example specifically models Person 1 as being a Council Member for District 1, Council President, Chair of Housing Committee, Vice Chair of Transporation Committee.

Person 2 is a Council Member for Position 9, one of the Citywide seats.

Front end query requirements: With these designs, we could display all the current roles of a person on the person details' page. If we wanted to, we could also display all relevant persons for a body.

Also I changed the district str in Person collection to seat

isaacna commented 4 years ago

How do we query if we want to find who all the active roles are for a body? Do we just query by body_id and whether end_date is present?

I think adding an is_active boolean field could help for the same reasoning we included it in body. But if that's not a use case we really need then it's not necessary.

tohuynh commented 4 years ago

How do we query if we want to find who all the active roles are for a body? Do we just query by body_id and whether end_date is present?

I think adding an is_active boolean field could help for the same reasoning we included it in body. But if that's not a use case we really need then it's not necessary.

To get all active roles for a body, we query body_id and today's date < end_date. end_date - start_date is basically the duration of a person's role. end_date and start_date is always present and must be valid datetimes. A person's role can't be permanently ongoing.

isaacna commented 4 years ago

A person's role can't be permanently ongoing.

Ah I see, so it's because most bodies are ongoing whereas roles change more frequently right?

Also for querying by today's date < end date, do we make this assumption because we know how long a member's term will last and calculate end date? I think that's fine unless there's some type of role that doesn't have a definite end date.

tohuynh commented 4 years ago

Ah I see, so it's because most bodies are ongoing whereas roles change more frequently right?

Hmm, think of a role as a relationship between a body and a person. For example,

"role-id1": {
      "person_id": "person-id-1",
      "person_name": "Person 1",
      "title": "Council Member",
      "body_id": "city-council-id",
      "body_name": "City Council",
      "start_date": "1/1/2020",
      "end_date": "12/31/2023",
      "seat_id": "position-1-seat"
 }

means Person 1 will hold Position 1 seat on the City Council for four years. If Person 1 is elected again for another four years , we would add another row/document to the Role collection with different start and end dates. Like so:

"role-id2": {
      "person_id": "person-id-1",
      "person_name": "Person 1",
      "title": "Council Member",
      "body_id": "city-council-id",
      "body_name": "City Council",
      "start_date": "1/1/2024",
      "end_date": "12/31/2027",
      "seat_id": "position-1-seat"
 }

Usually role-id is a randomly generated guid.

Also for querying by today's date < end date, do we make this assumption because we know how long a member's term will last and calculate end date? I think that's fine unless there's some type of role that doesn't have a definite end date.

Yea, for example in Seattle, Council Members are elected to a four-year term. Council President is elected to a two-year term. I'm not sure about the dates for the other roles like Chair and Vice Chair. But they should have a definite end date.

isaacna commented 4 years ago

Gotcha that makes sense, looks good to me