<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>council &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/council/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Tue, 04 Jul 2017 11:05:02 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>council &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Alexa - what bin day is it?]]></title>
		<link>https://shkspr.mobi/blog/2017/07/alexa-what-bin-day-is-it/</link>
					<comments>https://shkspr.mobi/blog/2017/07/alexa-what-bin-day-is-it/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Tue, 04 Jul 2017 11:05:02 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[alexa]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[council]]></category>
		<category><![CDATA[Open Data]]></category>
		<category><![CDATA[oxford]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=25465</guid>

					<description><![CDATA[Bin day is the most magical time of the week! Children of all ages cry &#34;Which bins is it?! Oh! Which bins?&#34;    Is today recycling day? Or green waste day? Or humble landfill day? Should my food caddy go out? Gosh! Who can keep track?  I mean, obviously I could look at my calendar. Or sign up for free SMS alert. Or use push notifications in their app. But where&#039;s the fun in that?  &#34;Alexa...&#34;   …]]></description>
										<content:encoded><![CDATA[<p>Bin day is the most magical time of the week! Children of all ages cry "Which bins is it?! Oh! Which bins?"</p>

<p><a href="https://www.flickr.com/photos/dave-goodman/3609172860/"><img src="https://shkspr.mobi/blog/wp-content/uploads/2017/07/Row-of-recycling-bins.jpg" alt="Row of recycling bins - photo by  Dave Goodman" width="1024" height="480" class="aligncenter size-full wp-image-25468"></a></p>

<p>Is today recycling day? Or green waste day? Or humble landfill day? Should my food caddy go out? Gosh! Who can keep track?  I mean, obviously I could look at my calendar. Or <a href="https://www.oxford.gov.uk/info/20250/bins/162/bin_collection_reminders">sign up for free SMS alert</a>. Or use push notifications in <a href="https://play.google.com/store/apps/details?id=com.cloud9technologies.oxford">their app</a>. But where's the fun in that?</p>

<p>"<a href="https://amzn.to/2tLmlJ3">Alexa</a>..."</p>

<video width="640" height="360" controls="" src="https://shkspr.mobi/blog/wp-content/uploads/2017/07/Oxford-Bins-97dQbkuQtUM.mp4">

<p>The code I've written uses Oxford City Council's civic data APIs - which will deal with bank holidays and other issues.</p>

<p>I've written before on <a href="https://shkspr.mobi/blog/2017/07/uk-flood-forecast-on-amazon-alexa/">how to build a Flash Briefing skill</a>.  You just need to host a scrap of JSON somewhere. In this case:</p>

<pre><code>{
  "uid": "https://example.com/bins/",
  "updateDate": "2017-07-04T00:00:00+01:00",
  "titleText": "Bins",
  "mainText": "Today's bin collection is Green Refuse Bins and Food Caddies",
  "redirectionUrl": "https://www.oxford.gov.uk/homepage/154/find_your_bin_collection_day"
}
</code></pre>

<h2 id="why-im-not-releasing-this-skill-to-the-public"><a href="https://shkspr.mobi/blog/2017/07/alexa-what-bin-day-is-it/#why-im-not-releasing-this-skill-to-the-public">Why I'm not releasing this skill to the public</a></h2>

<p>There's no <em>official</em> API yet.  I am using some... errr... "borrowed" credentials I found inside the official <a href="https://play.google.com/store/apps/details?id=com.cloud9technologies.oxford">Oxford City Council app</a>.  I'm chatting to someone at the council to see if there's a more official route I can take.</p>

<p><ins datetime="2017-07-05T14:03:52+00:00">Update! I'm delighted to say that there <em>is</em> an <strong>open</strong> API! Details at the end.</ins></p>

<p>Secondly, I'm afraid of handling personal data. The bins API requires a home's UPRN - <a href="https://www.ordnancesurvey.co.uk/about/news/2015/uprn-release-sharing-location-data.html">Unique Property Reference Number</a>.  Most people don't know their number, which means I'd need to integrate address lookup into the system. That would mean I would know which of my neighbours has purchased an Amazon Echo.</p>

<p>I'd also have to store that data, process it, and generally have to comply with data protection laws.  Which is a bit of a faff for a five-minute project.</p>

<h2 id="code"><a href="https://shkspr.mobi/blog/2017/07/alexa-what-bin-day-is-it/#code">Code</a></h2>

<p>If you have access to the API, you can run this PHP code and set up your own Alexa skill.</p>

<p>For postcode to UPRN lookups:</p>

<pre><code>https://apps.cloud9technologies.com/oxford/citizenmobile/openapi/addresses?postcode=OX1%203HZ
</code></pre>

<p>For bin lookups (last value is the UPRN):</p>

<pre><code>https://apps.cloud9technologies.com/oxford/citizenmobile/openapi/wastecollections/200004675068
</code></pre>

<p><strong>WARNING</strong> this really is a scrap of code that I threw together early on a Tuesday morning. No guarantees of style, substance, or efficacy.  Released under the <a href="https://opensource.org/licenses/MIT">MIT License</a></p>

<pre><code>&lt;?php

$wasteURL = "https://apps.cloud9technologies.com/oxford/citizenmobile/openapi/wastecollections/";
$uprn = "";

//  Get the data
$data = file_get_contents($wasteURL . $uprn);

//  Data is in JSON
$json = json_decode($data, true);

//  Strip out unneeded elements
unset($json["WasteCollectionDates"]["UPRN"]);

//  An array to hold the collection information
$collections = array ();

//  Loop through the array
//  Store the data as timestamp=&gt;bins
foreach ($json["WasteCollectionDates"] as $key =&gt; $value) {
    $details =  $value["ContainerDescription"];
    $date = strtotime($value["CollectionDate"]);
    if ($collections[$date] != null)
    {
        //  Multiple bins can be collected each day
        $details = " and " . $details;
    }

    //  Ignore empty elements
    if ($date != null)
    {
        $collections[$date] .= $details;
    }
}

//  Date order the array
ksort($collections);
//  Place pointer at the start of array
reset($collections);

//  The array key is a UNIX timestamp
$first_date = key($collections);
$first_bins = $collections[$first_date];

//  Is the next bin collection today, tomorrow, or further in the future?
//  https://stackoverflow.com/a/25623230/1127699
$today = new DateTime(); // This object represents current date/time

$today-&gt;setTime( 0, 0, 0 ); // reset time part, to prevent partial comparison

//  Get the timezone as the bins API doesn't return it
$timezone = $today-&gt;getTimezone();

//  What is the date of the next bin collection?
$match_date = DateTime::createFromFormat("U", $first_date);
//  Set the timezone based on the local time
$match_date-&gt;setTimezone($timezone);
$match_date-&gt;setTime( 0, 0, 0 ); // reset time part, to prevent partial comparison

$diff = $today-&gt;diff( $match_date );
$diffDays = (integer)$diff-&gt;format( "%R%a" ); // Extract days count in interval

$headline = "";

switch( $diffDays ) {
    case 0:
        $headline = "Today's bin collection is " . $first_bins;
        break;
    case +1:
        $headline = "Tomorrow's bin collection is " . $first_bins;
        break;
    default:
        $headline = "The next bin collection is " . $first_bins . " on ". $match_date-&gt;format('l');
}

//  Set the correct header for JSON data
header('Content-Type: application/json');
?&gt;{
  "uid": "https://example.com/bins/",
  "updateDate": "&lt;?php echo $today-&gt;format(DateTime::ATOM); ?&gt;",
  "titleText": "Bins",
  "mainText": "&lt;?php echo $headline; ?&gt;",
  "redirectionUrl": "https://www.oxford.gov.uk/homepage/154/find_your_bin_collection_day"
}
</code></pre>

<h2 id="thanks"><a href="https://shkspr.mobi/blog/2017/07/alexa-what-bin-day-is-it/#thanks">Thanks!</a></h2>

<p>If you've enjoyed this post, please leave a comment or you can <a href="https://www.amazon.co.uk/gp/registry/wishlist/ref=cm_wl_search_1?ie=UTF8&amp;cid=A327FR3Q472EBX&amp;tag=shksprblogwish-21">get me something from my Amazon wishlist</a></p>
</video><img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=25465&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2017/07/alexa-what-bin-day-is-it/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Why You Should Make Your QR Codes Unique]]></title>
		<link>https://shkspr.mobi/blog/2012/12/why-you-should-make-your-qr-codes-unique/</link>
					<comments>https://shkspr.mobi/blog/2012/12/why-you-should-make-your-qr-codes-unique/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Tue, 18 Dec 2012 12:00:50 +0000</pubDate>
				<category><![CDATA[qr]]></category>
		<category><![CDATA[council]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[QR Codes]]></category>
		<category><![CDATA[statistics]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=7033</guid>

					<description><![CDATA[Wandering around the steets of London, I came across this excellent initiative from Camden Council on how to use QR codes on street furniture.  If you see that a light - or anything else - is damaged, you can scan the QR code and report the issue.  There&#039;s even a phone number and vanilla URL for those who aren&#039;t quite up to speed with new technology.   There&#039;s only one slight issue - the QR code…]]></description>
										<content:encoded><![CDATA[<p>Wandering around the steets of London, I came across this excellent initiative from Camden Council on how to use QR codes on street furniture.</p>

<p>If you see that a light - or anything else - is damaged, you can scan the QR code and report the issue.  There's even a phone number and vanilla URL for those who aren't quite up to speed with new technology.
<img src="https://shkspr.mobi/blog/wp-content/uploads/2012/12/2012-11-08-15.52.29-768x1024.jpg" alt="QR Code Lamp-Post" width="768" height="1024" class="aligncenter size-large wp-image-7034"></p>

<p>There's only one slight issue - the QR code points to this site.
<img src="https://shkspr.mobi/blog/wp-content/uploads/2012/12/2012-11-08-15.53.40-576x1024.png" alt="Reporting Form" width="384" height="682" class="aligncenter size-large wp-image-7035"></p>

<p>The fact that the landing page isn't mobile friendly is bad enough, but what's worse is that they completely fail to take advantage of sending the user to a precise URL.</p>

<p>What <strong>should</strong> happen is that the URL should be something like</p>

<pre>http://qr.camden.gov.uk/light/22</pre>

<p>There are two solid reasons for doing this.</p>

<ol>
    <li>It saves the user time - take them directly to where they need to go.</li>
    <li>You can track where users are scanning your codes.</li>
</ol>

<p>QR codes are <a href="https://github.com/edent/QR-Generator-PHP">free to generate</a>, and cheap to print.  You don't need to be stuck in the old way of thinking about how you link the physical world to the digital world.</p>

<p>Imagine if, after scanning, the user was told "You're reporting street light 22 (Bedford Square) as broken. Click here to confirm."
And then, perhaps, on the next page "We'd like to stay in touch with you - please enter your details here." which could even be a Facebook / Twitter login.</p>

<p>As the owner of the QR, you can see exactly where and when people are scanning - at the moment, all the council knows is that <em>one</em> of the thousands of QR codes was scanned, but not <em>which</em> one.</p>

<p>It also means that users don't have to fiddle around on their phone's screen too much in order to report a problem.  At the moment, they have to navigate through a complex site, fill in a form, and then hope they remembered which number street lamp was busted.</p>

<p>It could be as simple as scan - click - done.  A win for users, and a nice set of analytics to monitor.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=7033&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2012/12/why-you-should-make-your-qr-codes-unique/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
