Covid_19: einheitliche Datenfiles der Kantone

Created on 20 Mar 2020  路  30Comments  路  Source: openZH/covid_19

Besteht die M枚glichkeit, dass wir f眉r alle Kantone ein einheitliches CSV-Format kriegen? Am besten w盲re ein Tool, welches das Format validiert vor dem Upload.

Most helpful comment

@tlorusso @metaodi I opened a PR in #30 where I added schema validation. The schema is a standard JSON Schema. It's currently incomplete.

All 30 comments

Ja, hat hohe Prio! Sollten das Format heute angleichen (inkl.
Beispiel-File). Hast du bez眉glich Validierung einen Vorschlag? WIr wollen
die H眉rden so tief wie m枚glich behalten, 'Validierung' ginge auch bei
Sichtung der Pull-Requests.

Es w盲re wahrscheinlich nicht zu aufw盲ndig, das mit einer GitHub Action und z.B. CSVLint f眉r PRs zu automatisieren.

Ich w眉rde irgendein Bash-Script machen. Seit ihr auf Linux?

@herrstucki Finde ich eine sehr gut Idee! Weisst Du wie das geht?

Hier ein awk Befehl f眉r Linux, welcher die Headers von zwei CSV Files vergleicht und die Headers anzeigt wenn sie 眉bereinstimmen:
awk 'NR==FNR{A[$1]++;next}A[$1]' COVID19_Fallzahlen_Kanton_AR_total.csv COVID19_Fallzahlen_Kanton_ZH_total.csv

@zdavatz I didn't see this issue before - I opened a PR to do automatic validation - see #24. I used a js library I found, but I'm sure it could be done with awk, I just don't have enough skills :)

Great, whatever works, works! Just has to be used. Thank you!

But, it doesn't compare the structure to some template - it just checks that all the rows are valid given the header _in the same file_

So I think what you are after can be a second step of this validation - happy to add it if you hand me a script

They are currently working on a standardised structure: https://twitter.com/OpenDataZH/status/1240934043971211264

@rokroskar are you also validating the name of the column header? If not, please do that too. Spelling has to be correct as well as the Upper and Lowercase.

With awk you do awk 'NR==FNR{A[$1]++;next}A[$1]' file_1 file_2 if they match it prints the header of the files as the header should be the same.

The advantage of using something more sophisticated like CSVLint is that you can also validate the content of each cell against a defined schema, i.e. validate numbers, date formats etc.

I could give it a shot this afternoon unless someone's already working on it!

@herrstucki certainly using something more sophisticated would be nice - at the moment there is no schema, afaik? And does CSVLint exist only as a service/API or is there a command-line tool that could be used?

@zdavatz yes we should validate the headers - what I did right now was a very quick solution to the problems caused by manual data inputs (corrupted TI data yesterday, for example). I guess that the headers, once in place, won't change much.

@rokroskar still, I would always validate them! Typos happen fast!

Could one of the maintainers (@andreasamsler @tlorusso) make the validation check mandatory for merges to master?

We're looking into it. In a first step, we will harmonize the structure of the example file as well as the cantonal files (this afternoon). In a next step, we will set up a validation process, @metaodi is thinking about doing it with CSVlinter and github actions as you suggested @herrstucki.

@tlorusso a first csv validation action was already merged in #24 - it's running on all pushes, but it's not required for merges. Even before setting up schemas etc this will catch and prevent manual edit errors.

@tlorusso @metaodi I opened a PR in #30 where I added schema validation. The schema is a standard JSON Schema. It's currently incomplete.

Lets merge it in ;). Great work.

Hi @tlorusso! Thanks for merging the PR. I noticed that right now the schema validation is a bit useless 馃槄 because a) the schema is quite incomplete and b) the files were moved.

I think two things would be useful as next steps:

  1. Change the script so that it can work with multiple schemas (probably one schema per CSV folder would make sense?)
  2. Write the schema(s)

I can do 1. and give 2. a shot, but I'm not sure what the progress on standardizing the format(s) is at the moment.

Also @rokroskar once this is working I think it would be OK to remove the schema-less validation step again?

@herrstucki @rokroskar In the 'total_fallzahlen'-Folder, the first 11 columns are now identical in each file, as this allow us to merge them. However, we want to allow for the collection of further information beyond these 11 columns, if necessary (thats why some differ in column length..). Do you guys have a suggestion? Could you help us defining a schema for the validation based on the shared columns?

By the way. Thank you all for your efforts. You guys are great!

@tlorusso OK, sounds good. I'll work on it when I find some time. Also thanks to you and everyone else for managing this effort! 馃檹

@herrstucki I would say that once the schema validation is in place, then indeed my check is not needed - I think until the schema is in-place, however, the schema validation action needs to be disabled and the simpler one verifying that at least the individual CSV files are correctly formatted should be a required status check. I've lost track a bit of the schema discussions tbh unfortunately... has it been decided to deviate from what is there atm?

The new README is good! Thank you!

We are also making great progress with completing and cleaning up the forms.
A small PoC in Python to extract the form data is already there, more feature updates can be expected today.
pls have a look and watch at:
https://github.com/lakay/COVID-19_PDF-Reporting

Testing of the forms and later of the code is greatly appreciated. We are working currently with 3 people to make fast progress, contributors are welcome to join.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sandrasurber picture sandrasurber  路  4Comments

simgraworldwide picture simgraworldwide  路  6Comments

jeanbrouille picture jeanbrouille  路  6Comments

dominikgehl picture dominikgehl  路  6Comments

Pseudomanifold picture Pseudomanifold  路  6Comments