ivelascog / TimeSearcherPlus

MIT License
2 stars 1 forks source link

The way the selected values are returned is different from the input data. #15

Closed ivelascog closed 5 months ago

ivelascog commented 6 months ago

TimeSearcher+ receives all data without grouping, however, it returns the data grouped by the "id" parameter. I don't know if it would be better to return the selected data in the same format as the input data to avoid confusion.

john-guerra commented 5 months ago

I think it makes sense to return the selected ids, and then provide a way of also accessing the individual rows including the time component. But given that the data is in tidy format

id x y
a 0 10
a 1 20
a 2 10
b 0 30
b 1 20
b 2 10

It is more useful to return that a and b as selected, rather than which specific combination of id, x, y are

john-guerra commented 5 months ago

Ok, so I can think of two options:

Option 1: Return a map

Similar to what we have now

Map of timeGroupName => Map itemID => Actual input data selected

e.g.

{
"Group_Spanish_Speaking" : 
  {
    "Colombia": 
     [  { Country: "Colombia",  temp: 27, year: 2020},
        { Country: "Colombia",  temp: 26, year: 2021},
        { Country: "Colombia",  temp: 28, year: 2022}
      ],
    "España": 
     [  { Country: "España",  temp: 17, year: 2020},
        { Country: "España",  temp: 16, year: 2021},
        { Country: "España",  temp: 18, year: 2022}
      ],
    ....
  },
 ....
}

Option 2 An array of the ids, with a timeGroupName Attribute

itemID timeGroupName pointsSelected in Original data
Colombia Group_Spanish_Speaking [ { Country: "Colombia", temp: 27, year: 2020}, { Country: "Colombia", temp: 26, year: 2021}, { Country: "Colombia", temp: 28, year: 2022} ]
España Group_Spanish_Speaking [ { Country: "España", temp: 17, year: 2020}, { Country: "España", temp: 16, year: 2021}, { Country: "España", temp: 18, year: 2022} ]
ivelascog commented 5 months ago

I think that option 1 gives more options to obtain in a simple way both the Ids per group and the selected points in the original data. I will make the change, although we will probably break some notebooks and examples.

john-guerra commented 5 months ago

Let's add a selectedIds attribute in the returned value that contains the ids of the currently selected group.

Also return a selectedGroup attribute that contains the name of the currently selected group