Skip to content

Commit

Permalink
🔨 update grapher schema to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Nov 18, 2024
1 parent b339d8c commit 2f55974
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 50 deletions.
2 changes: 1 addition & 1 deletion apps/wizard/app_pages/map_brackets.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def create_default_chart_config_for_variable(metadata: Dict[str, Any]) -> Dict[s
"""Create a default chart for a variable with id `variable_id`."""
chart_config = {
"hasMapTab": True,
"hasChartTab": False,
"chartTypes": [],
"tab": "map",
"map": {
# "timeTolerance": 0,
Expand Down
7 changes: 3 additions & 4 deletions apps/wizard/utils/chart_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"hideLegend": False,
"tab": "chart",
"logo": "owid",
"$schema": "https://files.ourworldindata.org/schemas/grapher-schema.005.json",
"$schema": "https://files.ourworldindata.org/schemas/grapher-schema.006.json",
"showYearLabels": False,
"id": 807,
"selectedFacetStrategy": "none",
Expand All @@ -41,7 +41,7 @@
"version": 14,
"sortOrder": "desc",
"maxTime": "latest",
"type": "LineChart",
"type": ["LineChart"],
"hideRelativeToggle": True,
"addCountryMode": "add-country",
"hideAnnotationFieldsInTitle": {"entity": False, "changeInPrefix": False, "time": False},
Expand All @@ -65,7 +65,6 @@
"missingDataStrategy": "auto",
"isPublished": False,
"timelineMinTime": "earliest",
"hasChartTab": True,
"timelineMaxTime": "latest",
"sortBy": "total",
}
Expand All @@ -84,7 +83,7 @@ def bake_chart_config(
Bakes a very basic config, which will be enough most of the times. If you want a more complex config, use this as a baseline to adjust to your needs.
Note: You can find more details on our Grapher API at https://files.ourworldindata.org/schemas/grapher-schema.005.json.
Note: You can find more details on our Grapher API at https://files.ourworldindata.org/schemas/grapher-schema.latest.json.
"""
# Define chart config
Expand Down
2 changes: 1 addition & 1 deletion apps/wizard/utils/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def grapher_chart(
You can either plot a given chart config (using chart_config) or plot an indicator with its default metadata using either catalog_path, variable_id or variable.
Note: You can find more details on our Grapher API at https://files.ourworldindata.org/schemas/grapher-schema.005.json.
Note: You can find more details on our Grapher API at https://files.ourworldindata.org/schemas/grapher-schema.latest.json.
Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion etl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def variable_metadata_url(variable_id):
TLS_VERIFY = bool(int(env.get("TLS_VERIFY", 1)))

# Default schema for presentation.grapher_config in metadata. Try to keep it up to date with the latest schema.
DEFAULT_GRAPHER_SCHEMA = "https://files.ourworldindata.org/schemas/grapher-schema.005.json"
DEFAULT_GRAPHER_SCHEMA = "https://files.ourworldindata.org/schemas/grapher-schema.006.json"


def enable_bugsnag() -> None:
Expand Down
2 changes: 1 addition & 1 deletion etl/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ def map_indicator_path_to_id(catalog_path: str) -> str | int:
def get_schema_from_url(schema_url: str) -> dict:
"""Get the schema of a chart configuration. Schema URL is saved in config["$schema"] and looks like:
https://files.ourworldindata.org/schemas/grapher-schema.005.json
https://files.ourworldindata.org/schemas/grapher-schema.006.json
More details on available versions can be found
at https://github.com/owid/owid-grapher/tree/master/packages/%40ourworldindata/grapher/src/schema.
Expand Down
38 changes: 18 additions & 20 deletions schemas/dataset-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1072,11 +1072,6 @@
"default": false,
"description": "Exclude entities that do not belong in any color group"
},
"hasChartTab": {
"type": "boolean",
"default": true,
"description": "Whether to show the (non-map) chart tab"
},
"data": {
"type": "object",
"description": "Obsolete name - used only to store the available entities",
Expand Down Expand Up @@ -1287,21 +1282,24 @@
]
]
},
"type": {
"type": "string",
"description": "Which type of chart should be shown (hasMapChart can be used to always also show a map chart)",
"default": "LineChart",
"enum": [
"LineChart",
"ScatterPlot",
"StackedArea",
"DiscreteBar",
"StackedDiscreteBar",
"SlopeChart",
"StackedBar",
"WorldMap",
"Marimekko"
]
"chartTypes": {
"type": "array",
"description": "Which types of chart should be shown",
"default": ["LineChart"],
"items": {
"type": "string",
"enum": [
"LineChart",
"ScatterPlot",
"StackedArea",
"DiscreteBar",
"StackedDiscreteBar",
"SlopeChart",
"StackedBar",
"WorldMap",
"Marimekko"
]
}
},
"hasMapTab": {
"type": "boolean",
Expand Down
42 changes: 20 additions & 22 deletions schemas/multidim-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@
"type": "string",
"description": "Url of the concrete schema version to use to validate this document",
"format": "uri",
"default": "https://files.ourworldindata.org/schemas/grapher-schema.005.json",
"const": "https://files.ourworldindata.org/schemas/grapher-schema.005.json"
"default": "https://files.ourworldindata.org/schemas/grapher-schema.006.json",
"const": "https://files.ourworldindata.org/schemas/grapher-schema.006.json"
},
"id": {
"type": "integer",
Expand Down Expand Up @@ -267,11 +267,6 @@
"default": false,
"description": "Exclude entities that do not belong in any color group"
},
"hasChartTab": {
"type": "boolean",
"default": true,
"description": "Whether to show the (non-map) chart tab"
},
"hideLegend": {
"type": "boolean",
"default": false
Expand Down Expand Up @@ -564,20 +559,23 @@
"type": "string",
"description": "Big title text of the chart"
},
"type": {
"type": "string",
"description": "Which type of chart should be shown (hasMapChart can be used to always also show a map chart)",
"default": "LineChart",
"enum": [
"LineChart",
"ScatterPlot",
"StackedArea",
"DiscreteBar",
"StackedDiscreteBar",
"SlopeChart",
"StackedBar",
"Marimekko"
]
"chartTypes": {
"type": "array",
"description": "Which types of chart should be shown",
"default": ["LineChart"],
"items": {
"type": "string",
"enum": [
"LineChart",
"ScatterPlot",
"StackedArea",
"DiscreteBar",
"StackedDiscreteBar",
"SlopeChart",
"StackedBar",
"Marimekko"
]
}
},
"hasMapTab": {
"type": "boolean",
Expand Down Expand Up @@ -960,4 +958,4 @@
"additionalProperties": false
}
}
}
}

0 comments on commit 2f55974

Please sign in to comment.