Skip to content

Commit

Permalink
[res] stare URL pro ciselniky (#297)
Browse files Browse the repository at this point in the history
Meli jsme stare URL, ktere uz nejsou aktualni. Podle dokumentace jsem
doplnit staronove URL.

https://www.czso.cz/csu/czso/registr-ekonomickych-subjektu-otevrena-data-dokumentace
  • Loading branch information
kokes authored Jun 17, 2024
1 parent d50f5d9 commit 3e7acb2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions data/res/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
CLS_URLS = [
CLS_BASE_URL + j
for j in (
# pro pravni formy potrebujem historicka i aktualni data
"?kodcis=56&typdat=0&datpohl=31.12.2021&cisjaz=203&format=2&separator=%2C",
"?kodcis=56&typdat=0&cisjaz=203&format=2&separator=%2C",
"?kodcis=109&typdat=0&cisjaz=203&format=2&separator=%2C",
"?kodcis=149&typdat=0&cisjaz=203&format=2&separator=%2C",
"?kodcis=149&typdat=0&datpohl=31.12.2021&cisjaz=203&format=2&separator=%2C",
"?kodcis=572&typdat=0&cisjaz=203&format=2&separator=%2C",
"?kodcis=579&typdat=0&cisjaz=203&format=2&separator=%2C",
"?kodcis=51&typdat=0&cisjaz=203&format=2&separator=%2C",
Expand All @@ -23,15 +28,6 @@
CLS_URLS.extend(
[
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=CZ_NACE_RES",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=56",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=149",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=109",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=572",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=579",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=51",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=5161",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=73",
"https://vdb.czso.cz/opendata/ciselniky/polozky?kod=564",
]
)

Expand Down Expand Up @@ -111,7 +107,9 @@ def main(outdir: str, partial: bool = False):
logging.info("Nacitam %s", cls_url)
with open_remote_gzipped(cls_url, partial) as r:
cr = csv.DictReader(r)
nrows = 0
for row in cr:
nrows += 1
# jsou dva typy ciselniku, tak musime nacitat hodnoty z ruznych klicu
kodcis = row.get("KODCIS", row.get("kodcis", row.get("ciselnik")))
chodnota = row.get(
Expand All @@ -124,6 +122,9 @@ def main(outdir: str, partial: bool = False):

cls_data[(int(kodcis), chodnota)] = text

if nrows == 0:
raise ValueError(f"prazdny soubor {cls_url}")

logging.info("Ciselniky hotove")

for url, filename in [DATA, NACE]:
Expand Down

0 comments on commit 3e7acb2

Please sign in to comment.