diff --git a/component_charts.ipynb b/component_charts.ipynb index 8422176..3b35545 100644 --- a/component_charts.ipynb +++ b/component_charts.ipynb @@ -56,10 +56,27 @@ "source": [ "import altair as alt\n", "\n", + "\n", "class MissingColumnsError(Exception):\n", " def __init__(self, columns):\n", " super().__init__(f\"The source data is missing one or more of these columns: {columns}\")\n", "\n", + "\n", + "chart_properties = {\n", + " \"width\": 600,\n", + " \"height\": 350,\n", + " \"padding\": 50,\n", + " \"title\": alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", + "}\n", + "chart_axis = {\n", + " \"titleFontSize\": 14,\n", + " \"labelFontSize\": 14,\n", + " \"labelPadding\": 5,\n", + " \"ticks\": False,\n", + " \"domain\": False,\n", + "}\n", + "\n", + "\n", "def check_columns(columns, data):\n", " # check if input contains the right columns\n", " if not columns.issubset(data.columns):\n", @@ -95,19 +112,8 @@ " alt.Tooltip(\"collection_id\", title=\"collection id\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -136,19 +142,8 @@ " alt.Tooltip(\"object_count\", title=\"number of objects\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -185,19 +180,8 @@ " alt.Tooltip(\"release_type\", title=\"release type\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -233,19 +217,8 @@ " alt.Tooltip(\"key\", title=\"object type\", type=\"nominal\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -272,27 +245,26 @@ " alt.Tooltip(\"total_tenders\", title=\"number of tenders\", type=\"quantitative\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )" ], "metadata": { "id": "Bip37aP917XY" }, - "execution_count": null, - "outputs": [] + "execution_count": 5, + "outputs": [ + { + "data": { + "text/html": "\n\n
\n", + "text/plain": "alt.Chart(...)" + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ] } ] } diff --git a/template_data_quality_feedback.ipynb b/template_data_quality_feedback.ipynb index 1791be9..f343fbf 100644 --- a/template_data_quality_feedback.ipynb +++ b/template_data_quality_feedback.ipynb @@ -168,18 +168,114 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "id": "Bip37aP917XY" }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import altair as alt\n", "\n", + "\n", "class MissingColumnsError(Exception):\n", " def __init__(self, columns):\n", " super().__init__(f\"The source data is missing one or more of these columns: {columns}\")\n", "\n", + "\n", + "chart_properties = {\n", + " \"width\": 600,\n", + " \"height\": 350,\n", + " \"padding\": 50,\n", + " \"title\": alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", + "}\n", + "chart_axis = {\n", + " \"titleFontSize\": 14,\n", + " \"labelFontSize\": 14,\n", + " \"labelPadding\": 5,\n", + " \"ticks\": False,\n", + " \"domain\": False,\n", + "}\n", + "\n", + "\n", "def check_columns(columns, data):\n", " # check if input contains the right columns\n", " if not columns.issubset(data.columns):\n", @@ -215,19 +311,8 @@ " alt.Tooltip(\"collection_id\", title=\"collection id\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -256,19 +341,8 @@ " alt.Tooltip(\"object_count\", title=\"number of objects\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -305,19 +379,8 @@ " alt.Tooltip(\"release_type\", title=\"release type\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -353,19 +416,8 @@ " alt.Tooltip(\"key\", title=\"object type\", type=\"nominal\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -392,19 +444,8 @@ " alt.Tooltip(\"total_tenders\", title=\"number of tenders\", type=\"quantitative\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )" ] diff --git a/template_publisher_analysis.ipynb b/template_publisher_analysis.ipynb index 10456f5..377b04c 100644 --- a/template_publisher_analysis.ipynb +++ b/template_publisher_analysis.ipynb @@ -168,18 +168,114 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "id": "Bip37aP917XY" }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import altair as alt\n", "\n", + "\n", "class MissingColumnsError(Exception):\n", " def __init__(self, columns):\n", " super().__init__(f\"The source data is missing one or more of these columns: {columns}\")\n", "\n", + "\n", + "chart_properties = {\n", + " \"width\": 600,\n", + " \"height\": 350,\n", + " \"padding\": 50,\n", + " \"title\": alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", + "}\n", + "chart_axis = {\n", + " \"titleFontSize\": 14,\n", + " \"labelFontSize\": 14,\n", + " \"labelPadding\": 5,\n", + " \"ticks\": False,\n", + " \"domain\": False,\n", + "}\n", + "\n", + "\n", "def check_columns(columns, data):\n", " # check if input contains the right columns\n", " if not columns.issubset(data.columns):\n", @@ -215,19 +311,8 @@ " alt.Tooltip(\"collection_id\", title=\"collection id\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -256,19 +341,8 @@ " alt.Tooltip(\"object_count\", title=\"number of objects\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -305,19 +379,8 @@ " alt.Tooltip(\"release_type\", title=\"release type\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -353,19 +416,8 @@ " alt.Tooltip(\"key\", title=\"object type\", type=\"nominal\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -392,19 +444,8 @@ " alt.Tooltip(\"total_tenders\", title=\"number of tenders\", type=\"quantitative\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )" ] diff --git a/template_structure_and_format_feedback.ipynb b/template_structure_and_format_feedback.ipynb index 42a1e43..436ebd9 100644 --- a/template_structure_and_format_feedback.ipynb +++ b/template_structure_and_format_feedback.ipynb @@ -168,18 +168,114 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "id": "Bip37aP917XY" }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import altair as alt\n", "\n", + "\n", "class MissingColumnsError(Exception):\n", " def __init__(self, columns):\n", " super().__init__(f\"The source data is missing one or more of these columns: {columns}\")\n", "\n", + "\n", + "chart_properties = {\n", + " \"width\": 600,\n", + " \"height\": 350,\n", + " \"padding\": 50,\n", + " \"title\": alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", + "}\n", + "chart_axis = {\n", + " \"titleFontSize\": 14,\n", + " \"labelFontSize\": 14,\n", + " \"labelPadding\": 5,\n", + " \"ticks\": False,\n", + " \"domain\": False,\n", + "}\n", + "\n", + "\n", "def check_columns(columns, data):\n", " # check if input contains the right columns\n", " if not columns.issubset(data.columns):\n", @@ -215,19 +311,8 @@ " alt.Tooltip(\"collection_id\", title=\"collection id\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -256,19 +341,8 @@ " alt.Tooltip(\"object_count\", title=\"number of objects\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -305,19 +379,8 @@ " alt.Tooltip(\"release_type\", title=\"release type\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -353,19 +416,8 @@ " alt.Tooltip(\"key\", title=\"object type\", type=\"nominal\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -392,19 +444,8 @@ " alt.Tooltip(\"total_tenders\", title=\"number of tenders\", type=\"quantitative\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )" ] diff --git a/template_usability_checks.ipynb b/template_usability_checks.ipynb index e691577..32c06d4 100644 --- a/template_usability_checks.ipynb +++ b/template_usability_checks.ipynb @@ -168,18 +168,114 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "id": "Bip37aP917XY" }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import altair as alt\n", "\n", + "\n", "class MissingColumnsError(Exception):\n", " def __init__(self, columns):\n", " super().__init__(f\"The source data is missing one or more of these columns: {columns}\")\n", "\n", + "\n", + "chart_properties = {\n", + " \"width\": 600,\n", + " \"height\": 350,\n", + " \"padding\": 50,\n", + " \"title\": alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", + "}\n", + "chart_axis = {\n", + " \"titleFontSize\": 14,\n", + " \"labelFontSize\": 14,\n", + " \"labelPadding\": 5,\n", + " \"ticks\": False,\n", + " \"domain\": False,\n", + "}\n", + "\n", + "\n", "def check_columns(columns, data):\n", " # check if input contains the right columns\n", " if not columns.issubset(data.columns):\n", @@ -215,19 +311,8 @@ " alt.Tooltip(\"collection_id\", title=\"collection id\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -256,19 +341,8 @@ " alt.Tooltip(\"object_count\", title=\"number of objects\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -305,19 +379,8 @@ " alt.Tooltip(\"release_type\", title=\"release type\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -353,19 +416,8 @@ " alt.Tooltip(\"key\", title=\"object type\", type=\"nominal\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -392,19 +444,8 @@ " alt.Tooltip(\"total_tenders\", title=\"number of tenders\", type=\"quantitative\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )" ] diff --git a/template_usability_checks_fieldlist.ipynb b/template_usability_checks_fieldlist.ipynb index 90911c1..6515233 100644 --- a/template_usability_checks_fieldlist.ipynb +++ b/template_usability_checks_fieldlist.ipynb @@ -168,18 +168,114 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "id": "Bip37aP917XY" }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import altair as alt\n", "\n", + "\n", "class MissingColumnsError(Exception):\n", " def __init__(self, columns):\n", " super().__init__(f\"The source data is missing one or more of these columns: {columns}\")\n", "\n", + "\n", + "chart_properties = {\n", + " \"width\": 600,\n", + " \"height\": 350,\n", + " \"padding\": 50,\n", + " \"title\": alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", + "}\n", + "chart_axis = {\n", + " \"titleFontSize\": 14,\n", + " \"labelFontSize\": 14,\n", + " \"labelPadding\": 5,\n", + " \"ticks\": False,\n", + " \"domain\": False,\n", + "}\n", + "\n", + "\n", "def check_columns(columns, data):\n", " # check if input contains the right columns\n", " if not columns.issubset(data.columns):\n", @@ -215,19 +311,8 @@ " alt.Tooltip(\"collection_id\", title=\"collection id\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -256,19 +341,8 @@ " alt.Tooltip(\"object_count\", title=\"number of objects\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -305,19 +379,8 @@ " alt.Tooltip(\"release_type\", title=\"release type\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -353,19 +416,8 @@ " alt.Tooltip(\"key\", title=\"object type\", type=\"nominal\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -392,19 +444,8 @@ " alt.Tooltip(\"total_tenders\", title=\"number of tenders\", type=\"quantitative\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )" ] diff --git a/template_usability_checks_registry.ipynb b/template_usability_checks_registry.ipynb index dd81dd3..4bee278 100644 --- a/template_usability_checks_registry.ipynb +++ b/template_usability_checks_registry.ipynb @@ -168,18 +168,114 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "id": "Bip37aP917XY" }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import altair as alt\n", "\n", + "\n", "class MissingColumnsError(Exception):\n", " def __init__(self, columns):\n", " super().__init__(f\"The source data is missing one or more of these columns: {columns}\")\n", "\n", + "\n", + "chart_properties = {\n", + " \"width\": 600,\n", + " \"height\": 350,\n", + " \"padding\": 50,\n", + " \"title\": alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", + "}\n", + "chart_axis = {\n", + " \"titleFontSize\": 14,\n", + " \"labelFontSize\": 14,\n", + " \"labelPadding\": 5,\n", + " \"ticks\": False,\n", + " \"domain\": False,\n", + "}\n", + "\n", + "\n", "def check_columns(columns, data):\n", " # check if input contains the right columns\n", " if not columns.issubset(data.columns):\n", @@ -215,19 +311,8 @@ " alt.Tooltip(\"collection_id\", title=\"collection id\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -256,19 +341,8 @@ " alt.Tooltip(\"object_count\", title=\"number of objects\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -305,19 +379,8 @@ " alt.Tooltip(\"release_type\", title=\"release type\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -353,19 +416,8 @@ " alt.Tooltip(\"key\", title=\"object type\", type=\"nominal\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )\n", "\n", @@ -392,19 +444,8 @@ " alt.Tooltip(\"total_tenders\", title=\"number of tenders\", type=\"quantitative\"),\n", " ],\n", " )\n", - " .properties(\n", - " width=600,\n", - " height=350,\n", - " padding=50,\n", - " title=alt.TitleParams(text=\"\", subtitle=[\"\"], fontSize=18),\n", - " )\n", - " .configure_axis(\n", - " titleFontSize=14,\n", - " labelFontSize=14,\n", - " labelPadding=5,\n", - " ticks=False,\n", - " domain=False,\n", - " )\n", + " .properties(**chart_properties)\n", + " .configure_axis(**chart_axis)\n", " .configure_view(strokeWidth=0)\n", " )" ]