CouncilDataProject / cdptools_v2

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

admin/minutes-item-vote-event-minutes-item-schema #139

Closed isaacna closed 4 years ago

isaacna commented 4 years ago

Pull request recommendations:

Thanks for contributing!

tohuynh commented 4 years ago

Can we combine minutes_item and event_minutes_item into just minutes_item? Seems like there's some overlap between the two. Is there a reason why the two are separated?

isaacna commented 4 years ago

Can we combine minutes_item and event_minutes_item into just minutes_item? Seems like there's some overlap between the two. Is there a reason why the two are separated?

They are separated since event_minutes_item refers to a specific instance of a use of a minutes_item in an event.

I think combining them could make a minutes_item instance to get bloated and hard to link to vote, because votes can happen on the same minutes_item over multiple events with different decisions.

@JacksonMaxfield has a better understanding of the context so could give some more input

tohuynh commented 4 years ago

They are separated since event_minutes_item refers to a specific instance of a use of a minutes_item in an event.

I think combining them could make a minutes_item instance to get bloated and hard to link to vote, because votes can happen on the same minutes_item over multiple events with different decisions.

@JacksonMaxfield has a better understanding of the context so could give some more input

I see. I just worry about one query. In the details tab of the event details page. To display the details tab we would query event_minutes_item using event_id. For the event_minutes_item that are matter-related, we have everything we need (matter_name and matter_title). But for non-matter event_minutes_item we would have to query minutes_item to get the name field. That's maybe around 5 more queries. It's no big deal though.

isaacna commented 4 years ago

But for non-matter event_minutes_item we would have to query minutes_item to get the name field. That's maybe around 5 more queries. It's no big deal though.

If that's the case and too many joins are a concern then we could just add minutes_item_name (and any other data needed for quick access) in the event_minutes_item table like this:

minutes_item: {
    minutes_item_id: str
    minutes_item_name: str
}

Since this is a non-relational database I think having duplicated data is preferred over having excessive joins from a performance and design view.