From d7deccb452c7cbb61819c1ab1e5eb75a32b772cd Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Mon, 22 Apr 2024 22:01:02 +0200 Subject: [PATCH 01/12] adds the list of currencies --- country_by_country/utils/constants.py | 2041 +++++++++++++++++++++++++ 1 file changed, 2041 insertions(+) diff --git a/country_by_country/utils/constants.py b/country_by_country/utils/constants.py index 8d10855..f29a6c2 100644 --- a/country_by_country/utils/constants.py +++ b/country_by_country/utils/constants.py @@ -1966,3 +1966,2044 @@ "Longitude (average)": "30", }, } + + +CURRENCIES = { + "AFGHANISTAN": { + "Currency": "Afghani", + "AlphabeticCode": "AFA", + "NumericCode": "004", + "MinorUnit": "", + "WidthdrawalDate": "2003-01", + }, + "ÅLAND ISLANDS": { + "Currency": "Markka", + "AlphabeticCode": "FIM", + "NumericCode": "246", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "ALBANIA": { + "Currency": "Old Lek", + "AlphabeticCode": "ALK", + "NumericCode": "008", + "MinorUnit": "", + "WidthdrawalDate": "1989-12", + }, + "ALGERIA": { + "Currency": "Algerian Dinar", + "AlphabeticCode": "DZD", + "NumericCode": "012", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "AMERICAN SAMOA": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ANDORRA": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "ANGOLA": { + "Currency": "Kwanza Reajustado", + "AlphabeticCode": "AOR", + "NumericCode": "982", + "MinorUnit": "", + "WidthdrawalDate": "2000-02", + }, + "ANGUILLA": { + "Currency": "East Caribbean Dollar", + "AlphabeticCode": "XCD", + "NumericCode": "951", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ANTARCTICA": { + "Currency": "No universal currency", + "AlphabeticCode": "", + "NumericCode": "", + "MinorUnit": "", + "WidthdrawalDate": "", + }, + "ANTIGUA AND BARBUDA": { + "Currency": "East Caribbean Dollar", + "AlphabeticCode": "XCD", + "NumericCode": "951", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ARGENTINA": { + "Currency": "Peso", + "AlphabeticCode": "ARY", + "NumericCode": "032", + "MinorUnit": "", + "WidthdrawalDate": "1989 to 1990", + }, + "ARMENIA": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1994-08", + }, + "ARUBA": { + "Currency": "Aruban Florin", + "AlphabeticCode": "AWG", + "NumericCode": "533", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "AUSTRALIA": { + "Currency": "Australian Dollar", + "AlphabeticCode": "AUD", + "NumericCode": "036", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "AUSTRIA": { + "Currency": "Schilling", + "AlphabeticCode": "ATS", + "NumericCode": "040", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "AZERBAIJAN": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1994-08", + }, + "BAHAMAS (THE)": { + "Currency": "Bahamian Dollar", + "AlphabeticCode": "BSD", + "NumericCode": "044", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BAHRAIN": { + "Currency": "Bahraini Dinar", + "AlphabeticCode": "BHD", + "NumericCode": "048", + "MinorUnit": "3", + "WidthdrawalDate": "", + }, + "BANGLADESH": { + "Currency": "Taka", + "AlphabeticCode": "BDT", + "NumericCode": "050", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BARBADOS": { + "Currency": "Barbados Dollar", + "AlphabeticCode": "BBD", + "NumericCode": "052", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BELARUS": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1994-06", + }, + "BELGIUM": { + "Currency": "Financial Franc", + "AlphabeticCode": "BEL", + "NumericCode": "992", + "MinorUnit": "", + "WidthdrawalDate": "1990-03", + }, + "BELIZE": { + "Currency": "Belize Dollar", + "AlphabeticCode": "BZD", + "NumericCode": "084", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BENIN": { + "Currency": "CFA Franc BCEAO", + "AlphabeticCode": "XOF", + "NumericCode": "952", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "BERMUDA": { + "Currency": "Bermudian Dollar", + "AlphabeticCode": "BMD", + "NumericCode": "060", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BHUTAN": { + "Currency": "Ngultrum", + "AlphabeticCode": "BTN", + "NumericCode": "064", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BOLIVIA (PLURINATIONAL STATE OF)": { + "Currency": "Mvdol", + "AlphabeticCode": "BOV", + "NumericCode": "984", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BONAIRE, SINT EUSTATIUS AND SABA": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BOSNIA AND HERZEGOVINA": { + "Currency": "Dinar", + "AlphabeticCode": "BAD", + "NumericCode": "070", + "MinorUnit": "", + "WidthdrawalDate": "1998-07", + }, + "BOTSWANA": { + "Currency": "Pula", + "AlphabeticCode": "BWP", + "NumericCode": "072", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BOUVET ISLAND": { + "Currency": "Norwegian Krone", + "AlphabeticCode": "NOK", + "NumericCode": "578", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BRAZIL": { + "Currency": "Cruzeiro Real", + "AlphabeticCode": "BRR", + "NumericCode": "987", + "MinorUnit": "", + "WidthdrawalDate": "1994-07", + }, + "BRITISH INDIAN OCEAN TERRITORY (THE)": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BRUNEI DARUSSALAM": { + "Currency": "Brunei Dollar", + "AlphabeticCode": "BND", + "NumericCode": "096", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "BULGARIA": { + "Currency": "Lev", + "AlphabeticCode": "BGL", + "NumericCode": "100", + "MinorUnit": "", + "WidthdrawalDate": "2003-11", + }, + "BURKINA FASO": { + "Currency": "CFA Franc BCEAO", + "AlphabeticCode": "XOF", + "NumericCode": "952", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "BURUNDI": { + "Currency": "Burundi Franc", + "AlphabeticCode": "BIF", + "NumericCode": "108", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "CABO VERDE": { + "Currency": "Cabo Verde Escudo", + "AlphabeticCode": "CVE", + "NumericCode": "132", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CAMBODIA": { + "Currency": "Riel", + "AlphabeticCode": "KHR", + "NumericCode": "116", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CAMEROON": { + "Currency": "CFA Franc BEAC", + "AlphabeticCode": "XAF", + "NumericCode": "950", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "CANADA": { + "Currency": "Canadian Dollar", + "AlphabeticCode": "CAD", + "NumericCode": "124", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CAYMAN ISLANDS (THE)": { + "Currency": "Cayman Islands Dollar", + "AlphabeticCode": "KYD", + "NumericCode": "136", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CENTRAL AFRICAN REPUBLIC (THE)": { + "Currency": "CFA Franc BEAC", + "AlphabeticCode": "XAF", + "NumericCode": "950", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "CHAD": { + "Currency": "CFA Franc BEAC", + "AlphabeticCode": "XAF", + "NumericCode": "950", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "CHILE": { + "Currency": "Unidad de Fomento", + "AlphabeticCode": "CLF", + "NumericCode": "990", + "MinorUnit": "4", + "WidthdrawalDate": "", + }, + "CHINA": { + "Currency": "Yuan Renminbi", + "AlphabeticCode": "CNY", + "NumericCode": "156", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CHRISTMAS ISLAND": { + "Currency": "Australian Dollar", + "AlphabeticCode": "AUD", + "NumericCode": "036", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "COCOS (KEELING) ISLANDS (THE)": { + "Currency": "Australian Dollar", + "AlphabeticCode": "AUD", + "NumericCode": "036", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "COLOMBIA": { + "Currency": "Unidad de Valor Real", + "AlphabeticCode": "COU", + "NumericCode": "970", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "COMOROS (THE)": { + "Currency": "Comorian Franc ", + "AlphabeticCode": "KMF", + "NumericCode": "174", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "CONGO (THE DEMOCRATIC REPUBLIC OF THE)": { + "Currency": "Congolese Franc", + "AlphabeticCode": "CDF", + "NumericCode": "976", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CONGO (THE)": { + "Currency": "CFA Franc BEAC", + "AlphabeticCode": "XAF", + "NumericCode": "950", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "COOK ISLANDS (THE)": { + "Currency": "New Zealand Dollar", + "AlphabeticCode": "NZD", + "NumericCode": "554", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "COSTA RICA": { + "Currency": "Costa Rican Colon", + "AlphabeticCode": "CRC", + "NumericCode": "188", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CÔTE D'IVOIRE": { + "Currency": "CFA Franc BCEAO", + "AlphabeticCode": "XOF", + "NumericCode": "952", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "CROATIA": { + "Currency": "Croatian Kuna", + "AlphabeticCode": "HRK", + "NumericCode": "191", + "MinorUnit": "", + "WidthdrawalDate": "2015-06", + }, + "CUBA": { + "Currency": "Peso Convertible", + "AlphabeticCode": "CUC", + "NumericCode": "931", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CURAÇAO": { + "Currency": "Netherlands Antillean Guilder", + "AlphabeticCode": "ANG", + "NumericCode": "532", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "CYPRUS": { + "Currency": "Cyprus Pound", + "AlphabeticCode": "CYP", + "NumericCode": "196", + "MinorUnit": "", + "WidthdrawalDate": "2008-01", + }, + "CZECHIA": { + "Currency": "Czech Koruna", + "AlphabeticCode": "CZK", + "NumericCode": "203", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "DENMARK": { + "Currency": "Danish Krone", + "AlphabeticCode": "DKK", + "NumericCode": "208", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "DJIBOUTI": { + "Currency": "Djibouti Franc", + "AlphabeticCode": "DJF", + "NumericCode": "262", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "DOMINICA": { + "Currency": "East Caribbean Dollar", + "AlphabeticCode": "XCD", + "NumericCode": "951", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "DOMINICAN REPUBLIC (THE)": { + "Currency": "Dominican Peso", + "AlphabeticCode": "DOP", + "NumericCode": "214", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ECUADOR": { + "Currency": "Unidad de Valor Constante (UVC)", + "AlphabeticCode": "ECV", + "NumericCode": "983", + "MinorUnit": "", + "WidthdrawalDate": "2000-09", + }, + "EGYPT": { + "Currency": "Egyptian Pound", + "AlphabeticCode": "EGP", + "NumericCode": "818", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "EL SALVADOR": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "EQUATORIAL GUINEA": { + "Currency": "Ekwele", + "AlphabeticCode": "GQE", + "NumericCode": "226", + "MinorUnit": "", + "WidthdrawalDate": "1986-06", + }, + "ERITREA": { + "Currency": "Nakfa", + "AlphabeticCode": "ERN", + "NumericCode": "232", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ESTONIA": { + "Currency": "Kroon", + "AlphabeticCode": "EEK", + "NumericCode": "233", + "MinorUnit": "", + "WidthdrawalDate": "2011-01", + }, + "ESWATINI": { + "Currency": "Lilangeni", + "AlphabeticCode": "SZL", + "NumericCode": "748", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ETHIOPIA": { + "Currency": "Ethiopian Birr", + "AlphabeticCode": "ETB", + "NumericCode": "230", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "EUROPEAN UNION": { + "Currency": "Euro", + "AlphabeticCode": "EUR", + "NumericCode": "978", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "FALKLAND ISLANDS (THE) [MALVINAS]": { + "Currency": "Falkland Islands Pound", + "AlphabeticCode": "FKP", + "NumericCode": "238", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "FAROE ISLANDS (THE)": { + "Currency": "Danish Krone", + "AlphabeticCode": "DKK", + "NumericCode": "208", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "FIJI": { + "Currency": "Fiji Dollar", + "AlphabeticCode": "FJD", + "NumericCode": "242", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "FINLAND": { + "Currency": "Markka", + "AlphabeticCode": "FIM", + "NumericCode": "246", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "FRANCE": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "FRENCH GUIANA": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "FRENCH POLYNESIA": { + "Currency": "CFP Franc", + "AlphabeticCode": "XPF", + "NumericCode": "953", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "FRENCH SOUTHERN TERRITORIES (THE)": { + "Currency": "Euro", + "AlphabeticCode": "EUR", + "NumericCode": "978", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "GABON": { + "Currency": "CFA Franc BEAC", + "AlphabeticCode": "XAF", + "NumericCode": "950", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "GAMBIA (THE)": { + "Currency": "Dalasi", + "AlphabeticCode": "GMD", + "NumericCode": "270", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "GEORGIA": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1994-04", + }, + "GERMANY": { + "Currency": "Deutsche Mark", + "AlphabeticCode": "DEM", + "NumericCode": "276", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "GHANA": { + "Currency": "Ghana Cedi", + "AlphabeticCode": "GHP", + "NumericCode": "939", + "MinorUnit": "", + "WidthdrawalDate": "2007-06", + }, + "GIBRALTAR": { + "Currency": "Gibraltar Pound", + "AlphabeticCode": "GIP", + "NumericCode": "292", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "GREECE": { + "Currency": "Drachma", + "AlphabeticCode": "GRD", + "NumericCode": "300", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "GREENLAND": { + "Currency": "Danish Krone", + "AlphabeticCode": "DKK", + "NumericCode": "208", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "GRENADA": { + "Currency": "East Caribbean Dollar", + "AlphabeticCode": "XCD", + "NumericCode": "951", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "GUADELOUPE": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "GUAM": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "GUATEMALA": { + "Currency": "Quetzal", + "AlphabeticCode": "GTQ", + "NumericCode": "320", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "GUERNSEY": { + "Currency": "Pound Sterling", + "AlphabeticCode": "GBP", + "NumericCode": "826", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "GUINEA": { + "Currency": "Syli", + "AlphabeticCode": "GNS", + "NumericCode": "324", + "MinorUnit": "", + "WidthdrawalDate": "1986-02", + }, + "GUINEA-BISSAU": { + "Currency": "Guinea-Bissau Peso", + "AlphabeticCode": "GWP", + "NumericCode": "624", + "MinorUnit": "", + "WidthdrawalDate": "1997-05", + }, + "GUYANA": { + "Currency": "Guyana Dollar", + "AlphabeticCode": "GYD", + "NumericCode": "328", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "HAITI": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "HEARD ISLAND AND McDONALD ISLANDS": { + "Currency": "Australian Dollar", + "AlphabeticCode": "AUD", + "NumericCode": "036", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "HOLY SEE (THE)": { + "Currency": "Euro", + "AlphabeticCode": "EUR", + "NumericCode": "978", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "HONDURAS": { + "Currency": "Lempira", + "AlphabeticCode": "HNL", + "NumericCode": "340", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "HONG KONG": { + "Currency": "Hong Kong Dollar", + "AlphabeticCode": "HKD", + "NumericCode": "344", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "HUNGARY": { + "Currency": "Forint", + "AlphabeticCode": "HUF", + "NumericCode": "348", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ICELAND": { + "Currency": "Old Krona", + "AlphabeticCode": "ISJ", + "NumericCode": "352", + "MinorUnit": "", + "WidthdrawalDate": "1989 to 1990", + }, + "INDIA": { + "Currency": "Indian Rupee", + "AlphabeticCode": "INR", + "NumericCode": "356", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "INDONESIA": { + "Currency": "Rupiah", + "AlphabeticCode": "IDR", + "NumericCode": "360", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "INTERNATIONAL MONETARY FUND (IMF)": { + "Currency": "SDR (Special Drawing Right)", + "AlphabeticCode": "XDR", + "NumericCode": "960", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "IRAN (ISLAMIC REPUBLIC OF)": { + "Currency": "Iranian Rial", + "AlphabeticCode": "IRR", + "NumericCode": "364", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "IRAQ": { + "Currency": "Iraqi Dinar", + "AlphabeticCode": "IQD", + "NumericCode": "368", + "MinorUnit": "3", + "WidthdrawalDate": "", + }, + "IRELAND": { + "Currency": "Irish Pound", + "AlphabeticCode": "IEP", + "NumericCode": "372", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "ISLE OF MAN": { + "Currency": "Pound Sterling", + "AlphabeticCode": "GBP", + "NumericCode": "826", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ISRAEL": { + "Currency": "Old Shekel", + "AlphabeticCode": "ILR", + "NumericCode": "376", + "MinorUnit": "", + "WidthdrawalDate": "1989 to 1990", + }, + "ITALY": { + "Currency": "Italian Lira", + "AlphabeticCode": "ITL", + "NumericCode": "380", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "JAMAICA": { + "Currency": "Jamaican Dollar", + "AlphabeticCode": "JMD", + "NumericCode": "388", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "JAPAN": { + "Currency": "Yen", + "AlphabeticCode": "JPY", + "NumericCode": "392", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "JERSEY": { + "Currency": "Pound Sterling", + "AlphabeticCode": "GBP", + "NumericCode": "826", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "JORDAN": { + "Currency": "Jordanian Dinar", + "AlphabeticCode": "JOD", + "NumericCode": "400", + "MinorUnit": "3", + "WidthdrawalDate": "", + }, + "KAZAKHSTAN": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1994-05", + }, + "KENYA": { + "Currency": "Kenyan Shilling", + "AlphabeticCode": "KES", + "NumericCode": "404", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "KIRIBATI": { + "Currency": "Australian Dollar", + "AlphabeticCode": "AUD", + "NumericCode": "036", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "KOREA (THE DEMOCRATIC PEOPLE'S REPUBLIC OF)": { + "Currency": "North Korean Won", + "AlphabeticCode": "KPW", + "NumericCode": "408", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "KOREA (THE REPUBLIC OF)": { + "Currency": "Won", + "AlphabeticCode": "KRW", + "NumericCode": "410", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "KUWAIT": { + "Currency": "Kuwaiti Dinar", + "AlphabeticCode": "KWD", + "NumericCode": "414", + "MinorUnit": "3", + "WidthdrawalDate": "", + }, + "KYRGYZSTAN": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1993-01", + }, + "LAO PEOPLE'S DEMOCRATIC REPUBLIC (THE)": { + "Currency": "Lao Kip", + "AlphabeticCode": "LAK", + "NumericCode": "418", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "LATVIA": { + "Currency": "Latvian Ruble", + "AlphabeticCode": "LVR", + "NumericCode": "428", + "MinorUnit": "", + "WidthdrawalDate": "1994-12", + }, + "LEBANON": { + "Currency": "Lebanese Pound", + "AlphabeticCode": "LBP", + "NumericCode": "422", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "LESOTHO": { + "Currency": "Financial Rand", + "AlphabeticCode": "ZAL", + "NumericCode": "991", + "MinorUnit": "", + "WidthdrawalDate": "1995-03", + }, + "LIBERIA": { + "Currency": "Liberian Dollar", + "AlphabeticCode": "LRD", + "NumericCode": "430", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "LIBYA": { + "Currency": "Libyan Dinar", + "AlphabeticCode": "LYD", + "NumericCode": "434", + "MinorUnit": "3", + "WidthdrawalDate": "", + }, + "LIECHTENSTEIN": { + "Currency": "Swiss Franc", + "AlphabeticCode": "CHF", + "NumericCode": "756", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "LITHUANIA": { + "Currency": "Talonas", + "AlphabeticCode": "LTT", + "NumericCode": "440", + "MinorUnit": "", + "WidthdrawalDate": "1993-07", + }, + "LUXEMBOURG": { + "Currency": "Luxembourg Financial Franc", + "AlphabeticCode": "LUL", + "NumericCode": "988", + "MinorUnit": "", + "WidthdrawalDate": "1990-03", + }, + "MACAO": { + "Currency": "Pataca", + "AlphabeticCode": "MOP", + "NumericCode": "446", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NORTH MACEDONIA": { + "Currency": "Denar", + "AlphabeticCode": "MKD", + "NumericCode": "807", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MADAGASCAR": { + "Currency": "Malagasy Franc", + "AlphabeticCode": "MGF", + "NumericCode": "450", + "MinorUnit": "", + "WidthdrawalDate": "2004-12", + }, + "MALAWI": { + "Currency": "Kwacha", + "AlphabeticCode": "MWK", + "NumericCode": "454", + "MinorUnit": "", + "WidthdrawalDate": "2016-02", + }, + "MALAYSIA": { + "Currency": "Malaysian Ringgit", + "AlphabeticCode": "MYR", + "NumericCode": "458", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MALDIVES": { + "Currency": "Maldive Rupee", + "AlphabeticCode": "MVQ", + "NumericCode": "462", + "MinorUnit": "", + "WidthdrawalDate": "1989-12", + }, + "MALI": { + "Currency": "Mali Franc", + "AlphabeticCode": "MLF", + "NumericCode": "466", + "MinorUnit": "", + "WidthdrawalDate": "1984-11", + }, + "MALTA": { + "Currency": "Maltese Pound", + "AlphabeticCode": "MTP", + "NumericCode": "470", + "MinorUnit": "", + "WidthdrawalDate": "1983-06", + }, + "MARSHALL ISLANDS (THE)": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MARTINIQUE": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "MAURITANIA": { + "Currency": "Ouguiya", + "AlphabeticCode": "MRO", + "NumericCode": "478", + "MinorUnit": "", + "WidthdrawalDate": "2017-12", + }, + "MAURITIUS": { + "Currency": "Mauritius Rupee", + "AlphabeticCode": "MUR", + "NumericCode": "480", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MAYOTTE": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "MEMBER COUNTRIES OF THE AFRICAN DEVELOPMENT BANK GROUP": { + "Currency": "ADB Unit of Account", + "AlphabeticCode": "XUA", + "NumericCode": "965", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "MEXICO": { + "Currency": "Mexican Peso", + "AlphabeticCode": "MXP", + "NumericCode": "484", + "MinorUnit": "", + "WidthdrawalDate": "1993-01", + }, + "MICRONESIA (FEDERATED STATES OF)": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MOLDOVA (THE REPUBLIC OF)": { + "Currency": "Moldovan Leu", + "AlphabeticCode": "MDL", + "NumericCode": "498", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MONACO": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "MONGOLIA": { + "Currency": "Tugrik", + "AlphabeticCode": "MNT", + "NumericCode": "496", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MONTENEGRO": { + "Currency": "Euro", + "AlphabeticCode": "EUR", + "NumericCode": "978", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MONTSERRAT": { + "Currency": "East Caribbean Dollar", + "AlphabeticCode": "XCD", + "NumericCode": "951", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MOROCCO": { + "Currency": "Moroccan Dirham", + "AlphabeticCode": "MAD", + "NumericCode": "504", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "MOZAMBIQUE": { + "Currency": "Mozambique Metical", + "AlphabeticCode": "MZM", + "NumericCode": "508", + "MinorUnit": "", + "WidthdrawalDate": "2006-06", + }, + "MYANMAR": { + "Currency": "Kyat", + "AlphabeticCode": "MMK", + "NumericCode": "104", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NAMIBIA": { + "Currency": "Rand", + "AlphabeticCode": "ZAR", + "NumericCode": "710", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NAURU": { + "Currency": "Australian Dollar", + "AlphabeticCode": "AUD", + "NumericCode": "036", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NEPAL": { + "Currency": "Nepalese Rupee", + "AlphabeticCode": "NPR", + "NumericCode": "524", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NETHERLANDS (THE)": { + "Currency": "Euro", + "AlphabeticCode": "EUR", + "NumericCode": "978", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NEW CALEDONIA": { + "Currency": "CFP Franc", + "AlphabeticCode": "XPF", + "NumericCode": "953", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "NEW ZEALAND": { + "Currency": "New Zealand Dollar", + "AlphabeticCode": "NZD", + "NumericCode": "554", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NICARAGUA": { + "Currency": "Cordoba", + "AlphabeticCode": "NIC", + "NumericCode": "558", + "MinorUnit": "", + "WidthdrawalDate": "1990-10", + }, + "NIGER (THE)": { + "Currency": "CFA Franc BCEAO", + "AlphabeticCode": "XOF", + "NumericCode": "952", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "NIGERIA": { + "Currency": "Naira", + "AlphabeticCode": "NGN", + "NumericCode": "566", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NIUE": { + "Currency": "New Zealand Dollar", + "AlphabeticCode": "NZD", + "NumericCode": "554", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NORFOLK ISLAND": { + "Currency": "Australian Dollar", + "AlphabeticCode": "AUD", + "NumericCode": "036", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NORTHERN MARIANA ISLANDS (THE)": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "NORWAY": { + "Currency": "Norwegian Krone", + "AlphabeticCode": "NOK", + "NumericCode": "578", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "OMAN": { + "Currency": "Rial Omani", + "AlphabeticCode": "OMR", + "NumericCode": "512", + "MinorUnit": "3", + "WidthdrawalDate": "", + }, + "PAKISTAN": { + "Currency": "Pakistan Rupee", + "AlphabeticCode": "PKR", + "NumericCode": "586", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "PALAU": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "PALESTINE, STATE OF": { + "Currency": "No universal currency", + "AlphabeticCode": "", + "NumericCode": "", + "MinorUnit": "", + "WidthdrawalDate": "", + }, + "PANAMA": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "PAPUA NEW GUINEA": { + "Currency": "Kina", + "AlphabeticCode": "PGK", + "NumericCode": "598", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "PARAGUAY": { + "Currency": "Guarani", + "AlphabeticCode": "PYG", + "NumericCode": "600", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "PERU": { + "Currency": "Sol", + "AlphabeticCode": "PES", + "NumericCode": "604", + "MinorUnit": "", + "WidthdrawalDate": "1986-02", + }, + "PHILIPPINES (THE)": { + "Currency": "Philippine Peso", + "AlphabeticCode": "PHP", + "NumericCode": "608", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "PITCAIRN": { + "Currency": "New Zealand Dollar", + "AlphabeticCode": "NZD", + "NumericCode": "554", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "POLAND": { + "Currency": "Zloty", + "AlphabeticCode": "PLZ", + "NumericCode": "616", + "MinorUnit": "", + "WidthdrawalDate": "1997-01", + }, + "PORTUGAL": { + "Currency": "Portuguese Escudo", + "AlphabeticCode": "PTE", + "NumericCode": "620", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "PUERTO RICO": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "QATAR": { + "Currency": "Qatari Rial", + "AlphabeticCode": "QAR", + "NumericCode": "634", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "RÉUNION": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "ROMANIA": { + "Currency": "New Romanian Leu ", + "AlphabeticCode": "RON", + "NumericCode": "946", + "MinorUnit": "", + "WidthdrawalDate": "2015-06", + }, + "RUSSIAN FEDERATION (THE)": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUB", + "NumericCode": "643", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "RWANDA": { + "Currency": "Rwanda Franc", + "AlphabeticCode": "RWF", + "NumericCode": "646", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "SAINT BARTHÉLEMY": { + "Currency": "Euro", + "AlphabeticCode": "EUR", + "NumericCode": "978", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA": { + "Currency": "Saint Helena Pound", + "AlphabeticCode": "SHP", + "NumericCode": "654", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SAINT KITTS AND NEVIS": { + "Currency": "East Caribbean Dollar", + "AlphabeticCode": "XCD", + "NumericCode": "951", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SAINT LUCIA": { + "Currency": "East Caribbean Dollar", + "AlphabeticCode": "XCD", + "NumericCode": "951", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SAINT MARTIN (FRENCH PART)": { + "Currency": "Euro", + "AlphabeticCode": "EUR", + "NumericCode": "978", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SAINT PIERRE AND MIQUELON": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "SAINT VINCENT AND THE GRENADINES": { + "Currency": "East Caribbean Dollar", + "AlphabeticCode": "XCD", + "NumericCode": "951", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SAMOA": { + "Currency": "Tala", + "AlphabeticCode": "WST", + "NumericCode": "882", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SAN MARINO": { + "Currency": "Italian Lira", + "AlphabeticCode": "ITL", + "NumericCode": "380", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "SAO TOME AND PRINCIPE": { + "Currency": "Dobra", + "AlphabeticCode": "STD", + "NumericCode": "678", + "MinorUnit": "", + "WidthdrawalDate": "2017-12", + }, + "SAUDI ARABIA": { + "Currency": "Saudi Riyal", + "AlphabeticCode": "SAR", + "NumericCode": "682", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SENEGAL": { + "Currency": "CFA Franc BCEAO", + "AlphabeticCode": "XOF", + "NumericCode": "952", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "SERBIA": { + "Currency": "Serbian Dinar", + "AlphabeticCode": "RSD", + "NumericCode": "941", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SEYCHELLES": { + "Currency": "Seychelles Rupee", + "AlphabeticCode": "SCR", + "NumericCode": "690", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SIERRA LEONE": { + "Currency": "Leone", + "AlphabeticCode": "SLL", + "NumericCode": "694", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SINGAPORE": { + "Currency": "Singapore Dollar", + "AlphabeticCode": "SGD", + "NumericCode": "702", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SINT MAARTEN (DUTCH PART)": { + "Currency": "Netherlands Antillean Guilder", + "AlphabeticCode": "ANG", + "NumericCode": "532", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + 'SISTEMA UNITARIO DE COMPENSACION REGIONAL DE PAGOS "SUCRE"': { + "Currency": "Sucre", + "AlphabeticCode": "XSU", + "NumericCode": "994", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "SLOVAKIA": { + "Currency": "Slovak Koruna", + "AlphabeticCode": "SKK", + "NumericCode": "703", + "MinorUnit": "", + "WidthdrawalDate": "2009-01", + }, + "SLOVENIA": { + "Currency": "Tolar", + "AlphabeticCode": "SIT", + "NumericCode": "705", + "MinorUnit": "", + "WidthdrawalDate": "2007-01", + }, + "SOLOMON ISLANDS": { + "Currency": "Solomon Islands Dollar", + "AlphabeticCode": "SBD", + "NumericCode": "090", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SOMALIA": { + "Currency": "Somali Shilling", + "AlphabeticCode": "SOS", + "NumericCode": "706", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SOUTH AFRICA": { + "Currency": "Financial Rand", + "AlphabeticCode": "ZAL", + "NumericCode": "991", + "MinorUnit": "", + "WidthdrawalDate": "1995-03", + }, + "SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS": { + "Currency": "No universal currency", + "AlphabeticCode": "", + "NumericCode": "", + "MinorUnit": "", + "WidthdrawalDate": "", + }, + "SOUTH SUDAN": { + "Currency": "Sudanese Pound", + "AlphabeticCode": "SDG", + "NumericCode": "938", + "MinorUnit": "", + "WidthdrawalDate": "2012-09", + }, + "SPAIN": { + "Currency": "Spanish Peseta", + "AlphabeticCode": "ESP", + "NumericCode": "724", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "SRI LANKA": { + "Currency": "Sri Lanka Rupee", + "AlphabeticCode": "LKR", + "NumericCode": "144", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SUDAN (THE)": { + "Currency": "Sudanese Pound", + "AlphabeticCode": "SDG", + "NumericCode": "938", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SURINAME": { + "Currency": "Surinam Guilder", + "AlphabeticCode": "SRG", + "NumericCode": "740", + "MinorUnit": "", + "WidthdrawalDate": "2003-12", + }, + "SVALBARD AND JAN MAYEN": { + "Currency": "Norwegian Krone", + "AlphabeticCode": "NOK", + "NumericCode": "578", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SWEDEN": { + "Currency": "Swedish Krona", + "AlphabeticCode": "SEK", + "NumericCode": "752", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "SWITZERLAND": { + "Currency": "WIR Franc (for electronic)", + "AlphabeticCode": "CHC", + "NumericCode": "948", + "MinorUnit": "", + "WidthdrawalDate": "2004-11", + }, + "SYRIAN ARAB REPUBLIC": { + "Currency": "Syrian Pound", + "AlphabeticCode": "SYP", + "NumericCode": "760", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "TAIWAN (PROVINCE OF CHINA)": { + "Currency": "New Taiwan Dollar", + "AlphabeticCode": "TWD", + "NumericCode": "901", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "TAJIKISTAN": { + "Currency": "Tajik Ruble", + "AlphabeticCode": "TJR", + "NumericCode": "762", + "MinorUnit": "", + "WidthdrawalDate": "2001-04", + }, + "TANZANIA, UNITED REPUBLIC OF": { + "Currency": "Tanzanian Shilling", + "AlphabeticCode": "TZS", + "NumericCode": "834", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "THAILAND": { + "Currency": "Baht", + "AlphabeticCode": "THB", + "NumericCode": "764", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "TIMOR-LESTE": { + "Currency": "Timor Escudo", + "AlphabeticCode": "TPE", + "NumericCode": "626", + "MinorUnit": "", + "WidthdrawalDate": "2002-11", + }, + "TOGO": { + "Currency": "CFA Franc BCEAO", + "AlphabeticCode": "XOF", + "NumericCode": "952", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "TOKELAU": { + "Currency": "New Zealand Dollar", + "AlphabeticCode": "NZD", + "NumericCode": "554", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "TONGA": { + "Currency": "Pa'anga", + "AlphabeticCode": "TOP", + "NumericCode": "776", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "TRINIDAD AND TOBAGO": { + "Currency": "Trinidad and Tobago Dollar", + "AlphabeticCode": "TTD", + "NumericCode": "780", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "TUNISIA": { + "Currency": "Tunisian Dinar", + "AlphabeticCode": "TND", + "NumericCode": "788", + "MinorUnit": "3", + "WidthdrawalDate": "", + }, + "TURKEY": { + "Currency": "New Turkish Lira", + "AlphabeticCode": "TRY", + "NumericCode": "949", + "MinorUnit": "", + "WidthdrawalDate": "2009-01", + }, + "TURKMENISTAN": { + "Currency": "Turkmenistan Manat", + "AlphabeticCode": "TMM", + "NumericCode": "795", + "MinorUnit": "", + "WidthdrawalDate": "2009-01", + }, + "TURKS AND CAICOS ISLANDS (THE)": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "TUVALU": { + "Currency": "Australian Dollar", + "AlphabeticCode": "AUD", + "NumericCode": "036", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "UGANDA": { + "Currency": "Old Shilling", + "AlphabeticCode": "UGW", + "NumericCode": "800", + "MinorUnit": "", + "WidthdrawalDate": "1989 to 1990", + }, + "UKRAINE": { + "Currency": "Karbovanet", + "AlphabeticCode": "UAK", + "NumericCode": "804", + "MinorUnit": "", + "WidthdrawalDate": "1996-09", + }, + "UNITED ARAB EMIRATES (THE)": { + "Currency": "UAE Dirham", + "AlphabeticCode": "AED", + "NumericCode": "784", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND (THE)": { + "Currency": "Pound Sterling", + "AlphabeticCode": "GBP", + "NumericCode": "826", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "UNITED STATES MINOR OUTLYING ISLANDS (THE)": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "UNITED STATES OF AMERICA (THE)": { + "Currency": "US Dollar (Next day)", + "AlphabeticCode": "USN", + "NumericCode": "997", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "URUGUAY": { + "Currency": "Uruguayan Peso", + "AlphabeticCode": "UYP", + "NumericCode": "858", + "MinorUnit": "", + "WidthdrawalDate": "1993-03", + }, + "UZBEKISTAN": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1994-07", + }, + "VANUATU": { + "Currency": "Vatu", + "AlphabeticCode": "VUV", + "NumericCode": "548", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "VENEZUELA (BOLIVARIAN REPUBLIC OF)": { + "Currency": "Bolívar", + "AlphabeticCode": "VEF", + "NumericCode": "937", + "MinorUnit": "", + "WidthdrawalDate": "2018-08", + }, + "VIET NAM": { + "Currency": "Dong", + "AlphabeticCode": "VND", + "NumericCode": "704", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "VIRGIN ISLANDS (BRITISH)": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "VIRGIN ISLANDS (U.S.)": { + "Currency": "US Dollar", + "AlphabeticCode": "USD", + "NumericCode": "840", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "WALLIS AND FUTUNA": { + "Currency": "CFP Franc", + "AlphabeticCode": "XPF", + "NumericCode": "953", + "MinorUnit": "0", + "WidthdrawalDate": "", + }, + "WESTERN SAHARA": { + "Currency": "Moroccan Dirham", + "AlphabeticCode": "MAD", + "NumericCode": "504", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "YEMEN": { + "Currency": "Yemeni Rial", + "AlphabeticCode": "YER", + "NumericCode": "886", + "MinorUnit": "2", + "WidthdrawalDate": "", + }, + "ZAMBIA": { + "Currency": "Zambian Kwacha", + "AlphabeticCode": "ZMK", + "NumericCode": "894", + "MinorUnit": "", + "WidthdrawalDate": "2012-12", + }, + "ZIMBABWE": { + "Currency": "Zimbabwe Dollar", + "AlphabeticCode": "ZWR", + "NumericCode": "935", + "MinorUnit": "", + "WidthdrawalDate": "2009-06", + }, + "ZZ01_Bond Markets Unit European_EURCO": { + "Currency": "Bond Markets Unit European Composite Unit (EURCO)", + "AlphabeticCode": "XBA", + "NumericCode": "955", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ02_Bond Markets Unit European_EMU-6": { + "Currency": "Bond Markets Unit European Monetary Unit (E.M.U.-6)", + "AlphabeticCode": "XBB", + "NumericCode": "956", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ03_Bond Markets Unit European_EUA-9": { + "Currency": "Bond Markets Unit European Unit of Account 9 (E.U.A.-9)", + "AlphabeticCode": "XBC", + "NumericCode": "957", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ04_Bond Markets Unit European_EUA-17": { + "Currency": "Bond Markets Unit European Unit of Account 17 (E.U.A.-17)", + "AlphabeticCode": "XBD", + "NumericCode": "958", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ06_Testing_Code": { + "Currency": "Codes specifically reserved for testing purposes", + "AlphabeticCode": "XTS", + "NumericCode": "963", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ07_No_Currency": { + "Currency": "The codes assigned for transactions where no currency is involved", + "AlphabeticCode": "XXX", + "NumericCode": "999", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ08_Gold": { + "Currency": "Gold", + "AlphabeticCode": "XAU", + "NumericCode": "959", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ09_Palladium": { + "Currency": "Palladium", + "AlphabeticCode": "XPD", + "NumericCode": "964", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ10_Platinum": { + "Currency": "Platinum", + "AlphabeticCode": "XPT", + "NumericCode": "962", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "ZZ11_Silver": { + "Currency": "Silver", + "AlphabeticCode": "XAG", + "NumericCode": "961", + "MinorUnit": "-", + "WidthdrawalDate": "", + }, + "BOLIVIA": { + "Currency": "Peso boliviano", + "AlphabeticCode": "BOP", + "NumericCode": "068", + "MinorUnit": "", + "WidthdrawalDate": "1987-02", + }, + "BURMA": { + "Currency": "Kyat", + "AlphabeticCode": "BUK", + "NumericCode": "104", + "MinorUnit": "", + "WidthdrawalDate": "1990-02", + }, + "CZECHOSLOVAKIA": { + "Currency": "Koruna", + "AlphabeticCode": "CSK", + "NumericCode": "200", + "MinorUnit": "", + "WidthdrawalDate": "1993-03", + }, + "EUROPEAN MONETARY CO-OPERATION FUND (EMCF)": { + "Currency": "European Currency Unit (E.C.U)", + "AlphabeticCode": "XEU", + "NumericCode": "954", + "MinorUnit": "", + "WidthdrawalDate": "1999-01", + }, + "FRENCH SOUTHERN TERRITORIES": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "GERMAN DEMOCRATIC REPUBLIC": { + "Currency": "Mark der DDR", + "AlphabeticCode": "DDM", + "NumericCode": "278", + "MinorUnit": "", + "WidthdrawalDate": "1990-07 to 1990-09", + }, + "HOLY SEE (VATICAN CITY STATE)": { + "Currency": "Italian Lira", + "AlphabeticCode": "ITL", + "NumericCode": "380", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "LAO": { + "Currency": "Pathet Lao Kip", + "AlphabeticCode": "LAJ", + "NumericCode": "418", + "MinorUnit": "", + "WidthdrawalDate": "1979-12", + }, + "MOLDOVA, REPUBLIC OF": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1993-12", + }, + "NETHERLANDS": { + "Currency": "Netherlands Guilder", + "AlphabeticCode": "NLG", + "NumericCode": "528", + "MinorUnit": "", + "WidthdrawalDate": "2002-03", + }, + "NETHERLANDS ANTILLES": { + "Currency": "Netherlands Antillean Guilder", + "AlphabeticCode": "ANG", + "NumericCode": "532", + "MinorUnit": "", + "WidthdrawalDate": "2010-10", + }, + "RUSSIAN FEDERATION": { + "Currency": "Russian Ruble", + "AlphabeticCode": "RUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "2004-01", + }, + "SAINT MARTIN": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "1999-01", + }, + "SAINT-BARTHÉLEMY": { + "Currency": "French Franc", + "AlphabeticCode": "FRF", + "NumericCode": "250", + "MinorUnit": "", + "WidthdrawalDate": "1999-01", + }, + "SERBIA AND MONTENEGRO": { + "Currency": "Euro", + "AlphabeticCode": "EUR", + "NumericCode": "978", + "MinorUnit": "", + "WidthdrawalDate": "2006-10", + }, + "SOUTHERN RHODESIA": { + "Currency": "Rhodesian Dollar", + "AlphabeticCode": "RHD", + "NumericCode": "716", + "MinorUnit": "", + "WidthdrawalDate": "1978 to 1981", + }, + "SUDAN": { + "Currency": "Sudanese Pound", + "AlphabeticCode": "SDP", + "NumericCode": "736", + "MinorUnit": "", + "WidthdrawalDate": "1998-06", + }, + "SWAZILAND": { + "Currency": "Lilangeni", + "AlphabeticCode": "SZL", + "NumericCode": "748", + "MinorUnit": "", + "WidthdrawalDate": "2018-08", + }, + "UNION OF SOVIET SOCIALIST REPUBLICS": { + "Currency": "Rouble", + "AlphabeticCode": "SUR", + "NumericCode": "810", + "MinorUnit": "", + "WidthdrawalDate": "1990-12", + }, + "UNITED STATES": { + "Currency": "US Dollar (Same day)", + "AlphabeticCode": "USS", + "NumericCode": "998", + "MinorUnit": "", + "WidthdrawalDate": "2014-03", + }, + "VENEZUELA": { + "Currency": "Bolivar Fuerte", + "AlphabeticCode": "VEF", + "NumericCode": "937", + "MinorUnit": "", + "WidthdrawalDate": "2011-12", + }, + "VIETNAM": { + "Currency": "Old Dong", + "AlphabeticCode": "VNC", + "NumericCode": "704", + "MinorUnit": "", + "WidthdrawalDate": "1989-1990", + }, + "YEMEN, DEMOCRATIC": { + "Currency": "Yemeni Dinar", + "AlphabeticCode": "YDD", + "NumericCode": "720", + "MinorUnit": "", + "WidthdrawalDate": "1991-09", + }, + "YUGOSLAVIA": { + "Currency": "Yugoslavian Dinar", + "AlphabeticCode": "YUN", + "NumericCode": "890", + "MinorUnit": "", + "WidthdrawalDate": "1995-11", + }, + "ZAIRE": { + "Currency": "Zaire", + "AlphabeticCode": "ZRZ", + "NumericCode": "180", + "MinorUnit": "", + "WidthdrawalDate": "1994-02", + }, + "ZZ01_Gold-Franc": { + "Currency": "Gold-Franc", + "AlphabeticCode": "XFO", + "NumericCode": "", + "MinorUnit": "", + "WidthdrawalDate": "2006-10", + }, + "ZZ02_RINET Funds Code": { + "Currency": "RINET Funds Code", + "AlphabeticCode": "XRE", + "NumericCode": "", + "MinorUnit": "", + "WidthdrawalDate": "1999-11", + }, + "ZZ05_UIC-Franc": { + "Currency": "UIC-Franc", + "AlphabeticCode": "XFU", + "NumericCode": "", + "MinorUnit": "", + "WidthdrawalDate": "2013-11", + }, +} From d4b96acf9dfd7856a145f9fb3e226072ad772df7 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Mon, 22 Apr 2024 22:10:32 +0200 Subject: [PATCH 02/12] add metadata fill page, include it in the menu, give it at the second step --- app/menu.py | 1 + app/pages/1_Selected_Pages.py | 2 +- app/pages/5_Metadata.py | 62 +++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 app/pages/5_Metadata.py diff --git a/app/menu.py b/app/menu.py index fc0bd82..d86a901 100644 --- a/app/menu.py +++ b/app/menu.py @@ -12,6 +12,7 @@ def display_pages_menu() -> None: st.markdown("# Pipeline steps") st.page_link("pages/0_Import_File.py", label="Upload PDF") st.page_link("pages/1_Selected_Pages.py", label="Pages selection") + st.page_link("pages/5_Metadata.py", label="Metadata") st.page_link("pages/2_Merge_Tables.py", label="Merge tables") st.page_link("pages/3_Clean_Headers.py", label="Headers setup") st.page_link("pages/4_Clean_Tables.py", label="Tables customization") diff --git a/app/pages/1_Selected_Pages.py b/app/pages/1_Selected_Pages.py index b57df5f..0496197 100644 --- a/app/pages/1_Selected_Pages.py +++ b/app/pages/1_Selected_Pages.py @@ -70,4 +70,4 @@ def set_validate() -> None: st.session_state["working_file_pdf"].name, [i - 1 for i in selected_pages], ) - st.switch_page("pages/2_Merge_Tables.py") + st.switch_page("pages/5_Metadata.py") diff --git a/app/pages/5_Metadata.py b/app/pages/5_Metadata.py new file mode 100644 index 0000000..e93985e --- /dev/null +++ b/app/pages/5_Metadata.py @@ -0,0 +1,62 @@ +import streamlit as st +from utils import set_algorithm_name, get_pdf_iframe +from menu import display_pages_menu +from country_by_country.utils.constants import JURIDICTIONS, CURRENCIES +from Levenshtein import distance +import sys +import logging +import pandas as pd +import numpy as np +import re + +logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(message)s") + + +st.set_page_config(layout="wide", page_title="Report metadata") +st.title("Country by Country Tax Reporting analysis : Metadata") +st.subheader( + "This page will allow you to fill in metadata about the report : company name, headquarter, currency, unit, ...", +) +display_pages_menu() + +if "pdf_after_page_validation" in st.session_state: + col1, col2 = st.columns(2) + with col1: + st.markdown( + get_pdf_iframe(st.session_state["pdf_after_page_validation"]), + unsafe_allow_html=True, + ) + with col2: + with st.form("metadata_form"): + company_name = st.text_input("Company name") + year = st.text_input("Year") + + currencies = { + ( + CURRENCIES[currency]["AlphabeticCode"], + CURRENCIES[currency]["Currency"], + ) + for currency in CURRENCIES + } + currencies = sorted(currencies, key=lambda x: x[0]) + currencies = [f"{currency[0]} - {currency[1]}" for currency in currencies] + currency = st.selectbox("Currency", currencies) + unit = st.selectbox( + "Unit", + ("thousands", "millions", "10 millions", "100 millions", "billions"), + ) + headquarter = st.selectbox( + "Headquarter location", list(JURIDICTIONS.keys()) + ) + submitted = st.form_submit_button( + label="Submit", + ) + if submitted: + st.session_state["metadata"] = { + "company_name": company_name, + "year": year, + "currency": currency, + "unit": unit, + "headquarter": headquarter, + } + st.switch_page("pages/2_Merge_Tables.py") From 0a92b3f48e1300339ffc794637251a0ef91d51bf Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Mon, 22 Apr 2024 22:13:08 +0200 Subject: [PATCH 03/12] rename pages to insert Metadata at step 2 --- app/menu.py | 8 ++++---- app/pages/1_Selected_Pages.py | 2 +- app/pages/{5_Metadata.py => 2_Metadata.py} | 2 +- app/pages/{2_Merge_Tables.py => 3_Merge_Tables.py} | 4 ++-- app/pages/{3_Clean_Headers.py => 4_Clean_Headers.py} | 8 ++++---- app/pages/{4_Clean_Tables.py => 5_Clean_Tables.py} | 0 6 files changed, 12 insertions(+), 12 deletions(-) rename app/pages/{5_Metadata.py => 2_Metadata.py} (97%) rename app/pages/{2_Merge_Tables.py => 3_Merge_Tables.py} (97%) rename app/pages/{3_Clean_Headers.py => 4_Clean_Headers.py} (94%) rename app/pages/{4_Clean_Tables.py => 5_Clean_Tables.py} (100%) diff --git a/app/menu.py b/app/menu.py index d86a901..1c93935 100644 --- a/app/menu.py +++ b/app/menu.py @@ -12,7 +12,7 @@ def display_pages_menu() -> None: st.markdown("# Pipeline steps") st.page_link("pages/0_Import_File.py", label="Upload PDF") st.page_link("pages/1_Selected_Pages.py", label="Pages selection") - st.page_link("pages/5_Metadata.py", label="Metadata") - st.page_link("pages/2_Merge_Tables.py", label="Merge tables") - st.page_link("pages/3_Clean_Headers.py", label="Headers setup") - st.page_link("pages/4_Clean_Tables.py", label="Tables customization") + st.page_link("pages/2_Metadata.py", label="Metadata") + st.page_link("pages/3_Merge_Tables.py", label="Merge tables") + st.page_link("pages/4_Clean_Headers.py", label="Headers setup") + st.page_link("pages/5_Clean_Tables.py", label="Tables customization") diff --git a/app/pages/1_Selected_Pages.py b/app/pages/1_Selected_Pages.py index 0496197..7afe902 100644 --- a/app/pages/1_Selected_Pages.py +++ b/app/pages/1_Selected_Pages.py @@ -70,4 +70,4 @@ def set_validate() -> None: st.session_state["working_file_pdf"].name, [i - 1 for i in selected_pages], ) - st.switch_page("pages/5_Metadata.py") + st.switch_page("pages/2_Metadata.py") diff --git a/app/pages/5_Metadata.py b/app/pages/2_Metadata.py similarity index 97% rename from app/pages/5_Metadata.py rename to app/pages/2_Metadata.py index e93985e..3a798f9 100644 --- a/app/pages/5_Metadata.py +++ b/app/pages/2_Metadata.py @@ -59,4 +59,4 @@ "unit": unit, "headquarter": headquarter, } - st.switch_page("pages/2_Merge_Tables.py") + st.switch_page("pages/3_Merge_Tables.py") diff --git a/app/pages/2_Merge_Tables.py b/app/pages/3_Merge_Tables.py similarity index 97% rename from app/pages/2_Merge_Tables.py rename to app/pages/3_Merge_Tables.py index 1d337f3..51e43c3 100644 --- a/app/pages/2_Merge_Tables.py +++ b/app/pages/3_Merge_Tables.py @@ -71,7 +71,7 @@ def save_merge(table_extractor: str) -> None: if "first_time_merge" not in st.session_state: st.session_state["first_time_merge"] = False - st.switch_page("pages/3_Clean_Headers.py") + st.switch_page("pages/4_Clean_Headers.py") col1, col2, col3 = st.columns([3, 1, 3]) with col1: @@ -110,7 +110,7 @@ def save_merge(table_extractor: str) -> None: args=(table_extractor,), ) if validated: - st.switch_page("pages/3_Clean_Headers.py") + st.switch_page("pages/4_Clean_Headers.py") with col3: if merged is True: diff --git a/app/pages/3_Clean_Headers.py b/app/pages/4_Clean_Headers.py similarity index 94% rename from app/pages/3_Clean_Headers.py rename to app/pages/4_Clean_Headers.py index c9bc0fc..5d89a40 100644 --- a/app/pages/3_Clean_Headers.py +++ b/app/pages/4_Clean_Headers.py @@ -12,9 +12,9 @@ def transpose_current_table(): - st.session_state.tables[ - st.session_state["algorithm_name"] - ] = st.session_state.tables[st.session_state["algorithm_name"]].transpose() + st.session_state.tables[st.session_state["algorithm_name"]] = ( + st.session_state.tables[st.session_state["algorithm_name"]].transpose() + ) def set_headers(algorithm_name: str) -> None: @@ -107,7 +107,7 @@ def set_headers(algorithm_name: str) -> None: ) if submitted: - st.switch_page("pages/4_Clean_Tables.py") + st.switch_page("pages/5_Clean_Tables.py") st.markdown("# Current extraction") st.markdown("The extracted table is displaye below") diff --git a/app/pages/4_Clean_Tables.py b/app/pages/5_Clean_Tables.py similarity index 100% rename from app/pages/4_Clean_Tables.py rename to app/pages/5_Clean_Tables.py From b6d57ce7df4a284c990ddbd1be449dfdc6e321a6 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Mon, 22 Apr 2024 22:22:34 +0200 Subject: [PATCH 04/12] refill the form with preselected values if any --- app/pages/2_Metadata.py | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/app/pages/2_Metadata.py b/app/pages/2_Metadata.py index 3a798f9..1b7d72b 100644 --- a/app/pages/2_Metadata.py +++ b/app/pages/2_Metadata.py @@ -28,8 +28,22 @@ ) with col2: with st.form("metadata_form"): - company_name = st.text_input("Company name") - year = st.text_input("Year") + if "metadata" in st.session_state: + company_name = st.session_state["metadata"]["company_name"] + year = st.session_state["metadata"]["year"] + currency = st.session_state["metadata"]["currency"] + unit = st.session_state["metadata"]["unit"] + headquarter = st.session_state["metadata"]["headquarter"] + print(company_name, year, currency, unit, headquarter) + else: + company_name = "" + year = "" + currency = "" + unit = None + headquarter = "" + + company_name = st.text_input("Company name", value=company_name) + year = st.text_input("Year", value=year) currencies = { ( @@ -40,14 +54,22 @@ } currencies = sorted(currencies, key=lambda x: x[0]) currencies = [f"{currency[0]} - {currency[1]}" for currency in currencies] - currency = st.selectbox("Currency", currencies) - unit = st.selectbox( - "Unit", - ("thousands", "millions", "10 millions", "100 millions", "billions"), + currency = st.selectbox( + "Currency", + currencies, + index=currencies.index(currency) if currency else 0, ) + + units = ["thousands", "millions", "10 millions", "100 millions", "billions"] + unit = st.selectbox("Unit", units, index=units.index(unit) if unit else 0) + + headquarters = list(JURIDICTIONS.keys()) headquarter = st.selectbox( - "Headquarter location", list(JURIDICTIONS.keys()) + "Headquarter location", + headquarters, + index=headquarters.index(headquarter) if headquarter else 0, ) + submitted = st.form_submit_button( label="Submit", ) From 12bf348500ef162ad63080d3f1255428d22aaf22 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Mon, 22 Apr 2024 22:27:25 +0200 Subject: [PATCH 05/12] reformat with precommit --- app/pages/4_Clean_Headers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/pages/4_Clean_Headers.py b/app/pages/4_Clean_Headers.py index 5d89a40..dfe9cb3 100644 --- a/app/pages/4_Clean_Headers.py +++ b/app/pages/4_Clean_Headers.py @@ -12,9 +12,9 @@ def transpose_current_table(): - st.session_state.tables[st.session_state["algorithm_name"]] = ( - st.session_state.tables[st.session_state["algorithm_name"]].transpose() - ) + st.session_state.tables[ + st.session_state["algorithm_name"] + ] = st.session_state.tables[st.session_state["algorithm_name"]].transpose() def set_headers(algorithm_name: str) -> None: From 56326012461e7650a87427c680b03de2b78929cc Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Mon, 22 Apr 2024 22:37:30 +0200 Subject: [PATCH 06/12] populate the exported csv with the metadata columns --- app/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/utils.py b/app/utils.py index f07e5e0..e6147c9 100644 --- a/app/utils.py +++ b/app/utils.py @@ -20,6 +20,12 @@ def set_algorithm_name(my_key: str) -> None: @st.cache_data def to_csv_file(df: pd.DataFrame) -> bytes: + # Populate the columns with the metadata + df = df.assign(company=st.session_state["metadata"]["company_name"]) + df = df.assign(year=st.session_state["metadata"]["year"]) + df = df.assign(currency=st.session_state["metadata"]["currency"]) + df = df.assign(unit=st.session_state["metadata"]["unit"]) + df = df.assign(headquarter=st.session_state["metadata"]["headquarter"]) return df.to_csv(index=False).encode("utf-8") From 720417492dec0023ce2aa8ac0c3ac81a3848b1f7 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Tue, 23 Apr 2024 12:35:10 +0200 Subject: [PATCH 07/12] adding the sectors and the list of companies with their headquarters and sector --- country_by_country/utils/constants.py | 331 ++++++++++++++++++++++++++ 1 file changed, 331 insertions(+) diff --git a/country_by_country/utils/constants.py b/country_by_country/utils/constants.py index f29a6c2..f4c9f44 100644 --- a/country_by_country/utils/constants.py +++ b/country_by_country/utils/constants.py @@ -4007,3 +4007,334 @@ "WidthdrawalDate": "2013-11", }, } + +SECTORS = { + "Transport, Freight & Storage", + "Textiles & Clothing Manufacturing", + "Wood, Furniture & Paper Manufacturing", + "Food & Tobacco Manufacturing", + "Miscellaneous Manufacturing", + "Utilities", + "Business Services", + "Leather, Stone, Clay & Glass products", + "Transport Manufacturing", + "Printing & Publishing", + "Construction", + "Travel, Personal & Leisure", + "Computer Software", + "Retail", + "Industrial, Electric & Electronic Machinery", + "Chemicals, Petroleum, Rubber & Plastic", + "Banking, Insurance & Financial Services", + "Wholesale", + "Property Services", + "Communications", + "Metals & Metal Products", + "Biotechnology and Life Sciences", + "Mining & Extraction", +} + +COMPANIES = { + "Acciona": {"headquarter": "ESP", "sector": "Construction"}, + "Acerinox": {"headquarter": "ESP", "sector": "Metals & Metal Products"}, + "ACS": {"headquarter": "ESP", "sector": "Construction"}, + "Adecco": {"headquarter": "CHE", "sector": "Business Services"}, + "Adyen": { + "headquarter": "NLD", + "sector": "Banking, Insurance & Financial Services", + }, + "Aegon": { + "headquarter": "NLD", + "sector": "Banking, Insurance & Financial Services", + }, + "Ajinomoto": {"headquarter": "JPN", "sector": "Food & Tobacco Manufacturing"}, + "AkerSolutions": {"headquarter": "NOR", "sector": "Business Services"}, + "AkzoNobel": { + "headquarter": "NLD", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Allianz": { + "headquarter": "DEU", + "sector": "Banking, Insurance & Financial Services", + }, + "AmericaMovil": {"headquarter": "MEX", "sector": "Communications"}, + "Amorepacific": { + "headquarter": "KOR", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "AngloAmerican": {"headquarter": "GBR", "sector": "Mining & Extraction"}, + "Applus": {"headquarter": "ESP", "sector": "Business Services"}, + "Aquafil": { + "headquarter": "ITA", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "ASTM": {"headquarter": "ITA", "sector": "Transport, Freight & Storage"}, + "Atlantia": {"headquarter": "ITA", "sector": "Transport, Freight & Storage"}, + "AutostradePerL'Italia": { + "headquarter": "ITA", + "sector": "Transport, Freight & Storage", + }, + "AXA": {"headquarter": "FRA", "sector": "Banking, Insurance & Financial Services"}, + "Barloworld": {"headquarter": "ZAF", "sector": "Wholesale"}, + "BayWa": {"headquarter": "DEU", "sector": "Wholesale"}, + "BHP": {"headquarter": "AUS", "sector": "Mining & Extraction"}, + "Biocon": { + "headquarter": "IND", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Bonava": {"headquarter": "SWE", "sector": "Construction"}, + "BP": {"headquarter": "GBR", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "BT": {"headquarter": "GBR", "sector": "Communications"}, + "BuzziUnicem": { + "headquarter": "ITA", + "sector": "Leather, Stone, Clay & Glass products", + }, + "BWEnergy": {"headquarter": "BMU", "sector": "Mining & Extraction"}, + "Canacol": {"headquarter": "CAN", "sector": "Mining & Extraction"}, + "Castellum": {"headquarter": "SWE", "sector": "Property Services"}, + "Cellnex": {"headquarter": "ESP", "sector": "Communications"}, + "CELSA": {"headquarter": "ESP", "sector": "Metals & Metal Products"}, + "Cembre": { + "headquarter": "ITA", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "Cipla": {"headquarter": "IND", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "Coloplast": { + "headquarter": "DNK", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "Corwin": {"headquarter": "SVK", "sector": "Property Services"}, + "CSL": {"headquarter": "AUS", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "Cyient": {"headquarter": "IND", "sector": "Computer Software"}, + "Diasorin": { + "headquarter": "ITA", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Discovery": { + "headquarter": "ZAF", + "sector": "Banking, Insurance & Financial Services", + }, + "DNO": {"headquarter": "NOR", "sector": "Mining & Extraction"}, + "DSM": {"headquarter": "NLD", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "Dundee": { + "headquarter": "CAN", + "sector": "Banking, Insurance & Financial Services", + }, + "Duratex": { + "headquarter": "BRA", + "sector": "Wood, Furniture & Paper Manufacturing", + }, + "Ecopetrol": {"headquarter": "COL", "sector": "Mining & Extraction"}, + "Eisai": {"headquarter": "JPN", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "ElCorteInglés": {"headquarter": "ESP", "sector": "Retail"}, + "EmpresasCopec": {"headquarter": "CHL", "sector": "Retail"}, + "Enagas": {"headquarter": "ESP", "sector": "Transport, Freight & Storage"}, + "ENAV": {"headquarter": "ITA", "sector": "Transport, Freight & Storage"}, + "Endesa": {"headquarter": "ESP", "sector": "Utilities"}, + "Enel": {"headquarter": "ITA", "sector": "Utilities"}, + "ENI": {"headquarter": "ITA", "sector": "Mining & Extraction"}, + "Equinor": {"headquarter": "NOR", "sector": "Mining & Extraction"}, + "ERG": {"headquarter": "ITA", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "Esprinet": {"headquarter": "ITA", "sector": "Business Services"}, + "Essity": {"headquarter": "SWE", "sector": "Wholesale"}, + "EVRAZ": {"headquarter": "GBR", "sector": "Mining & Extraction"}, + "Exxaro": {"headquarter": "ZAF", "sector": "Mining & Extraction"}, + "FalckRenewables": {"headquarter": "ITA", "sector": "Utilities"}, + "FCFMinerals": {"headquarter": "PHL", "sector": "Mining & Extraction"}, + "Fedrigoni": { + "headquarter": "ITA", + "sector": "Wood, Furniture & Paper Manufacturing", + }, + "Feralpi": {"headquarter": "ITA", "sector": "Metals & Metal Products"}, + "Ferrovial": {"headquarter": "ESP", "sector": "Construction"}, + "FerrovieDelloStatoItaliane": { + "headquarter": "ITA", + "sector": "Transport, Freight & Storage", + }, + "FILA": {"headquarter": "ITA", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "Finnair": {"headquarter": "FIN", "sector": "Transport, Freight & Storage"}, + "Fortum": {"headquarter": "FIN", "sector": "Utilities"}, + "Generali": { + "headquarter": "ITA", + "sector": "Banking, Insurance & Financial Services", + }, + "GeoPark": {"headquarter": "BMU", "sector": "Mining & Extraction"}, + "Grundfos": { + "headquarter": "DNK", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "GVS": { + "headquarter": "ITA", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "Heimstaden": {"headquarter": "SWE", "sector": "Property Services"}, + "HessCorporation": { + "headquarter": "USA", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Hydro": {"headquarter": "NOR", "sector": "Metals & Metal Products"}, + "Iberdrola": {"headquarter": "ESP", "sector": "Utilities"}, + "Iberostar": {"headquarter": "ESP", "sector": "Travel, Personal & Leisure"}, + "IKEA": {"headquarter": "NLD", "sector": "Retail"}, + "Inditex": {"headquarter": "ESP", "sector": "Textiles & Clothing Manufacturing"}, + "Indra": {"headquarter": "ESP", "sector": "Business Services"}, + "InPost": {"headquarter": "LUX", "sector": "Retail"}, + "InsudPharma": { + "headquarter": "AUT", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Interpump": { + "headquarter": "ITA", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "ItauUnibanco": { + "headquarter": "BRA", + "sector": "Banking, Insurance & Financial Services", + }, + "Kesko": {"headquarter": "FIN", "sector": "Wholesale"}, + "KPN": {"headquarter": "NLD", "sector": "Communications"}, + "L&G": {"headquarter": "GBR", "sector": "Banking, Insurance & Financial Services"}, + "Leonardo": {"headquarter": "ITA", "sector": "Transport Manufacturing"}, + "LupinLimited": { + "headquarter": "IND", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Lush": {"headquarter": "GBR", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "LU-VE": { + "headquarter": "ITA", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "MAPFRE": { + "headquarter": "ESP", + "sector": "Banking, Insurance & Financial Services", + }, + "MegaHoldings": { + "headquarter": "TWN", + "sector": "Banking, Insurance & Financial Services", + }, + "Meiji": {"headquarter": "JPN", "sector": "Food & Tobacco Manufacturing"}, + "MeliaHotels": {"headquarter": "ESP", "sector": "Travel, Personal & Leisure"}, + "MotorOilHellas": { + "headquarter": "GRC", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Mundys": {"headquarter": "ITA", "sector": "Transport, Freight & Storage"}, + "MunichRe": { + "headquarter": "DEU", + "sector": "Banking, Insurance & Financial Services", + }, + "NationalGrid": {"headquarter": "GBR", "sector": "Utilities"}, + "Nedbank": { + "headquarter": "ZAF", + "sector": "Banking, Insurance & Financial Services", + }, + "Newmont": {"headquarter": "USA", "sector": "Mining & Extraction"}, + "NH": {"headquarter": "ESP", "sector": "Travel, Personal & Leisure"}, + "NN": {"headquarter": "NLD", "sector": "Banking, Insurance & Financial Services"}, + "Nordgold": {"headquarter": "GBR", "sector": "Mining & Extraction"}, + "NovoHoldings": { + "headquarter": "DNK", + "sector": "Banking, Insurance & Financial Services", + }, + "NTT": {"headquarter": "JPN", "sector": "Computer Software"}, + "OHLA": {"headquarter": "ESP", "sector": "Construction"}, + "OldMutual": { + "headquarter": "ZAF", + "sector": "Banking, Insurance & Financial Services", + }, + "Omron": { + "headquarter": "JPN", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "Orica": {"headquarter": "AUS", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "Ørsted": {"headquarter": "DNK", "sector": "Utilities"}, + "OTB": {"headquarter": "ITA", "sector": "Textiles & Clothing Manufacturing"}, + "Pandora": {"headquarter": "DNK", "sector": "Miscellaneous Manufacturing"}, + "Panoro": {"headquarter": "NOR", "sector": "Mining & Extraction"}, + "ParquesReunidos": {"headquarter": "ESP", "sector": "Travel, Personal & Leisure"}, + "Pearson": {"headquarter": "GBR", "sector": "Printing & Publishing"}, + "Philips": { + "headquarter": "NLD", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "Piaggio": {"headquarter": "ITA", "sector": "Transport Manufacturing"}, + "Piquadro": {"headquarter": "ITA", "sector": "Retail"}, + "Prisa": {"headquarter": "ESP", "sector": "Printing & Publishing"}, + "Prudential": { + "headquarter": "GBR", + "sector": "Banking, Insurance & Financial Services", + }, + "Prysmian": {"headquarter": "ITA", "sector": "Communications"}, + "QIAGEN": {"headquarter": "NLD", "sector": "Biotechnology and Life Sciences"}, + "Radici": { + "headquarter": "ITA", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Randstad": {"headquarter": "NLD", "sector": "Business Services"}, + "Recordati": { + "headquarter": "ITA", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "RedElectrica": {"headquarter": "ESP", "sector": "Utilities"}, + "REPSOL": {"headquarter": "ESP", "sector": "Mining & Extraction"}, + "RIOTINTO": {"headquarter": "AUS", "sector": "Mining & Extraction"}, + "RoyalUnibrew": {"headquarter": "DNK", "sector": "Food & Tobacco Manufacturing"}, + "SAES": { + "headquarter": "ITA", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "Saipem": {"headquarter": "ITA", "sector": "Mining & Extraction"}, + "SGR": {"headquarter": "ITA", "sector": "Utilities"}, + "SHELL": {"headquarter": "GBR", "sector": "Mining & Extraction"}, + "SHV": {"headquarter": "NLD", "sector": "Wholesale"}, + "Siltronic": { + "headquarter": "DEU", + "sector": "Industrial, Electric & Electronic Machinery", + }, + "SJP": {"headquarter": "GBR", "sector": "Banking, Insurance & Financial Services"}, + "SNAM": {"headquarter": "ITA", "sector": "Transport, Freight & Storage"}, + "SOL": {"headquarter": "ITA", "sector": "Chemicals, Petroleum, Rubber & Plastic"}, + "Sonoco": {"headquarter": "USA", "sector": "Wood, Furniture & Paper Manufacturing"}, + "South32": {"headquarter": "AUS", "sector": "Mining & Extraction"}, + "SSE": {"headquarter": "GBR", "sector": "Utilities"}, + "SumitomoMetalMining": {"headquarter": "JPN", "sector": "Metals & Metal Products"}, + "SwissLife": { + "headquarter": "CHE", + "sector": "Banking, Insurance & Financial Services", + }, + "SwissRe": { + "headquarter": "CHE", + "sector": "Banking, Insurance & Financial Services", + }, + "TeckResources": {"headquarter": "CAN", "sector": "Mining & Extraction"}, + "Telefonica": {"headquarter": "ESP", "sector": "Communications"}, + "Telenor": {"headquarter": "NOR", "sector": "Communications"}, + "Terna": {"headquarter": "ITA", "sector": "Utilities"}, + "TIM": {"headquarter": "ITA", "sector": "Communications"}, + "Tinexta": {"headquarter": "ITA", "sector": "Business Services"}, + "TKH": {"headquarter": "NLD", "sector": "Metals & Metal Products"}, + "Tod's": {"headquarter": "ITA", "sector": "Textiles & Clothing Manufacturing"}, + "TotalEnergies": {"headquarter": "FRA", "sector": "Mining & Extraction"}, + "Unilever": {"headquarter": "GBR", "sector": "Food & Tobacco Manufacturing"}, + "Uniper": {"headquarter": "DEU", "sector": "Utilities"}, + "Usiminas": {"headquarter": "BRA", "sector": "Metals & Metal Products"}, + "VanLanschotKempen": { + "headquarter": "NLD", + "sector": "Banking, Insurance & Financial Services", + }, + "Vattenfall": {"headquarter": "SWE", "sector": "Utilities"}, + "Vodacom": {"headquarter": "ZAF", "sector": "Communications"}, + "VODAFONE": {"headquarter": "GBR", "sector": "Communications"}, + "Vopak": {"headquarter": "NLD", "sector": "Transport, Freight & Storage"}, + "VR": {"headquarter": "FIN", "sector": "Transport, Freight & Storage"}, + "Wesfarmers": { + "headquarter": "AUS", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Yara": {"headquarter": "NOR", "sector": "Mining & Extraction"}, + "Yokohama": { + "headquarter": "JPN", + "sector": "Chemicals, Petroleum, Rubber & Plastic", + }, + "Other": {"headquarter": "", "sector": ""}, +} From a76440c89ce259dae1ec528f8546d06ae28ebf30 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Tue, 23 Apr 2024 13:20:09 +0200 Subject: [PATCH 08/12] order sectors in alphabetic order, add sector selectbox --- app/pages/2_Metadata.py | 10 ++++++- country_by_country/utils/constants.py | 42 ++++++++++++++------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/app/pages/2_Metadata.py b/app/pages/2_Metadata.py index 1b7d72b..f749364 100644 --- a/app/pages/2_Metadata.py +++ b/app/pages/2_Metadata.py @@ -1,7 +1,7 @@ import streamlit as st from utils import set_algorithm_name, get_pdf_iframe from menu import display_pages_menu -from country_by_country.utils.constants import JURIDICTIONS, CURRENCIES +from country_by_country.utils.constants import JURIDICTIONS, CURRENCIES, SECTORS from Levenshtein import distance import sys import logging @@ -30,6 +30,7 @@ with st.form("metadata_form"): if "metadata" in st.session_state: company_name = st.session_state["metadata"]["company_name"] + sector = st.session_state["metadata"]["sector"] year = st.session_state["metadata"]["year"] currency = st.session_state["metadata"]["currency"] unit = st.session_state["metadata"]["unit"] @@ -37,12 +38,18 @@ print(company_name, year, currency, unit, headquarter) else: company_name = "" + sector = "" year = "" currency = "" unit = None headquarter = "" company_name = st.text_input("Company name", value=company_name) + + sector = st.selectbox( + "Sector", SECTORS, index=SECTORS.index(sector) if sector else 0 + ) + year = st.text_input("Year", value=year) currencies = { @@ -76,6 +83,7 @@ if submitted: st.session_state["metadata"] = { "company_name": company_name, + "sector": sector, "year": year, "currency": currency, "unit": unit, diff --git a/country_by_country/utils/constants.py b/country_by_country/utils/constants.py index f4c9f44..9a6beed 100644 --- a/country_by_country/utils/constants.py +++ b/country_by_country/utils/constants.py @@ -4008,31 +4008,33 @@ }, } -SECTORS = { - "Transport, Freight & Storage", - "Textiles & Clothing Manufacturing", - "Wood, Furniture & Paper Manufacturing", - "Food & Tobacco Manufacturing", - "Miscellaneous Manufacturing", - "Utilities", + +SECTORS = [ + "Banking, Insurance & Financial Services", + "Biotechnology and Life Sciences", "Business Services", - "Leather, Stone, Clay & Glass products", - "Transport Manufacturing", - "Printing & Publishing", - "Construction", - "Travel, Personal & Leisure", - "Computer Software", - "Retail", - "Industrial, Electric & Electronic Machinery", "Chemicals, Petroleum, Rubber & Plastic", - "Banking, Insurance & Financial Services", - "Wholesale", - "Property Services", "Communications", + "Computer Software", + "Construction", + "Food & Tobacco Manufacturing", + "Industrial, Electric & Electronic Machinery", + "Leather, Stone, Clay & Glass products", "Metals & Metal Products", - "Biotechnology and Life Sciences", "Mining & Extraction", -} + "Miscellaneous Manufacturing", + "Other", + "Printing & Publishing", + "Property Services", + "Retail", + "Textiles & Clothing Manufacturing", + "Transport Manufacturing", + "Transport, Freight & Storage", + "Travel, Personal & Leisure", + "Utilities", + "Wholesale", + "Wood, Furniture & Paper Manufacturing", +] COMPANIES = { "Acciona": {"headquarter": "ESP", "sector": "Construction"}, From df88ef7e3a917f2a4001204c89a2a3bc4fb752a1 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Tue, 23 Apr 2024 13:27:23 +0200 Subject: [PATCH 09/12] add companies selectbox --- app/pages/2_Metadata.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/pages/2_Metadata.py b/app/pages/2_Metadata.py index f749364..5108bc1 100644 --- a/app/pages/2_Metadata.py +++ b/app/pages/2_Metadata.py @@ -1,7 +1,12 @@ import streamlit as st from utils import set_algorithm_name, get_pdf_iframe from menu import display_pages_menu -from country_by_country.utils.constants import JURIDICTIONS, CURRENCIES, SECTORS +from country_by_country.utils.constants import ( + JURIDICTIONS, + CURRENCIES, + SECTORS, + COMPANIES, +) from Levenshtein import distance import sys import logging @@ -19,6 +24,7 @@ ) display_pages_menu() + if "pdf_after_page_validation" in st.session_state: col1, col2 = st.columns(2) with col1: @@ -35,7 +41,6 @@ currency = st.session_state["metadata"]["currency"] unit = st.session_state["metadata"]["unit"] headquarter = st.session_state["metadata"]["headquarter"] - print(company_name, year, currency, unit, headquarter) else: company_name = "" sector = "" @@ -43,8 +48,12 @@ currency = "" unit = None headquarter = "" - - company_name = st.text_input("Company name", value=company_name) + companies = list(COMPANIES.keys()) + company_name = st.selectbox( + "Company name", + companies, + index=companies.index(company_name) if company_name else 0, + ) sector = st.selectbox( "Sector", SECTORS, index=SECTORS.index(sector) if sector else 0 From 5537660b0694ae9d54a7f07b42072e2b1fcb4fb8 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Tue, 23 Apr 2024 13:37:41 +0200 Subject: [PATCH 10/12] also adds the sector in the final csv output --- app/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/utils.py b/app/utils.py index 186cb18..4d2db02 100644 --- a/app/utils.py +++ b/app/utils.py @@ -22,6 +22,7 @@ def set_algorithm_name(my_key: str) -> None: def to_csv_file(df: pd.DataFrame) -> bytes: # Populate the columns with the metadata df = df.assign(company=st.session_state["metadata"]["company_name"]) + df = df.assign(year=st.session_state["metadata"]["sector"]) df = df.assign(year=st.session_state["metadata"]["year"]) df = df.assign(currency=st.session_state["metadata"]["currency"]) df = df.assign(unit=st.session_state["metadata"]["unit"]) From 9b06d11a17f3da152e2875f5548f791192a8fdd8 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Wed, 24 Apr 2024 08:45:28 +0200 Subject: [PATCH 11/12] fix: should be None now these are selectbox rather than empty string --- app/pages/2_Metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/pages/2_Metadata.py b/app/pages/2_Metadata.py index 5108bc1..2f4a01b 100644 --- a/app/pages/2_Metadata.py +++ b/app/pages/2_Metadata.py @@ -42,10 +42,10 @@ unit = st.session_state["metadata"]["unit"] headquarter = st.session_state["metadata"]["headquarter"] else: - company_name = "" - sector = "" + company_name = None + sector = None year = "" - currency = "" + currency = None unit = None headquarter = "" companies = list(COMPANIES.keys()) From a08afb68f5f8dfa89540133c9f912fbce4b432d9 Mon Sep 17 00:00:00 2001 From: Jeremy Fix Date: Wed, 24 Apr 2024 08:45:38 +0200 Subject: [PATCH 12/12] add a case where the metadata step is skipped --- app/utils.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/app/utils.py b/app/utils.py index 4d2db02..d6726c0 100644 --- a/app/utils.py +++ b/app/utils.py @@ -20,11 +20,22 @@ def set_algorithm_name(my_key: str) -> None: @st.cache_data def to_csv_file(df: pd.DataFrame) -> bytes: - # Populate the columns with the metadata - df = df.assign(company=st.session_state["metadata"]["company_name"]) - df = df.assign(year=st.session_state["metadata"]["sector"]) - df = df.assign(year=st.session_state["metadata"]["year"]) - df = df.assign(currency=st.session_state["metadata"]["currency"]) - df = df.assign(unit=st.session_state["metadata"]["unit"]) - df = df.assign(headquarter=st.session_state["metadata"]["headquarter"]) + # Populate the columns with the metadata, if available + # They may not be available if the user skipped the metadata page + # by not clicking on Submit + if "metadata" in st.session_state: + df = df.assign(company=st.session_state["metadata"]["company_name"]) + df = df.assign(sector=st.session_state["metadata"]["sector"]) + df = df.assign(year=st.session_state["metadata"]["year"]) + df = df.assign(currency=st.session_state["metadata"]["currency"]) + df = df.assign(unit=st.session_state["metadata"]["unit"]) + df = df.assign(headquarter=st.session_state["metadata"]["headquarter"]) + else: + df = df.assign(company="") + df = df.assign(sector="") + df = df.assign(year="") + df = df.assign(currency="") + df = df.assign(unit="") + df = df.assign(headquarter="") + return df.to_csv(index=False).encode("utf-8")