This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.
Initial Value Generator
Country Initial Value Generator
This script generates the Tocco initial values for countries.
The data source is https://mledoze.github.io/countries
The BFS data source is https://www.bfs.admin.ch/bfs/de/home/grundlagen/stgb.html
Execute Script
Prerequisite: PyYAML is installed (Debian/Ubuntu: apt install python3-yaml, other OSes: pip install PyYAML)
Clone the generator from https://gitlab.com/toccoag/country-initial-value-generator
Go to the data source on GitHub and download the latest version of the
countries.jsonfileCopy the
countries.jsonfile to theinputdirectoryGo to the BFS data source and download the data in XML format
Extract the
.xmlfile from the downloaded ZIP file. Rename it tobfs_countries.xmland copy it toinput/bfs_countries.xmldirectoryRun the script with
python3 CountryImporter.pyCopy the existing initial value file (from the Nice repository
optional/address/resources/db/initialvalues/Country.yaml) toinput/Country.yamlRun the script with
python3 CountryDiff.pyFor each country code in the Country code no longer exists list do the following in the Nice repository (change set location should be
optional/address/resources/db/initialvalues/2.xx_update_country.xml):If a country still exist with another iso3 code (new iso3 code must be listed in New country code added), then add the following change set:
<changeSet author="anonymous" dbms="postgresql" id="ID" runOnChange="true"> <preConditions onFail="MARK_RAN"> <tableExists tableName="nice_country"/> </preConditions> <update tableName="nice_country"> <column name="iso3" value="NEW_VALUE"/> <where>iso3 = 'OLD_VALUE'</where> </update> </changeSet>
Set
IDto something likeupdateCountry_XKV_to_UNK/2.27,OLD_VALUEis the old iso3 code andNEW_VALUEis the new iso3 codeAdditionally, update
input/{licence_plate, sorting}.csvin the generator repository if necessaryElse, write a change set to set the country to inactive:
<changeSet author="anonymous" dbms="postgresql" id="ID" runOnChange="true"> <preConditions onFail="MARK_RAN"> <tableExists tableName="nice_country"/> </preConditions> <update tableName="nice_country"> <column name="active" value="false"/> <where>iso3 = 'ISO_CODE'</where> </update> </changeSet>
Set
IDto something likeupdateCountry_remove_ANT/2.27andISO_CODEis the iso3 codeCopy the output files (in
output) to the Nice repository:Override the existing
Country.yamlfile inoptional/address/resources/db/initialvaluesOverride the country name section in the language file
language_XX.propertieswhich is located atoptional/address/resources/model/textresources
Check the git diff to verify the data source quality
Additional Information
The
licence_platefield is not part of the data source. There is a static file underinput/licence_plate.csvas data source in the formatIso3,Licence_plate_codeThe
sortingfield is an internal Tocco field. Per default a country obtains the value100. If a non-default value is required there is a static file underinput/sorting.csvin the formatIso3,numberto define the value per countrySome countries have multiple currency codes and calling codes. In such a case the values are comma-separated written into the text field