<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Open Data Toronto - Medium]]></title>
        <description><![CDATA[Telling stories with data. For more content, check the knowledge centre in the Open Data Toronto portal. For more content, check out the Knowledge Centre in the open.toronto.ca - Medium]]></description>
        <link>https://medium.com/open-data-toronto?source=rss----52113315e049---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Open Data Toronto - Medium</title>
            <link>https://medium.com/open-data-toronto?source=rss----52113315e049---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 00:52:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/open-data-toronto" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Towards a Data Quality Score in open data (part 2)]]></title>
            <link>https://medium.com/open-data-toronto/towards-a-data-quality-score-in-open-data-part-2-3f193eb9e21d?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/3f193eb9e21d</guid>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[open-data]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[toronto]]></category>
            <dc:creator><![CDATA[Carlos Hernandez]]></dc:creator>
            <pubDate>Tue, 18 Feb 2020 14:37:11 GMT</pubDate>
            <atom:updated>2020-02-17T15:54:09.563Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UYlpz0-wRaZxHcvCsdBy1Q.jpeg" /></figure><h4>How the DQS was created: a walkthrough for organizations facing similar challenges</h4><p><a href="https://medium.com/@careduz/towards-a-data-quality-score-in-open-data-part-1-525e59f729e9">In my first story on Open Data Toronto’s Data Quality Score (DQS)</a> I shared <em>why</em> data quality matters to us and <em>what</em> the DQS is at a high-level; in this story, I walk through the steps of exactly <em>how</em> we created it so it is more detailed and a little more technical. Read on if that’s your jam.</p><h3>1. Established goals and scope for the DQS</h3><p>I find iterative product development is as key in data as other fields given many data science tasks, e.g. model tuning or feature engineering, can be an endless pursuit: that extra 1% in accuracy is not always worth the effort and defining product increments helps establish the “good enough” point.</p><p>With that in mind, set as our delivery target a Minimum Viable Product (MVP) — a version of the product with just enough features to start learning from users with minimum effort.</p><p>There were 5 goals for the MVP:</p><p>A. Integrate perspectives from outside the open data team</p><p>B. Provide a reasonable indication of quality without having to view the data</p><p>C. Create an automatic scoring and delivery mechanism</p><p>D. Enable us to begin capturing catalogue data quality trends over time</p><p>E. Share our DQS scoring method with the public on an ongoing basis</p><p>At the end of this, 4 goals were met. Goal C, automatic scoring, is halfway there: the scoring is done automatically via a script but, for the beta, it has to be run manually. This is temporary while learning what works, what doesn’t, and making changes. Will go through the rigorous promotion processes into production and schedule the script to run daily once it is stable.</p><h3>2. Assembled a diverse group to offer feedback and perspective</h3><p>We brought together a Data Quality Working Group to aid us with the ambiguous meaning of quality and validate our approach. It was composed of a diverse membership: multiple teams, users with a range of comfort around data, both data producers and consumers, and an array of wide-ranging perspectives including from outside our organization altogether.</p><p>Sought diversity and the divergent thinking that comes with it for two reasons. First, users are different from us (and it’s for the better that others have interests beyond data and technology!) and we needed exposure to different perspective around data and quality. Secondly, to mitigate dangers of groupthink and biases more likely in a group of like-minded individuals.</p><p>They acted as our sounding board and proved invaluable by providing feedback and perspective throughout the process — and it enabled us to meet Goal A.</p><h3>3. Researched what makes “good” or “bad” data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Wc0bcZ7MkwGBEbVkxNKLQ.png" /><figcaption>Identified dimensions used to measure data quality across industry (left) and academic (right) papers. Actual terms in the papers may differ, these were abstracted for comparison.</figcaption></figure><p>I was particularly interested in how to determine what makes data “high” or “low” quality. To this end, reviewed various academic articles and industry white papers, and identified 15 dimensions for measuring quality including accuracy, completeness, metadata, and timeliness… as expected, basically, but still provided a mental model and rigour moving forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPxnU2YdDqamiSWnLPoq-A.png" /><figcaption>Interpretations for each quality dimension identified in the research</figcaption></figure><p>It quickly became evident that quality depends on the degree to which data fits its intended purpose — hence why dimensions were different across papers. Metadata is important in open data, for instance, because most users are neither domain nor data experts; on the other hand, to data scientists tuning a real-time recommendation system in a production environment metadata is much less important than timeliness, or how quickly input data is received for processing.</p><h3>4. Selected quality dimensions that fit the DQS</h3><p>Then selected dimensions in scope because Open Data could not assess all quality dimensions in a reliable fashion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IhlOrx9MC2kREW5fg28P5A.png" /><figcaption>Score could be composed of 8 dimensions because 2 were not applicable and 5 were on publishers</figcaption></figure><p>As shown above, several dimensions were taken out of scope:</p><ul><li><strong>Accuracy, Coherence, Precision, Reliability, and Non-Redundancy:</strong> publishers have the domain expertise and knowledge to assess these dimensions since they revolve around the actual data values. Taking these out was a difficult decision but the Open Data team recognized our focus is <em>opening</em> and <em>activating</em> data —we are simply ill-equipped for assessing these dimensions.</li><li><strong>Credibility:</strong> assumed datasets are equally credible.</li><li><strong>Relevance:</strong> dependence on who and why uses the data makes this dimension inherently subjective. However, not all datasets are equally important; in fact, the team already captured five of the most relevant problems facing Toronto <a href="https://open.toronto.ca/powering-open-data-with-civic-issues/">into “civic issues” to tag datasets and prioritize data requests</a>.</li></ul><p>Our ideal dimensions to score and aggregate to an overall DQS were then: Accessibility, Comparability, Machine Readability, Completeness, Granularity, Interpretability, Metadata and Timeliness.</p><p>With this many dimensions, I thought the DQS was at risk of becoming difficult to understand and sustain. That aside, they clearly could not all be measured so reality would help with pruning… as often happens in data projects.</p><h3>5. Defined metrics to measure each dimension</h3><p>To determine how to assess these dimensions, identified performance factors for each dimension and, from there, define feasible metric(s) to measure these factor. Metrics aggregate to dimension scores which, in turn, have individual weights towards to the overall DQS.</p><p>This resulted in 7 dimensions (2 were merged), 18 factors, and 12 metrics. There are fewer metrics than factors because we could not conjure feasible metrics for every factor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z159zofS4aSnjFih-J2Lhw.png" /></figure><p>The most straightforward dimensions to measure were <strong>Accessibility,</strong> i.e. whether a dataset is available via API; <strong>Completeness,</strong> i.e. proportion of missing values; and <strong>Freshness </strong>(formerly <em>Timeliness</em>), i.e. time durations such as collection to publication, target to actual refresh, today and time last refreshed.</p><p><strong>Usability </strong>replaced <em>Comparability</em> and<em> Machine Readability</em>, for ease of use, and was challenging due to its inherent subjectivity. Most noteworthy factors:</p><ul><li><em>Meaningful column names</em>: obscure column names is one of the most frustrating issues when faced with a new dataset, which often occur due to source system limitations or to publishers being so accustomed to them that they do not immediately see how confusing they can be to new users. As a metric, thought of the portion of English words contained in the name.</li><li><em>Ability to join with other datasets</em>: data is most valuable when combined (e.g. parks data may tell you “where” you could go, and enhanced with weather data it could also tell you “when” you should go). In an ideal world, datasets are easy to join. Yet, due to the variety of source systems, data types, aggregation levels, field names, publishers, etc. a feasible metric avoided us for now.</li><li><em>Data shape</em>: long data, for example a single “year” column instead of one per year, makes visualization easier. Had ideas on metrics but nothing truly feasible, same as JSON depth and nested fields.</li><li><em>Geospatial validity and slivers</em>: geospatial data-specific factors and metrics</li></ul><p><strong>Granularity</strong>,<strong> </strong>despite being a relatively simple concept, proved difficult to do programmatically because determining how “atomic” data is entails some subjectivity (e.g. the most atomic level may contain private information).</p><p><strong>Metadata</strong> entails whether metadata fields are filled out (e.g. description, contact name) — easy to measure as a True/False — and the quality of content in those fields — harder to measure, need natural language processing to some degree as well as a training set.</p><p><strong>Interpretability</strong> is impacted by multiple factors including columns with a constant value, columns with only default values, and consistency in the data.</p><h3>6. Ranked dimensions for determining weights</h3><p>Since dimensions would weight towards the overall DQS, the weights had to be assigned the weights. In no particular order, 3 principles guided how weights were determined:</p><ol><li>Weighting methodology had to be easy to implement and explainable to a wide audience, so the approach could be shared transparently.</li><li>Weights had to be determined with input from outside the Open Data team (indeed, this was a key contribution of the working group).</li><li>Wanted to avoid asking user preferences (as often results in “it’s all important”). In essence, I wanted to <em>force a choice</em> to reflect the reality there are tradeoffs and dimensions not equally significant.</li></ol><p>Opted for a rank weighting method where criteria are ranked by importance in descending order — 1 being most important — and weights based on the ranks, with higher ranks weighting more than lower ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*HSaRlrNp-QrH9bROV0EBPA.png" /><figcaption>Working group and Open Data team members ranked dimensions by importance. <a href="https://forms.gle/8NZ8pAnyEgrb4RHK6">This survey is open to the public</a>, for anyone who wants to take it as a starting point for their own.</figcaption></figure><p>After surveying the working group and our internal team, the dimension ranking result was:</p><ol><li>Interpretability</li><li>Usability</li><li>Metadata</li><li>Freshness</li><li>Granularity</li><li>Completeness</li><li>Accessibility</li></ol><p>Finally, decided to use equal weighting for how much metrics contribute to their specific dimension score and refine it after listening from users. The aim was to avoid getting caught in “analysis paralysis” — going back on forth on this, endlessly, without delivering. A starting point is better than not starting.</p><h3>7. Selected metrics in scope for the MVP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkA7Xb288TWTmI659I78gQ.png" /></figure><p>Selected 8 metrics of the 12 defined for the MVP because they could be calculated programmatically fairly quickly. This meant removing <strong>Granularity</strong>, which had no metrics, and Interpretability from the MVP.</p><p><strong>Interpretability</strong> had one metric, <em>percent of columns with a constant value</em>; however, as the highest-ranked dimension it contributed to the largest weight of the DQS. Meaning that metric alone would have accounted for 32% of the score until other metrics were captured — an unreasonable weight. Instead of removing the metric, which is still a good indicator of overall quality, it was moved under Usability.</p><h4>Important caveat on Freshness</h4><p>The date used to calculate <strong>Freshness </strong>is “Last Refreshed”, which is <em>when Open Data pulled from the source system and not when the data was last updated</em> (often referred to as “Currency”). Take this dataset:</p><pre>Last refreshed: 31/12/2010<br>Currency: 01/01/2020</pre><p>Ideally, would use “Currency” for determining <strong>Freshness</strong>; however, it must be standardized to make scalability and automation of the pipeline feasible.</p><p>Alas, this is not possible because the open data catalogue contains such widely different datasets that they may or may not have a currency timestamp and, if they do, it will probably be under a different name… Plus, often the meaning of currency itself is muddled because time is a tricky concept.</p><p>For these reasons, decided to use Last Refreshed date as the closest proxy to currency. Although not exactly where we want to be, it is a step in that general direction.</p><h3>8. Set dimension weights with Sum and Reciprocal rank weighting</h3><p>Many algorithms can calculate weights from ranks, differing in how they distribute weights: some favour on higher ranking criteria and others weight them more evenly.</p><p>If interested, the algorithms tested were outlined in a <a href="http://pure.iiasa.ac.at/id/eprint/14219/1/GDN%202016%20conf.pdf">paper comparing trade-offs in rank weighting methods</a>: rank sum, rank reciprocal, sum and reciprocal, rank exponent, rank order centroid.</p><p>After trying several rank weighting methods settled on <em>Sum and Reciprocal </em>as it produced relatively balanced weights across criteria. Dimension weights were (finally!) set:</p><ul><li><strong>Usability</strong>: 38%</li><li><strong>Metadata</strong>: 25%</li><li><strong>Freshness</strong>: 18%</li><li><strong>Completeness</strong>: 12%</li><li><strong>Accessibility</strong>: 7%</li></ul><h3>9. Finalized the DQS calculation</h3><p>With all the pieces in place, the last item was calculating the DQS:</p><ol><li>Measure <strong>metric values</strong>. They will be between 0 and 1.</li><li>Get <strong>raw dimension scores, </strong>which are is the mean of their metrics</li><li>Calculate <strong>dimension scores</strong> by multiply their weight by their raw score</li><li>Get <strong>raw DQ scores</strong> by summing dimension scores</li><li>Scaled raw DQ scores via min-max scaling to get the <strong>DQS</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OiDbEc7T-_ef8Q82gG_z7w.png" /></figure><p><a href="https://github.com/open-data-toronto/framework-data-quality/blob/master/data_quality_score.ipynb">For detailed metric calculations check out the script in GitHub</a>, which scores automatically those datasets <strong>in scope:</strong> those in our database. <strong>Data files are not rated</strong>. This is because automation is much easier for data in the database because it is standardized (whereas files can be quite different even when in the same format) and because once they are in the database, the data can be accessed automatically through the CKAN Datastore API.</p><p>As mentioned in the first story, I wanted to stay away from reporting a number as the score because I felt doing so would distract from the main purpose of this MVP: to provide a reasonable <em>indicator </em>of quality (Goal B).</p><p>The score would make it easy to focus on the meaning of each percentage point, e.g. whether a dataset deserves a 75% or 80% . This type of conversation would not have been very valuable, however: the score is far from perfect but it didn’t have to be exact. Just provide a general idea.</p><h3>10. Created bronze, silver, and gold tiers</h3><p>Binned the scores to avoid reporting a specific number. This makes communication easier and helps anchor conversations around broader data quality <em>concepts </em>instead of the meaning of percentage points — essentially, it makes it allows one to see the forest from the trees.</p><p>Began with letter grades (A-F) since scores were roughly normally distributed but that resulted in too many bins that were difficult to differentiate, and the traditional cutoffs were too punitive.</p><p>Reducing the number of bins allowed for better differentiation of the bins, with the benefit the Gold/Silver/Bronze model is broadly familiar. To set the boundaries, i.e. when a Bronze score becomes Silver or a Silver score becomes Gold, followed a pragmatic approach:</p><ol><li>Experimenting with boundaries</li><li>Confirming datasets fit in their bins, especially if they are at the edge</li><li>Ensuring the distribution makes sense. Logic dictates Bronze would be largest in terms of numbers, Silver smaller, and so on</li><li>Rinse and repeat until it makes (enough) sense</li></ol><blockquote>There’s a lot of art in data science. For instance, it is interpretation and imagination by data scientists and analysts that often give meaning to bins.</blockquote><p>At the end of this, the score distribution and dataset-to-tier fit well overall — finally meeting Goal B. It gave us a general idea of the quality of a dataset without having to see it first! The catalogue was scored, and the final boundaries and counts were:</p><ol><li>Bronze (normalized score less than 60%): 34 datasets</li><li>Silver (normalized score 60% -80%): 23 datasets</li><li>Gold (normalized score over 80%): 11 datasets</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*nUIceEF8IDTCTCrUYH-FLg.png" /></figure><h3>11. Capturing results to a new dataset for full transparency</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ibBnAEgxO3qJ3AxeqKztFQ.png" /><figcaption>Our own dataset, as of the time of writing, scored Silver! This is because the refresh was way overdue (remember, for now it has to be run manually… won’t be an issue once it is scheduled). It does pain me a bit and it’s a little embarrassing to admit, but just being open.</figcaption></figure><p>To meet our final goals, the ability to view catalogue data quality trends over time and share the methodology around the DQS , released the <a href="https://open.toronto.ca/dataset/catalogue-quality-scores/">Catalogue quality scores dataset</a>, which contains two “resources” (CKAN terms… they just look like files in the portal):</p><ol><li><strong>Scoring models (JSON)</strong> contains the version, and parameters of the DQS model (e.g. rank weighting method, dimension ranks and weights, bins) to track how the model changes over time.</li><li><strong>Catalogue scorecard (CSV)</strong> contains the scores from every run of the DQS, as new ones are just added to the end of the file. Interesting fact: if a dataset page loads and there is a score on the sidebar it actually comes from here because this data is in the datastore.</li></ol><h3>What’s next</h3><p>There is still a lot of room for improvement in the DQS. It isn’t “finished” or “perfect”, and will probably never be— it is a starting point to exploring the automated DQS concept in the open data space.</p><p>From our side, we are listening to feedback from users and the community at large to learn what works and continue tweaking. On a more ambitious note, it would be splendid to come up with ideas of including the publisher dimensions into the DQS, such as accuracy and precision, but that will not happen any time soon.</p><p>There’s actually a spin-off from this project! A tool to help the average person validate their data quickly. Although it has been start-and-stop, early versions showed a lot of promise for increasing efficiencies around some internal tasks. I will share it here, as well, once I can make the time for it.</p><p>Would be great to continue refining this in collaboration with other programs or teams. If you are interested, or have questions/comments reach me via the comments, <a href="https://twitter.com/CareduzTweets">DM me on Twitter</a>, or email the team at opendata@toronto.ca.</p><p>If you like this article don’t forget to give it a few claps, after all it costs nothing.</p><h3>Special thanks because I was not alone</h3><p>To <a href="https://www.linkedin.com/in/ryangarnett/">Ryan Garnett</a> (Open Data manager at the time and data quality aficionado) forever) for your championing, bringing together the working group, and valuable input.</p><p>To <a href="https://www.linkedin.com/in/yizhao-tan/">Yizhao Tan</a> (data Swiss Army Knife and web dev by necessity), for the endless sound-boarding, brainstorming, and helping level up the initial code (the POC code was for testing metrics were measurable, not for readability!).</p><p>And of course the Open Data team at large for your support.</p><p>P.S. Don’t forget to <a href="https://twitter.com/Open_TO">follow Open Data Toronto on Twitter</a> and subscribe to our monthly newsletter, the Open Data Update, in <a href="https://open.toronto.ca/">our portal</a>.</p><h3>References</h3><h4>Step #2: Researching what makes “good” or “bad” data</h4><p><strong>Industry sources</strong></p><ul><li><a href="http://bankofengland.co.uk/-/media/boe/files/statistics/data-quality-framework">Bank of England, Statistics and Regulatory Data Division: Data Quality Framework (Whitepaper), March 2014</a></li><li><a href="http://reports.opendataenterprise.org/BriefingPaperonOpenDataandImprovingDataQuality.pdf">The Center for Open Data Enterprise: Open Data and Data Quality (Briefing Paper), 2016</a></li><li><a href="https://www.europeandataportal.eu/sites/default/files/d2.1.2_training_module_2.2_open_data_quality_en_edp.pdf">European Commission: Open Data &amp; Metadata Quality (Presentation), 2014</a></li></ul><p><strong>Academic sources</strong></p><ul><li>Bai, Lu, Rob Meredith, and Frada Burstein. “A data quality framework, method and tools for managing data quality in a health care setting: an action case study.” <em>Journal of Decision Systems</em> 27.sup1 (2018): 144–154.</li><li>Wang, Richard Y., and Diane M. Strong. “Beyond accuracy: What data quality means to data consumers.” <em>Journal of management information systems</em> 12.4 (1996): 5–33.</li></ul><h4>Step #8: Set dimension weights with Sum and Reciprocal rank weighting</h4><ul><li>Danielson, Mats, and Love Ekenberg. “Trade-offs for ordinal ranking methods in multi-criteria decisions.” <em>International Conference on Group Decision and Negotiation</em>. Springer, Cham, 2016.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f193eb9e21d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/towards-a-data-quality-score-in-open-data-part-2-3f193eb9e21d">Towards a Data Quality Score in open data (part 2)</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Towards a Data Quality Score in open data (part 1)]]></title>
            <link>https://medium.com/open-data-toronto/towards-a-data-quality-score-in-open-data-part-1-525e59f729e9?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/525e59f729e9</guid>
            <category><![CDATA[toronto]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[open-data]]></category>
            <dc:creator><![CDATA[Carlos Hernandez]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 18:56:12 GMT</pubDate>
            <atom:updated>2020-02-12T22:37:34.180Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*o-952DWuYpcjTUFSF-HgIA.jpeg" /></figure><h4>Why Open Data Toronto created a score to assess data quality and what it measures</h4><p>As proud nerds, we have been excited about data quality at Open Data Toronto for a while; so much so, in fact, we created and recently released a Data Quality Score (DQS) to measure the quality of our catalogue.</p><p>In this post, I share <strong>why we want to measure quality </strong>and <strong>what the DQS is</strong>.<strong> </strong>Next month I will follow up with an article detailing <em>how</em> we created the DQS — including code and papers — for open data programs or teams facing similar challenges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfx63-NDtu9ol2IeC3kCVg.png" /><figcaption>Data quality scores are now displayed on some datasets</figcaption></figure><h3>Why quality &gt; quantity (for us)</h3><p>Traditionally, Open Data Toronto program performance has been tied to the number of datasets in the catalogue. <a href="https://www.thestar.com/news/city_hall/2017/10/18/a-look-at-john-torys-record-shows-18-campaign-promises-kept-13-broken.html">Mayor Tory and City Council have used this metric to focus the program on growth since early 2014</a>, resulting in the team increasing the catalogue size by over 190% in the last 5 years.</p><p>Today, however, catalogue size is less relevant primarily because it fails to measure progress towards the program’s vision of enabling anyone, anywhere, to improve life in Toronto with open data.</p><p>A more relevant metric helps measure user value, effectively shifting conversations around the open data catalogue from “how many?” to “how good?”. <a href="https://www.toronto.ca/legdocs/mmis/2018/ex/bgrd/backgroundfile-110740.pdf">A focus on value has been a core tenet of the Open Data Master Plan (ODMP)</a>, which was co-developed with the community and received unanimous Council approval; in fact, it established “emphasizing quality over quantity” as a key strategic action for the program (Strategic Action 1c for those keeping score).</p><h4>Catalogue size does not capture what matters</h4><p>Although dataset count is easy to measure and understand, several issues with that metric have become increasingly salient as the program has matured:</p><ol><li><strong>Users don’t view number of datasets as particularly useful.</strong> We heard this <em>repeatedly</em> from the community and in the ODMP public consultations.</li><li><strong>More datasets do not mean more value.</strong> Getting more data users don’t want, can’t use, or can’t help solve civic issues could <em>diminish</em> value.</li><li><strong>Skews publisher incentives.</strong><em> </em>Given performance is tied to providing more data, efforts towards improving data quality are not recognized.</li></ol><h4>Quality is a better indicator of value and potential for impact</h4><p>Measuring quality would provide a better indicator of how useful datasets are and their potential to be used for improving life in Toronto. This would also enable conversations and enhance accountability around aspects of the catalogue more relevant to the people who use it.</p><p>To understand why this is the case, imagine a catalogue with millions of datasets in files in proprietary formats, out of date, without metadata, empty, and with obscure attributes… Hard to use for experts, let alone most people! Not exactly helpful in improving lives.</p><p>Now, picture the opposite: a catalogue with datasets that make you think of “good” data, e.g. timely, well described, complete, in various formats, accessible via APIs, etc. The potential of these datasets to be used for improving people’s lives is much greater.</p><blockquote>High-quality data enables high-quality impact</blockquote><p>The data quality frameworks identified in our research did not assess quality in the way we were looking for. For example, the <a href="https://5stardata.info/en/">5-star Open Data framework focuses primarily on linked data</a> and the <a href="https://certificates.theodi.org/en">ODI Open Data Certificate on the context <em>around </em>it</a> (e.g. policies, access) instead of the data.</p><p>So we decided to create our own measure — the Data Quality Score, or DQS.</p><h3>What the Data Quality Score is (and isn’t)</h3><blockquote>With the DQS users get an idea of how good data is without viewing it and publishers get pointers for improving their data.</blockquote><h4>Is created with feedback from other teams and the community</h4><p>Assembled a Data Quality Working Group representing a diverse membership (e.g. types of users, technical abilities, even from outside the organization) to provide advice and guidance while creating the score.</p><h4>Is calculated from 5 dimensions and 8 metrics</h4><p>The DQS is a result of 5 dimensions, i.e. factors that influence quality, which are scored individually and account for different weights towards the score. We defined them after a review of academic and industry papers, with the working group, then set their weights via a rank weighting method.</p><p>We then selected metrics to score dimensions that could be automated and made operational fairly quickly, to focus on delivery and prevent “analysis paralysis”. Although it is not an exhaustive list by any means and these metrics paint an incomplete picture of their respective dimensions, issues with here indicate larger quality problems are more likely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7MBn-JjSWYuuHda8_dLXRg.png" /></figure><p>The dimensions, their weight, and underlying metrics are:</p><p><strong>1. Usability (38%): how easy is it to work with the data?</strong> Measured by 3 metrics:</p><ul><li>Proportion of columns with meaningful names</li><li>Proportion of columns with a constant value</li><li>Proportion of valid features (for geospatial datasets)</li></ul><p><strong>2. Metadata (25%): is the data well described? </strong>Measured by percent of metadata fields that have been filled out by the publisher.</p><p><strong>3. Freshness (18%): how close to creation is publication?</strong> Measured by the time gap between published refresh rate v. actual (e.g. expected daily but it has been a week), and gap between last refreshed and today.</p><p><strong>4. Completeness (12%): how much data is missing?</strong> Measured by proportion of empty cells in the dataset.</p><p><strong>5. Accessibility (7%): is the data easy to access?</strong> Measured by whether the data can be accessed via the DataStore API — a freebie for the MVP, as it contains data from the DataStore only.</p><p>In our tests datasets generally scored about where we expected, with better datasets scoring higher and questionable ones scoring lower.</p><h4>Is only for “Table” or “Map” datatasets (stored in our database)</h4><p>We store data in 2 ways, individual files and a database. In the portal the former are tagged “Document”, and the latter “Table” or “Map” (as a sidenote, I don’t think these are the right terms so will revisit them in the future but they are for now).</p><p>The score applies only to datasets in the database, as it allowed us to use features (such as APIs) and enjoy standardization that make automation far easier and faster than working with individual files. Given how different files can be from one another — Excel, PDF, Shapefiles, etc — we had to remove them from scope.</p><h4>Is reported via Bronze/Silver/Gold medals</h4><p>Instead of reporting the score as a percentage we opted for medals because, at this stage, <em>getting the overall concept right is more important than the specific number. </em>We want to start conversations at a high-level and then move into the details — once we ensure “Gold” is really better than “Bronze” we can look into whether a dataset should score 87% or 83%, for example.</p><h4>Is designed for tracking scores and models over time</h4><p>We created the <a href="https://open.toronto.ca/dataset/catalogue-quality-scores/">Catalogue quality scores dataset to keep track of every dataset’s DQS</a>, underlying dimension scores, and when they were last scored so we can keep track of improvements to the catalogue over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BLFSd3iA9yas0WXF1jJGJw.png" /><figcaption>In addition to recording when the scoring happened, and what version of the model, we are also recording the DQS (badge and score), as well dimension scores for every dataset to track trends over time.</figcaption></figure><p>The dataset also contains the scoring model (including method, weights, and model version) in a JSON file to track how the model evolves:</p><pre><strong>{<br>  </strong>&quot;v0.1.0&quot;: <strong>{<br>    </strong>&quot;aggregation_methods&quot;: <strong>{<br>      &quot;</strong>metrics_to_dimension&quot;: &quot;avg&quot;,<br>      &quot;dimensions_to_score&quot;: &quot;sum_and_reciprocal&quot;<br>    <strong>}</strong>,<br>    &quot;dimensions&quot;: <strong>[<br>      {<br>        </strong>&quot;name&quot;: &quot;usability&quot;,<br>        &quot;rank&quot;: <strong>1</strong>,<br>        &quot;weights&quot;: <strong>0.37854889589905355<br>       }</strong>, <strong>{<br>        </strong>&quot;name&quot;: &quot;metadata&quot;,<br>        &quot;rank&quot;: <strong>2</strong>,<br>        &quot;weights&quot;: <strong>0.24605678233438483<br>       }</strong>, <strong>{<br>        </strong>&quot;name&quot;: &quot;freshness&quot;,<br>        &quot;rank&quot;: <strong>3</strong>,<br>        &quot;weights&quot;: <strong>0.17665615141955834<br>       }</strong>, <strong>{<br>        </strong>&quot;name&quot;: &quot;completeness&quot;,<br>        &quot;rank&quot;: <strong>4</strong>,<br>        &quot;weights&quot;: <strong>0.12302839116719241<br>       }</strong>, <strong>{<br>        </strong>&quot;name&quot;: &quot;accessibility&quot;,<br>        &quot;rank&quot;: <strong>5</strong>,<br>        &quot;weights&quot;: <strong>0.07570977917981071<br>       }<br>  ]<br>}</strong></pre><h4>Is not a measure for how accurate data is — that’s for publishers</h4><p>Despite how important correctness of the data is to quality, open data is not equipped to assess the actual values since we are not experts in it. Accuracy and similar dimensions (e.g. precision, redundancy) are best in the hands of publishers, with their domain and data expertise.</p><h4>Is not final and will (probably) never be</h4><p>Analytical models are not “set it and forget it” — the world is always changing, and they need be maintained in order to model it correctly. For example, dimensions or metrics significant today can change or new ones can arise.</p><h3>Where we go from here</h3><p>There’s a long list of metrics to integrate and other ideas for improving the score; first, however, it has to be “out in the wild” so we can learn what works.</p><p>Additionally, now that we are collecting the data on quality of the catalogue, I expect us and others to begin to visualize and share what we learn.</p><p>I share the details of our approach with papers, methodologies and code, in a <a href="https://medium.com/@careduz/towards-a-data-quality-score-in-open-data-part-2-3f193eb9e21d">follow-up story</a> for others to leverage or (ideally!) build on. Stay tuned for that if your organization is facing similar challenges.</p><p>I would particularly love to hear how the DQS working out for you (or not) —do expectations of a dataset set by the DQS match the reality after opening it?</p><p>Hope you found my first Medium post informative, enjoyable, and/or useful. I welcome feedback as there is no other way to get better.</p><p>You can reach me via the comments or by <a href="https://twitter.com/CareduzTweets">messaging me on Twitter</a>. Also, don’t forget to <a href="https://twitter.com/Open_TO">follow Open Data Toronto on Twitter</a> and subscribe to our monthly newsletter, the Open Data Update, in <a href="https://open.toronto.ca/">our portal</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=525e59f729e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/towards-a-data-quality-score-in-open-data-part-1-525e59f729e9">Towards a Data Quality Score in open data (part 1)</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Towards Data Analytics: Open Data and the CKAN Google Sheets add-on]]></title>
            <link>https://medium.com/open-data-toronto/towards-data-analytics-open-data-and-the-ckan-google-sheets-add-on-8eafe47bdbf0?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/8eafe47bdbf0</guid>
            <category><![CDATA[google-sheets]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[open-data]]></category>
            <category><![CDATA[data-literacy]]></category>
            <dc:creator><![CDATA[Open Data - Toronto]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 18:43:03 GMT</pubDate>
            <atom:updated>2020-02-06T18:53:00.861Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TTpzoXHcVhR_AFqSc7yssQ.png" /></figure><p><a href="https://medium.com/@ryan.garnett/towards-data-analytics-open-data-and-the-ckan-google-sheets-add-on-3d9010a2102e"><em>Original story by Ryan Garnett</em></a><em>. Republished with permission.</em></p><h3>1.0 Purpose</h3><p>Data. For many people, this simple four letter word is scary. Data is becoming increasingly more important in daily life but the vast majority of people are not comfortable working with it. The fear of mathematics, difficulty understanding statistics, uncertainty on what data can do, or the lack of access are all contributors to a data illiterate society. With data being coined as the “new oil” and data science the “sexiest job of the 21st century”, it’s essential that we address the discomforts many experience when working with data. There are many reasons for this, as stated above, but the combination of access and education are two significant contributing factors.</p><p>Learning data isn’t always fun and finding relevant datasets that have meaning for individuals is difficult. Educators, in public schools and post secondary institutions, for example, experience this regularly. To address these insufficiencies, government organizations throughout the world are increasingly making data available via open data initiatives.</p><p>In a nutshell open data is data that is made available to the public for use free of charge; allowing residents, students, educators, start-ups, and businesses to access and leverage the data for their needs. So what’s the problem? Typically this data is only available via the organization’s open data portal, meaning that individuals must go to a portal and search for the dataset, download it, and then import it into a software application. This may seem like a straightforward task, but for those with lower data literacy this is daunting and the first barrier to becoming data literate.</p><p>Within the education sector, K-12 and post secondary, a large number of institutions are moving towards using Google. The suite of tools provide a means for educators and students to work more seamlessly together, with one lacking area: data access. There are many ideas on data access, with “go where people play<em>”</em> being a growing trend. The premise of <em>go where people play</em> is that people should be able to access data from within the applications that they currently use; rather than needing to go to an external source for data access. With this I would like to introduce the CKAN Google Sheets add-on, a <em>go where people play</em> method for accessing open data from within the most widely used education spreadsheet — Google Sheets.</p><h3>2.0 The CKAN Google Sheets Add-on</h3><p>The CKAN Google Sheets add-on was developed by Evert Pot. The add-on provides functionality to load and display open data from CKAN enabled data portals. For more information visit the <a href="https://chrome.google.com/webstore/detail/ckan-sheets-add-on/jolojoedfljdjiibjffeaehjaiofjkfg">Google web store</a> or <a href="https://github.com/evert/ckan-googlesheets-addon">Evert Pot’s GitHub page</a>.</p><h3>2.1 Installing the Google Sheets Open Data Add-on</h3><p>Installing Google add-ons is pretty straightforward. Add-ons are installed from within Google Sheets from the Add-ons menu. The process walks you step-by-step finishing with an installed add-on. Currently the CKAN add-on has not been verified, which will require an additional step. The add-on has been tested and no safety concerns have been identified. The installation steps are as follows:</p><ul><li>Access G Suite Marketplace (within Google Sheets from <em>Add-ons</em>, <em>Get add-ons</em>)</li><li>Search for add-on</li><li>Select add-on (<em>CKAN sheets add-on</em>)</li><li>Install add-on</li><li>Provide add-on permission</li><li>Choose Google account</li><li>Accept unverified add-on (click <em>Advanced</em> and then Go to <em>CKAN sheets add-on</em>)</li><li>One more thing…allow</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_YokWI5gU7XF3j7N.png" /><figcaption>Figure 1: Installed CKAN open data add-on</figcaption></figure><h3>2.2 Accessing Open Data</h3><p>Traditionally accessing open data was performed within an organizations web portal, but the Google Sheets add-on allows you to access open data managed within a CKAN environment from within Google Sheets; a win for educators and data literacy. The add-on allows users to search for open data from within Google Sheets, removing the requirement of searching in different portals and importing different files into Google Sheets. Now users have a seamless simplified customer experience.</p><p>Once the add-on is installed it is a few clicks away from being access, simply go to <em>Add-ons</em>, <em>CKAN sheets add-on</em>, <em>Open</em>; a new window will open and dock to the right side of the sheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xMOxmnnpqNgTKdP5.png" /><figcaption>Figure 2: Accessing the CKAN add-on</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*N6vuuAePkEMxDNt8.png" /><figcaption>Figure 3: CKAN open data add-on</figcaption></figure><p>By default three providers are listed. In this story we will access data from the City of Toronto. Don’t see a provider you are interested in? If they have a public CKAN API (application programming interface, a fancy for saying web link), you can add it through the <em>Add new provider </em>button.</p><p>With your data provider selected you can scroll through the <em>data sets</em> list and click on the one of interest. Once clicked the description of the data set will be populated. To add the data to the sheet scroll down and click the <em>Insert sheet</em> button, and like magic the data is added to the sheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gtT_mzYStRghTJqh.png" /><figcaption>Figure 4: Open data in Google Sheets via CKAN add-on</figcaption></figure><p>With the data added to the sheet countless forms of analysis, data exploration and data visualization can be performed. The CKAN add-on provides access to a wide and varying amount of data, providing a great entry into data analytics for people of all ages and data literacy. Happy data analysis’ing.</p><h3>3.0 Next Steps</h3><p>The City of Toronto’s Open Data team is focusing on improving access to City data, as well as helping with data literacy. An area of interest is working with K-12 educators to develop content that can be used by students of all ages. We plan to create data analytic content that aligns with different K-12 curriculum, specifically using Open Data within Google Sheets.</p><h3>4.0 Resources</h3><p>For more information on Open Data, accessing open datasets, and data literacy visit the City of Toronto’s Open Data site and Open Data Portal:</p><p><a href="https://www.toronto.ca/city-government/data-research-maps/open-data/">City of Toronto’s Open Data site</a></p><p><a href="https://portal0.cf.opendata.inter.sandbox-toronto.ca/">City of Toronto’s Open Data portal</a></p><p><a href="https://portal0.cf.opendata.inter.sandbox-toronto.ca/blog/">City of Toronto’s Open Data knowledge centre</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eafe47bdbf0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/towards-data-analytics-open-data-and-the-ckan-google-sheets-add-on-8eafe47bdbf0">Towards Data Analytics: Open Data and the CKAN Google Sheets add-on</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Toronto Voter Statistics using Golang]]></title>
            <link>https://medium.com/open-data-toronto/exploring-toronto-voter-statistics-using-golang-3459f4fc62ac?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/3459f4fc62ac</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[vote]]></category>
            <category><![CDATA[elections]]></category>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Open Data - Toronto]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 18:32:55 GMT</pubDate>
            <atom:updated>2020-02-06T18:46:40.278Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5z9jwAM-YgJYBkXub8befQ.jpeg" /></figure><p><a href="https://towardsdatascience.com/exploring-toronto-voter-statistics-using-golang-33077b6db123"><em>Original story by Yizhao Tan</em></a><em>, republished with permission.</em></p><p>October marks the official start of the <a href="https://www.cbc.ca/news/politics/election-campaign-starts-today-1.5277657">Canadian federal election campaign</a>. As such, I was interested in exploring the <a href="https://open.toronto.ca/dataset/elections-voter-statistics/">Toronto Voter Statistics</a> dataset published by <a href="https://open.toronto.ca/">Open Data Toronto</a>. Although data were collected from the Toronto municipal elections, it seemed like an interesting dataset that may present some insights on how people in Toronto vote.</p><p><a href="https://www.cnn.com/2016/11/11/politics/popular-vote-turnout-2016/index.html">Low voter turnouts</a> have been attributed as one of the major reasons why Trump won the 2016 US presidential election. While Canada’s own 2015 federal election saw the <a href="https://globalnews.ca/news/2287464/federal-election-2015-voter-turnout-highest-since-1997/">highest turnouts in decades</a>, with an average turnout of 68.49% across the country, I was curious to see if this trend was also reflected on a local level in Canada’s largest municipality.</p><p>Unlike the <a href="https://towardsdatascience.com/exploring-toronto-bike-share-ridership-using-python-3dc87d35cb62">Toronto Bikeshare Ridership dataset I previously explored</a>, this dataset is well structured and easy to work with. Instead of using Python (as per usual), I decided to use this dataset as an opportunity to explore Go’s capabilities for data processing and visualizations.</p><p>Go has been on my radar for some time now. And although Go is not known for its data-related functions, packages such as <a href="https://github.com/gopherdata/gophernotes">gophernotes</a> and <a href="https://github.com/gonum/gonum">gonum</a> are making data related work more approachable. Also, posts like <a href="https://blog.chewxy.com/2017/11/02/go-for-data-science/">this one</a> are making convincing arguments on why Go might be a better choice than Python for data heavy applications.</p><h3>About the Data</h3><p>Data was provided for the past 5 elections from 2003–2018. However, due to the changes in the number of wards in 2018 from <a href="https://www.thestar.com/news/toronto-election/2018/09/21/what-you-need-to-know-about-torontos-25-new-wards.html">44 to 25 wards</a>, I decided to keep things simple and focus only on the data from the 2018 election.</p><p>The data provided has been aggregated by the ward and voting station and provides information on:</p><ul><li>Ward and voting station number</li><li>Voting station location name and address</li><li>Count of voters on the voting list, modifications to the voter list, and count of final eligible voter</li><li>Number of voters that voted</li><li>Count of voters by the school support</li><li>Count of rejected and declined ballots</li></ul><p>I was interested in geocoding the data based on voting station addresses and mapping historical voting data to the new map with 25 wards. This would enable me to track how voting trends have changed across the years. For now, I decided this would be out of scope for the purpose of exploring Go.</p><p>If you would like to follow along, the data and the notebooks I used can be found <a href="https://github.com/open-data-toronto/story-election-voter-statistics">here</a> on GitHub.</p><h3>Preparations</h3><p>Before diving into the analysis, I identified a number of research questions I was interested in answering:</p><ol><li>What is the distribution of turnouts by ward? Are there any patterns when comparing wards with high vs. low turnout?</li><li>How has the ward change impacted the turnouts?</li><li>How has the number of registered voters and turnouts changed over the years?</li><li>Does the ease of access to a voting station have an impact on turnouts?</li><li>Are there any patterns for when voting stations have a higher vs. lower turnouts?</li></ol><p>Questions 2, 3, and 4 require comparison with previous election years or geocoding and therefore they are out of scope for this analysis.</p><p>I defined a number of functions that will be used later in the analysis:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bY371qF1EVH9Kry2.png" /></figure><p>The data itself is fairly well structured and data cleaning was minimal. Mixed within the data (aggregated by ward and voting station) were also rows where the data were also summed by the ward. I dropped these rows since they can be easily calculated later.</p><p>The original data is provided as an Excel sheet which I manually converted to a CSV for easier import. Then I read the data into memory by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u55yv-CalVc2X0f6.png" /></figure><h3>Turnouts Distribution</h3><p>The gonum plot library makes visualization fairly straightforward. I visualized ward vs. turnouts by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1gC3ehdAq8cTzSWD.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*zZNkXKM9GCh3e3HI.png" /></figure><p>A few things stood out to me. First, the turnout for Toronto’s municipal election in 2018 is <strong>much</strong> less than the federal election in 2015. The average turnout across all 25 wards was 40.67%, ~28% lower than the federal turnout in 2016.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BHkUnvbRqqA_AoIv.png" /></figure><p>There was also a big range between the wards with the highest and the lowest turnouts. Ward 14 had the highest turnout at 49.22%, while Ward 23 had the lowest turnout at 34.05%.</p><p>A quick visual comparison showed that the 5 wards with the highest turnouts (Wards 14, 15, 12, 19, and 4) are all located near the downtown core. The 5 wards with the lowest turnouts (Wards 23, 7, 10, 1, and 21) were mostly further out into the suburbs, with Ward 10 as the exception.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/0*1TP-abjUsA2bXGHq.jpg" /></figure><p><a href="https://www.toronto.ca/city-government/data-research-maps/neighbourhoods-communities/ward-profiles/">https://www.toronto.ca/city-government/data-research-maps/neighbourhoods-communities/ward-profiles/</a></p><p>Visual comparison on a map felt unreliable, so I extracted a portion of the data from the <a href="https://open.toronto.ca/dataset/ward-profiles-2018-25-ward-model/">Ward Profiles</a> dataset for more systematic analysis and focused on the impact of education and income on voter turnout. The extracted data file I used is also available on GitHub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ugZlgvkuTDLNQ8TA.png" /></figure><p>The dataset presents the most recent census data by wards. Since the census data was collected in 2016, I assumed that no major demographics changes occurred between 2016 and the election. I specifically focused on two factors:</p><ol><li>% of the population with post-secondary or higher education</li><li>% of the population from a household with a higher than $80,000 total income (the 2016 median household income was <a href="https://www12.statcan.gc.ca/census-recensement/2016/dp-pd/hlt-fst/inc-rev/Table.cfm?Lang=Eng&amp;T=102&amp;PR=0&amp;D1=1&amp;RPP=25&amp;SR=1&amp;S=104&amp;O=D">$78,373</a>)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s4AS1ejM932fnJT6.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XhTpe2f1kFsoEqrB.png" /></figure><p>And the Pearson correlation coefficients were calculated to be 0.57 and 0.55 for education and income, respectively. Based on this, it seems fair to say that both education and income have a positive impact the turnouts. While the correlation values were on the lower side, this is most likely due to other factors that are also impacting how likely the voters are to vote.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D-LngwVLAqbAnYc-.png" /></figure><p>Ward 10, with a 34.85% turnout, stood out both during the initial review on the ward map and during the census data analysis. Not only is this ward located in the downtown core (where turnouts are usually high), 78% of the people living in this ward had a post-secondary education. I would be interested to include age as an additional factor in future analysis to see if it may have contributed to Ward 10’s unusually low turnout.</p><h3>Voting Station Trends</h3><p>Next, I broke down the turnouts further by visualizing the turnout at each station as a box and whisker plot.</p><p>The advance voting stations didn’t have a fixed eligible elector count and I removed these stations from this visualization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zsMfzK2EUGVeLFWC.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*JA1sRMw4ieUoPJY-.png" /></figure><p>I was surprised to see there are stations with 100% and 0% turnout. I reviewed the data to try to understand where these outliers occurred.</p><p>Although there were no distinct trends from the stations with 0% turnout, I noticed that many of the stations with 100% turnout were long-term care facilities (ie. retirement homes, veteran care locations, etc.). I identified a list of keywords for these facilities and counted the number of outlier stations that contained these keywords in their name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yHnM1Fiqr-YZCt07.png" /></figure><p>Instead of focusing only on the stations with 100% turnout, I examined all stations with turnouts greater than or equal to the 91st percentile for their ward. Out of these 164 voting stations, only 34 of these stations contained one of the keywords. These are only a small percentage of all outliers stations.</p><p>Next, I calculated that each stations are expecting about ~1106 voter on average. But these stations with high turnouts (&gt;91 percentile) only were expecting about 94 voters. Since these voting stations were only expecting a handful of voters, it was easy to reach a high turnout at these locations. This would be the likely explanation why these stations reached an usually high turnout, rather than differences in the voters’ demographics at these stations.</p><h3>Thoughts on Go</h3><p>Two major things I immediately noticed with Go:</p><ol><li>It is verbose. I always needed to explicitly state what to expect, whether I was defining the expected inputs of the data from the CSV or how number characters are parsed into the numeric types</li><li>There are less pre-built functions for data. Pandas and numpy may have spoiled me with easy data manipulations. And although gonum plot functions were straightforward and simple to use, creating visualizations were also much more limited in Go than Python (eg. for creating bar graphs, I needed to explicitly state the distance between each bar to avoid bars overlapping).</li></ol><p>Both of these things contributed to a much longer time spent working on the code. I am used to a workflow where I can load the data directly into memory (as a pandas DataFrame), explore the data, and then decide on the next steps. However, with Go, the workflow reverses. I needed to know what the data contains, what I plan to do with the data (so I can define the right structure), and then finally load the data.</p><p>In general, <strong>exploring data with Go felt clunky and slow</strong> even though gophernotes made it possible to run snippets of code in Jupyter notebooks.</p><p>But that is not to say there are no places for Go in the world of data science. Libraries like pandas make assumptions. For example, in pandas, the data type for integer columns containing NaN is float instead of int. While these assumptions are almost always correct, they are not always guaranteed to be correct 100% of the time. Since Go is verbose and functions are often defined by the developers, Go applications are often executed in a more controlled manner. This means <strong>Go is more robust and more reliable in production</strong>.</p><p>Overall, I don’t think I would use Go for another project where the main purpose is to explore the data. But for any applications where consistency is important (eg. data pipelines, backends for dashboards, etc.) I would definitely consider using Go over Python.</p><h3>Next Steps and Conclusion</h3><p>I would be interested in revisiting this dataset in the future using Python with a more geospatial approach. A potential future analysis could include:</p><ol><li>Geocode voting data from all available elections and map the historical data to current neighbourhood boundaries. Then track the change of turnout for each neighbourhood over time</li><li>Join the data with the neighbourhood profile dataset and analyze the relationship of demographics and turnouts on more dimensions than education and income</li></ol><p>I hope that this data story outlines a few interesting insights on how people are voting in Toronto and point the way for more in-depth (and interesting) analysis that you can perform on your own. If you have any questions, feel free to contact the Open Data team at opendata@toronto.ca or me directly at Yizhao.Tan@toronto.ca.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3459f4fc62ac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/exploring-toronto-voter-statistics-using-golang-3459f4fc62ac">Exploring Toronto Voter Statistics using Golang</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open Data: A product approach]]></title>
            <link>https://medium.com/open-data-toronto/original-story-by-ryan-garnett-republished-with-permission-bb5a885da0e1?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/bb5a885da0e1</guid>
            <category><![CDATA[open-data]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Open Data - Toronto]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 18:25:43 GMT</pubDate>
            <atom:updated>2020-02-06T18:47:26.140Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@ryan.garnett/open-data-a-product-approach-53cbb8fdc330"><em>Original story by Ryan Garnett</em></a><em>, republished with permission.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y3bHsSxfpfH21c9qlqb9DA.png" /></figure><h3>Purpose</h3><p>What is open data? Believe it or not, this is a very common question, and rightfully so. Many people are unaware of the decade long open data movement that has been going on in Toronto, longer elsewhere in North America. Governments around the world are making an effort to make data available to the public free of cost under an open license. There are many reasons for this, such as:</p><ul><li>enabling economic opportunities</li><li>improving operational efficiencies</li><li>increasing transparency</li><li>stimulating innovation</li></ul><p>With such noble intentions why are so many people unaware of the open data movement? One reason could be the initial target audience, application developers. The early days of open data in Toronto focused on releasing data with the hope that software applications would be developed to improve social services. While there have been some successful applications developed from the City of Toronto’s open data (i.e. <a href="https://www.rocketmanapp.com/">Rocket Man</a>) the level of application development did not reach the desired level, meaning the positive news and linkage that would accompany the promotion from an app did not occur. The second, and maybe the more likely reason, people are scared of data. The majority of people do not search out data for the sole purpose to perform analysis or to build software applications. Most people are intimidated by data and are unaware of how to begin working with open data; let alone understand how to perform statistical analysis, machine learning, or complex visualizations. The open data movement, like many technology related areas, has a marketing problem, <em>they</em> couldn’t communicate the “how will this help me” question that is so important to go mainstream<em>.</em></p><p>Open data at the City of Toronto has been up and running for a decade this year, with an amazing and active community. However, this is not the case everywhere, and outside of our exceptional community, open data is still unknown by many. With this in mind the City of Toronto’s Open Data team decided to look at changing the conversation around open data by implementing a product management approach to the Open Data Master Plan project, with the hopes of improving communication and adoption of open data not only within Toronto but also worldwide.</p><p>Within this story we will outline our product approach to the Open Data Master Plan and how we are approaching productization.</p><h3>The Open Data Master Plan</h3><p>On January 31, 2018 the Open Data Master Plan was unanimously adopted by City of Toronto Council, endorsing the four year strategic direction and roadmap for revamping the City’s open data initiative to be more inclusive and benefiting a wider audience, including individuals with a minimal technological background.</p><p>The Open Data Master Plan (ODMP) was co-developed with the community and consists of four themes and twelve actions that provide the direction needed to shape the future of open data in Toronto. Keeping with the name of the team, information about the plan is openly available <a href="https://www.toronto.ca/city-government/data-research-maps/open-data/open-data-master-plan/">here</a>, including artifacts collected during the Open Data Master Plan process. Specific detail about the plan can be viewed <a href="https://www.toronto.ca/legdocs/mmis/2018/ex/bgrd/backgroundfile-110740.pdf">here</a>.</p><h3>Productization</h3><p>The Open Data Master Plan was developed to be consumable and actionable, outlining 76 deliverables to be tackled over a four year period. During the first year of the ODMP project the team undertook the work typical to many IT projects:</p><ol><li>build a workplan</li><li>develop a schedule</li><li>prioritize work tasks</li><li>work on tasks</li><li>test developed components</li><li>deploy components</li><li>report</li></ol><p>While this method may be successful for other IT projects it wasn’t working for the ODMP, which was diverse and meant to be co-executed with the community. Furthermore, defining the scope of many of the deliverables was difficult, making reporting on progress a challenge. The project team quickly realized that a change was needed. Being nimble and passionate the team was up for the challenge.</p><p>With <strong>data</strong> in our name, Open Data team, we decided to take some data analysis principles to get a better understanding of the project and began classifying each deliverable in three areas:</p><ul><li>type (technical or non-technical deliverable)</li><li>owner (primary responsibility for making decisions and input)</li><li>priority (low, medium, high, and critical)</li></ul><p>Looking at the results of the classification exercise was very telling. Immediately we realized that the vast majority, ~60%, of the deliverables were non-technical, a surprise for an IT project. With the additional three pieces of information (type, owner, and priority classification) we were able to dissect the project and gain a greater level of insight than before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*iBH88e1Ld4Cnz4Gt.png" /><figcaption>Figure 1: Deliverable types</figcaption></figure><p>Like with many projects one of the first things we wanted to know was the breakdown of the priorities. While understanding the distribution of priorities was important, grouping the priorities with the delivery type was extremely telling. Very quickly we were able to see two valuable insights:</p><ol><li>Low priority deliverables were primarily non-technical</li><li>The vast majority of technical deliverables were medium to critical</li></ol><p>This information was very valuable, it provided us with the ability to plan and communicate, based on data, contingencies within the project. For the first time we were able to built “what if” scenarios that we could communicate to project stakeholders, senior executives, and the community at large. This information empowered us, we were able to make evidence based decisions on what deliverables would not be completed if changes or unplanned events influenced the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*3WsXmg8mhN5qutUU.png" /><figcaption>Figure 2: Delivery type and priority level</figcaption></figure><p>While the classification approach provided valuable insight to understand and improve our planning process, it did little to alleviate the challenges associated to defining scope, reporting progress, and communication the value of open data. A different approach was required.</p><h3>Product Alignment</h3><p>At this point you may be saying “this is fairly basic project planning approaches” which would be correct. Applying different classification to the deliverables was beneficial for planning and risk mitigation, but it did not provide the information needed to assist with many other challenges. For this reason we decided to take a different approach, product.</p><p>What is a product approach? Before we get to the approach let’s look at what a “product” is. Some typical definitions of a product are:</p><ul><li>An article or substance that is manufactured or refined for sale</li><li>A thing or person that is the result of an action or process</li></ul><p>These definitions while good, did not fit with the principles of open data, so we decided to make a spin on product that reflected the values and goals of open data:</p><p><strong>product</strong><em>: an application, artifact, or process that is created to provide civic value, available openly and free of charge</em>.</p><p>With a working idea of what product meant in the world of open data we were set to align the deliverables to products. Six products streams were identified within the Open Data Master Plan:</p><ol><li>Business Plan</li><li>Datasets</li><li>Framework</li><li>Pipeline</li><li>Policy</li><li>Portal</li></ol><p>Deliverables, where applicable, were aligned to one of the six products resulting in 48 deliverables mapped to a product. The largest product stream is the business plan and the portal, each with 12 deliverables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/0*tJ2yy-Nx11wL9-eG.png" /><figcaption>Table 1: Open data master plan products</figcaption></figure><p>Defining and aligning the deliverables to a product was the first step, the real work for productization was establishing the product level for all relevant deliveries over the four year project period. Product levels were identified as proof of concept, minimal viable product, version 1, and version 2. The following are the definition for each of the four product levels used within the Open Data Master Plan productization.</p><p><strong>Proof of Concept (POC)</strong></p><p>The purpose of a POC is to test the feasibility of an Open Data Master Plan deliverable. A POC is not meant to be used by users or in production, but rather gain insights to future development. An example of a POC could be process flow diagram, dynamic dashboard in Google Sheets, etc.</p><p><strong>Minimal Viable Product (MVP)</strong></p><p>The purpose of the MVP is to have a functional working version of the deliverable; not focusing on all the features that would be desired. An MVP allows for evaluation by users within a controlled environment.</p><p><strong>Version 1 (V1)</strong></p><p>The purpose of the V1 is to implement a feature rich stable product capable of performing in operational situations. The V1 has been tested and improved by minimal feature enhancements.</p><p><strong>Version 2 (V2)</strong></p><p>The purpose of the V2 is to add additional feature enhancements to the delivery. A V2 product is the highest expected level within the Open Data Master Plan.</p><p>The 48 product deliveries were mapped to one of the four product levels (POC, MVP, V1, or V2) for each year of the project, illustrating the planned product progression for the Open Data Master Plan. The majority of the deliverables are proof of concepts, with no version 2 deliveries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*5QjHqDdndW4prT-k" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*T5nH6quw7zBKKeS4.png" /><figcaption>Figure 3: Product tiers</figcaption></figure><p>Similar to the classification exercise, the product tiers were linked to the priority groups and product streams, illustrating valuable insight. The POC deliveries are primarily comprised of low and medium priorities, while V1 are made up of high and critical deliverables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*CrdmpeY-JQ8UyD3h.png" /></figure><p>When looking at the product tiers across the product streams it clearly shows that POCs are distributed throughout all six of the streams. This analysis also identifies the four streams (business plan, framework, pipeline, and portal) that have version 1 products.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*9uoo-xV9h9ExT4eI.png" /></figure><p>With product tiers and streams identified we had the pieces needed to communicate progress. Prior to the product approach we consistently came into the same issue “how do we report where we are on a deliverable” especially when they could occur over multiple years and may evolve unconventionally. The product tiers allowed us to apply a weighted score for each of the four tiers:</p><ul><li>POC — 1 point</li><li>MVP — 3 points</li><li>V1–6 points</li><li>V2–9 points</li></ul><p>By implementing the product tiers into our project management planning process we can now track the progress and report how the project is doing through a simple comparison of what was planned vs. what was delivered. For example, within Theme 4 there is a deliverable to <em>implement visualizations of open datasets in the portal</em>, which was planned to be a MVP in 2019, however a V1 has been implemented to date; making reporting a simple task:</p><p>2019 actual <strong><em>minus</em></strong><em> </em>2019 planned <strong>OR </strong>V1 (6) — MVP (3); product score of 3</p><p>This approach was performed on all deliverables that were aligned to a product tier and was built into a simple dynamic reporting dashboard outlining the Open Data Master Plan product performance (available <a href="https://docs.google.com/presentation/d/16z-Qa8ArpKEDNmaZ4bYHE7pY-1n3jegsQraq4ukFrg8/edit#slide=id.g5f56935e4b_1_19">here</a>).</p><h3>Next Steps</h3><p>Like most new approaches there are still areas that need work or revisions. Within the productization of the Open Data Master Plan we plan to identify the features of each product tier for all product deliveries. This level of effort will allow us to identify dependencies and relationships between products.</p><h3>Resources</h3><p>The City of Toronto’s Open Data team works in a collaborative environment and tries to be fully transparent. We regularly commit to our publicly available GitHub site, publish articles on our Knowledge Centre, and report on the progress of the project. The following are links that may be of interest.</p><p>Open Data Knowledge Centre (available <a href="https://open.toronto.ca/blog/">here</a>)</p><p>Open Data Master Plan project performance dashboard (available <a href="https://docs.google.com/presentation/d/16z-Qa8ArpKEDNmaZ4bYHE7pY-1n3jegsQraq4ukFrg8/edit?usp=sharing">here</a>)</p><p>Toronto Open Data GitHub site (available <a href="https://github.com/open-data-toronto">here</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb5a885da0e1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/original-story-by-ryan-garnett-republished-with-permission-bb5a885da0e1">Open Data: A product approach</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Towards Location Intelligence: Open Data and the QGIS CKAN Browser plugin]]></title>
            <link>https://medium.com/open-data-toronto/towards-location-intelligence-open-data-and-the-qgis-ckan-browser-plugin-c781bade3411?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/c781bade3411</guid>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[qgis]]></category>
            <category><![CDATA[geospatial-intelligence]]></category>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[open-data]]></category>
            <dc:creator><![CDATA[Open Data - Toronto]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 18:15:53 GMT</pubDate>
            <atom:updated>2020-02-06T18:48:02.904Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@ryan.garnett/towards-data-analytics-data-literacy-in-r-d99a2f8b0952"><em>Original article by Ryan Garnett</em></a><em>, republished with permission</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0-jWxlws56QNgGmEVwBFw.png" /></figure><h3>1.0 Purpose</h3><p>Data is king; the availability of data has never been higher, and it continues to grow. Quotes like “as much data is now being created every two days, as was created from the beginning of human civilization to the year 2003” from Google’s Eric Schmidt clearly indicates the vast amounts of data that is available. However available does not mean accessible. While the availability of data is increasing, it is in no way readily accessible, especially for all users.</p><p>Recently significant efforts have been made to improve data access for software developers and data scientists through application programming interfaces (APIs). An API provides a programmatic method for accessing data that is stored in enterprise systems, such as a database. The technical nature of data access through APIs can be limiting for non-technical users as well as specific software applications, as certain applications do not allow for API integration, leaving a need for alternative data access methods.</p><p>Geospatial, or location data, is a type of data that is widely used in many industries and sectors; providing valuable information required for decision making. Location data, like other types, is increasing in availability, and like other data types access to location data can be difficult.</p><p>Enter Open Data. Open Data is a growing movement where organizations, especially government, release data to the public for use free of charge; allowing residents, students, educators, start-ups, and businesses to access and leverage the data for their needs. Location data represents a large portion of open data, approximately 60–80% of all open datasets, making location data an extremely valuable data type. Users of location data vary greatly making accessing data an important topic.</p><p>There are many ideas on data access, with “go where people play<em>”</em> being a growing trend. The premise of <em>go where people play</em> is that people should be able to access data from within the applications that they currently use; rather than needing to go to an external source for data access. With this I would like to introduce the CKAN QGIS Browser plugin, a <em>go where people play</em> method for accessing location based open data from within the most widely used open source GIS application — QGIS.</p><p>CKAN and QGIS are both popular open source projects that have a very active community. The remainder of this story will focus on accessing location data within QGIS via the Open Data CKAN Browser plugin.</p><h3>2.0 QGIS — Open Source GIS</h3><p>QGIS is a professional GIS application that is Free and Open Source Software (FOSS). Designed as a user friendly Open Source Geographic Information System (GIS), QGIS is an official project of the Open Source Geospatial Foundation (OSGeo); running on Linux, Unix, Mac OSX, Windows and Android, supporting numerous vector, raster, and database formats and functionalities. For more information visit the <a href="https://qgis.org/en/site/">QGIS website</a>.</p><p>QGIS is available for Windows, Mac, Linux and Android users. The software can be downloaded <a href="https://qgis.org/en/site/forusers/download.html">here</a>; while installing software is very important it will not be covered within this story.</p><h3>3.0 The CKAN QGIS Plugin</h3><p>The CKAN QGIS plugin was developed by BergWerkGIS, originally for QGIS version 2.x, but recently has released a version for QGIS 3.x. The plugin provides functionality to “load and display Open Data from CKAN enabled data portals”. For more information visit the <a href="https://extensions.ckan.org/extension/qgis-ckan-browser/">CKAN extension page</a> or <a href="https://github.com/bergwerkgis/qgis-ckan-browser">BergWerkGIS GitHub page</a>.</p><h3>3.1 Installing the Open Data CKAN Browser Plugin</h3><p>Plugins are installed in QGIS through the <em>manage and install plugins</em> tool within the plugins menu. There are two main classes of QGIS plugins, official and experimental. Official plugins have been accepted and are available on the QGIS plugin repository. Experimental plugins typically have been developed by community members and are available from their personal repository (i.e. GitHub). To access a wider range of plugins, allowing experimental plugins should be enabled.</p><p>The plugins are access within the QGIS menus from: Plugins — Manage and Install Plugins…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8_5vmpS5lv64acw2.png" /><figcaption>Figure 1: QGIS plugins settings</figcaption></figure><p>The plugin can be installed two different ways:</p><ol><li>Searching for ckan-browser within the <em>manage and install plugins</em> tool</li><li>Download the <a href="https://github.com/BergWerkGIS/QGIS-CKAN-Browser/blob/master/CKANBrowser.zip">zipped version of the plugin</a> and install it via the install from zip option within the <em>manage and install plugins</em> tool</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qEuqWq93kTXWci4b.png" /><figcaption>Figure 2: Search of CKAN Browser plugin within QGIS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*97xEYN6ARYuOb8Wp.png" /><figcaption>Figure 3: Install plugin from zip file within QGIS</figcaption></figure><h3>3.2 Configuring the CKAN Browser Plugin</h3><p>Once the plugin is successfully install it is ready for use. The plugin works specifically for data that is stored in CKAN repositories. Prior to accessing data the plugin must be configured to link to a specific CKAN repository. This can be achieved by opening the CKAN Browser via <em>Plugins — Open Data (CKAN) Browser </em>from and clicking on the <em>Open Data (CKAN) Browser </em>icon from<em> </em>within QGIS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ma5T06f7AJ0VOpyx.png" /><figcaption>Figure 4: Accessing the CKAN Browser plugin</figcaption></figure><p>The first time the CKAN Browser plugin is opened a cache location needs to be identified. The cache stores temporary files that are required by the plugin. For this story C:/Temp was used. With the cache directory identified click the save button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*KNSKmcrONXspnPca.png" /><figcaption>Figure 5: Identifying the plugin cache directory</figcaption></figure><p>With the cache directory save the CKAN Browser plugin will be available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H7PudDEPwR8JGuJR.png" /><figcaption>Figure 6: CKAN Browser</figcaption></figure><p>There are 200+ publicly available CKAN i<a href="https://ckan.org/about/instances/">nstances</a>, however not all have the api-url identified, which is the method used to connect the CKAN Browser plugin to an open dataset. Any CKAN api-url can be added into the <em>CKAN API Endpoint</em>, providing access to open data managed within CKAN.</p><p>In this story we will access data from the City of Toronto’s Open Data portal. To accessing a CKAN repository click <em>Select CKAN Server </em>button, a new window will open (see Figure 7). From within the new window (<em>CKAN Servers</em>) enter the CKAN api-url (i.e. <a href="https://ckan0.cf.opendata.inter.prod-toronto.ca/api/3/)"><em>https://ckan0.cf.opendata.inter.prod-toronto.ca/api/3/</em>)</a> to access a specific CKAN instance that is not listed below in the list of publicly accessible CKAN api-urls. If you would like to make a CKAN api-url publicly accessible complete the following form (<a href="https://ckan.org/census/">https://ckan.org/census/</a>) to add your CKAN instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x7VSdfM6XnaptHOv.png" /><figcaption>Figure 7: CKAN Server connection</figcaption></figure><p>The final step is to check the City of Toronto CKAN instance and click the save button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/0*oCDUe7FzoblfCyXC.png" /><figcaption>Figure 8: Identifying the CKAN instance to connect to</figcaption></figure><p>Once the configurations have been set you are ready to access data via the plugin.</p><h3>3.3 Accessing Open Data</h3><p>Once configured and connected to a CKAN repository all available datasets are listed in the <em>Search Results</em> section of the plugin. At the time of this story the City of Toronto’s Open Data CKAN repository had 309 datasets.</p><p>There are two ways to find data:</p><ul><li>Scrolling through the dataset list and pages</li><li>Using the <em>Search term</em> search bar</li></ul><p>By selecting a dataset, clicking on and highlighting a dataset in the <em>Search Result</em> section, different information about the dataset becomes available, such as the description, file formats, and resource URL. Selecting a dataset and checking the desired version/format (Ambulance Station Locations — SHP: 2019-ambulance-station-location-wgs84) the data is loaded into QGIS by clicking the <em>Load Data</em> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kCeZTRhSrP2Q538F.png" /><figcaption>Figure 9: Selecting and loading data</figcaption></figure><p>The data will be loaded into QGIS as a layer allowing for analysis, modelling, or visualization. Additional layers from the Open Data CKAN Browser, or other sources, can be added for full location intelligence capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gkFi4-tGaKx5OAak.png" /><figcaption>Figure 10: Data loaded into QGIS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DHTIGIxGzcXBa5YZ.png" /><figcaption>Figure 11: Multiple data source loaded into QGIS</figcaption></figure><h3>4.0 Resources</h3><p>For more information on Open Data, accessing open datasets, and data literacy visit the City of Toronto’s Open Data site and Open Data Portal:</p><p><a href="https://www.toronto.ca/city-government/data-research-maps/open-data/">City of Toronto’s Open Data site</a></p><p><a href="https://portal0.cf.opendata.inter.sandbox-toronto.ca/">City of Toronto’s Open Data portal</a></p><p><a href="https://portal0.cf.opendata.inter.sandbox-toronto.ca/blog/">City of Toronto’s Open Data knowledge centre</a></p><p>Interested in improving your abilities with QGIS, then you may be interested in the QGIS GeoAcademy curriculum available <a href="http://spatialquerylab.com/foss4g-academy-curriculum/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c781bade3411" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/towards-location-intelligence-open-data-and-the-qgis-ckan-browser-plugin-c781bade3411">Towards Location Intelligence: Open Data and the QGIS CKAN Browser plugin</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Towards Data Analytics: Data literacy in R]]></title>
            <link>https://medium.com/open-data-toronto/towards-data-analytics-data-literacy-in-r-cb835269cc3b?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/cb835269cc3b</guid>
            <category><![CDATA[open-data]]></category>
            <dc:creator><![CDATA[Open Data - Toronto]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 18:07:14 GMT</pubDate>
            <atom:updated>2020-02-06T18:48:40.206Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@ryan.garnett/towards-data-analytics-data-literacy-in-r-d99a2f8b0952"><em>Original article by Ryan Garnett</em></a><em>, republished with permission</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_xZ41-fnOMEa1b-sY05URA.png" /></figure><h3>1.0 Purpose</h3><p>Data is everywhere, and is a critical component in every faction of work. Understanding data is essential for evidence based decision making. Within most organizations Excel is King, the application that is used to collect, share, manipulate, analyse, and communicate information from data. While great for many things, Excel has limitation related to data analytics. This story aims to demystify the perceived notions around the difficulty associated to data analytics. Focusing on understanding data, and introducing principle elements that data practioners face daily, the hands-on approach will help those looking to improve their analysis abilities beyond using Excel.</p><h3>1.1 Learning Outcomes</h3><p>The story will focus solely on using RStudio, an open source industry leader for data analytics. Specific focus areas will include:</p><ul><li>Importing data</li><li>Explore data</li><li>Working with data</li><li>Performing calculations</li><li>Visualizations</li><li>Next steps in the RStudio journey</li></ul><h3>1.2 Data within RStudio</h3><p>RStudio has the ability to work with a wide range of data types and formats.</p><ul><li>Structured data capabilities within RStudios:</li><li>files (csv, xls, etc.)</li><li>connect to databases</li><li>pull from an application programming interface (API)</li><li>read geospatial data</li></ul><p>Data imported into RStudios is saved as an object in memory, meaning it is not a physical file. In memory objects allow for increase speed during data analysis. The objects are stored within RStudios and can be referenced, manipulated, queried, or visualized at anytime. Assigning data to an object is performed as follows:</p><p><em>object</em> &lt;- <em>source or action</em><br><em>exampleData</em> &lt;- read_csv(“C:/Temp/sourceData.csv”)</p><p>The <strong>&lt;-</strong> operator acts as an assignment, for example “using the source csv file, assign it to the object <em>exampleData</em>”. Within this story additional examples of assigning data to an object will be covered.</p><h3>1.3 Understanding Data</h3><p>RStudio has five (5) main data types:</p><ul><li>character (text, string, etc.)</li><li>complex</li><li>integer (number without decimals)</li><li>logical (boolean)</li><li>numeric (number including those with decimals)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VJFmjSgX8VJopK34N4tUmw.png" /></figure><p>Dates are a special sub type of characters or doubles. The are a number of different date formats that are available within RStudio:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*ImN5GwvbILAX69Fy_GAi5Q.png" /></figure><p>Data analysis methods depend on the the data type. Some analysis methods are not available for different data types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6GuqDDAu-h_Ppxmz_vOqSA.png" /></figure><h3>1.3.1 Tidy Data</h3><p>The concept of tidy data is to provide a consistent organization and structure to data that reduces time required for data cleaning, allowing more time for data analysis. Tidy datasets provide benefit through their structure making the data easier to manipulate, model and visualize. The data arranged such that each variable is a column and each observation is a row.</p><p>There are three interrelated rules which make a dataset tidy:</p><ul><li>each variable must have its own column</li><li>each observation must have its own row</li><li>each value must have its own cell</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fO2ZmATMjoylNLvbXalIiQ.png" /></figure><p>(Tidy information, definitions, and graphics referenced from: <a href="https://r4ds.had.co.nz/tidy-data.html">https://r4ds.had.co.nz/tidy-data.html</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3F8ivB93JaqE-WBjA9At1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VGra2dr7yqEBK10nh0aWZw.png" /></figure><h3>2.0 Setting up the Environment</h3><p>RStudio, similar to other software application, has the capability to extend functionality via add-ins. Within the world of R add-ins are called “packages”. A package is similar to a library in other programming languages (i.e. Python), or extensions in Microsoft Excel.</p><p>As of April 17, 2019 there were 13,802 packages available on the official repository. In order to access a package it must first be installed, which can be done with the following line of code: install.packages(“packageName”) i.e. install.packages(“tidyverse”). Once a package is installed it must be accessed using a command called <em>library</em>. Within the story we will be using three packages: tidyverse, esquisse, and dataexplorer.</p><p><strong><em>tidyverse: </em></strong>The tidyverse is a collection of R packages designed for data science. All packages share an underlying design philosophy, grammar, and data structures. The core tidyverse includes the packages that you’re likely to use in everyday data analyses. As of tidyverse 1.2.0, the following packages are included:</p><ul><li>ggplot2</li><li>dplyr</li><li>tidyr</li><li>readr</li><li>purrr</li><li>tibble</li><li>stringr</li><li>forcats</li></ul><p><strong><em>esquisse:</em></strong> The purpose of this plugin is to let you explore your data quickly to extract the information they hold. You can only create simple plots, you won’t be able to use custom scales and all the power of ggplot2.</p><p>This package allows you to interactively explore your data by visualizing it with the ggplot2 package. It allows you to draw bar graphs, curves, scatter plots, histograms, then export the graph or retrieve the code generating the graph.</p><p><strong><em>DataExplorer</em></strong> Automated data exploration process for analytic tasks and predictive modeling, allowing users to focus on understanding data and extracting insights. The package scans and analyzes each variable, and visualizes them with typical graphical techniques. Common data processing methods are also available to treat and format data.</p><h3>2.1 Packages</h3><p>The following code snippets illustrate how to access packages within RStudio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j23OJ0fn0mwnDqLrsaAubA.png" /></figure><h3>2.2 Import Data</h3><p>The following code snippets illustrate how to import a .CSV file within RStudio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mHsfry7b4LEqUZZvCYJRIQ.png" /></figure><h3>3.0 Explore Data</h3><p>Within analytics one of the first steps once a dataset is imported is to explore the data elements. Data exploration can be performed within a table or through visualization, which will be discussed later in the story. The purpose of exploring the data is to find anomalies or trends within the dataset. The findings from the data exploration exercise will influence data cleaning, model development and the creation of data visualizations.</p><p>There are many different approaches to explore data, and depending on the purpose (i.e. data cleaning, model development, data visualization, etc.) the techniques will differ. A general rule for data exploration is to:</p><ul><li>A: look at the structure and composition of the entire dataset</li><li>B: look are the elements and records in each column</li></ul><p>The following two tables outline techniques for performing data exploration at the dataset and column level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZBxQoUzYqHIgasOk.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uz1KJc50GUxJ7uYe.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lI2Fse4UE_MwbZu1.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SuIMzWAzGLfugpsv.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KXOUeoyGFUz8QOvY.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0YxXN4Y4QF-Q08GX.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8dKXhlGp0tvGEo7D.png" /></figure><h3>4.0 Cleaning Data</h3><p>Importing date information can be converted to different formats (i.e. integer or string) depending on the format that was entered in the data source. Lubridate is a package that is specifically developed to work with date information. In order to take advantage of date analysis functions the information must be stored as a date value.</p><p>Typical data cleaning tasks:</p><ul><li>change mistakes (i.e. spelling)</li><li>changing character cases (i.e. upper case to lower case)</li><li>convert data types (i.e. character to numeric, character to date, etc.)</li><li>identify missing values</li><li>populate missing values</li><li>tidy data (i.e. create multi column from single column — I&amp;T — Networking into two columns — I&amp;T and Networking)</li></ul><p>Performing data quality is a large and varying process, typically requiring multiple steps and processes. In depth data cleaning is out-of-scope of this story, but a common data type conversion will be explored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7o1BEGPh0BYZNf4d.png" /></figure><h3>5.0 Working with Data — Filters</h3><p>When working with data a necessary tasks is to limit the number of records to analyze. A common approach to achieve this is filtering data based on some value, for example “show me only records that are greater than some value”, or “only records that are equal to some value”. When filtering data it is important to remember the data type, as some operators do not work with specific data types. The following table outlines common filtering operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kma2IWpUM5kJ50yJ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*979mKpCFQmAMsbKa.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I2uTF7D5U7o-bNN_.png" /></figure><h3>6.0 Calculations</h3><p>Creating new values is common when working with data; in the data analytics domain it is referred to as “feature engineering”. The creation of new values typically will result in a new column. Mutate is a function in dplyr, which is part of the Tidyverse package, that adds new variables and preserves existing columns. New values can be calculated using a range of operators, such arithmetic operators (+, -, *, /), properties (length, nchar, class), conditional (if_else, recode, case_when), etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FDaW-xLEZTVRFh_7.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9POMzjQtLXqVW8jT.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8eHjwRTu_5QabxuY.png" /></figure><h3>7.0 Visualizations</h3><p>Visualizations are an essential component in data analytics. There are a number of different visualization packages available, however ggplot2, which is part of the Tidyverse package, is the most commonly used visualization package utilized within RStudios. ggplot2 is a powerful package allowing for customized visualization products. ggplot2 uses the “grammer of graphics” syntax, which can be difficult. For this reason the story will use a package called esquisse, which is a drag-and-drop graphical user interface for ggplot2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qrGUuW3C6gWYwpAi.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EWggMDBLOp997WwH.gif" /></figure><h3>8.0 Resources</h3><p>The following links are great resources for transitioning into data analytics using R:</p><p><a href="https://github.com/ryangarnett/rDataLiteracy">Data literacy R notebook example</a></p><p><a href="https://cran.r-project.org/web/packages/esquisse/readme/README.html">esquisse package examples</a></p><p><a href="http://r4ds.had.co.nz/">R for Data Science book</a></p><p><a href="http://moderngraphics11.pbworks.com/f/ggplot2-Book09hWickham.pdf">ggplot2 book</a></p><p><a href="http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/">ggplot2 Colours Cookbook</a></p><p><a href="https://cdn2.hubspot.net/hub/53/file-863940581-pdf/Data_Visualization_101_How_to_Design_Charts_and_Graphs.pdf">Data visualization 101</a></p><p><a href="https://www.rstudio.com/resources/cheatsheets/">RStudio cheat sheets</a></p><p><a href="http://www.jstatsoft.org/v59/i10/paper">Tidy Data paper</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb835269cc3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/towards-data-analytics-data-literacy-in-r-cb835269cc3b">Towards Data Analytics: Data literacy in R</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Towards a Priority Framework for Open Data]]></title>
            <link>https://medium.com/open-data-toronto/original-article-by-ryan-garnett-republished-with-permission-c7b75726833c?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/c7b75726833c</guid>
            <category><![CDATA[open-data]]></category>
            <dc:creator><![CDATA[Open Data - Toronto]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 17:57:29 GMT</pubDate>
            <atom:updated>2020-02-06T18:49:53.772Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@ryan.garnett/towards-a-priority-framework-for-open-data-fe0af33afd9a"><em>Original article by Ryan Garnett</em></a><em>, republished with permission</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yeG9BP_0a0xUp40nJ6fVNQ.jpeg" /></figure><h3>1.0: Purpose</h3><p>The City of Toronto developed an Open Data Master Plan that was unanimously accepted by Toronto City Council on January 31, 2018. The Open Data Master Plan provides strategic direction for the improvement and delivery of the City’s Open Data team. The plan <a href="https://www.toronto.ca/city-government/data-research-maps/open-data/open-data-master-plan/">available here</a> consists of four themes and 13 actions, with one action focusing exclusively on the prioritization of data releases.</p><h3>1.1: Theme 1b –Prioritize Data Releases</h3><p>The prioritization framework, including expected value scores and weighting methodology, will be shared with the public for enhanced visibility into planned open data releases.</p><h3>Where we are</h3><ul><li>Low visibility into release prioritization and publication status reduces transparency</li><li>Corporate data inventory is currently in progress and can be leveraged as a starting point</li><li>Centralized but manual process to request and provide feedback on datasets limits scaling capacity</li><li>Community input on release prioritization not captured via a formal mechanism</li></ul><h3>What we need to do</h3><ul><li>Publish the corporate data inventory with regular refreshes</li><li>Identify the publishing status (i.e. In Review, Restricted, or Open) for each item in the corporate data inventory, with estimated release dates</li><li>Provide a public listing of all open dataset requests</li><li>Identify where open datasets link to strategic initiatives</li><li>Target open data releases around key civic issues</li><li>Publish the prioritization framework, including expected value scores and weighting methodology</li></ul><h3>What we’ll measure</h3><ul><li>Degree to which open data released enables the City to address key civic issues</li><li>Gaps in open data around key civic issues</li><li>Publication of datasets in corporate data inventory</li><li>Alignment between demand for data, data released, and prioritization method</li></ul><h3>2.0: The Framework</h3><p>What is the priority framework? The Open Data team receives numerous requests to publish new data, as well as update existing datasets. Currently data releases and updates are release in the order of the request,prioritizing the date rather than the civic benefit of the dataset.</p><p>While the Open Data team believes that all available data should be made open, the team is focusing on releasing datasets that provide value for the City’s residents, businesses, visitors, and employees. For this the team has developed a prioritization framework to assist with objectively ranking dataset priority according to a set of criteria, consisting of four groups with each group containing different elements:</p><ul><li>Civic Issue</li><li>Requester</li><li>Output</li><li>Source</li></ul><p>The framework will continue to be developed and will evolve over time. It has been designed in a way that allows for elements to be added, modified, or removed, based on feedback and direction from council and the public. Each element and group is assigned a value and weight, which is combined into a calculation, allowing the process to be repeatable and objective.</p><h3>2.1: Civic Issue</h3><p>The Open Data team heard a lot of feedback during the development of the Open Data Master Plan around civic issues and open data publishing. The information gained during the Open Data Master Plan development phases resulted in the identifications of five actions (1b, 2c, 3a, 3b, and 3c) and eight deliveries tied to civic issues. Aligning to strategic initiatives identified by Toronto City Council, the Open Data team has decided on the following five civic issues:</p><ul><li><strong>Affordable housing</strong></li><li><strong>Climate change</strong></li><li><strong>Fiscal responsibility</strong></li><li><strong>Mobility</strong></li><li><strong>Poverty reduction</strong></li></ul><p>Further information on the Open Data civic issue initiative can be found <a href="https://portal0.cf.opendata.inter.sandbox-toronto.ca/civic-issues-initiative/">here</a></p><h3>2.2: Output</h3><p>The release of open data is great, however benefits are only realized through the activation of datasets by providing a beneficial and consumable output. Outputs have been characterized into the following six elements:</p><ul><li><strong>Application development</strong><br>Consists of outputs related to the creation of software applications (i.e. mobile apps, visualizations, or web apps), or commercial business ventures.</li><li><strong>City</strong><br>Consists of outputs related to the creation of city reports, studies or other documents, which can be developed by either internal or external groups.</li><li><strong>Education</strong><br>Consists of outputs related to the development of educational course development at the K-12 (public or private classes), college, or university level.</li><li><strong>Media</strong><br>Consists of outputs related to the delivery of media based products (i.e. newspaper article, blog post, tv/radio interview, etc.).</li><li><strong>Personal</strong><br>Consists of outputs related to actions that primarily have personal benefit (i.e. personal development/learning/interest, hobby, etc.).</li><li><strong>Research</strong><br>Consists of outputs related to the enhancement of academic research projects.</li></ul><h3>2.3: Requester</h3><ul><li><strong>Council</strong></li><li><strong>Decision Support: </strong>Open data has been published to coincide with the release of City initiatives that used data driven approaches to influence a process or policy direction.</li><li><strong>Public</strong></li><li><strong>Other</strong></li></ul><h3>2.4: Source</h3><p>Associated to level of effort…source system connection allows for the utilization of the automated publishing process, resulting in unlocking a wide range of enhanced features on the Open Data Portal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tVEBaeA_sQYZvVVHvAhL3g.png" /><figcaption>Table 1: Priority Element Weight Factor</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_jUoPIlp2QJuSFNkUypQ7A.png" /><figcaption>Table 2: Priority Group Weight Factor</figcaption></figure><p>The input elements and groups are used within an equation that provides a requested dataset priority score, which is used to rank the priority of the request (new or update), allowing for an objective evolution of each request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-oJ0W5NJWLs9cL2RCQQjlQ.png" /><figcaption>Priority Framework Equation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SHD41lqpaQlV4R1PZVNv8w.png" /><figcaption>Table 3: Priority Framework Equation Codes</figcaption></figure><h3>3.0: Test Evaluation of the Framework</h3><h3>3.1: Setting up the Environment in RStudio</h3><pre><strong>library</strong>(tidyverse)</pre><pre>## Warning: package &#39;tidyverse&#39; was built under R version 3.4.4## -- Attaching packages -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tidyverse 1.2.1 --</pre><pre>## v ggplot2 3.1.0       v purrr   0.3.0  <br>## v tibble  2.0.1       v dplyr   0.8.0.1<br>## v tidyr   0.8.2       v stringr 1.3.1  <br>## v readr   1.3.1       v forcats 0.4.0</pre><pre>## Warning: package &#39;ggplot2&#39; was built under R version 3.4.4<br>## Warning: package &#39;tibble&#39; was built under R version 3.4.4<br>## Warning: package &#39;tidyr&#39; was built under R version 3.4.4<br>## Warning: package &#39;readr&#39; was built under R version 3.4.4<br>## Warning: package &#39;purrr&#39; was built under R version 3.4.4<br>## Warning: package &#39;dplyr&#39; was built under R version 3.4.4<br>## Warning: package &#39;stringr&#39; was built under R version 3.4.4<br>## Warning: package &#39;forcats&#39; was built under R version 3.4.4</pre><pre>## -- Conflicts ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tidyverse_conflicts() --</pre><pre>## x dplyr::filter() masks stats::filter()<br>## x dplyr::lag()    masks stats::lag()</pre><pre><em>#Import data</em><br>odpSource &lt;- read_csv(&quot;C:/Temp/openData/OpenDataPriorityFramework.csv&quot;)</pre><pre>## Parsed with column specification:<br>## cols(<br>##   Timestamp = col_character(),<br>##   `Dataset name` = col_character(),<br>##   Division = col_character(),<br>##   `Who is requesting the dataset` = col_character(),<br>##   `Identify the civic issue that the request aligns to` = col_character(),<br>##   `Is there a source system connection` = col_character(),<br>##   `Category of outputs` = col_character()<br>## )</pre><pre><em>#Rename columns</em><br>odpSource &lt;- odpSource %&gt;%<br>  drop_na() %&gt;%<br>  rename(dataset = `Dataset name`) %&gt;%<br>  rename(division = Division) %&gt;%<br>  rename(requestor = `Who is requesting the dataset`) %&gt;%<br>  rename(civicissue = `Identify the civic issue that the request aligns to`) %&gt;%<br>  rename(datasource = `Is there a source system connection`) %&gt;%<br>  rename(output = `Category of outputs`)</pre><pre>odpSource</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1bfdcVdmVI4mgaI6_QqioA.png" /></figure><h3>3.2: Framework Weighting</h3><pre><em>#Framework weight factors</em><br><em>#Requester weight factor</em><br>rWF &lt;- 0.4</pre><pre><em>#Civic issue weight factor</em><br>cWF &lt;- 0.3</pre><pre><em>#Source weight factor</em><br>sWF &lt;- 0.1</pre><pre><em>#Output weight facator</em><br>oWF &lt;- 0.2</pre><pre><em>#Requester variables</em><br>r1 &lt;- 1<br>r2 &lt;- 0.85<br>r3 &lt;- 0.75<br>r4 &lt;- 0.25</pre><pre><em>#Civic issue variables</em><br>c1 &lt;- 1<br>c2 &lt;- 1<br>c3 &lt;- 1<br>c4 &lt;- 1<br>c5 &lt;- 1</pre><pre><em>#Source variables</em><br>s1 &lt;- 1<br>s2 &lt;- 0.25</pre><pre><em>#Output variables</em><br>o1 &lt;- 0.69<br>o2 &lt;- 0.75<br>o3 &lt;- 0.61<br>o4 &lt;- 0.59<br>o5 &lt;- 0.37<br>o6 &lt;- 0.59</pre><h3>4.0: Framework Variables</h3><h3>4.1: Requestors Entries</h3><pre><em>#Clean requestor data</em><br>odpR &lt;- odpSource %&gt;%<br>  select(dataset, requestor)<br>  <br>odpR &lt;- odpR %&gt;%<br>  separate(requestor, into = c(&quot;r1&quot;, &quot;r2&quot;, &quot;r3&quot;, &quot;r4&quot;), sep = &quot;,&quot;)</pre><pre>## Warning: Expected 4 pieces. Missing pieces filled with `NA` in 11 rows [1,<br>## 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].</pre><pre><em>#Convert NA values to 0</em><br>odpR[is.na(odpR)] &lt;- 0</pre><pre><em>#Function to remove trailing whitespace</em><br>cTrim &lt;- <strong>function</strong>(a) {<br>  str_trim(a, side = &quot;both&quot;)<br>}</pre><pre><em>#Run whitespace function of columns 2 to 5</em><br>odpR &lt;- data.frame(lapply(odpR[2:5], cTrim))</pre><pre>odpR</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D1qb41nALemRsAzwIOMLYg.png" /></figure><pre><em>#Prepare for rScore</em><br><em>#Function to recode text to numeric</em><br>cvtRFun &lt;- <strong>function</strong>(R) {<br>  case_when(<br>    R == &quot;Council&quot; ~ r1,<br>    R == &quot;Decision support&quot; ~ r2,<br>    R == &quot;Public&quot; ~ r3,<br>    R == &quot;0&quot; ~ 0,<br>    TRUE ~ r4<br>    )<br>}</pre><pre><em>#Apply convert function on column 2 to 5  </em><br>odpR &lt;- data.frame(lapply(odpR, cvtRFun))</pre><pre><em>#Calculate rScore</em><br>odpR &lt;- odpR %&gt;%<br>  mutate(rScore = r1 + r2 + r3 + r4)<br>odpR</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bRfeHJ_QofH7ntsIAm4qJA.png" /></figure><h3>4.2: Civic Issue Entries</h3><pre><em>#Clean requestor data</em><br>odpC &lt;- odpSource %&gt;%<br>  select(dataset, civicissue)<br>  <br>odpC &lt;- odpC %&gt;%<br>  separate(civicissue, into = c(&quot;c1&quot;, &quot;c2&quot;, &quot;c3&quot;, &quot;c4&quot;, &quot;c5&quot;), sep = &quot;,&quot;)</pre><pre>## Warning: Expected 5 pieces. Missing pieces filled with `NA` in 11 rows [1,<br>## 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].</pre><pre><em>#Convert NA values to 0</em><br>odpC[is.na(odpC)] &lt;- 0</pre><pre><em>#Function to remove trailing whitespace</em><br>cTrim &lt;- <strong>function</strong>(a) {<br>  str_trim(a, side = &quot;both&quot;)<br>}</pre><pre><em>#Run whitespace function of columns 2 to 5</em><br>odpC &lt;- data.frame(lapply(odpC[2:6], cTrim))</pre><pre>odpC</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9dw9o0CXaCLuPdDFDfTiLQ.png" /></figure><pre><em>#Prepare for cScore</em><br><em>#Function to recode text to numeric</em><br>cvtCFun &lt;- <strong>function</strong>(C) {<br>  case_when(<br>    C == &quot;Affordable housing&quot; ~ c1,<br>    C == &quot;Climate change&quot; ~ c2,<br>    C == &quot;Fiscal responsibility&quot; ~ c3,<br>    C == &quot;Mobility&quot; ~ c4,<br>    C == &quot;Poverty reduction&quot; ~ c5,<br>    TRUE ~ 0<br>    )<br>}</pre><pre><em>#Apply convert function on column 2 to 5  </em><br>odpC &lt;- data.frame(lapply(odpC, cvtCFun))</pre><pre><em>#Calculate cScore</em><br>odpC &lt;- odpC %&gt;%<br>  mutate(cScore = c1 + c2 + c3 + c4 + c5)<br>odpC</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fN04kBAJr2fAbKkeCIPHjA.png" /></figure><h3>4.3: Source Entries</h3><pre><em>#Clean requestor data</em><br>odpS &lt;- odpSource %&gt;%<br>  select(dataset, datasource)</pre><pre><em>#Calc sScore</em></pre><pre>odpS &lt;- odpS %&gt;%<br>  mutate(sScore = case_when(<br>    datasource == &quot;Yes&quot; ~ s1,<br>    TRUE ~ s2<br>  ))</pre><pre>odpS</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a095T5MKrhlvmdAfyRnm0Q.png" /></figure><h3>4.4: Output Entries</h3><pre><em>#Clean output data</em><br>odpO &lt;- odpSource %&gt;%<br>  select(dataset, output)</pre><pre>odpO &lt;- odpO %&gt;%<br>  mutate(o1 = str_extract(output, &quot;Application&quot;)) %&gt;%<br>  mutate(o2 = str_extract(output, &quot;City&quot;)) %&gt;%<br>  mutate(o3 = str_extract(output, &quot;Education&quot;)) %&gt;%<br>  mutate(o4 = str_extract(output, &quot;Media&quot;)) %&gt;%<br>  mutate(o5 = str_extract(output, &quot;Personal&quot;)) %&gt;%<br>  mutate(o6 = str_extract(output, &quot;Research&quot;))</pre><pre><em>#Convert NA values to 0</em><br>odpO[is.na(odpO)] &lt;- 0</pre><pre>odpO</pre><pre><em>#Prepare for oScore</em><br><em>#Function to recode text to numeric</em><br>cvtOFun &lt;- <strong>function</strong>(O) {<br>  case_when(<br>    O == &quot;Application&quot; ~ o1,<br>    O == &quot;City&quot; ~ o2,<br>    O == &quot;Education&quot; ~ o3,<br>    O == &quot;Media&quot; ~ o4,<br>    O == &quot;Research&quot; ~ o5,<br>    O == &quot;Personal&quot; ~ o6,<br>    TRUE ~ 0<br>    )<br>}</pre><pre><em>#Apply convert function on column 2 to 5  </em><br>odpO &lt;- data.frame(lapply(odpO[3:8], cvtOFun)</pre><pre><em>#Calculate oScore</em><br>odpO &lt;- odpO %&gt;%<br>  mutate(oScore = o1 + o2 + o3 + o4 + o5 + o6)<br>odpO</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GUGuDhnpOxl_cC-yM2bL4Q.png" /></figure><h3>4.5: Rds Score</h3><pre><em>#Create score dataframe by combining from each of the dataframes</em><br>odpScore &lt;- cbind(odpSource[1:3], rev(odpR)[1], rev(odpC)[1], rev(odpS)[1], rev(odpO)[1])</pre><pre>odRds &lt;- odpScore %&gt;%<br>  mutate(Rds = (rScore * oWF) + (cScore * cWF) + (sScore * sWF) + (oScore * oWF)) %&gt;%<br>  select(Timestamp, dataset, division, Rds)</pre><pre>odpScore</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*du5MQl9nziU7OSe8SvgHzQ.png" /></figure><pre><em>#Theoretical priority values</em><br><em>#Low: 0 - 1.2; Medium: 1.21 - 2.4; High: 2.41 - 3.6</em><br>odRds &lt;- odRds %&gt;%<br>  mutate(priorityT = case_when(<br>    Rds &lt;= 1.15 ~ &quot;Low&quot;,<br>    Rds &gt;= 3.32 ~ &quot;High&quot;,<br>    TRUE ~ &quot;Medium&quot;<br>  )) %&gt;%<br>  arrange(desc(Rds))</pre><pre><em>#Actual priority values</em><br><em>#Low: 0.683 - 1.138; Medium: 1.138 - 1.593; High: 1.593 - 2.049</em><br>odRds &lt;- odRds %&gt;%<br>  mutate(priorityA = case_when(<br>    Rds &lt; 1.138 ~ &quot;Low&quot;,<br>    Rds &gt;= 1.593 ~ &quot;High&quot;,<br>    TRUE ~ &quot;Medium&quot;<br>  )) %&gt;%<br>  arrange(desc(Rds))</pre><pre>odRds</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0JsTWMvag7tQ7qcxlpzeZA.png" /></figure><pre>inner_join(odpScore, odRds) %&gt;%<br>  arrange(desc(Rds))</pre><pre>## Joining, by = c(&quot;Timestamp&quot;, &quot;dataset&quot;, &quot;division&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vk9S5W7vjxGw3GPxBnIEiw.png" /></figure><pre>odRds %&gt;%<br>ggplot() +<br>  aes(x = priorityA) +<br>  geom_bar(fill = &quot;#0c4c8a&quot;) +<br>  labs(title = &quot;Open Data Publishing Priority&quot;,<br>    x = &quot;Priority Classes&quot;,<br>    y = &quot;Count&quot;) +<br>  theme_minimal()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f54uRIIJjA19nOcVy5djGQ.png" /><figcaption>Open Data Publishing Priority Classes</figcaption></figure><pre><em>#Value vs. Effort visualization</em></pre><pre>VE &lt;- odpScore %&gt;%<br>  mutate(vScore = (rScore + cScore + oScore)) %&gt;%<br>  mutate(value = (rScore + cScore + oScore)/max(rScore + cScore + oScore)) %&gt;%<br>  mutate(ease = sScore)</pre><pre>VE$id &lt;- seq(1, 11)</pre><pre>VETimestamp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LSS0ykhNQ3mpvcFUtFsvrA.png" /></figure><pre>ggplot(data = VE) +<br>  aes(x = ease, y = value) +<br>  geom_point(color = &quot;#0c4c8a&quot;, size = 3.5) +<br>  labs(title = &quot;Ease of publishing vs. Dataset Value&quot;,<br>    x = &quot;Ease of publishing (low to high)&quot;,<br>    y = &quot;Dataset value (low to high)&quot;) +<br>    geom_hline(yintercept = 0.5) +<br>    geom_vline(xintercept = 0.5) +<br>    xlim(0, 1) +<br>    ylim(0, 1) +<br>    <em>#geom_text(aes(label = id),hjust = -1, vjust = 0) +</em><br>  theme_minimal()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_PO0Jtsq1kOXhFwAzJPOw.png" /><figcaption>Ease of Publishing (Low to High) vs. Dataset Value (Low to High)</figcaption></figure><h3>5.0 Next Steps</h3><p>The first step of the Open Data priority framework provides a reproducible and objective process for dataset publication. We plan to integrate additional elements to improve the uptake of open data, such as data quality. Additionally the Open Data team intends to publish the prioritized datasets list for public consumption, so that users are aware of what’s coming up.</p><p>The priority framework was developed to be modular, allowing users to adjust weighting factors with changing priorities. The team envisions community members and City staff using the priority framework to proactively assess open datasets to understand where their request fits according to the City’s strategic directions.</p><p>For questions about this data story, please contact the City of Toronto Open Data team via Twitter at <a href="https://medium.com/u/d5621189fcc0?source=post_page-----fe0af33afd9a----------------------">Open Data — Toronto</a>, or through email via <a href="/service/mailto:opendata@toronto.ca">opendata@toronto.ca</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7b75726833c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/original-article-by-ryan-garnett-republished-with-permission-c7b75726833c">Towards a Priority Framework for Open Data</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Toronto Bike Share Ridership using Python]]></title>
            <link>https://medium.com/open-data-toronto/exploring-toronto-bike-share-ridership-using-python-5c0e79fad442?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/5c0e79fad442</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[transportation]]></category>
            <dc:creator><![CDATA[Open Data - Toronto]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 17:34:59 GMT</pubDate>
            <atom:updated>2020-02-06T18:52:06.561Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*MV-gE2jxlJ8EDEClYoCDrg.jpeg" /></figure><p><a href="https://towardsdatascience.com/exploring-toronto-bike-share-ridership-using-python-3dc87d35cb62"><em>Original article by Yizhao Tan</em></a><em>, republished with permission</em></p><p>Over the past few years, Bike Share has become an increasingly attractive way to get around the city. Considering the amount of bike theft in my neighbourhood, Bike Share’s speedy expansion of station coverage, and rising TTC fares, it was an easy decision for me to renew my membership for the third year this March.</p><p>People were making similar decisions in the US as well: <a href="https://www.wired.com/story/americans-falling-in-love-bike-share/">in 2017, cyclists in the US took 35 million trips through a bike-sharing program, a 25% increase from 2016</a>. Meanwhile, Bike Share Toronto saw an <a href="https://www.toronto.ca/legdocs/mmis/2018/pa/bgrd/backgroundfile-121986.pdf">81% ridership increase during the same time period</a>.</p><p>I wanted to explore the Bike Share Ridership dataset to better understand how Torontonians are using Bike Share and to demonstrate some techniques that can be used to explore the other 294 (and counting) datasets released by the <a href="https://www.toronto.ca/city-government/data-research-maps/open-data/">Open Data Program</a>.</p><h3>About the Data</h3><p>Bike Share collects data using systems provided by third-party organizations. The availability of historical ridership data is limited due to a change of provider in 2016. I decided to focus on the data from 2017 instead. The data can be retrieved from the <a href="https://www.toronto.ca/city-government/data-research-maps/open-data/open-data-catalogue/#343faeaa-c920-57d6-6a75-969181b6cbde">Open Data Catalog</a> or from the new <a href="https://portal0.cf.opendata.inter.sandbox-toronto.ca/dataset/bike-share-toronto-ridership-data/">Portal</a> (the new site replacing the Catalog later this year).</p><p>If you would like to follow along the steps I took, the notebooks I used are also available on <a href="https://github.com/open-data-toronto/story-bike-share-ridership">GitHub</a>.</p><p>The data is a ZIP file containing multiple CSVs, separating the yearly data by quarters. An initial review of the Q1 data shows that each record within the data represents a unique trip and contains the following columns:</p><ul><li><strong>trip_id</strong>: unique identifier for each trip</li><li><strong>trip_start_time</strong>: time when the trip started</li><li><strong>trip_stop_time</strong>: time when the trip ended</li><li><strong>trip_duration_seconds</strong>: duration of the trip measured in seconds</li><li><strong>from_station_id</strong>: station ID where the trip started</li><li><strong>from_station_name</strong>: name of the station where the trip started</li><li><strong>to_station_id</strong>: station ID where the trip ended</li><li><strong>to_station_name</strong>: name of the station where the trip ended</li><li><strong>user_type</strong>: identify if the user has a membership or purchased a pass</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mOjJvJ0SPs8P4_5PZd03LA.png" /></figure><p>However, further exploration of the data in the other files reveal a few issues:</p><ol><li>Datetime format varies between files (eg. 31/12/2017 12:30 vs. 12/30/17 12:30:00)</li><li>Only Q1 and Q2 data contain station IDs</li><li>Inconsistent station names (eg. <em>Lake Shore</em> Blvd vs. <em>Lakeshore</em> Blvd)</li><li>Trips with the same start and end stations, suggesting potential data collection errors</li></ol><p>Not ideal, but also fairly common in a typical data analysis project. It’s not unusual for data cleaning to take up to 80% of the time in any analysis. Data from the real world is often messy and it must be cleaned before any analysis or modelling. While data cleaning is tedious and time-consuming, it also has a significant impact on the final result.</p><p>For this analysis, I created a new directory containing the Jupyter notebooks and a data folder containing all the data that I used.</p><h3>Data Cleaning</h3><p>The objective of this step is to consolidate the data from multiple sources into a single <em>pandas </em>DataFrame, containing standardized dates and station information, as well as with the outliers removed. See <a href="https://towardsdatascience.com/the-art-of-cleaning-your-data-b713dbd49726">this article</a> for an in-depth breakdown of common data cleaning steps covering a few more other cases.</p><p>Bike Share exposes <a href="https://tor.publicbikesystem.net/ube/gbfs/v1/">APIs endpoints containing information about their services</a>. The station_information endpoint can be used as the source of truth to resolve inconsistencies between the station IDs and names, and also to enhance the data with additional geospatial information of each station.</p><h3>Standardization</h3><p>First, I imported the required libraries and loaded the station data from the Bike Share API endpoint:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cfe63930023cb02b38f96169bfd78aea/href">https://medium.com/media/cfe63930023cb02b38f96169bfd78aea/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*6W8ow2JuhYLb5vSd7JAKlw.png" /></figure><p>Next, I manually identified the date structure used in each file and concatenate the ridership data into a single DataFrame using the identified structure.</p><p>Also, the data from Q1 and Q2 are in UTC timezone (4 hours ahead) while the data from Q3 and Q4 are in Eastern timezone. This was not immediately obvious and I only realized this issue later on when I visualized the data. Data cleaning is an iterative process, and its almost impossible to catch all the issues on the first pass.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d57d2567763ba69583594172197e891c/href">https://medium.com/media/d57d2567763ba69583594172197e891c/href</a></iframe><p>Next, I needed to resolve the issues with the station IDs and names. To improve efficiency, I extracted the unique combinations of station ID and station name.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c63c3ea91c20b1e8748b92d97af0e092/href">https://medium.com/media/c63c3ea91c20b1e8748b92d97af0e092/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*x8BwDKAy4OuRbeq6_eTlkQ.png" /></figure><p>The stations with IDs can be updated easily from the API data, but the stations without IDs require a slightly more complex solution. Fuzzy matching is a technique used to identify things that are similar (eg. Yonge <em>St.</em> vs Yonge <em>Street</em>). There are many ways to fuzzy match strings in Python and I opted to use the <a href="https://github.com/seatgeek/fuzzywuzzy"><em>fuzzywuzzy</em></a> library.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c2a930be2c90effd7fe9055e50d7229b/href">https://medium.com/media/c2a930be2c90effd7fe9055e50d7229b/href</a></iframe><p>Finally, I concatenated the station data, merged it with the API data to include the stations’ location coordinates, and updated the DataFrame with the correct station IDs and names.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a1b2ca9afcad18e065ad965ae90aa88/href">https://medium.com/media/5a1b2ca9afcad18e065ad965ae90aa88/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4JiP1TjkxqWwWJKjcI_XJw.png" /></figure><p>Conversations with the Toronto Parking Authority (TPA), the city division responsible for managing Bike Share, revealed that the station IDs correspond with the physical terminal rather than the location. If a terminal moves, the API would only show the new coordinates. Therefore, by merging with the API data on the station IDs, there are some trips where the start or end locations are incorrect.</p><h3>Outliers</h3><p>Before removing the outliers, I used the describe() function to see a simple profile of the data within the DataFrame (I excluded all ID columns for a clearer view):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*699zaQH1hzUc2hFfe8SMbg.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48ed417eefeb57e13a96abd45ef380ef/href">https://medium.com/media/48ed417eefeb57e13a96abd45ef380ef/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-HvTFglg_9NjqwNSPKZtHQ.png" /></figure><p>Considering Bike Share’s pricing model, I expected the majority of the trips to have taken less than 30 minutes. But the data showed a trip duration ranging from 1 to 6,382,030 seconds (~74 days), suggesting outliers in the data.</p><p>TPA generally consider trips less than a minute to be false trips in their own analysis. I removed these 29,595 trips, about 2% of the total trips.</p><p>A common statistical method of removing outliers from data is by considering the interquartile range (IQR), the middle 50% of the data. The outliers are defined as the data points that are ±1.5*IQR away from the median. I removed some outliers using this method. See <a href="https://towardsdatascience.com/ways-to-detect-and-remove-the-outliers-404d16608dba">this article</a> for an excellent step-by-step example.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/393c7ca9a34f8166fb7cebc680a11709/href">https://medium.com/media/393c7ca9a34f8166fb7cebc680a11709/href</a></iframe><p>Finally, I saved the cleaned data for later use.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ebb679e3f0507ba24fa834476412e0d/href">https://medium.com/media/1ebb679e3f0507ba24fa834476412e0d/href</a></iframe><h3>Research Question Definitions</h3><p>Before jumping into the analysis, we should define the questions we want to answer by the end of the analysis (or else I often end up creating graphs after graphs that lead to no particular conclusion). We took a fairly informal approach for this analysis:</p><ol><li>Brainstormed a variety of questions related to Bike Share and biking in the city</li><li>Identified whether the questions could be answered by the data available or if they required other external datasets</li><li>Removed questions that can’t be answered due to limited access to data (eg. user information are removed due to privacy reason)</li><li>Grouped the questions remaining into major themes</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvOiuGdsZk5QH9qTQBCUVw.jpeg" /><figcaption>A sample of the questions identified relating to Bike Share and biking in Toronto</figcaption></figure><p>The final major categories we identified were:</p><ul><li><strong>Who</strong> is using Bike Share? Are there distinct differences between members vs. casual users behaviours? If so, what are these differences?</li><li><strong>When</strong> are people using Bike Share? How does usage change across the year, the week, and the day?</li><li><strong>How</strong> is Bike Share being used? Are people mostly using Bike Share as a way to commute to work or to explore the city? How does the weather change the way people use Bike Share?</li></ul><h3>Analysis and Visualization</h3><p>Personally, I prefer to create a new Jupyter notebook for analysis only. In the new notebook, I first imported the libraries and the cleaned data, then created new <em>pandas</em> Categorical datatypes for the day of the week (Monday, Tuesday, etc.) and month names to ensure fixed sorting order (useful when visualizing the data).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5348fdb87b962c55ebc68aeb9ca38767/href">https://medium.com/media/5348fdb87b962c55ebc68aeb9ca38767/href</a></iframe><p>Next, I transformed the data to make analysis and visualizations easier later on. These transformations include:</p><ul><li>Renamed fields for clarity</li><li>Parsed out quarter, month, date, day of the week, and hour from the trip start time</li><li>Generated a new route_id for each trip in the format of “start station ID-end station ID” to identify the route for the trips</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c171b0680c85cf4525779813a40f314/href">https://medium.com/media/2c171b0680c85cf4525779813a40f314/href</a></iframe><p>Next, I also calculated the distance between the start and end stations. This added another dimension that may be helpful later.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a802af1bfffdaa5bfc7963cfa6fb8d82/href">https://medium.com/media/a802af1bfffdaa5bfc7963cfa6fb8d82/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*Zf0pEDG33U0HymdyVpHfWA.png" /></figure><h3>Who is using Bike Share?</h3><p>A common method to answer questions of “who” is to examine the demographic. Initially, it seemed promising to estimate demographic based on the station locations. For example, we might expect that stations located in neighbourhoods with a younger population be more popular.</p><p>However, the majority of the stations are located near subway/streetcar lines and are in the downtown areas. Therefore the results could be skewed towards a specific demographic different from the real representation of the users. Feel free to explore this using the <a href="https://www.toronto.ca/city-government/data-research-maps/open-data/open-data-catalogue/#8c732154-5012-9afe-d0cd-ba3ffc813d5a">Neighborhood Profiles</a> dataset.</p><p>Since I couldn’t reliably infer any user information, I only had the user type (member vs. casual) to work with. I drilled down on the user types and visualized the distribution of trip duration and distance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e82a3488774c9ef7e7340d303058478/href">https://medium.com/media/4e82a3488774c9ef7e7340d303058478/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ho_TN4PeC0mhKey5Z2SbQ.png" /></figure><p>And the graph shows a distinct difference in behaviours between the members and casual users: while both groups generally travel within similar distances, members reach their destinations significantly faster.</p><p>I further broke down the difference in behaviours between these user types by looking at the when and how they are using Bike Share in the next sections.</p><h3>When is Bike Share being used?</h3><p>I aggregated the data by the user type and trip date and counted the number of trips per day.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f1e5f850ec5dd6375d6e5844f58870e/href">https://medium.com/media/2f1e5f850ec5dd6375d6e5844f58870e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*MKWLa6v0gMA5E1rbiekf_w.png" /></figure><p>Then, I visualized the ridership trends across 2017.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/474d782aa75c02ab97decce56c6ec064/href">https://medium.com/media/474d782aa75c02ab97decce56c6ec064/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aqi124VHDA-UkZgBBAgiDQ.png" /></figure><p>While the graph showed some expected trends (eg. more ridership in warmer months), there were also some less expected patterns that emerged:</p><ul><li>A shift in the peak season between members and casual users</li><li>Consistent rise and fall on a small time scale</li></ul><p>I zoomed in and visualized only a few months of the data to get a better view on a more granular level.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0746ba59b646f9909671cd79be1645f/href">https://medium.com/media/c0746ba59b646f9909671cd79be1645f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ROAp77p_Eirsp2HQHAktYg.png" /></figure><p>While the trend is more distinct for July, the graphs showed that ridership increases and decreases on a weekly period. To further tease out this cycle, I visualized the average daily trips for each weekday and separating the data by the quarter and user type.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4373c49debae665ef17841027e93e405/href">https://medium.com/media/4373c49debae665ef17841027e93e405/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o6mC_kqB0C-Yl95hiKqV-g.png" /></figure><p>These graphs further tell the story of how different user types cycle: members primarily bike on weekdays while casual users are mostly biking during the weekends. The only exception was in the third quarter where there was a significant increase in casual trips on Wednesdays. A deeper dive into the data from those months shows that this actually only occurred in July.</p><p><a href="https://gist.github.com/dottyz/3231c70db64d01bdb654b8eaab19ba07#file-story_bike_share_analyze_9-py">https://gist.github.com/dottyz/3231c70db64d01bdb654b8eaab19ba07#file-story_bike_share_analyze_9-py</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J4WiIY_vV6ZYPDc6K_fXZQ.png" /></figure><p>A quick Google searched showed that this was because <a href="https://bikesharetoronto.com/news/mayor-john-tory-bike-share-toronto-roll-free-ride-wednesdays-july/">Bike Share offered free services on Wednesday for July in 2017</a>.</p><p>Finally, I also wanted to take a look at the ridership trend across the day by the hour.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e6791ccc244cfe690268e2b6ddb3fab/href">https://medium.com/media/1e6791ccc244cfe690268e2b6ddb3fab/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AFMaw1wroMpugF23iHbI2A.png" /></figure><p>Again, this graph shows distinct differences in behaviours between members and casual users: members experience rush hours around 8 AM and 5 PM while casual users are much more consistent throughout the day.</p><p>This — combined with previous findings that members primarily use Bike Share over the weekdays — suggests that members usually use Bike Share as a method of commute while casual users are using Bike S<a href="https://towardsdatascience.com/tag/transportation">Transportation</a></p><ul><li><a href="https://towardsdatascience.com/tag/python">Python</a></li><li><a href="https://towardsdatascience.com/tag/data-analysis">Data Analysis</a></li><li><a href="https://towardsdatascience.com/tag/data-science">Data Science</a></li><li><a href="https://towardsdatascience.com/tag/data-visualization">Data Visualization</a></li></ul><p>I took the daily temperature and precipitation data from the <a href="http://climate.weather.gc.ca/historical_data/search_historic_data_e.html">Government of Canada’s weather station data</a> from the Toronto City station.</p><p>First, I merged the ridership data with the weather data and created a pairplot to understand the relationship between the variables on a high level. In addition, I created a heatmap to visualize the Pearson correlation coefficient between the variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*loLbdm4OwZ1oj102c01SpQ.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bc180f1f635a7f008447396d886e20b/href">https://medium.com/media/4bc180f1f635a7f008447396d886e20b/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*VR0po7UVzZoQ7e5tL5fl9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*piFv-82jYCguFwcWBt2IWA.png" /></figure><p>While I was initially surprised at the low correlation between precipitation and ridership, the result makes sense. The data only provides the total precipitation for each day at the specific weather station location. However, it rarely rains a consistent amount throughout the entire day and evenly across all Bike Share stations locations. Since ridership varies depending on the hour, I would need the precipitation data on an hourly level and from multiple weather stations to understand the relationship between these variables.</p><p>Feel free to explore this topic using the <a href="https://www.toronto.ca/city-government/data-research-maps/open-data/open-data-catalogue/#09dee024-b840-174f-7270-29c1a1773d14">rain gauge data</a>, for the rest of this analysis I focused on the temperature instead. I visualized the ridership and temperature across time as a dual axis plot for members and casual users.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1d9d363bf085cf1091cc0d510c11f66/href">https://medium.com/media/f1d9d363bf085cf1091cc0d510c11f66/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z2dLX4MIlLkHE7Vs2mX9fg.png" /></figure><p>The fact that people are biking more in the warmer months is a bit of a “duh..”, so I wanted to go a step further and find the temperature that is the turning point for people to decide whether they will bike or not. I decided to only look at the casual users since they showed a higher correlation with temperature, but the same idea would apply for both user types.</p><p>I had some difficulties when trying to define this point. Intuitively, it seems like there must be a way to determine this mathematically, however, many industries determine this point simply based on empirical observations over time. In the end, a colleague of mine found <a href="https://raghavan.usc.edu//papers/kneedle-simplex11.pdf">this article</a> which suggests a general approach based on the curvature of the plot. It turns out there is already a Python library using this application: <a href="https://github.com/arvkevi/kneed"><em>kneed</em></a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a9e025cc91e28934364cd48a281cb86/href">https://medium.com/media/7a9e025cc91e28934364cd48a281cb86/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IjQaNwq6HH6FcPrnTgFICA.png" /></figure><p>The <em>kneed </em>library requires the data to be curve fitted before determining the point. Given the data, I fitted the data as a linear, exponential without a shift in the Y-axis, and exponential functions and then evaluated the results.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/992d13ecb09c6a15bd1e199fed3b8484/href">https://medium.com/media/992d13ecb09c6a15bd1e199fed3b8484/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwYIiXsPDqSmU26SRC15lA.png" /></figure><p>Only the exponential growth without shift led to a curve where a knee point can be determined (the other 2 curves were too linear). And the result showed that this point is at 16.1 ºC.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5504e331b6c81f023c673139a1f583cc/href">https://medium.com/media/5504e331b6c81f023c673139a1f583cc/href</a></iframe><p>I can double check this value by using percentage cumulative trips (ie. calculating <em>x</em> percent of the trips took place under <em>y</em> ºC), where the curve fit function would be a logistic growth with a maximum limit of 100%. This method showed a point of 16.0 ºC.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99f488728339cd820b0b777f769ce84e/href">https://medium.com/media/99f488728339cd820b0b777f769ce84e/href</a></iframe><p>Using a similar concept, I wanted to find the point where ridership stops growing with increases in temperature. Intuitively, it would make sense for users to stop caring about the temperature once its “warm enough” (eg. the difference between 22 ºC vs. 23 ºC would not be the determining factor for a user to decide if they will bike). To find this point, I simply applied the same calculation to the section of the curve greater than the initial point, and I found that this second point is a 21.6 ºC.</p><p>I would be interested in using this concept on data from a warmer city where the average daily temperature might reach 30+ ºC, and see at what temperature the heat inhibits ridership.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef1505942e7843e97cd03f4df1b99233/href">https://medium.com/media/ef1505942e7843e97cd03f4df1b99233/href</a></iframe><h3>Conclusion and Next Steps</h3><p>While this dataset itself is fairly simple, containing only a few columns of basic information, I was able to determine a number of small insights by merging the data with other public datasets.</p><p>During our conversation with TPA, they mentioned that despite their efforts in presenting Bike Share as the method to travel the “first and last mile”, the general public often sees Bike Share as a program for promoting tourism in Toronto. The behaviours identified in this analysis show that the majority of Bike Share users are, in fact, commuters who bikes on a regular basis.</p><p>While the user information is not publicly available to enable user behaviour analysis, it could be worthwhile to further dive into the geospatial aspects of the Bike Share program. For example, linking the number of TTC/GO stations (or other public centers) to the popularity of Bike Share stations, or further consider the route and availability of bike paths between stations.</p><p>I hope that this data story provides an introduction to data analysis using Python and identifies some tools that you might want to consider when doing your analysis. If you have any questions, feel free to contact the Open Data team at opendata@toronto.ca, and I encourage you to perform your own analysis using Open Data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c0e79fad442" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/exploring-toronto-bike-share-ridership-using-python-5c0e79fad442">Exploring Toronto Bike Share Ridership using Python</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Toronto cleared building permits data]]></title>
            <link>https://medium.com/open-data-toronto/exploring-cleared-building-permits-data-8372a2b225d4?source=rss----52113315e049---4</link>
            <guid isPermaLink="false">https://medium.com/p/8372a2b225d4</guid>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[permits]]></category>
            <category><![CDATA[open-data]]></category>
            <dc:creator><![CDATA[Carlos Hernandez]]></dc:creator>
            <pubDate>Thu, 23 Jan 2020 15:18:05 GMT</pubDate>
            <atom:updated>2020-01-25T10:46:37.256Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DdXBBlOmLzrgl87ELuPv0w.jpeg" /></figure><h4>A visual approach to data analysis</h4><p><em>This is an oldie — first published in </em><a href="https://open.toronto.ca/blog/"><em>the Toronto Open Data portal</em></a><em> on 28/08/2017 before we decided to get on Medium. This was the prototype “data story” concept we have been working on at Open Data.</em></p><p>The City of Toronto publishes data on building permits going as far back as 2000. Excited about this, we at the Open Data Team asked ourselves: how might we learn from <a href="https://open.toronto.ca/dataset/building-permits-cleared-permits-prior-years/">the Cleared Building Permits dataset</a>? Could we use it for improving our understanding of Toronto and how we deliver services to the community? In this data story, we walk through our process and share the materials created, from data preparation to visualization, for you to use as a starting point in your own analysis or to follow along.</p><p>I specifically wanted to limit analysis to visual means because, despite how cool they are, sophisticated analysis tools like machine learning and neural nets are not the answer to every analysis challenge; in this case, the data was small and the nature of what we wanted to find out was more descriptive (i.e. what happened?) rather than predictive (i.e what will happen?) or prescriptive (i.e. how do we make something happen?) in nature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDaUypmJs-1T2ytl9RYqPg.png" /></figure><h3>Background: About the data</h3><p>A building permit is formal permission from the city to begin construction, demolition, addition, or renovation on your property. Permits move through five stages:</p><ol><li><strong>Application:</strong> drawings, documents, and forms depending on the type of permit submitted</li><li><strong>Review:</strong> City Building staff review plans to ensure compliance, applicants may have to revise plan until compliant</li><li><strong>Issue:</strong> Plans are approved and construction can begin</li><li><strong>Inspection:</strong> Toronto Buildings staff inspect the project to ensure adherence with permit submitted, construction is deemed compliant after inspections are completed and passed</li><li><strong>Close:</strong> Applicant contacts the city, inspection results are confirmed, and permit is considered completed</li></ol><p>Permits are considered Active until closed. Both Active and Closed permits are available in the open data catalogue, under separate datasets, however the scope of this story is limited to Closed permits — permits going through the process will not be present.</p><p>Finally, note that in the portal “Closed Permits” are referred to as “Cleared Permits”. The goal is to standardize this in the future.</p><h3>1. Define research questions</h3><blockquote><em>“If you don’t know where you are going you might not get there.”</em><br>– Yogi Berra</blockquote><blockquote>Data analysis projects must begin by defining, at least, one question you hope to answer with the data.</blockquote><p>It is normal to revise these research questions throughout the process, as they they primarily serve as a launch pad from which to begin, but without them it is simple to get caught in an endless cycle of analysis without synthesizing it into a practical application.</p><p>Given their open-ended nature, formulating these questions can be quite difficult. We followed a two-pronged approach consisting of personal interests and the data itself.</p><p>First, initial ideas were derived from the team’s personal interests in Toronto housing-related trends. For instance, questions revolved around types of permits issued, availability of housing over time or place, and how trends compare to the cost of real estate.</p><p>Then, we familiarized ourselves with the data to refine our questions and come up with completely new ones. In-depth understanding of the data was not needed at this stage so, instead, we used the column descriptions available in the portal. This is known as the <em>metadata</em>.</p><p>A better understanding of the metadata helped us determine if the initial questions could be answered by the data and come up with new ideas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zJvcbpSgBpyL0IMuL4W-kg.png" /><figcaption>Here are some example questions derived from the metadata alone</figcaption></figure><p>Essentially, this two-pronged approach enabled us to balance what <em>we want to learn</em> (e.g. personal interests) with what <em>we think we can learn</em> given the data and analysis toolkit (i.e. visualization in this case).</p><p>After this we narrowed scope of analysis the following research questions:</p><ol><li>How has the distribution of permit types issued changed over time?</li><li>Has inspection period length improved over time?</li><li>Has review period length improved over time?</li><li>How has the number of units created changed over time?</li></ol><h3>2. Prepare data for analysis</h3><p>Past experience has taught me that the vast majority of time in analysis projects is spent on <em>preparing</em> data for analysis and this time was no exception. This usually involves tasks such as:</p><p>• <strong>Cleaning</strong>, e.g. identifying and addressing errors in the data<br>• <strong>Reshaping</strong>, e.g. breaking up datasets into multiple datasets<br>• <strong>Transforming</strong>, e.g. calculating number of days from two date fields</p><h4>Consolidation</h4><p>Cleared building permits are available in multiple comma-separated value (.csv) files, one per year from 2000 to 2017 (year to date).</p><figure><a href="https://gist.github.com/careduz/57f04f902c7001880d959a23b341ea40#file-clearedpermits_file_integration-ipynb"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HpAPr1f1y2O8wIj6Lbuvcw.png" /></a><figcaption>These 17 files were consolidated for analysis via a Python script</figcaption></figure><h4>Transformation</h4><p>Work on the dataset beyond file consolidation was necessary to be able to analyze the data. Various issues were addressed during transformation, including but not limited to:</p><ol><li><strong>Ensuring columns contain the correct data types</strong> so math can be performed on numerical fields and time operations on date fields</li><li><strong>Calculating time intervals between dates</strong> to calculate review and inspection periods from the columns</li><li><strong>Sorting permits</strong> to calculate time between permit revisions, which must be calculated by rows</li></ol><figure><a href="https://gist.github.com/careduz/2b1c592b9dee2b7ce93a3d4ed750b698#file-clearedpermits_transformation-ipynb"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhAYkVGwwgTi5UzQXehxKw.png" /></a><figcaption>Data was transformed through another Python script</figcaption></figure><h3>3. Visualize data for exploration</h3><p>Next, visualized the data to explore it and hopefully generate some insight. Although the data could not have been processed raw due to issues like the ones above, data was ready for consumption by data visualization software after the transformations performed in Step #2.</p><p>As mentioned, experts in this dataset revealed to us there are two distinct aspects to the data: permits issued up to 2005 and permits issued after 2005, due to changes to several changes to rules around the data, such as classification. Visualized only the permits issued post-2005 because they are more relevant and because the changes rendered time periods incomparable.</p><p>Created the dashboard in Tableau Public, the free version of Tableau Software’s leading data visualization software, to create an interactive dashboard for “slicing and dicing” data — feel free to explore it yourself below.</p><figure><a href="https://public.tableau.com/profile/carlos.hernandez#!/vizhome/BuildingPermits-SampleExplorationDashboard/BuildingPermits-DataExplorationDashboard"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e6vO_IHgGMIuIlRmujrQnQ.png" /></a><figcaption>An example dashboard created in Tableau, primarily for exploration purposes — to slice and dice the data, guided first by the research questions. Best viewed in full screen.</figcaption></figure><h3>4. Analyze patterns and outliers</h3><p>Data exploration revealed 6. Of these, 4 help answer the research questions posed at the beginning and 2 were observations uncovered while attempting to answer the questions — perhaps not directly related but valuable still.</p><figure><a href="https://public.tableau.com/profile/carlos.hernandez#!/vizhome/BuildingPermits-SampleDataStory/BuildingPermits-ExampleStory"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tlKrF_f3-1Z2p4M_FCSccw.png" /></a><figcaption>Insights reached from visual analysis</figcaption></figure><p>These insights are covered in detail (and I think more engaging) in the visualization dashboard above, but the highlights are below.</p><h4>Question 1: Active permits are needed for an accurate view of permits issued over time</h4><p>An accurate representation of the number of permits issued over time requires active and closed permits. Close permits are underrepresented in more recent years, as the complex ones have not had enough time to close.</p><h4>Question 2: Inspection periods have improved, though closed permits are only part of the picture</h4><p>Since permits can remain active after inspections, looking at closed permits alone paints an incomplete picture. With this in mind, the number of permits issues between 2013–2016 is on average higher than 2006–2013 which points to an overall increase in issuances. However, we would need the active permits to validate this theory.</p><h4>Question 3: Review periods may have improved throughout the years</h4><p>Once again, for a full picture we really need to complement this data with active permits. That being said, a visualization of the distribution of review periods indicates the median may have improved slightly over the years although not evident enough to be particularly certain of it without actual statistical analysis.</p><p>We can see from the visualization that review period durations are closer together in later years, which could mean improvement in terms of greater consistency — essentially, fewer outliers. Again, however, one must look at active permits for a more complete picture because this bias could be baked into data selection: complex permits, requiring longer review periods, are not yet closed in more recent years.</p><h4>Question 4: Dwelling units increased; however, data collection caveats make this visual unreliable</h4><p>Although the number of dwelling units created far outstripped that of number of units lost, this number refers to a net across permits — and, again, it is incomplete without considering the active permits.</p><h4>Bonus Observation 1: Most permits fall in a small number of types</h4><p>After removing common permit types included in more complex permit requests, such as Plumbing and Mechanical and often multiples of each, found that over 80% of permit types in our data are <em>Small Residential Projects, Building Additions/Alterations, and Drain and Site Service</em>.</p><h4>Bonus Observation 2: Spike in <em>Drain and Site Services </em>permits in 2013 are attributed to flooding prevention subsidies</h4><p>There was a four-fold increase in <em>Drain and Site Service</em> permits from 2012 and 2013, which caught my attention for being remarkably outside the norm. Discussions with the Buildings team (and some Googling) revealed an interesting bit of history: <a href="https://www.ctvnews.ca/canada/toronto-battered-by-storm-flooding-thousands-stranded-1.1358719">in 2013 a storm cause massive damage</a> which , in turn, led to the <a href="https://www.toronto.ca/services-payments/water-environment/managing-rain-melted-snow/basement-flooding/basement-flooding-protection-subsidy-program/">Basement Flooding Protection Subsidy Program to help reduce these risks</a>.</p><h3>5. Engage with data owners</h3><p>The next step was chatting with internal subject matter experts to review findings, get clarification on anomalies identified, and uncover other insights. Knowledge sharing from the experts proved essential towards validating the process and findings and providing much-needed context. Indeed, that insight enabled a much deeper understanding of the data and thus a higher quality analysis.</p><p>A great deal was learned from the experts. Although too much to list everything, the major lessons were:</p><ul><li>The relationship between closed and active permits, and why considering both is key for understanding the whole building permits story. Having only one is inherently limiting, primarily because issued permits can remain active for long time periods until the final step is taken by the applicant.</li><li>The relationship between Mechanical and Plumbing permits with other permit types, and how multiple of these can be issued with other permits (a new building, for example, may entail several of these).</li><li>Spike in Drain and Site Service permits in 2013 onwards was due to the floods and the prevention subsidy program</li></ul><p>Every lesson learned enhanced the quality of the analysis. My advice is to always speak with the experts of the data as their knowledge adds an invaluable dimension to an analytics project.</p><h3>Next Steps: Ideas</h3><p>Sometimes analytics projects pose more questions than they answer, maybe because the more you know, the more you realize you <em>don’t</em> know. And to a degree this held true in this case.</p><p>This analysis can certainly be improved in multiple ways and can be taken in many directions. Personally, the most promising of which would be inclusion of Active Permits to the data being analyzed. This will provide a much more holistic picture of permits across the city. Understanding the relationships between various permits types could enable normalization and allow more accurate comparison between them. Finally, joining this data to different datasets would lead to new opportunities for insight — personally, I am interested in exploring what can be learned from mapping permits by address.</p><p>Depending on the team’s priorities around data stories, these enhancements may follow on a Part II. More rewarding for me would be if someone in the community to uses this story as a starting point and builds on it! We invite you to do so and share with us what you find.</p><p>We are always seeking to improve data stories — please share your thoughts on how to make them better. Feedback is welcomed via the comments, <a href="http://opendata@toronto.ca/">email</a> or <a href="https://twitter.com/Open_TO">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8372a2b225d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-data-toronto/exploring-cleared-building-permits-data-8372a2b225d4">Exploring Toronto cleared building permits data</a> was originally published in <a href="https://medium.com/open-data-toronto">Open Data Toronto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>