ariccio / COVID-CO2-tracker

Other
13 stars 3 forks source link

Feature: support shared devices #14

Open jaraco opened 4 months ago

jaraco commented 4 months ago

We have a device that we share between two of us. We'd like to both be able to submit readings from that device, but adding a device with an existing serial number is not allowed. Could you allow it?

jaraco commented 3 months ago

@ariccio is this something that might be possible/acceptable? If it's not going to be possible to share a device, I'll probably forge a fake serial number to enter readings from our shared device.

ariccio commented 3 months ago

Oops! I did totally miss your initial issue filing. Not sure how, I didn't even see an email. (Not your fault!)

(Typing response)

ariccio commented 3 months ago

I keep the uniqueness constraint in the code because a lot of people (not you) misunderstand the intent, and enter something like "aranet4" and that's a really easy way to reduce the noise they add.

One option that I considered in the past was enforcing uniqueness for user ownership only. This could work, but does little to deal with people entering things like "aranet4" in general.

Another option I considered was trying to enforce some sort of format for the serial number, but this has unknowns and also doesn't help prevent people adding nonsense numbers. But this would be model specific. I really only have enough data right now to make guesses about the aranet4, so I could special case that. While you're reading, does your serial number also start with 3811?

I'm starting to lean towards "unique per account" instead of globally unique. If I add in some kind of format verification, it would also only be for the aranet4. This could be a few hundred lines of code tops, so I could get to it quickly once I deal with some maintenance. I finally have end to end testing working (though I need to merge a patch upstream, oops I forgot 😅), so it shouldn't be too buggy.

I could also implement that by asking an "are you really sure you want to add another one with the same serial number?" prompt in the flow, but that would be extra complexity and I'm not even sure whether those prompts work for users.

Do you have any input on any of these? Before I implement anything, I'd be fine with you in this case entering the actual serial number plus some other identifier for yourself and your wife.

For background: The things I'm trying to balance here are a fewfold. I want to not have to go into the database manually with any regularity to clean things up. I want to keep this as a dataset that's high enough quality for anybody interested in studying indoor airborne transmission to use it with little normalization, dedication, and wrangling. I also want to keep the code simple enough that if I have a few weeks spent in the field talking to businesses on foot instead of on my laptop in vscode, that I don't get surprised by latent bugs.

jaraco commented 3 months ago

Oops! I did totally miss your initial issue filing.

No big deal. Grateful for the work you have done.

While you're reading, does your serial number also start with 3811?

No. Ours starts with 3179.

Do you have any input on any of these?

I completely understand the maintenance burden and cost of UI-managed controls. Any solution is fine to me and we're willing to append a suffix if that's the best pragmatic way forward.

I'm starting to lean towards "unique per account" instead of globally unique.

I worry this approach would fail your primary purpose for adding the constraint - as now any user could add theirs as "aranet4".

If it were me (and I'm very maintenance averse), I'd simply drop the constraint and then maybe (as the luxury of free time permits) add a regex for allowed serial numbers (defaulting to a lenient, allowing everything, and only define for aranet4 for now).

I might be willing to help develop the validation, but no promises.