Mosqlimate-project / Data-platform

Mosqlimate data Platform.
GNU General Public License v3.0
6 stars 6 forks source link

[Viz] Create a hashable ID for Predictions to improve comparison #153

Closed luabida closed 8 months ago

luabida commented 8 months ago

While updating the Model specs I've wondered if it wouldn't be good to have a predefined identifier that would be responsible for comparing different Predictions. These IDs would be generated according to the required visualization specs (i.e. ADM_level, disease, geocode, ini/end prediction date, etc) and would be comparable to each other.

Each spec would've a translation table to digits and/or letters and the IDs would follow a fixed format in which the information will be extracted and decomposed back to its specs if needed.

The Dashboard selection boxes would be responsible for composing the part of an ID in which would then create a filter query to retrieve the Predictions to be shown

luabida commented 8 months ago

Example:

disease = {
    "dengue": "01",
    "zika": "02",
    "chikungunya": "03"
}

time_resolution = {
    "day": "D",
    "week": "W",
    "month": "M",
    "year": "Y",
}

adm_level = {
    0: "NA",
    1: "ST",
    2: "MU",
    3: "SM",
}

spatial = {
    False: 0,
    True: 1
}

temporal = {
    False: 0,
    True: 1
}

categorical = {
    False: 0,
    True: 1
}

geocode = Prediction.adm_2_geocode

ini_date = Timestamp(Prediction.date_ini_prediction)

end_date = Timestamp(Prediction.date_end_prediction)

# Example
# 01DMU-110-3304557-1388775707-1704301311
# dengue/daily/adm2 - spatio-temporal quantitative - Rio de janeiro - Jan 03 2014 until Jan 03 2024
luabida commented 8 months ago

Done in #143