# ---- 2️⃣ Build the CountryInfo struct --------------------------- info = CountryInfo( get(data["name"], "common", "unknown"), get(data["name"], "official", "unknown"), get(data, "cca2", "??"), get(data, "cca3", "???"), get(data, "population", 0), get(data, "area", 0.0), get(data, "capital", String[]), get(data, "region", "unknown"), get(data, "subregion", "unknown"), languages_from_dict(get(data, "languages", Dict())), currencies_from_dict(get(data, "currencies", Dict())), get(data["flags"], "png", "") )
| Part | What it does | |------|--------------| | | Handles the HTTP request and JSON parsing. | | CountryInfo struct | Stores the raw fields we care about. | | CountryReport struct | Holds the CountryInfo plus computed metrics (density, optional GDP data). | | analyze_country | Core API call, data extraction, metric computation, optional GDP merge. | | Pretty‑print ( show ) | Makes println(report) produce a nicely formatted one‑liner summary. | | Example block | Shows how to call the function with a small GDP table; you can replace it with any source you like. | julia pais anal