Threads

Designing databases for uncertain and relative dates

8 tweets · March 2020 · 6 likes · 0 retweets · read on Twitter

Replying to mix irving @whimful ·

Challenge : how can I store dates which allow me to store varying precision e.g. 1991 (unspecified month/ day/ time) e.g. 8am March 1st, 2020 UTC This is for whakapapa records in #ahau

@whimful Cool challenge! Seems like actually 3 questions: 1. how to store in db in a way that allows machine-sorting of which events came before others 2. how to represent an individual date to users in ways that feel accurate (including uncertainty) 3. how to relate 1 & 2

@whimful If you only needed 2, you could just use arbitrary strings ("the first full moon after the frost" ✓) If you only needed 1, you could just use fake timestamps, maybe with an additional "confidence interval" or "range" or something. So in some sense the challenge is the bothness

@whimful One other interesting thing, given the context here, is that you may end up with instances where you know more about the relative dates of some events than the absolute dates. Eg age ordering of siblings, & maybe roughly the age difference... but not know which decade born in.

@whimful An approach: Store 1 & 2 completely separately. When the user enters a string for 2, calculate a guess for 1, & display & confirm it, maybe next to some related events. So they say "B born fall 1906" & it shows that as a range next to "hot summer of 1906" & "C died winter 1907"

@whimful Another piece of approach: You might discover that for some dates the time-of-year is known more precisely than which year it is. That's true of how my memory works sometimes, and also makes sense—seasons are more different from each other than one year from the next.

@whimful So a single "range" might be inadequate. You might need the db to actually store separately - "time of year" - "year" (year might be a wide range, even if the time of year is precisely winter solstice) "D was born on the darkest day, 3 generations ago"

@whimful I actually think that this kind of design thinking is something that's missing from many modern apps too! It's relevant to human memory, even if data has exact date. I'd love to be able to search   `keyword + timeOfYear:{May,June,July}` in photos, email, tweets, &+

@whimful Or "show me all photos I took between 9am and noon in the last year" (maybe I vaguely recalling that the photo I'm looking for was taken in the morning) Or "show me tweets about rhizomes from days I also tweeted about self-reference"