Added USA CPI.
[?]
Jun 1, 2021, 11:10 PM
JTX5OHWHO647X4XLQPUDLH34QG2VDP7N7X6OL7XEIZQYVWELV6CACDependencies
- [2]
UCSU3QE4Created keytree generator for u and cpi. - [3]
IKPVWWLKFilter unemployment rate series. - [4]
AIFRDCG2Split off countries mod into a separate crate. - [5]
LURDUHBIFinished series filter for CPI. - [6]
GUXZCEWWAdded Country enum. - [7]
4MG5JFXTFirst record. - [8]
CUADTSHQSave csv data as multiple files. - [9]
AT753JPOSelected US unemployment series. - [10]
5POF332LWorking on fn cpi_included().
Change contents
- file deletion: countries.rs
use std::fmt;#[derive(Clone, Copy, Debug)]pub enum Country {China,India,UnitedStates,Indonesia,Pakistan,Brazil,Nigeria,Bangladesh,Russia,Mexico,Ethiopia,Philippines,Egypt,Vietnam,DRCongo,Iran,Turkey,Germany,France,UnitedKingdom,Thailand,SouthAfrica,Tanzania,Italy,Myanmar,SouthKorea,Colombia,Kenya,Spain,Argentina,Algeria,Sudan,Uganda,Ukraine,Iraq,Canada,Poland,Morocco,Uzbekistan,SaudiArabia,Peru,Afghanistan,Malaysia,Angola,Ghana,Mozambique,Yemen,Nepal,Venezuela,IvoryCoast,Madagascar,Australia,NorthKorea,Cameroon,Niger,Taiwan,SriLanka,BurkinaFaso,Mali,Chile,Romania,Kazakhstan,Malawi,Zambia,Syria,Ecuador,Netherlands,Senegal,Guatemala,Chad,Somalia,Zimbabwe,Cambodia,SouthSudan,Rwanda,Guinea,Burundi,Benin,Bolivia,Haiti,Tunisia,Belgium,Cuba,Jordan,Greece,CzechRepublic,DominicanRepublic,Sweden,Portugal,Azerbaijan,Hungary,UnitedArabEmirates,Honduras,Belarus,Israel,Tajikistan,PapuaNewGuinea,Austria,Switzerland,SierraLeone,Togo,HongKong,Paraguay,Laos,Libya,Bulgaria,Serbia,ElSalvador,Lebanon,Kyrgyzstan,Nicaragua,Turkmenistan,Denmark,Singapore,Congo,CentralAfricanRepublic,Finland,Slovakia,Norway,Palestine,CostaRica,NewZealand,Ireland,Liberia,Oman,Kuwait,Panama,Mauritania,Croatia,Georgia,Eritrea,Uruguay,Mongolia,BosniaAndHerzegovina,PuertoRico,Armenia,Albania,Lithuania,Jamaica,Qatar,Moldova,Namibia,Botswana,Gambia,Gabon,Slovenia,NorthMacedonia,Lesotho,Latvia,Kosovo,GuineaBissau,Bahrain,EquatorialGuinea,TrinidadAndTobago,Estonia,EastTimor,Mauritius,Eswatini,Djibouti,Fiji,Cyprus,Comoros,Bhutan,Guyana,SolomonIslands,Macau,Luxembourg,Montenegro,WesternSahara,Suriname,CapeVerde,Malta,Transnistria,Brunei,Belize,Bahamas,Maldives,NorthernCyprus,Iceland,Vanuatu,Barbados,FrenchPolynesia,NewCaledonia,Abkhazia,SaoTomeAndPrincipe,Samoa,SaintLucia,Guam,Curacao,RepublicOfArtsakh,Kiribati,Grenada,Aruba,SaintVincentAndTheGrenadines,Jersey,FSMicronesia,USVirginIslands,Tonga,AntiguaAndBarbuda,Seychelles,Andorra,Dominica,CaymanIslands,Bermuda,Guernsey,AmericanSamoa,NorthernMarianaIslands,Greenland,MarshallIslands,SaintKittsandNevis,SouthOssetia,FaroeIslands,TurksandCaicosIslands,SintMaarten,Liechtenstein,Monaco,SaintMartin,Gibraltar,SanMarino,AlandIslands,BritishVirginIslands,Palau,CookIslands,Anguilla,Nauru,WallisandFutuna,Tuvalu,SaintBarthelemy,SaintPierreAndMiquelon,SaintHelenaAndTristanDaCunha,Montserrat,FalklandIslands,ChristmasIsland,NorfolkIsland,Niue,Tokelau,VaticanCity,CocosKeelingIslands,PitcairnIslands,}impl Country {/// Return the country name in lowercase with underscores replacing spaces.pub fn as_path(&self) -> String {self.to_string().to_lowercase().replace(' ', "_")}}impl fmt::Display for Country {fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {let s = match self {Country::China => "China",Country::India => "India",Country::UnitedStates => "United States",Country::Indonesia => "Indonesia",Country::Pakistan => "Pakistan",Country::Brazil => "Brazil",Country::Nigeria => "Nigeria",Country::Bangladesh => "Bangladesh",Country::Russia => "Russia",Country::Mexico => "Mexico",Country::Ethiopia => "Ethiopia",Country::Philippines => "Philippines",Country::Egypt => "Egypt",Country::Vietnam => "Vietnam",Country::Iran => "Iran",Country::Turkey => "Turkey",Country::Germany => "Germany",Country::France => "France",Country::Thailand => "Thailand",Country::Tanzania => "Tanzania",Country::Italy => "Italy",Country::Myanmar => "Myanmar",Country::Colombia => "Colombia",Country::Kenya => "Kenya",Country::Spain => "Spain",Country::Argentina => "Argentina",Country::Algeria => "Algeria",Country::Sudan => "Sudan",Country::Uganda => "Uganda",Country::Ukraine => "Ukraine",Country::Iraq => "Iraq",Country::Canada => "Canada",Country::Poland => "Poland",Country::Morocco => "Morocco",Country::Uzbekistan => "Uzbekistan",Country::Peru => "Peru",Country::Afghanistan => "Afghanistan",Country::Malaysia => "Malaysia",Country::Angola => "Angola",Country::Ghana => "Ghana",Country::Mozambique => "Mozambique",Country::Yemen => "Yemen",Country::Nepal => "Nepal",Country::Venezuela => "Venezuela",Country::IvoryCoast => "Ivory Coast",Country::Madagascar => "Madagascar",Country::Australia => "Australia",Country::NorthKorea => "North Korea",Country::Cameroon => "Cameroon",Country::Niger => "Niger",Country::Taiwan => "Taiwan",Country::SriLanka => "SriLanka",Country::BurkinaFaso => "Burkina Faso",Country::Mali => "Mali",Country::Chile => "Chile",Country::Romania => "Romania",Country::Kazakhstan => "Kazakhstan",Country::Malawi => "Malawi",Country::Zambia => "Zambia",Country::Syria => "Syria",Country::Ecuador => "Ecuador",Country::Netherlands => "Netherlands",Country::Senegal => "Senegal",Country::Guatemala => "Guatemala",Country::Chad => "Chad",Country::Somalia => "Somalia",Country::Zimbabwe => "Zimbabwe",Country::Cambodia => "Cambodia",Country::SouthSudan => "South Sudan",Country::Rwanda => "Rwanda",Country::Guinea => "Guinea",Country::Burundi => "Burundi",Country::Benin => "Benin",Country::Bolivia => "Bolivia",Country::Haiti => "Haiti",Country::Tunisia => "Tunisia",Country::Belgium => "Belgium",Country::Cuba => "Cuba",Country::Jordan => "Jordan",Country::Greece => "Greece",Country::Sweden => "Sweden",Country::Portugal => "Portugal",Country::Azerbaijan => "Azerbaijan",Country::Hungary => "Hungary",Country::Honduras => "Honduras",Country::Belarus => "Belarus",Country::Israel => "Israel",Country::Tajikistan => "Tajikistan",Country::Austria => "Austria",Country::Switzerland => "Switzerland",Country::SierraLeone => "SierraLeone",Country::Togo => "Togo",Country::HongKong => "HongKong",Country::Paraguay => "Paraguay",Country::Laos => "Laos",Country::Libya => "Libya",Country::Bulgaria => "Bulgaria",Country::Serbia => "Serbia",Country::Lebanon => "Lebanon",Country::Kyrgyzstan => "Kyrgyzstan",Country::Nicaragua => "Nicaragua",Country::Turkmenistan => "Turkmenistan",Country::Denmark => "Denmark",Country::Singapore => "Singapore",Country::Congo => "Congo",Country::Finland => "Finland",Country::Slovakia => "Slovakia",Country::Norway => "Norway",Country::Palestine => "Palestine",Country::Ireland => "Ireland",Country::Liberia => "Liberia",Country::Oman => "Oman",Country::Kuwait => "Kuwait",Country::Panama => "Panama",Country::Mauritania => "Mauritania",Country::Croatia => "Croatia",Country::Georgia => "Georgia",Country::Eritrea => "Eritrea",Country::Uruguay => "Uruguay",Country::Mongolia => "Mongolia",Country::Armenia => "Armenia",Country::Albania => "Albania",Country::Lithuania => "Lithuania",Country::Jamaica => "Jamaica",Country::Qatar => "Qatar",Country::Moldova => "Moldova",Country::Namibia => "Namibia",Country::Botswana => "Botswana",Country::Gambia => "Gambia",Country::Gabon => "Gabon",Country::Slovenia => "Slovenia",Country::Lesotho => "Lesotho",Country::Latvia => "Latvia",Country::Kosovo => "Kosovo",Country::Bahrain => "Bahrain",Country::Estonia => "Estonia",Country::Mauritius => "Mauritius",Country::Eswatini => "Eswatini",Country::Djibouti => "Djibouti",Country::Fiji => "Fiji",Country::Cyprus => "Cyprus",Country::Comoros => "Comoros",Country::Bhutan => "Bhutan",Country::Guyana => "Guyana",Country::Macau => "Macau",Country::Luxembourg => "Luxembourg",Country::Montenegro => "Montenegro",Country::WesternSahara => "Western Sahara",Country::Suriname => "Suriname",Country::Malta => "Malta",Country::Transnistria => "Transnistria",Country::Brunei => "Brunei",Country::Belize => "Belize",Country::Bahamas => "Bahamas",Country::Maldives => "Maldives",Country::Iceland => "Iceland",Country::Vanuatu => "Vanuatu",Country::Barbados => "Barbados",Country::NewCaledonia => "New Caledonia",Country::Abkhazia => "Abkhazia",Country::Samoa => "Samoa",Country::Guam => "Guam",Country::Curacao => "Curaçao",Country::Kiribati => "Kiribati",Country::Grenada => "Grenada",Country::Aruba => "Aruba",Country::Jersey => "Jersey",Country::USVirginIslands => "US Virgin Islands",Country::Tonga => "Tonga",Country::Seychelles => "Seychelles",Country::Andorra => "Andorra",Country::Dominica => "Dominica",Country::Bermuda => "Bermuda",Country::Guernsey => "Guernsey",Country::Greenland => "Greenland",Country::Liechtenstein => "Liechtenstein",Country::Monaco => "Monaco",Country::Gibraltar => "Gibraltar",Country::SanMarino => "San Marino",Country::Palau => "Palau",Country::Anguilla => "Anguilla",Country::Nauru => "Nauru",Country::Tuvalu => "Tuvalu",Country::Montserrat => "Montserrat",Country::Niue => "Niue",Country::Tokelau => "Tokelau",};write!(f, "{}", s)}}Country::VaticanCity => "Vatican City",Country::CocosKeelingIslands => "Cocos Keeling Islands",Country::PitcairnIslands => "Pitcairn Islands",Country::FalklandIslands => "Falkland Islands",Country::ChristmasIsland => "Christmas Island",Country::NorfolkIsland => "Norfolk Island",Country::SaintBarthelemy => "Saint Barthélemy",Country::SaintPierreAndMiquelon => "Saint Pierre and Miquelon",Country::SaintHelenaAndTristanDaCunha => "Saint Helena and Tristan Da Cunha",Country::WallisandFutuna => "Wallis and Futuna",Country::CookIslands => "Cook Islands",Country::AlandIslands => "Åland Islands",Country::BritishVirginIslands => "British Virgin Islands",Country::SaintMartin => "Saint Martin",Country::MarshallIslands => "Marshall Islands",Country::SaintKittsandNevis => "Saint Kitts and Nevis",Country::SouthOssetia => "South Ossetia",Country::FaroeIslands => "Faroe Islands",Country::TurksandCaicosIslands => "Turks and Caicos Islands",Country::SintMaarten => "Sint Maarten",Country::AmericanSamoa => "American Samoa",Country::NorthernMarianaIslands => "Northern Mariana Islands",Country::CaymanIslands => "Cayman Islands",Country::IsleOfMan => "Isle of Man",Country::AntiguaAndBarbuda => "Antigua and Barbuda",Country::FSMicronesia => "FS Micronesia",Country::SaintVincentAndTheGrenadines => "Saint Vincent and the Grenadines",Country::RepublicOfArtsakh => "Republic Of Artsakh",Country::SaintLucia => "Saint Lucia",Country::SaoTomeAndPrincipe => "São Tomé and Príncipe",Country::FrenchPolynesia => "French Polynesia",Country::NorthernCyprus => "Northern Cyprus",Country::CapeVerde => "Cape Verde",Country::SolomonIslands => "Solomon Islands",Country::EastTimor => "East Timor",Country::EquatorialGuinea => "Equatorial Guinea",Country::TrinidadAndTobago => "Trinidad and Tobago",Country::GuineaBissau => "Guinea Bissau",Country::NorthMacedonia => "North Macedonia",Country::BosniaAndHerzegovina => "Bosnia and Herzegovina",Country::PuertoRico => "Puerto Rico",Country::CostaRica => "Costa Rica",Country::NewZealand => "New Zealand",Country::CentralAfricanRepublic => "Central African Republic",Country::ElSalvador => "El Salvador",Country::PapuaNewGuinea => "Papua New Guinea",Country::UnitedArabEmirates => "United Arab Emirates",Country::CzechRepublic => "Czech Republic",Country::DominicanRepublic => "Dominican Republic",Country::SaudiArabia => "Saudi Arabia",Country::SouthKorea => "Korea",Country::SouthAfrica => "South Africa",Country::UnitedKingdom => "United Kingdom",Country::DRCongo => "DR Congo",Country::Japan => "Japan",IsleOfMan,Japan,/// Country - replacement in src/main.rs at line 9
// save_all_cpi_data(&format!("{}/{}", root_dir, "/cpi"));// save_all_cpi_data_after(&Country::Israel, &format!("{}/{}", root_dir, "/cpi/israel"));// println!("{}", cpi_series(&Country::NewZealand));generate_keytree(&format!("{}/generated.keytree", root_dir));save_cpi_data(&Country::UnitedStates, &format!("{}/cpi/united_states", root_dir)); - replacement in src/lib.rs at line 452
// TODOpanic!();vec!("Harmonized Index of Consumer Prices: All Items for United States","Consumer Price Index: Total All Items for the United States","Consumer Price Index: Harmonized Prices: Total All Items for the United States","Consumer Price Index: Harmonized Prices: Total All Items for the United States (DISCONTINUED)","Research Consumer Price Index: All Items","Consumer Price Index for United States","Flexible Price Consumer Price Index","Inflation, consumer prices for the United States","Consumer Price Index, All Items for United States","Rate of Change (6 Month Span at Annual Rate), Consumer Price Index, All Items (Centered) for United States","Median Consumer Price Index","Sticky Price Consumer Price Index","16% Trimmed-Mean Consumer Price Index","Consumer Price Index: All Items for the United States","Consumer Price Index of All Items in United States","Consumer Price Index in the United States (DISCONTINUED)","Consumer Price Index: All Items (Harmonized Index of Consumer Prices) for the United States","Consumer Price Index: All Items (Harmonized Index of Consumer Prices) for the United States (DISCONTINUED)","Harmonized Index of Consumer Prices in the United States (DISCONTINUED)",) - replacement in src/lib.rs at line 476
match Fred::tags_series(&to_tag("cpi", &country)) {Ok(tags_series) => {tags_series.seriess.equals_one_of(titles)match country {Country::UnitedStates => {match Fred::tags_series("cpi;usa") {Ok(tags_series) => {tags_series.seriess.equals_one_of(titles)},Err(json_error) => {println!("{}", json_error);panic!();},} - replacement in src/lib.rs at line 489
Err(json_error) => {println!("{}", json_error);panic!();_ => {match Fred::tags_series(&to_tag("cpi", &country)) {Ok(tags_series) => {tags_series.seriess.equals_one_of(titles)},Err(json_error) => {println!("{}", json_error);panic!();},} - edit in src/lib.rs at line 503
- edit in src/lib.rs at line 506
- replacement in src/lib.rs at line 1184[3.5380]
pub fn usa_cpi() -> String {Fred::tags_series("cpi;usa;nation").unwrap().to_string()}