Skip to content

Commit

Permalink
rdf+bcp47+hxl (#41), admin-l (#39), pcodes (#2): HXLTM and No1 now ex…
Browse files Browse the repository at this point in the history
…pand all ABs
  • Loading branch information
fititnt committed Jun 12, 2022
1 parent 8ea1066 commit cfc8bfe
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 21 deletions.
47 changes: 38 additions & 9 deletions officina/999999999/0/L999999999_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -2535,6 +2535,10 @@ def praeparatio(self, formatum: str):
self.caput_hxltm.append(caput_novi)

if self.identitas_locali_index < 0:
ōrdinēs = range(self.ordo + 1)
for ordo in reversed(ōrdinēs):
self.praeparatio_identitas_numerodinatio(ordo)
# self.praeparatio_identitas_numerodinatio(0)
self.praeparatio_identitas_locali()

# if formatum == 'no1':
Expand Down Expand Up @@ -2629,7 +2633,8 @@ def praeparatio_identitas_locali(
linea_novae = []
pcode_completo = linea[pcode_index]
if ordo == 0:
linea_novae.append(pcode_completo) # Ex. BR
# linea_novae.append(pcode_completo) # Ex. BR
linea_novae.append(self.unm49) # Ex. 76 ex BR
else:

# Ex. 31 ad BR31
Expand All @@ -2655,14 +2660,22 @@ def praeparatio_identitas_locali(

def praeparatio_identitas_numerodinatio(
self, ordo: int = None):
"""praeparatio_identitas_locali
"""praeparatio_identitas_numerodinatio
Change self.data and self.caput_hxltm
Args:
ordo (int, optional): _description_. Defaults to None.
"""
raise NotImplementedError
if ordo is None:
ordo = self.ordo
# raise NotImplementedError
hxl_hashtag = '#adm{0}+code+v_numerodinatio'.format(ordo)
# if ordo is None:
# ordo = self.ordo
pcode_index = None
pcode_hashtag_de_facto = ''
if ordo == 0:
hxl_hashtag = '#country+code+v_numerodinatio'
pcode_hashtag = [
'#country+code+v_pcode', '#country+code+v_iso2',
'#country+code+v_iso3166p1a2']
Expand Down Expand Up @@ -2691,7 +2704,14 @@ def praeparatio_identitas_numerodinatio(
linea_novae = []
pcode_completo = linea[pcode_index]
if ordo == 0:
linea_novae.append(pcode_completo) # Ex. BR
# raise ValueError(ordo)
_numerordinatio = '{0}:{1}:{2}'.format(
self.numerordinatio_praefixo,
self.unm49,
"0",
)
# linea_novae.append(pcode_completo) # Ex. 76 for BR
linea_novae.append(_numerordinatio) # Ex. 76 for BR
else:

# Ex. 31 ad BR31
Expand All @@ -2701,7 +2721,15 @@ def praeparatio_identitas_numerodinatio(
pcode_numeri = re.sub('[^0-9]', '', pcode_numeri)

try:
linea_novae.append(int(pcode_numeri))
pcode_numeri = int(pcode_numeri)
_numerordinatio = '{0}:{1}:{2}:{3}'.format(
self.numerordinatio_praefixo,
self.unm49,
ordo,
str(pcode_numeri),
)

linea_novae.append(_numerordinatio)
except ValueError as err:
raise ValueError('<{0}:{1}> -> int({2})?? [{3}]'.format(
pcode_hashtag_de_facto,
Expand All @@ -2724,7 +2752,7 @@ def praeparatio_numerordinatio(self):
if self.ordo > 0:
hashtag_numerordinatio = '#adm{0}+v_numerordinatio'.format(
self.ordo)
self.caput_no1.insert(0, hashtag_numerordinatio)
# self.caput_no1.insert(0, hashtag_numerordinatio)
self.caput_no1.insert(0, '#item+conceptum+numerordinatio')
data_novis = []

Expand All @@ -2740,7 +2768,8 @@ def praeparatio_numerordinatio(self):
str(self.ordo),
_identitas_locali,
)
linea_novae = [_numerordinatio, _numerordinatio]
# linea_novae = [_numerordinatio, _numerordinatio]
linea_novae = [_numerordinatio]
linea_novae.extend(linea)

data_novis.append(linea_novae)
Expand Down
24 changes: 12 additions & 12 deletions officina/999999999/1603_45_16.sh
Original file line number Diff line number Diff line change
Expand Up @@ -924,17 +924,17 @@ __temp_preproces_quicktest_1603_16_24() {

frictionless validate "${objectivum_archivum_no1}" || true

set -x
"${ROOTDIR}/999999999/0/999999999_7200235.py" \
--methodus=xlsx_ad_no1bcp47 \
--numerordinatio-praefixo="$numerordinatio_praefixo" \
--ordines="$cod_level" \
--pcode-praefix="$pcode_praefixo" \
--unm49="$unm49" \
"$fontem_archivum" >"${objectivum_archivum_no1bcp47}"
set +x
# set -x
# "${ROOTDIR}/999999999/0/999999999_7200235.py" \
# --methodus=xlsx_ad_no1bcp47 \
# --numerordinatio-praefixo="$numerordinatio_praefixo" \
# --ordines="$cod_level" \
# --pcode-praefix="$pcode_praefixo" \
# --unm49="$unm49" \
# "$fontem_archivum" >"${objectivum_archivum_no1bcp47}"
# set +x

frictionless validate "${objectivum_archivum_no1bcp47}" || true
# frictionless validate "${objectivum_archivum_no1bcp47}" || true

done
}
Expand Down Expand Up @@ -1021,8 +1021,8 @@ __temp_download_external_cod_data() {
# __temp_download_external_cod_data
# exit 1
# bootstrap_1603_45_16__all
# bootstrap_1603_45_16__item "1603_45_16_24" "24" "AGO" "AO" "3" "1" "0"
__temp_preproces_quicktest_1603_16_24
bootstrap_1603_45_16__item "1603_45_16_24" "24" "AGO" "AO" "3" "1" "0"
# __temp_preproces_quicktest_1603_16_24
exit 0

# bootstrap_1603_45_16__all
Expand Down

0 comments on commit cfc8bfe

Please sign in to comment.