OCHA-DAP / hdx-cli-toolkit

A commandline tool for interacting with HDX with a view to doing bulk updates
MIT License
1 stars 0 forks source link

Add functionality to update a showcase on a dataset #8

Closed IanHopkinson closed 6 months ago

IanHopkinson commented 7 months ago

This functionality should follow the scheme for Quick Charts, the showcase metadata can be stored in a CSV file (following my legacy projects attributes.csv format, or in a JSON file). Commandline should look like this:

hdx-toolkit showcase --showcase_name=climada-litpop-dataset --hdx_site=stage --attributes_file_path=attributes.csv

Example attributes.csv entries look like this:

dataset_name,timestamp,attribute,value,secondary_value
climada-litpop-showcase,2024-02-21T08:11:10.725670,entity_type,"showcase",
climada-litpop-showcase,2024-02-21T08:11:10.725670,name,"climada-litpop-showcase",
climada-litpop-showcase,2024-02-21T08:11:10.725670,parent_dataset,"climada-litpop-dataset",
climada-litpop-showcase,2024-02-21T08:11:10.725670,title,"CLIMADA LitPop Methodology Documentation",
climada-litpop-showcase,2024-02-21T08:11:10.725670,notes,"Click the image to go to the original source for this data",
climada-litpop-showcase,2024-02-21T08:11:10.725670,url,https://climada-python.readthedocs.io/en/stable/tutorial/climada_entity_LitPop.html,
climada-litpop-showcase,2024-02-21T08:11:10.725670,image_url,https://github.com/OCHA-DAP/hdx-scraper-climada/blob/main/src/hdx_scraper_climada/output/litpop/litpop-haiti-showcase.png,
climada-litpop-showcase,2024-02-21T08:11:10.725670,tags,"economics",
climada-litpop-showcase,2024-02-21T08:11:10.725670,tags,"gross domestic product-gdp",
climada-litpop-showcase,2024-02-21T08:11:10.725670,tags,"population",

A JSON version would look like this:

{
    "entity_type": "showcase",
    "name": "climada-litpop-showcase",
    "parent_dataset": "climada-litpop-dataset",
    "title": "CLIMADA LitPop Methodology Documentation",
    "notes": "Click the image to go to the original source for this data",
    "url": "https://climada-python.readthedocs.io/en/stable/tutorial/climada_entity_LitPop.html",
    "image_url": "https://github.com/OCHA-DAP/hdx-scraper-climada/blob/main/src/hdx_scraper_climada/output/litpop/litpop-haiti-showcase.png",
    "tags": [
        "economics",
        "gross domestic product-gdp",
        "population"
    ]
}