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

Add supports for models #61

Open
MihaMarkic opened this issue Dec 16, 2020 · 4 comments
Open

Add supports for models #61

MihaMarkic opened this issue Dec 16, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@MihaMarkic
Copy link
Member

Support for posting and retrieving models

Specs
Prikaz modelskih napovedi omogoča zajem in prikaz modelskih napovedi. Za posredovanje podatko sta na voljo dva API-ja:

  • API za zajem podatkov modelskih napovedi
  • API za posredovanje podatkov modelskih napovedi

API za zajem podatkov

Klienti pošljejo podatke s POST zahtevkom. Vsebina telesa zahtevka je modelska predikcija v CSV obliki, zahtevek pa mora biti opremljen še z naslednjimi query parametri:

  • id: ID modela
  • date: datum napovedi
  • signature: hash ID modela + shared secret (za zagotavljanje identite)
  • scenario: scenarij modela
  • intervalType: (INTERVAL_ZAUPANJA | VERJETNOSTNI_INTERVAL) option
  • intervalWidth: (50 | 95) option

Scenarij lahko zavzame naslednje vrednosti:

  • BREZ_NOVIH_OKUZB - Brez novih okuzb. Kaj imamo ze na “zalogi”?
  • STACINOARNO_STANJE - Stacinoarno stanje, kot je sedaj.
  • POJEMANJE_10 - 10% pojemanje (kar vi si zeleli, pa tega ni)
  • POJEMANJE_40 - 40% pojemanje kot v prvem valu
  • ODPRTJE - Scenarij, ce odpremo karanteno, ko se malo pademo in greco exponentno v 3 val.

Stolpci (polja) v CSV datoteki so: date, deceased, deceasedLowerBound, deceasedUpperBound, deceasedToDate, deceasedToDateLowerBound, deceasedToDateUpperBound, icu, icuLowerBound, icuUpperBound, hospitalized, hospitalizedLowerBound, hospitalizedUpperBound

Če se za isti model, dan, scenarij, intervalType in intervalWidth pošlje ponovno napoved se stara napoved prepiše.

Če se bodo izvorni podatki shranjevali kot CSV datoteke mora biti direktorijska/imenska sktuktura dovolj bogata in fleksibilna, da podpre različne tipe in (potencialno) njihovo evolucijo. Na primer:

//////data.json

API za posredovanje podatkov

API ponuja tri endpointe:

  • Ali so podatki za tekoči dan zaključeni (pripravljeni) (READY)
  • Seznam modelov, ki so na voljo (MODELS)
  • Podatki napovedi modelov (DATA)

Struktura API-ja:

  • /ready/ - timestamp option
  • /models/ - vrne seznam vseh aktivnih modelov
  • /models/predictions/2020-08-01/ - vrne napovedi vseh aktivnih modelov za izbrani dan

MODELS endpoint vrača JSON podatke oblike (za točnapolja glej shemo):

[
{
"id": "20540b1c-a7b6-4e45-bd57-9d60f1cdf28f",
"name": "My precious model",
"code": "https://github.com/zaplotnik/korona",
"homepage": "https://arxiv.org/pdf/2005.13282.pdf"
}
]

Podatki so lahko v JSON ali CSV obliki.

DATA endpoint vrača podatke oblike:

[
"modelId": "20540b1c-a7b6-4e45-bd57-9d60f1cdf28f",
"date": "2020-11-04",
"scenario": "(BREZ_NOVIH_OKUZB | ...)",
"interval": {
"intervalType": "(INTERVAL_ZAUPANJA | VERJETNOSTNI_INTERVAL) option",
"intervalTypeWidth": "(50 | 95) option" }
"data":
[
{
"date": "2020-08-01",
"deceased": "int",
"deceasedLowerBound": "int option",
"deceasedUpperBound": "int option",
"deceasedToDate": "int",
"deceasedToDateLowerBound": "int option",
"deceasedToDateUpperBound": "int option",
"icu": "int",
"icuLowerBound": "int option",
"icuUpperBound": "int option",
"hospitalized": "int",
"hospitalizedLowerBound": "int option",
"hospitalizedUpperBound": "int option"
}
...
]
]

Podatki so lahko v JSON ali CSV obliki.

Predlog: v obliki CSV je telo odgovora data, metapodatki modelId, date ... pa se posredujejo kot response headers.

@MihaMarkic MihaMarkic self-assigned this Dec 16, 2020
@MihaMarkic MihaMarkic added the enhancement New feature or request label Dec 16, 2020
@MihaMarkic
Copy link
Member Author

MihaMarkic commented Dec 17, 2020

@joahim @overlordtm

  1. models_prediction created and updated fields are populated by code?
    2. Is it possible to update models_prediction? And if yes, then what is the primary key in such case? Perhaps model_id, date, scenario_id? I guess not today through API, right?
  2. Do we have a test file with data?

@joahim
Copy link

joahim commented Dec 17, 2020

  1. Yes, created and updated fields are managed by the API code.
  2. Yes, the predictions can always be updated. The composite key is: (date, model, scenario, interval_kind)
  3. Yes, prediction.csv.zip

@MihaMarkic
Copy link
Member Author

Shall we then use POST for creating a new one and PUT for updating it?

@MihaMarkic
Copy link
Member Author

@joahim What does modelprediction.code property map to? Perhaps description column on entity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants