diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3789b99..493dd46 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,13 @@ ## Code List +[Recommendation No. 20 Codes for Units of Measure Used in International Trade](https://github.com/uncefact/vocab-codes/tree/main/CLR/Rec20) +[Recommendation No. 21 Codes for Passengers, Types of Cargo, Packages and Packaging Materials](https://github.com/uncefact/vocab-codes/tree/main/CLR/Rec21) +[Recommendation No. 23 Freight Cost Code (FCC)](https://github.com/uncefact/vocab-codes/tree/main/CLR/Rec23) [Recommendation No. 24 Trade and Transport Status Codes](https://github.com/uncefact/vocab-codes/tree/main/CLR/Rec24) [Recommendation No. 28 Codes for Types of Means of Transport](https://github.com/uncefact/vocab-codes/tree/main/CLR/Rec28) ## Maintenance Request issue - + Ref #{issue_number} ### Mentions: diff --git a/CLR/Rec20/csv_to_json.py b/CLR/Rec20/csv_to_json.py new file mode 100644 index 0000000..a94be37 --- /dev/null +++ b/CLR/Rec20/csv_to_json.py @@ -0,0 +1,32 @@ +import csv +import json + +def csv_to_json(csvFilePath, jsonFilePath): + data = {} + data["label"] = "Recommendation Code List 20" + data["uri"] = "rec20" + data["comment"] = "CODES FOR UNITS OF MEASURE USED IN INTERNATIONAL TRADE" + values = [] + + #read csv file + with open(csvFilePath, encoding='utf-8') as csvf: + #load csv file data using csv library's dictionary reader + csvReader = csv.DictReader(csvf) + + #convert each csv row into python dict + for row in csvReader: + #add this python dict to json array + row["uri"] = "unece:rec20#"+row["CommonCode"] + values.append(row) + + data["values"] = values + data["referencedBy"] = [] + + #convert python jsonArray to JSON String and write to file + with open(jsonFilePath, 'w', encoding='utf-8') as jsonf: + jsonString = json.dumps(data, indent=4) + jsonf.write(jsonString) + +csvFilePath = r'current/Annex || & Annex |||/code-list.csv' +jsonFilePath = r'current/rec20.json' +csv_to_json(csvFilePath, jsonFilePath) \ No newline at end of file diff --git a/CLR/Rec20/current/Annex || & Annex |||/code-list.csv b/CLR/Rec20/current/Annex || & Annex |||/code-list.csv index 8f9bbb6..0bb67d0 100644 --- a/CLR/Rec20/current/Annex || & Annex |||/code-list.csv +++ b/CLR/Rec20/current/Annex || & Annex |||/code-list.csv @@ -1,4 +1,4 @@ -Status,"CommonCode",Name,Description,"Level/Category",Symbol,ConversionFactor +Status,"CommonCode",Name,Description,"LevelCategory",Symbol,ConversionFactor X,05,lift,,3.9,, X,06,small spray,,3.9,, X,08,heat lot,,3.9,, diff --git a/CLR/Rec21/current/code-list.csv b/CLR/Rec21/current/code-list.csv index 52d66b3..38c3a7c 100644 --- a/CLR/Rec21/current/code-list.csv +++ b/CLR/Rec21/current/code-list.csv @@ -1,4 +1,4 @@ -Status,Code,Name,Description,Numeric code +Status,Code,Name,Description,NumericCode ,1A,"Drum, steel",,34 ,1B,"Drum, aluminium",,34 ,1D,"Drum, plywood",,34 diff --git a/CLR/Rec23/current/code-list.csv b/CLR/Rec23/current/code-list.csv index aea0c81..7b8ef62 100644 --- a/CLR/Rec23/current/code-list.csv +++ b/CLR/Rec23/current/code-list.csv @@ -1,4 +1,4 @@ -CI,Group,Subgroup,Detail,Description,Mode/Site Indicator,Duplicate Indicator +CI,Group,Subgroup,Detail,Description,ModeSiteIndicator,DuplicateIndicator ,1,00,000, FREIGHT CHARGES,, ,1,00,999,All freight charges,, ,1,01,000, BASIC FREIGHT,,