mirror of https://github.com/apache/superset.git
docs(maps): jupyter notebook now auto-updates docs site (#27003)
This commit is contained in:
parent
a08c24c4aa
commit
76d897eaa2
|
@ -20,6 +20,7 @@ jobs:
|
|||
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history
|
||||
persist-credentials: false
|
||||
submodules: recursive
|
||||
- name: Check npm lock file version
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
"countries": [
|
||||
"Afghanistan",
|
||||
"Albania",
|
||||
"Algeria",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Austria",
|
||||
"Belgium",
|
||||
"Bolivia",
|
||||
"Brazil",
|
||||
"Bulgaria",
|
||||
"Burundi",
|
||||
"Canada",
|
||||
"Chile",
|
||||
"China",
|
||||
"Colombia",
|
||||
"Costa Rica",
|
||||
"Cuba",
|
||||
"Cyprus",
|
||||
"Czech Republic",
|
||||
"Denmark",
|
||||
"Dominican Republic",
|
||||
"Ecuador",
|
||||
"Egypt",
|
||||
"El Salvador",
|
||||
"Estonia",
|
||||
"Ethiopia",
|
||||
"France",
|
||||
"France (regions)",
|
||||
"Finland",
|
||||
"Germany",
|
||||
"Guatemala",
|
||||
"Haiti",
|
||||
"Honduras",
|
||||
"Iceland",
|
||||
"India",
|
||||
"Indonesia",
|
||||
"Iran",
|
||||
"Italy",
|
||||
"Italy (regions)",
|
||||
"Japan",
|
||||
"Jordan",
|
||||
"Kazakhstan",
|
||||
"Kenya",
|
||||
"Korea",
|
||||
"Kuwait",
|
||||
"Kyrgyzstan",
|
||||
"Latvia",
|
||||
"Liechtenstein",
|
||||
"Lithuania",
|
||||
"Malaysia",
|
||||
"Mexico",
|
||||
"Morocco",
|
||||
"Myanmar",
|
||||
"Netherlands",
|
||||
"Nicaragua",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Oman",
|
||||
"Pakistan",
|
||||
"Panama",
|
||||
"Papua New Guinea",
|
||||
"Paraguay",
|
||||
"Peru",
|
||||
"Philippines",
|
||||
"Philippines (regions)",
|
||||
"Portugal",
|
||||
"Poland",
|
||||
"Puerto Rico",
|
||||
"Qatar",
|
||||
"Russia",
|
||||
"Rwanda",
|
||||
"Saint Barthelemy",
|
||||
"Saint Martin",
|
||||
"Saudi Arabia",
|
||||
"Singapore",
|
||||
"Slovenia",
|
||||
"Spain",
|
||||
"Sri Lanka",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Syria",
|
||||
"Tajikistan",
|
||||
"Tanzania",
|
||||
"Thailand",
|
||||
"Timorleste",
|
||||
"Turkey",
|
||||
"Turkey (regions)",
|
||||
"Turkmenistan",
|
||||
"Uganda",
|
||||
"UK",
|
||||
"Ukraine",
|
||||
"United Arab Emirates",
|
||||
"Uruguay",
|
||||
"USA",
|
||||
"Uzbekistan",
|
||||
"Venezuela",
|
||||
"Vietnam",
|
||||
"Zambia"
|
||||
]
|
||||
}
|
|
@ -5,6 +5,8 @@ sidebar_position: 10
|
|||
version: 1
|
||||
---
|
||||
|
||||
import countriesData from '../../data/countries.json';
|
||||
|
||||
## The Country Map Visualization
|
||||
|
||||
The Country Map visualization allows you to plot lightweight choropleth maps of
|
||||
|
@ -21,102 +23,11 @@ The current list of countries can be found in the src
|
|||
|
||||
The Country Maps visualization already ships with the maps for the following countries:
|
||||
|
||||
- Afghanistan
|
||||
- Albania
|
||||
- Algeria
|
||||
- Argentina
|
||||
- Australia
|
||||
- Austria
|
||||
- Belgium
|
||||
- Bolivia
|
||||
- Brazil
|
||||
- Bulgaria
|
||||
- Burundi
|
||||
- Canada
|
||||
- Chile
|
||||
- China
|
||||
- Colombia
|
||||
- Costa Rica
|
||||
- Cuba
|
||||
- Cyprus
|
||||
- Denmark
|
||||
- Dominican Republic
|
||||
- Ecuador
|
||||
- Egypt
|
||||
- El_salvador
|
||||
- Estonia
|
||||
- Ethiopia
|
||||
- France
|
||||
- France Regions
|
||||
- Finland
|
||||
- Germany
|
||||
- Guatemala
|
||||
- Haiti
|
||||
- Honduras
|
||||
- Iceland
|
||||
- India
|
||||
- Indonesia
|
||||
- Iran
|
||||
- Italy
|
||||
- Italy Regions
|
||||
- Japan
|
||||
- Jordan
|
||||
- Kazakhstan
|
||||
- Kenya
|
||||
- Korea
|
||||
- Kuwait
|
||||
- Kyrgyzstan
|
||||
- Latvia
|
||||
- Liechtenstein
|
||||
- Lithuania
|
||||
- Malaysia
|
||||
- Mexico
|
||||
- Morocco
|
||||
- Myanmar
|
||||
- Netherlands
|
||||
- Nicaragua
|
||||
- Nigeria
|
||||
- Norway
|
||||
- Oman
|
||||
- Pakistan
|
||||
- Panama
|
||||
- Papua New Guinea
|
||||
- Paraguay
|
||||
- Peru
|
||||
- Philippines
|
||||
- Portugal
|
||||
- Poland
|
||||
- Puerto_rico
|
||||
- Qatar
|
||||
- Russia
|
||||
- Rwanda
|
||||
- Saint Barthelemy
|
||||
- Saint Martin
|
||||
- Saudi Arabia
|
||||
- Singapore
|
||||
- Slovenia
|
||||
- Spain
|
||||
- Sri Lanka
|
||||
- Sweden
|
||||
- Switzerland
|
||||
- Syria
|
||||
- Tajikistan
|
||||
- Tanzania
|
||||
- Thailand
|
||||
- Timorleste
|
||||
- Turkey
|
||||
- Turkey Regions
|
||||
- Turkmenistan
|
||||
- Uganda
|
||||
- Uk
|
||||
- Ukraine
|
||||
- United Arab Emirates
|
||||
- Uruguay
|
||||
- USA
|
||||
- Uzbekistan
|
||||
- Venezuela
|
||||
- Vietnam
|
||||
- Zambia
|
||||
<ul style={{columns: 3}}>
|
||||
{countriesData.countries.map((country, index) => (
|
||||
<li key={index}>{country}</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
## Adding a New Country
|
||||
|
||||
|
|
|
@ -51,13 +51,14 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 77,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Dependencies\n",
|
||||
"\n",
|
||||
"import os\n",
|
||||
"import json\n",
|
||||
"import requests\n",
|
||||
"import geopandas as gpd\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
|
@ -2590,28 +2591,26 @@
|
|||
"id": "Fb58eGlIt1LW"
|
||||
},
|
||||
"source": [
|
||||
"## Output Typescript"
|
||||
"## Output Typescript & JSON for Docs Site"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 51,
|
||||
"execution_count": 80,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"TypeScript code written to src/countries.ts\n"
|
||||
"TypeScript code written to src/countries.ts\n",
|
||||
"JSON written to docs/data/countries.json\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n",
|
||||
"\n",
|
||||
"# Function to convert country name to a valid JavaScript identifier\n",
|
||||
"def to_js_identifier(name):\n",
|
||||
" return name.replace(' ', '_').replace('-', '_')\n",
|
||||
|
@ -2677,8 +2676,33 @@
|
|||
"with open(\"../src/countries.ts\", \"w\") as file:\n",
|
||||
" file.write(typescript_code)\n",
|
||||
"\n",
|
||||
"print(\"TypeScript code written to src/countries.ts\")"
|
||||
"print(\"TypeScript code written to src/countries.ts\")\n",
|
||||
"\n",
|
||||
"# DOCS JSON:\n",
|
||||
"# Replace underscores with spaces and title-case each country name\n",
|
||||
"formatted_countries = [country.replace(\"_\", \" \") for country in countries]\n",
|
||||
"formatted_countries = [country.upper() if country in {\"usa\", \"uk\"} else country.title() for country in formatted_countries]\n",
|
||||
"formatted_countries = [country.replace(\" Regions\",\" (regions)\") for country in formatted_countries]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Create a dictionary in the desired format\n",
|
||||
"data = {\"countries\": formatted_countries}\n",
|
||||
"# Convert the dictionary to a JSON string with proper formatting\n",
|
||||
"json_data = json.dumps(data, indent=2) + \"\\n\"\n",
|
||||
"\n",
|
||||
"# Write to a file\n",
|
||||
"with open(\"../../../../docs/data/countries.json\", \"w\") as file:\n",
|
||||
" file.write(json_data)\n",
|
||||
"\n",
|
||||
"print(\"JSON written to docs/data/countries.json\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
Loading…
Reference in New Issue