From c7654f91a82f698557074c89ac59b7e36ad75df2 Mon Sep 17 00:00:00 2001 From: Emerson Rocha Date: Wed, 3 Aug 2022 07:51:50 -0300 Subject: [PATCH] 999999999_521850.py (#43): worldbank, draft of get all PS stats from topic-health --- officina/999999999/0/999999999_521850.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/officina/999999999/0/999999999_521850.py b/officina/999999999/0/999999999_521850.py index 1240b90..a14eaae 100755 --- a/officina/999999999/0/999999999_521850.py +++ b/officina/999999999/0/999999999_521850.py @@ -230,6 +230,15 @@ '#{t}+rem+i_qcc+is_zxxx+ix_iso8601v{v1}+rdf_p_wdata_p{v2}_s{trivio}+rdf_t_xsd_int': r"^#(?P[a-z0-9]{3,99})\+rem\+i_qcc\+is_zxxx\+ix_iso8601v(?P[0-9]{4})\+ix_xywdatap(?P[0-9]{1,12})" } +DATA_METHODUS = { + 'worldbank': { + # https://data.worldbank.org/topic/health?view=chart + 'health': { + 'download_url': 'https://api.worldbank.org/v2/en/topic/8?downloadformat=csv' + } + } +} + DATA_HXL_DE_CSV_REGEX = { # @see https://data.humdata.org/tools/hxl-example/ # @see https://data.worldbank.org/indicator @@ -257,6 +266,12 @@ # TODOs # GINI https://data.worldbank.org/indicator/SI.POV.GINI?view=chart # Redugees https://data.worldbank.org/indicator/SM.POP.REFG?view=chart + + # - https://data.worldbank.org/indicator?tab=all + # From all indicators, the health bring most of agregated data + # - https://data.worldbank.org/topic/health?view=chart + # - https://api.worldbank.org/v2/en/topic/8?downloadformat=csv + 'health': '#indicator+value+year{0}', } } @@ -1249,6 +1264,14 @@ def praeparatio(self): - praeparātiō, s, f, Nom., https://en.wiktionary.org/wiki/praeparatio """ # return True + + if self.methodus in DATA_METHODUS['worldbank']: + self.link_fonti = DATA_METHODUS['worldbank'][self.methodus][ + 'download_url'] + else: + self.link_fonti = 'https://api.worldbank.org/v2/en/indicator/{0}?downloadformat=csv'.format( + self.methodus) + if self.objectivum_formato == 'link-fonti': # print(self.link_fonti) return True