greenelab / word-lapse

Explore how a word changes over time
https://greenelab.github.io/word-lapse/
Other
6 stars 3 forks source link

Return changepoints as tuple #21

Closed falquaddoomi closed 2 years ago

falquaddoomi commented 2 years ago

Comes from discussion in issue #19. Currently, changepoints are returned from the API as a hyphen-delimited string, i.e. "2000-2001". Instead, they should be returned as a tuple (or a Javascript tuple-equivalent), i.e. ("2000", "2001").

vincerubinetti commented 2 years ago

Perhaps the changepoint structure can just be like this:

{
  ...
  "changepoints": [
    ["2019", "2020"],
    ["2002", "2003"]
  ],
   ...
}

as well, instead of the changepoint_idx (not sure if that has special meaning but it seems like it could be gotten rid of).

When you do this, can you update this line at the frontend at the same time:

https://github.com/greenelab/word-lapse/blob/main/app/src/api.js#L48

or ping me to do it.

danich1 commented 2 years ago

not sure if that has special meaning but it seems like it could be gotten rid of)

It was only to indicate when a changepoint occurred. You can remove if you think this is a better way to do it.

falquaddoomi commented 2 years ago

Closed by #22 .