Skip to content

Commit

Permalink
185 html report always cleaning (#248)
Browse files Browse the repository at this point in the history
* feat: add doctstring;add param;add type defence

* feat: add condition on whether to clean or not

* fix: fixed small typo in error message

* fix: changed match in test to fit error message

* fix: update gtfs attr table for html reports

* test: Refactor tests that are now warning about expired feed

* refactor: Test targets new row thanks to feed expired warning

* refactor: Tests assert against fixture with expired feed warning

---------

Co-authored-by: Sergio Recio <[email protected]>
Co-authored-by: r-leyshon <[email protected]> 4300b44
  • Loading branch information
r-leyshon and SergioRec committed May 1, 2024
1 parent 4df80d7 commit 66357f9
Show file tree
Hide file tree
Showing 65 changed files with 183 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 2c2420c3fa857586cb7378c0f1f9c276
config: 057f7cf2e9f6fd2ab00c78029dae325c
tags: 645f666f9bcd5a90fca523b33c5a78b7
2 changes: 1 addition & 1 deletion _modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../_static/jquery.js?v=5d32c60e"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/gtfs/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/gtfs/cleaners.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/gtfs/gtfs_utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/gtfs/multi_validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/gtfs/routes.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
13 changes: 10 additions & 3 deletions _modules/transport_performance/gtfs/validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down Expand Up @@ -1442,6 +1442,7 @@ <h1>Source code for transport_performance.gtfs.validation</h1><div class="highli
<span class="s2">&quot;stops&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed</span><span class="o">.</span><span class="n">stops</span><span class="p">,</span>
<span class="s2">&quot;trips&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed</span><span class="o">.</span><span class="n">trips</span><span class="p">,</span>
<span class="s2">&quot;calendar&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed</span><span class="o">.</span><span class="n">calendar</span><span class="p">,</span>
<span class="s2">&quot;full_stop_schedule&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">full_stop_schedule</span><span class="p">,</span>
<span class="p">}</span>

<span class="c1"># determine which errors/warnings have rows that can be located</span>
Expand Down Expand Up @@ -1567,6 +1568,7 @@ <h1>Source code for transport_performance.gtfs.validation</h1><div class="highli
<span class="n">overwrite</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span>
<span class="n">summary_type</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;mean&quot;</span><span class="p">,</span>
<span class="n">extended_validation</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span>
<span class="n">clean_feed</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Generate a HTML report describing the GTFS data.</span>

Expand All @@ -1582,7 +1584,9 @@ <h1>Source code for transport_performance.gtfs.validation</h1><div class="highli
<span class="sd"> default &quot;mean&quot;</span>
<span class="sd"> extended_validation : bool, optional</span>
<span class="sd"> Whether or not to create extended reports for gtfs validation</span>
<span class="sd"> errors/warnings.</span>
<span class="sd"> errors/warnings, by default True</span>
<span class="sd"> clean_feed : bool, optional</span>
<span class="sd"> Whether or not to clean the feed before validating, by default True</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
Expand All @@ -1595,6 +1599,8 @@ <h1>Source code for transport_performance.gtfs.validation</h1><div class="highli

<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">_type_defence</span><span class="p">(</span><span class="n">overwrite</span><span class="p">,</span> <span class="s2">&quot;overwrite&quot;</span><span class="p">,</span> <span class="nb">bool</span><span class="p">)</span>
<span class="n">_type_defence</span><span class="p">(</span><span class="n">clean_feed</span><span class="p">,</span> <span class="s2">&quot;clean_feed&quot;</span><span class="p">,</span> <span class="nb">bool</span><span class="p">)</span>
<span class="n">_type_defence</span><span class="p">(</span><span class="n">extended_validation</span><span class="p">,</span> <span class="s2">&quot;extended_validation&quot;</span><span class="p">,</span> <span class="nb">bool</span><span class="p">)</span>
<span class="n">_type_defence</span><span class="p">(</span><span class="n">summary_type</span><span class="p">,</span> <span class="s2">&quot;summary_type&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span>
<span class="n">_set_up_report_dir</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="n">report_dir</span><span class="p">,</span> <span class="n">overwrite</span><span class="o">=</span><span class="n">overwrite</span><span class="p">)</span>
<span class="n">summary_type</span> <span class="o">=</span> <span class="n">summary_type</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
Expand All @@ -1606,7 +1612,8 @@ <h1>Source code for transport_performance.gtfs.validation</h1><div class="highli
<span class="n">date</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">(),</span> <span class="s2">&quot;</span><span class="si">%d</span><span class="s2">-%m-%Y&quot;</span><span class="p">)</span>

<span class="c1"># feed evaluation</span>
<span class="bp">self</span><span class="o">.</span><span class="n">clean_feed</span><span class="p">(</span><span class="n">validate</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">fast_travel</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="k">if</span> <span class="n">clean_feed</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">clean_feed</span><span class="p">(</span><span class="n">validate</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">fast_travel</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="c1"># re-validate to clean any newly raised errors/warnings</span>
<span class="n">validation_dataframe</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_valid</span><span class="p">(</span><span class="n">far_stops</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

Expand Down
3 changes: 1 addition & 2 deletions _modules/transport_performance/gtfs/validators.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down Expand Up @@ -244,7 +244,6 @@ <h1>Source code for transport_performance.gtfs.validators</h1><div class="highli
<span class="k">return</span> <span class="n">invalid_stops</span>

<span class="c1"># add the error to the validation table</span>
<span class="c1"># TODO: After merge add full_stop_schedule to HTML output table keys</span>
<span class="n">_add_validation_row</span><span class="p">(</span>
<span class="n">gtfs</span><span class="o">=</span><span class="n">gtfs</span><span class="p">,</span>
<span class="n">_type</span><span class="o">=</span><span class="s2">&quot;warning&quot;</span><span class="p">,</span>
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/osm/osm_utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/osm/validate_osm.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/population/rasterpop.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _modules/transport_performance/population/vectorpop.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=d45e8c67"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand Down
2 changes: 1 addition & 1 deletion _static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
2 changes: 1 addition & 1 deletion _static/doctools.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Base JavaScript utilities for all Sphinx HTML documentation.
*
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
4 changes: 2 additions & 2 deletions _static/language_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/

var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];


/* Non-minified version is copied as a separate JS file, is available */
/* Non-minified version is copied as a separate JS file, if available */

/**
* Porter Stemmer
Expand Down
Loading

0 comments on commit 66357f9

Please sign in to comment.