Covid_19: Validate cummulative fields in CSVs

Created on 26 Mar 2020  ·  4Comments  ·  Source: openZH/covid_19

Some fields like ncumul_tested are supposed to be cummulative. Add a simple validation to check if this number is either the same or greater than the previous number or empty.

Most helpful comment

Yes that looks good.

But unfortunately not all fields starting with ncumul are _actually_ cummulative (see README for details). Can you create a PR with the updated script?

I'm anyways working on a "validation" workflow, so I'll include that there.

All 4 comments

Something like this?

https://github.com/gaberoo/covid_19/blob/validate_cumul/scripts/validate_csv.rb

The script checks all fields that start with ncumul for inconsistencies, i.e. the subsequent number is smaller than the previous one.

 ❯ ruby scripts/validate_csv.rb scripts/validate_csv_test.csv                                                                   
Error on line 1, canton BS, field ncumul_conf: 9 < 10

Yes that looks good.

But unfortunately not all fields starting with ncumul are _actually_ cummulative (see README for details). Can you create a PR with the updated script?

I'm anyways working on a "validation" workflow, so I'll include that there.

Gotcha. I’ll look into this in a bit.

So the cummulative fields are:

  • ncumul_tested
  • ncumul_conf
  • ncumul_released
  • ncumul_deceased
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pseudomanifold picture Pseudomanifold  ·  6Comments

rsalzer picture rsalzer  ·  3Comments

baryluk picture baryluk  ·  3Comments

jb3-2 picture jb3-2  ·  6Comments

tlorusso picture tlorusso  ·  6Comments