codersforcauses / poops

A progressive web app to help volunteers track their volunteering activities, register vet concerns and log incident reports. Documentations: https://codersforcauses.github.io/poops
https://poops.vercel.app/
MIT License
23 stars 5 forks source link

Add vet concerns to notes #180

Closed junhyap closed 1 year ago

junhyap commented 1 year ago

Is your feature request related to a problem? Please describe. Vet concerns are currently not added to the notes of the specific visit.

Describe the solution you'd like Vet concerns should be added to the notes of the specific visit. And also add the vet concerns to a collection called vet_concerns. The schema for the document should be:

/vet_concerns
  /{vet_concern}
    - user_uid: string
    - user_name: string
    - user_email: string
    - user_phone?: integer
    - client_name: string
    - pet_name: string
    - visit_time: timestamp
    - visit_id: string
    - detail: string
    - created_at: timestamp

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

github-actions[bot] commented 1 year ago

Branch i180-add_vet_concerns_to_notes created!

justinliangg commented 1 year ago

@skyheat @NicholasChoong In #157, the vet concern frontend form takes in additional info. Should I remove them and follow this schema or would you like to add the extra info? Additionally, should I also add the visitId to the schema?

image

NicholasChoong commented 1 year ago

@skyheat @NicholasChoong

In #157, the vet concern frontend form takes in additional info. Should I remove them and follow this schema or would you like to add the extra info? Additionally, should I also add the visitId to the schema?

image

Yours is better and yea add the visit id and the visit date or time stamp.

justinliangg commented 1 year ago

@NicholasChoong Looking at the schema again, is it necessary to add the visit date, petnames, email and username when we are already storing the visitId, userId? Having the extra info will reduce extra reads later when displaying the concerns later, but I feel like that might affect the integrity of the data when somebody changes any of the visit or user info.

NicholasChoong commented 1 year ago

Firebase recommends us to denormalise our database which means storing redundant info to speed up read. The way to tackle that problem you mentioned is to create a function that will edit the other documents that is related to the edited document. Hmm, im not sure which is more cost effective though. A trigger function that updates multiple documents but will only require one read to access the incident/vet concern or a relation table that requires 2 read to access the docs.

NicholasChoong commented 1 year ago

I have updated the schema but feel free to experiment with it.

justinliangg commented 1 year ago

Firebase recommends us to denormalise our database which means storing redundant info to speed up read. The way to tackle that problem you mentioned is to create a function that will edit the other documents that is related to the edited document. Hmm, im not sure which is more cost effective though. A trigger function that updates multiple documents but will only require one read to access the incident/vet concern or a relation table that requires 2 read to access the docs.

I think accessing the docs would be more cost efficient compared to the trigger since we have more reads than writes. I will follow the schema for now, should be easy to change in the future if we need to.

justinliangg commented 1 year ago

I have updated the schema but feel free to experiment with it.

Thanks! :)