Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate away from arbitrary reference dates #2140

Closed
6 tasks
sophiamersmann opened this issue Apr 25, 2023 · 2 comments
Closed
6 tasks

Migrate away from arbitrary reference dates #2140

sophiamersmann opened this issue Apr 25, 2023 · 2 comments

Comments

@sophiamersmann
Copy link
Member

sophiamersmann commented Apr 25, 2023

Unblocks #2007

Summary

What: Migrate away from specifying dates as the number of days since an arbitrary reference date that is either chosen by an author or defaulting to 2020-01-21
Why: To make internal date representation more sane (and also to prepare for future work supporting more time intervals)
How: Substantial database migrations, plus some work in the Grapher codebase

Current state

  • Time points are represented as integers and either...
    • interpreted as years
    • interpreted as the number of days since a reference date (if the metadata field display.yearIsDay is true)
      • the reference date is either taken from display.zeroDay
      • or the default reference date is used (EPOCH_DATE): 2020-01-21

Concerns

  • Specifying dates with reference to an arbitrary date in Jan 2020 is weird/unexpected
  • Arbitrary reference dates add unnecessary complexity

Actionable plan

Step 1: Change the default reference date

  • Write a database migration: For all variables without an explicit zeroDay, set the zeroDay to the the current default date, 2020-01-21
  • Change the EPOCH_DATE in Grapher to 1970-01-01

Step 2: Clean up database and make sure all variables use the new default reference date (1970-01-01)

  • Write a database migration: For all variables with daily data, update the time column to use the new default reference date (1970-01-01)
  • Remove display.zeroDay

(optional) Step 3: Store years and dates in different columns

  • Add a new column data_values.date
  • For all variables with daily data, move time points from data_values.year to data_values.date
@marcelgerber
Copy link
Member

Makes sense!

PS: I changed display.zeroDate to display.zeroDay in the above text, which is what the field is actually called :)

@danyx23 danyx23 removed the data label Mar 12, 2024
@larsyencken larsyencken changed the title Project: Migrate away from arbitrary reference dates Migrate away from arbitrary reference dates Mar 28, 2024
@danyx23
Copy link
Contributor

danyx23 commented Jul 17, 2024

We talked abou this - it's probably a lot of work for relatively little benefit. It is probably better to concentrate on building a new, better solution for dealing with time as part of #2007 and then deprecate yearIsDay or migrate away from it if that is worthwhile.

@danyx23 danyx23 closed this as completed Jul 17, 2024
@danyx23 danyx23 reopened this Jul 17, 2024
@danyx23 danyx23 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants