<?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[Stories by Basile Simon on Medium]]></title>
        <description><![CDATA[Stories by Basile Simon on Medium]]></description>
        <link>https://medium.com/@basilesimon?source=rss-2a1ea80539bd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*WvPmuQgZb678nAh0.jpg</url>
            <title>Stories by Basile Simon on Medium</title>
            <link>https://medium.com/@basilesimon?source=rss-2a1ea80539bd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 03:16:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@basilesimon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The best of the Times Interactive team]]></title>
            <link>https://medium.com/digital-times/the-best-of-the-times-interactive-team-53c5ed962065?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/53c5ed962065</guid>
            <category><![CDATA[interactive]]></category>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[journalism]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Mon, 30 Jul 2018 16:58:14 GMT</pubDate>
            <atom:updated>2021-02-09T16:10:09.030Z</atom:updated>
            <content:encoded><![CDATA[<p><em>View our best of 2020 page </em><a href="https://medium.com/digital-times/the-best-of-the-times-and-the-sunday-times-data-and-digital-storytelling-team-404546a81324"><em>here</em></a><em> and our best of 2021 page </em><a href="https://medium.com/digital-times/the-best-of-the-times-and-the-sunday-times-data-and-digital-storytelling-team-2021-ea905cacbe06"><em>here</em></a></p><p>While we try to get a coveted thetimes.co.uk/interactives spot, here is a selection of our favourite bespoke projects, involving several that have involved collaboration with the rest of the newsroom and wider Digital team.</p><h3>The election in one room</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1qzvldJRxfQ6AWkaMm7n6w.png" /><figcaption><a href="https://www.thetimes.co.uk/article/meet-the-100-people-who-will-decide-the-election-xgvdn86q2">Meet the 100 people who will decide the election</a></figcaption></figure><p>In the largest election focus group attempted, The Times in conjunction with the opinion research company Public First assembled 100 undecided voters from marginal constituencies in England and Wales, and listened to them talk about the issues that most affected them, moved them, and irritated them. These were a cross-section of the population, mixed by age, race, gender, past voting patterns and political inclination, who would decide the outcome on December 12th: The Election in One Room.</p><h3>GPs investigation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*xLg5ToFmgTEXlJPbhkC0KQ.gif" /><figcaption><a href="https://www.thetimes.co.uk/edition/news/gp-crisis-nhs-shortages-mean-one-doctor-has-to-care-for-11-000-patients-v25nt2cdl">GP crisis: NHS shortages mean one doctor has to care for 11,000 patients</a></figcaption></figure><p>The interactive team helped to lead an investigation into the GP crisis in the UK. Using a mixture of open-source data and responses from Freedom of Information requests, we revealed that NHS shortages meant one GP was left caring for 11,000 patients at a single surgery, while the average GP has 200 more patients than they did four years ago. We also created a look-up so readers could see how their Clinical Commissioning Group had performed compared with the national average.</p><h3>General Election 2019</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ZBYHDCPfvES2A-vM1Hv_g.png" /><figcaption><a href="https://www.thetimes.co.uk/article/general-election-2019-results-live-uk-result-in-full-zwf0dcftd">General Election 2019 full results</a></figcaption></figure><p>The interactive team was heavily involved in the Times’ and the Sunday Times’ political coverage before, during and after the election. Below is a snapshot of some of the content we are most proud of.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*EYIOkNSwzNt-fcFNz4mLRQ.gif" /><figcaption><a href="https://www.thetimes.co.uk/edition/news/elections-results-mapped-60-seats-that-always-back-the-winner-l3zjqjlb9">Election results mapped: 63 seats that always back the winner</a></figcaption></figure><p><a href="https://www.thetimes.co.uk/edition/news/elections-results-mapped-60-seats-that-always-back-the-winner-l3zjqjlb9"><strong>Tree-ring map</strong></a> Working with Josh Rayman, we created one election map to rule them all. Named the tree-ring map, it displayed the results of the last five general elections all on one viz. It was a great way of highlighting Tony Blair’s impact in traditional Tory seats in 2005 and, given the Conservative’s success in the northern Labour heartlands in 2019, was equally striking this time around.</p><p><a href="https://www.thetimes.co.uk/article/election-turnout-britains-most-politically-engaged-seats-revealed-tqbq75f6w"><strong>Turnout</strong></a> We analysed every election since 1918 to reveal Britain’s most and least engaged constituencies. This was a mammoth undertaking, involving weighted averages, more than 600 constituencies, plenty of boundary changes and 27 elections. You can use our postcode look-up to see how turnout in your area compares with the national average.</p><p><a href="https://www.thetimes.co.uk/article/tactical-voting-guide-who-should-i-back-in-the-general-election-53z9klrbw"><strong>Tactical voting</strong></a> One of the big questions in the run-up to the election was whether tactical voting by Remain or alliances would have an impact. We worked with The Sunday Times to create our own comprehensive guide, using YouGov’s constituency-level MRP survey to give readers bespoke results for their constituency based on six questions.</p><p><a href="https://www.thetimes.co.uk/article/general-election-2019-results-live-uk-result-in-full-zwf0dcftd"><strong>Election results page</strong></a> On the big night we launched a live page which gave readers national and constituency-level results as they came in. For the first time ever, this ran in our mobile app and was featured on our home page. The page updated every 30 seconds with data from the Press Association.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8GhR47ragGfKsHvNyrvPQ.png" /><figcaption><a href="https://www.thetimes.co.uk/edition/news/uk-general-election-results-2019-maps-charts-k6xx25xx9">UK election results in maps and charts</a></figcaption></figure><p><a href="https://www.thetimes.co.uk/edition/news/uk-general-election-results-2019-maps-charts-k6xx25xx9"><strong>The result in charts and maps</strong></a> When people were waking up to the news of a massive Tory majority we were already busy working on our Election results in charts and maps analysis piece. With a host of graphics almost entirely produced in R, we attempted to make sense of the result and explain the new political landscape.</p><h3>What does Boris Johnson really think?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1IgoLcZzTnaaog7Ts-UzzA.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/reading-boris-johnsons-mind-unique-analysis-reveals-what-the-pm-really-thinks-00jqvn9lq">Reading Boris Johnson’s mind: unique analysis reveals what the PM really thinks</a></figcaption></figure><p>We analysed more than 350,000 words written in Telegraph columns over 15 years in an attempt to understand what Boris Johnson obsesses over.</p><p>Using IBM Watson’s natural language understanding API, we pulled out the key topics the prime minister has discussed most in his column over the years. We also analysed the sentiment that the PM expresses when writing about certain people, places or words. Our findings show that he discusses the Queen with the most joy, Labour with the most sadness, the police with the most fear and the Lib Dems with the most disgust.</p><p>Using the vast amount of data we collected, we trained a neural network to output our own Boris Johnson column, and used this to create a game to see if you can tell if a sentence was written by Boris, or by our bot.</p><h3>Food Standards</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JFWO61l1I0TNpB9WdgajqA.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/food-hygiene-ratings-check-your-local-restaurants-grdvfl83s">Food hygiene ratings: check your local restaurants</a></figcaption></figure><p>An investigation by the interactive team revealed that 15,000 restaurants in the United Kingdom — or one in 20 — are failing according to the Food Standard Agency (FSA) rating system.</p><p>That means they operate with a zero, one or two star hygiene rating out of five. The FSA say every restaurant should be capable of scoring five.</p><p>We downloaded the scores for half a million british businesses from the FSA website and built a searchable tool to allow consumers to check a restaurant’s score before they eat at or order from the establishment.</p><p>We also matched the data to restaurants hosted by three biggest takeaway companies in the country, revealing that 4,000 failing establishments are hosted by Deliveroo, one in eight takeaways on Just Eat are in need of improvement and 30 from a sample of 500 restaurants on Uber Eats scored lower than permitted.</p><h3>North Korea investigation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*T2UFFbK0ouQo_Qa1LK9YUA.gif" /><figcaption><a href="https://www.thetimes.co.uk/edition/news/british-owned-ships-smuggle-coal-out-of-north-korea-jn0fnsprh">British-owned ships smuggle coal out of North Korea</a></figcaption></figure><p>We worked with our defence correspondent Lucy Fisher on her investigation into British-owned ships smuggling coal out of North Korea.</p><p>We built a number of bespoke graphics to help tell the story and created a scroll-driven map showing the journey of the Lucky Star Vessel around the Korean peninsula.</p><h3><strong>Moon landing</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJVfRDELyaUopxXmPmgEGA.gif" /><figcaption><a href="https://www.thetimes.co.uk/edition/news/what-could-have-gone-wrong-with-the-apollo-11-moon-landing-9c3k6xj7p">What could have gone wrong with the Apollo 11 mission</a></figcaption></figure><p>As part of the Times coverage of the 50th anniversary of the moon landing the interactive team looked at <a href="https://www.thetimes.co.uk/edition/news/what-could-have-gone-wrong-with-the-apollo-11-moon-landing-9c3k6xj7p">what could have gone wrong with the Apollo 11 mission</a>.</p><p>From touching down on the moon with just 25 seconds of fuel remaining to Buzz Aldrin replacing a broken switch with a pen, the crew relied on an extraordinary level of mathematics, rigorous testing and above all good fortune against the unforgiving realities of manned spaceflight.</p><p>To create the project we worked closely with the design department to create a visually-rich piece, including animated SVGs which helped explain the various parts of the first and only mission to put man on the moon.</p><h3><strong>Britain’s “slums of the future”</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qyNmJ1eXUdjxOVDL0xlafQ.png" /><figcaption><a href="https://www.thetimes.co.uk/edition/news/landlords-make-millions-from-flats-the-size-of-a-parking-space-nm5tw72ss">Landlords make millions from flats the size of a parking space</a></figcaption></figure><p>A <a href="https://www.thetimes.co.uk/edition/news/landlords-make-millions-from-flats-the-size-of-a-parking-space-nm5tw72ss">Times investigation</a> revealed that housing developers have been exploiting a change in planning rules to convert offices into hundreds of flats, some as small as 14 square meters (150 sq ft). We used floor-plans from planning documents combined with official government regulations to illustrate just how small these new studios are.</p><h3><strong>Bivariate Map</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d7C7hcwmIHQJgvB7GoR92Q.png" /><figcaption><a href="https://www.thetimes.co.uk/edition/news/next-pm-urged-to-help-the-low-skilled-hgwqzdcbw">Next PM urged to help low‑skilled workers</a></figcaption></figure><p>We worked with Red Box editor Matt Chorley and the Tory modernising think tank Onward to create a bivariate map highlighting the correlation between places that voted Leave in the EU referendum and areas vulnerable to job automation.</p><p>By combining data from the 2011 census with industrial statistics and probabilities of automation compiled by the ONS, we revealed that 48 of the 50 areas most at risk of job automation voted to leave in the 2016 referendum and 42 of the 50 areas least at risk voted remain.</p><h3><strong>Could you be a tennis line umpire?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E8QahuiBnldw6vJpRfRcNA.png" /><figcaption><a href="http://thetimes.co.uk/tennislinejudge">Could you be a tennis line judge?</a></figcaption></figure><p>Could you be a tennis line judge? The latest in our series of our sports games places the reader at the heart of the action on Centre court, using a collection of close tennis line calls to see if they can decide whether the ball is in or out.</p><h3><strong>Could you be the speaker in the House of Commons?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UbOhwjI0doFb0_0dqypiWQ.png" /><figcaption><a href="https://www.thetimes.co.uk/article/could-you-be-speaker-house-of-commons-bercow-xck6lxv98">Could you be the speaker in the House of Commons?</a></figcaption></figure><p>To mark the 10 year anniversary of John Bercow’s time as Speaker we asked the Times’s brilliant cartoonist Morten Morland to animate a series of scenarios from the Erskine May to see if readers could tell what is allowed and not allowed in the House of Commons.</p><p>How did readers get on? Everybody who played it got at least one question right — <a href="https://twitter.com/jacob_rees_mogg/status/1140549159763816449?s=12">including Jacob Rees-Mogg</a> — but just three per cent of players scored 10/10.The second question was the hardest, with only 25 per cent of readers correctly judging whether or not you can wear hats in the Commons (play the game yourself to find out the answer to that one).</p><h3>Air pollution</h3><p>The Interactive team was at the forefront of the Times’ #CleanAirForAll campaign, with multiple bespoke projects featured in our coverage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*IKx7whOB5hRASvImyjkXZQ.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/london-air-pollution-mapped-how-does-your-childs-school-compare-nqxbbm8nl">London air pollution mapped: how does your child’s school compare?</a></figcaption></figure><p>Our schools analysis led our reporting and featured on the front page for the first day of the campaign. To calculate the London schools air pollution database, we combined 20m by 20m pollution data with the shape files for every school in the capital to create a ‘score’ for each school. The results revealed that every school in London breached the WHO daily guideline of 10ug/m³. More than half of the 3,200 schools in our database were searched at least once in the interactive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g894yafaPQnPpCeQjopCHg.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/air-pollution-postcode-checker-what-is-the-level-near-me-2rkvd0pt3">Air pollution postcode checker: What is the level near me?</a></figcaption></figure><p>With our national dashboard we set out to answer the following question: how bad is the air you breathe? Using government estimates of particulate pollution for every square kilometre in Great Britain we were able to match postcodes to pollution levels, enabling readers to see how their neighbourhood compares to the rest of the country. The dashboard contextualises the results by converting them into the equivalent number of cigarettes. We also return a recommendation for where a reader could move to find cleaner air.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5MFy5LtHWPck5eiXpnO-GA.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/how-to-solve-air-pollution-uk-crisis-campaign-solutions-63xschxdc">How do we make the air in our cities breathable?</a></figcaption></figure><p>After exploring air pollution levels in Britain our attention turned to solutions. Air quality is at its worst in cities so we looked at how urban areas could adapt, setting out to answer the question: how do we make the air in our cities breathable? We looked at the scale of the problem in London before analysing how other European cities had been transformed, finally rebuilding Marylebone road with the emphasis on clean air.</p><h3>Estate agent investigation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*Pk-swmDtp0no--dKRCmjdQ.gif" /><figcaption><a href="https://www.thetimes.co.uk/edition/news/which-estate-agent-slashes-the-price-of-homes-by-the-most-in-your-area-3gh02f070">Which estate agents overvalue properties the most in your area?</a></figcaption></figure><p>An investigation by the interactive team analysed more than 200,000 property listings and found that some of the country’s biggest estate agents are overvaluing homes by tens of thousands of pounds.</p><p>Readers were able to find out which agents had the biggest price reductions in their area using our postcode lookup.</p><h3><strong>US government shutdown</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xh561lo7iEZYdDHV" /><figcaption><a href="https://www.thetimes.co.uk/article/snubbed-trump-calls-off-state-of-the-union-address-wlbh2rzpt">Trump’s state of the union address called off over shutdown</a></figcaption></figure><p>Our government shutdown chart was in high demand and featured for both <a href="https://www.thetimes.co.uk/article/snubbed-trump-calls-off-state-of-the-union-address-wlbh2rzpt">The Times</a> and <a href="https://www.thetimes.co.uk/article/overflowing-bins-give-bears-a-banquet-in-us-shutdown-mg0d3c8d8">the Sunday Times</a>. We continuously updated it throughout the shutdown, which became the longest in US history, resulting in a lot of updating of scales and tweaking of words.</p><h3><strong>How many crimes were committed in your neighbourhood?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uC9wA7pOsagf8pmEq6Vy-g.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/how-many-crimes-were-committed-in-your-neighbourhood-vb7dw5npp">How many crimes were committed in your neighbourhood?</a></figcaption></figure><p>We tweaked and re-ran our <a href="https://t.co/FiG9Dzht5i">police data postcode lookup</a>, this time focusing on violent crimes and sexual offences in the neighbourhoods you care about.</p><p>To do this we downloaded three years worth of street-level police data and grouped it by lower super output area and local authority. We took the total number of violent crimes in 2018 and used mid-year population estimates to calculate violent crime rates which we visualised with a barcode chart.</p><h3><strong>Tax haven billionaires</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*7LzyACeLrY3R60ei" /><figcaption><a href="https://www.thetimes.co.uk/article/a-third-of-british-billionaires-have-moved-to-a-tax-haven-zk6q53rtd">Tax investigation: A third of British billionaires have moved to a tax haven</a></figcaption></figure><p>The interactive team were at the heart of the tax investigation which revealed that a third of British billionaires have moved to tax havens. We built a tool allowing readers to discover more information about the 28 billionaires featured in the investigation, with readers able to sort the data by location and industry.</p><p>We also worked with the data team to create a map revealing the vast swathes of land in England and Wales controlled by billionaires living abroad: 8,000 plots covering 120,000 acres, including airports and Premier League stadiums. This became the centrepiece of the Times coverage on day three of the investigation, running both digitally and across a double-page spread in the paper.</p><h3><strong>The people vs the Oscars</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pIsOrmFBX1di_jIV" /><figcaption><a href="https://www.thetimes.co.uk/edition/culture/the-people-v-the-oscars-502qlbl6d">The people vs the Oscars</a></figcaption></figure><p>What do cinema lovers think of <a href="https://www.thetimes.co.uk/article/the-oscar-for-best-picture-goes-to-the-arty-one-that-nobody-saw-x6fkz7v6n">Bafta and Oscar nominations for best picture</a>? To find out, we looked at millions of ratings on the movie website IMDb for hundreds of films over the past 50 years. We also ran this in stories about the <a href="https://www.thetimes.co.uk/article/the-oscar-for-best-picture-goes-to-the-arty-one-that-nobody-saw-x6fkz7v6n">Bafta best-picture award</a> the following week.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jXCD6RCcisjWMAN2" /><figcaption><a href="https://medium.com/digital-times/tackling-brexit-diary-of-an-interactive-journalist-4520d02c416d?source=collection_home---4------0---------------------">Read more about how we’ve tackled Brexit</a></figcaption></figure><h3><strong>Brexit vote(s)</strong></h3><p>We built a reusable Brexit vote interactive that allowed readers to see the overall result for each amendment but also how their MP had voted. It has become particularly useful given the number of votes that have taken place so far this year. The interactive has been placed in all relevant stories, and due to their popularity the charts have had great exposure with a really engaged audience. For the vote of no-confidence, 21% of users searched for an MP — a great percentage given that it is a secondary function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*NS4MkN8dINmRtNUK" /><figcaption><a href="https://www.thetimes.co.uk/edition/sport/january-transfer-window-track-every-premier-league-signing-and-sale-strklzw2s">January transfer window: every Premier League signing and sale</a></figcaption></figure><h3>January transfer window</h3><p>Our January transfer window interactive could be tailored to any football club, giving the sports desk the ability to default the interactive to a specific club depending on the story. Reading an article about <a href="https://www.thetimes.co.uk/article/how-mauricio-pochettino-will-reach-decision-over-whether-to-leave-spurs-for-manchester-united-ztzk5k7gp">Mauricio Pochettino being linked with Manchester United</a>? Let’s default our interactive in the piece to Tottenham so you can see just how little money they’ve spent over the past few years…</p><h3>The Brexit flowchart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*clABj0QdsDHTawmAM0JE4w.png" /><figcaption><a href="https://www.thetimes.co.uk/article/brexit-vote-what-happens-if-theresa-may-loses-deal-h6lldrhvk">Find out what will happen to May’s deal</a></figcaption></figure><p>From a drawing on the back of an envelope to a double-page spread and a full interactive flowchart, we brought to life Henry Zeffman’s explanation of what could happen to Brexit and Theresa May ahead of the December 11 vote on her deal.</p><h3>Armistice centenary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*os1gBJhObJdrkoB1ZoEcqQ.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/armistice-end-first-world-war-ww1-psnx52d2k">How The Times reported the Armistice</a></figcaption></figure><p>The Times and Sunday Times’s coverage of Armistice was months in the making and a cross-title mobilisation of resources on a huge scale. Our standout digital projects made the most of our archive and included an annotated version of The Times newspaper published on November 12 1918, the <a href="https://www.thetimes.co.uk/article/armistice-images-bloom-in-glorious-colour-7d29nwpms">colourising of black and white photos of celebrations</a> around the country and the <a href="https://www.thetimes.co.uk/article/armistice-day-remembrance-how-the-first-world-war-was-won-the-hundred-days-offensive-mapped-9xnsqpgwl">retelling of the Hundred Days Offensive using maps published 100 years ago</a>.</p><h3>Storm Florence</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bfyp7XKF4BEi9qhzeJHYfw.png" /><figcaption>Read our explainer on <a href="https://www.thetimes.co.uk/article/4dc81bbc-b5cc-11e8-9605-b6ff09b482a1">Hurricane Florence</a></figcaption></figure><p>Plenty of maps, updated twice a day, as Florence made its way to the east cost of the United States.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*jjRhQxg_7ZazIx1BBEypxg.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/half-of-divorced-women-happier-without-a-man-57pm366hs">Half of divorced women happier without a man</a></figcaption></figure><h3>Divorce survey</h3><p>Our first collaboration with the Sunday Times Style section, and another two-day project aiming at making of a few of the piece’s top lines more personal.</p><h3>NHS at 70</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N6r1PP5_UgmPJXeRTIEKDw.png" /><figcaption>Read <a href="https://www.thetimes.co.uk/article/nhs-at-70-your-memories-of-the-national-health-service-xg5rlh56n">Your memories of the NHS</a></figcaption></figure><p>The NHS celebrated its 70th anniversary in July 2018. We celebrated the UK’s love/hate relationship with the institution with two bespoke projects.</p><p>We set up a phone voicemail for our readers to share their stories of the NHS. We picked the most interesting stories and built a bespoke storytelling template with a scrolling audio player to bring them to life.</p><h3>How does my hospital compare?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vlfem-nGPNqThxSNcxyZlQ.gif" /><figcaption>See <a href="https://www.thetimes.co.uk/article/nhs-at-70-how-your-hospital-experience-compares-hn20kd6nq">How your hospital compares</a></figcaption></figure><p>After weeks of research and compiling data, we built a page for readers to compare <em>their</em> hospital and NHS trust to the rest of the country.</p><h3>Unsolved crimes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*Gf1r9chs_mFMJQZf3VhKpA.gif" /><figcaption>Read <a href="https://www.thetimes.co.uk/article/sunday-times-crime-map-how-many-offences-go-unsolved-where-you-live-8qhkqz9ks">How many crimes go unsolved in your local authority</a></figcaption></figure><p>This Sunday Times splash about poor police performance was a result of a collaboration with the data team – and we got our postcode searcher out of the cupboard, packing a mapping of LSOA results and a comparison with the whole of the country.</p><h3>LBW or not?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W20wtQq4eQT57KPq6PzbVA.png" /><figcaption>Play <a href="https://www.thetimes.co.uk/article/cricket-umpire-lbw-game-tg06rcv7s">Could you be a cricket umpire?</a></figcaption></figure><p>The latest in our series of news-games! This time, our readers are placed in the boots of a cricket umpire and have to decide if a batsman should be given out LBW.</p><p>A continuation on the theme of sports games we started last year with our <em>offside or not</em> assistant referee simulator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*sU8XmraSJZIvG1gLeicuqg.png" /><figcaption>Read <a href="https://www.thetimes.co.uk/article/child-slave-gangs-go-free-as-police-fail-to-investigate-sgjs8n2qc">Child slave gangs go free</a></figcaption></figure><h3>Modern slavery</h3><p>A prime example of a quick-turnaround bespoke project, putting your guess of how many slaves there are in Britain against official estimates — and other readers’ guesses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*Jkkogj_bWbLmnRO-THSXUQ.png" /><figcaption>Read <a href="https://www.thetimes.co.uk/article/italian-election-2018-polls-latest-who-will-win-the-italian-election-and-could-berlusconi-end-up-the-kingmaker-53t006k9r">our pre-coverage of the Italian election</a></figcaption></figure><h3>Italy votes</h3><p>Silvio Berlusconi’s return to Italian politics led to a lot of interest in the March 2018 election.</p><p>We produced a comprehensive and visual pre-coverage, as well as a <a href="https://www.thetimes.co.uk/article/italian-election-2018-results-and-analysis-xpddmqprl">detailed analysis</a> comparing demographic factors with the populist part Five Star Movement’s results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYR79Xm49XUwwchals-ZTw.png" /><figcaption>Read about <a href="https://www.thetimes.co.uk/edition/news/trump-and-his-twitter-dawn-chorus-m3p2thprp">the president’s social behaviour</a></figcaption></figure><h3>The Trump vocabulary</h3><p>As long as Donald Trump only picks fights on Twitter… but just exactly how did his catchphrases and hashtags come about during the primary, election campaign, and his presidency?</p><p>The Data team studied President Trump’s Twitter vocabulary from 2014.</p><h3>The Star Wars Quiz</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MaU2JXyfSbh7x_RhCGFGHQ.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/star-wars-quiz-light-or-dark-side-r5xgcv9bw">Will you join the dark side?</a></figcaption></figure><p>Take our comedic guide to intergalactic politics to work out where you stand on the side of dark and light.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*WkfaiicXTpm6i80P_dLvvg.png" /><figcaption>See <a href="https://www.thetimes.co.uk/article/the-decline-of-isis-control-across-iraq-and-syria-in-maps-qrt2nxcnq">The fall of Islamic State</a></figcaption></figure><h3>The fall of Islamic State in maps</h3><p>A successful collaboration with our Graphics department to show how the Islamic State’s territorial gains and losses have changed over the so-called caliphate’s lifespan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9iSrz9_SskZo3XCn_QOhIg.gif" /><figcaption><a href="https://www.thetimes.co.uk/article/brexit-explained-bfb5tfpkj">Brexit explained: the progress so far and what happens next</a></figcaption></figure><h3>Brexit explained</h3><p>Taking the reader through all the essential need-to-knows of Brexit, updated as the national conversation has continued.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0EizT5LyOhqrs9y6_tCjw.png" /><figcaption><a href="https://www.thetimes.co.uk/article/russian-election-2018-why-does-putin-always-win-s8sd060zt">Why does Putin always win?</a></figcaption></figure><h3>Why does Putin always win?</h3><p>Putin’s hold on Russian politics has shown no signs of weakening: he was re-elected president in 2018. Our teams explain why and how.</p><h3>General election 2017</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XqigYRmPGOawNg1KvfjleQ.png" /><figcaption>Read our whole <a href="https://www.thetimes.co.uk/article/general-election-2017-live-uk-results-in-full-x2sfdc9vp">general election coverage here</a></figcaption></figure><p>Six weeks to build an election page and pre-coverage from the ground up was not <a href="https://www.thetimes.co.uk/article/a-walk-in-the-park-the-quaker-trail-where-may-made-her-snap-decision-pmk927xnc">a walk in the park</a>. But we had it all:</p><ul><li>A <a href="https://www.thetimes.co.uk/article/general-election-2017-latest-updates-pd6np0bl2">daily briefing</a> written by our top political commentators featuring data from a selected constituency;</li><li>A results page, updating live, at the top of the website.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53c5ed962065" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/the-best-of-the-times-interactive-team-53c5ed962065">The best of the Times Interactive team</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building quick interactive projects (and we’re hiring)]]></title>
            <link>https://medium.com/digital-times/building-quick-interactive-projects-and-were-hiring-da5e4acd8380?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/da5e4acd8380</guid>
            <category><![CDATA[journalism]]></category>
            <category><![CDATA[newsroom]]></category>
            <category><![CDATA[data-journalism]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Thu, 19 Jul 2018 09:58:26 GMT</pubDate>
            <atom:updated>2018-07-19T10:08:09.824Z</atom:updated>
            <content:encoded><![CDATA[<p>The week began like any other. Catchup and planning Mondays, a bit of work on Tuesday as everything is going as planned. Then…</p><blockquote>“Hey, we’ve got this big story up this weekend. Could you build us a [insert big interactive name here] pronto? Shouldn’t be too much work, right?”</blockquote><p>Plans are un-made, and here we go working on something new on a very tight deadline.</p><p>Obviously we’re feeling very happy about the newsroom engaging with our work so much, but the challenge of producing something of value in a short time always seems a bit daunting. Chris and I <a href="https://medium.com/digital-times/open-sourcing-our-budget2017-work-4cf4f0700456">have written already</a> about how to manage such deadlines and our high design and development standards, but recent weeks have been fun in this regard.</p><h3><a href="https://www.thetimes.co.uk/past-six-days/2018-06-17/news/sunday-times-crime-map-under-5-of-all-burglaries-and-robberies-solved-vw569clqh"><strong>“How many crimes go unsolved where you live?”</strong></a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*Gf1r9chs_mFMJQZf3VhKpA.gif" /></figure><p>This Sunday Times investigation into the number of crimes solved by police relies on Krystina Shveda’s analysis of public data. Krystina, from the Times and Sunday Times Data team, told us about this project about a week ahead of time.</p><p>Other commitments left us with three working days to complete this project.</p><p>We wanted to provide readers with a personalised insight into the story. The piece would cover the issues uncovered in England and Wales, and our interactive would be a classic “put your postcode in, see how it is where you live.”</p><p>Resolving postcodes is so easy these days thanks to the incredible <a href="https://postcodes.io/">postcodes.io</a> API. In this instance we obtained matches to an LSOA (Lower Super Output Area, a geographical area built to contain consistent population sizes of about 1,500). Our analysis then matched the granularity of the <a href="https://data.police.uk/">data.police.uk</a> dataset.</p><p>Maps were as just as straightforward as using react-leaflet and adding our LSOA GeoJSON overlay.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7c4999a08d47c60b021736404de1e67/href">https://medium.com/media/c7c4999a08d47c60b021736404de1e67/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ktLfqD-6K4uofa7jXx06_g.png" /></figure><p>With an additional day, we added some context to the reader’s local area data thanks to this barcode plot, which shows your local area, the national average, and a visual sense of how the crime solving rate is clustered between 10 and 15% across England and Wales.</p><h3><a href="https://www.thetimes.co.uk/article/child-trafficking-boys-lured-by-dreams-of-football-stardom-forced-into-sex-slavery-9qr53xpkw">“How many slaves do you think there are in Britain today?”</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zCcC-LyIT3bYM5nXN2NGYw.gif" /></figure><p>This story was pitched and put on the schedule while I was away, and a lot of the work was done ahead of time. I normally like to be involved early on, and before the visualisation technique has been agreed. In this instance it was not possible — and that’s another typical example of how things occasionally work in the news business.</p><p>Based on rough wireframes, our head of digital design Matt Myers worked some great designs, and the whole thing was reviewed and agreed upon when I made it in on Thursday morning.</p><p>Chris and I divided up the work between the interactive slider and viz part and the backend database and plumbing.</p><p>We built in parallel over two days and connected our work through Chris’s Serverless API, which handled the submission of an estimate by the readers as well as returning the dataset that allowed the distribution of guesses visualisation.</p><p>Using a lambda — a small chunk of code, often just a single function — allowed us keep everything simple, and easy to maintain, and meant we could focus on the business logic and the user interface.</p><p>We also used a second Lambda function to batch process the predictions from our database into a JSON file that could be consumed by our UI component, and write it to a static file storage system, in our case <a href="https://aws.amazon.com/s3/">AWS S3</a>. Serverless makes it trivial to run a function on a schedule, using their rate(2 minutes) configuration syntax.</p><p>To give us absolute confidence in the code, and with any future changes, and full suite of tests were written using the <a href="https://jestjs.io/">Jest</a> testing framework. These ensured that both our HTTP endpoint, and our batch process ran as expected, and returned any errors if invalid data was passed. While we could trust our UI to send valid data structures, it’s always a good idea to validate in the backend code as well.</p><p>Viz-wise, central to the success of this project was our initial discussion first thing in the morning, which put at the centre of the frontend job a d3 scale.</p><p>This scale would be, contrary to what was initially drawn up, placed at the very top of our app and passed down to the two stages of the project: the slider that asks a guess from readers, then the visualisation itself. The transition between stages was then seamless, and building with an immutable scale made positioning everything a dream.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c3e1c3cb2b273e81292317f79771802/href">https://medium.com/media/0c3e1c3cb2b273e81292317f79771802/href</a></iframe><p>From the components construction above, we’re able to smoothly pick up the reader’s guess and transition nicely to the visualisation itself:</p><ul><li>what the reader has guessed;</li><li>two official estimates (hard-coded);</li><li>and an average estimates from Times readers’ submissions.</li></ul><p>A few observations:</p><ol><li>Despite our slider being linear and ranging from 0 to 30,000+, we observe a stepping of guesses (see the taller bars every 5,000 increment).</li><li>Many picked 30,000+, which surprised us.</li><li>Based on the two points above, I wonder what would have happened if we had given a free text input to readers…</li></ol><h3>End note</h3><p>If you liked this article and want to work with us, we have two job openings going at the moment.</p><p>One is a data journalist role [1] that would work with the Times and Sunday Times data team, and the second job [2] is for an interactive journalist. You can get in touch with me with any question at basile.simon@thetimes.co.uk</p><p>1: <a href="https://newscareers.broadbeantech.com/jobs/view/3240.html">https://newscareers.broadbeantech.com/jobs/view/3240.html</a><br>2: <a href="https://newscareers.broadbeantech.com/jobs/view/3296.html">https://newscareers.broadbeantech.com/jobs/view/3296.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da5e4acd8380" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/building-quick-interactive-projects-and-were-hiring-da5e4acd8380">Building quick interactive projects (and we’re hiring)</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Opening The Times Dataviz Catalogue]]></title>
            <link>https://medium.com/digital-times/opening-the-times-dataviz-catalogue-c6fd6e30ccb2?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6fd6e30ccb2</guid>
            <category><![CDATA[d3js]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[newsroom]]></category>
            <category><![CDATA[newspapers]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Tue, 05 Dec 2017 11:10:07 GMT</pubDate>
            <atom:updated>2017-12-05T11:10:07.316Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57sbiU06flH3A8H5XUAw2g.png" /></figure><p>Today, we are happy to share the first version of <a href="https://times.github.io/dataviz-catalogue/">our data visualisation catalogue</a>: a collection of data visualisations created for the Times and Sunday Times, collected together in one place in the hope that what we have learned can be useful to others.</p><p>Our goal is to compile and showcase the best of our burgeoning data visualisation work, rather than to offer a taxonomy of visual journalism (the FT’s <a href="https://ft-interactive.github.io/visual-vocabulary/">Visual Vocabulary</a> is a fantastic resource for that).</p><p>This collection will also be used internally as a training resource to upskill members of our digital team. From reporters to editors, developers and designers, understanding the correct way to visualise a data set is crucial to enhancing our stories and bringing them to life online.</p><p>The catalogue is both a publicly accessible website showing the breadth of our work, and a <a href="https://github.com/times/dataviz-catalogue">Github repository</a> allowing developers to understand how they are built.</p><h3><strong>Two audiences?</strong></h3><p><a href="https://times.github.io/dataviz-catalogue/">The website is a great starting place for showcasing</a> our work and a resource we intend to grow over time. The website can also be used to <a href="http://nytimes.github.io/svg-crowbar/">crowbar</a> SVGs out for additional Illustrator massage — think of it as a hiring tool and a style guide.</p><p>We display only one chart per page to keep things clean, and we’re publishing everything <a href="https://github.com/times/dataviz-catalogue">on Github</a> so you can clone the code and see a data visualisation’s evolution there too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*u7VNqWkihxN1BXn2A6wz_A.gif" /></figure><p>README files for each type of chart provide handy details about the data format we have implemented. As a growing number of journalists become proficient with basic data manipulation, we wanted to fulfill this requirement directly.</p><p>Frequent practitioners will notice that the code is kept very simple. This is a purposeful decision, and following conventions and habits (particularly around d3.js). In doing so, we aim to make our code more familiar, and hopefully easier to experiment with.</p><p>The only notable exception to what remains common in d3 world is the use of ES6. The elegance of arrow functions, the relatively wide cross-browser support, and the broad adoption of tools like <a href="https://babeljs.io/">Babel</a> to cater for those browsers that don’t fully support ES6 should convince everyone to make the switch.</p><pre>/*<br> * d3.extent returns a [min,max] array<br> * /</pre><pre>var xExtent = d3.extent(dataset, function(d) {<br>  return d.Age;<br>});</pre><pre>// in ES6:<br>const xExtent = d3.extent(dataset, d =&gt; d.Age);</pre><p>As mentioned previously, the whole project is <a href="https://github.com/times/dataviz-catalogue/">on Github</a> and we intend to continue improving it. You can also check out our <a href="https://github.com/times/dataviz-catalogue/issues">list of issues</a> and see where we’re headed.</p><p>Follow <a href="https://twitter.com/timesdevelops">@TimesDevelops</a> and <a href="http://twitter.com/basilesimon/">@basilesimon</a> on Twitter for updates and new things coming to the page.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6fd6e30ccb2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/opening-the-times-dataviz-catalogue-c6fd6e30ccb2">Opening The Times Dataviz Catalogue</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open sourcing our #Budget2017 work]]></title>
            <link>https://medium.com/digital-times/open-sourcing-our-budget2017-work-4cf4f0700456?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cf4f0700456</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[newsroom]]></category>
            <category><![CDATA[d3js]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Fri, 24 Nov 2017 12:34:57 GMT</pubDate>
            <atom:updated>2017-11-24T13:29:52.454Z</atom:updated>
            <content:encoded><![CDATA[<h4>A conversation between Times Development team members about the tradeoffs between code quality and working against a deadline</h4><blockquote>TL;DR: We’re hiring, and this is how we work and some of the things we do.</blockquote><p>Wednesday 22nd November was, as you might expect, a busy day in the newsroom. Philip Hammond unveiled the government’s budget for the year to come, and there was <a href="https://www.thetimes.co.uk/past-six-days/2017-11-23/budget-2017">much to write about it</a> to cover it properly.</p><p>The paper included a budget supplement the following morning, and the Digital team had to provide a few things for the day. Set pieces like this are — to an extent — prepared ahead of time, but it’s impossible to know how everything is going to look before the chancellor’s speech ends.</p><p>We then planned a few things, and as we’re hiring for several positions (see the bottom of this article) we thought potential candidates would like to know how it’s been here over the last few days.</p><p>Here is a rundown of two projects we selected:</p><ul><li><strong>A </strong><a href="https://github.com/times/times-treemap-budget/"><strong>bespoke treemap</strong></a> visualising where the money comes from and how it is spent based on the figures released</li><li><strong>And </strong><a href="https://github.com/times/budget-calculator"><strong>our interactive tax calculator</strong></a> based on PWC data telling you if you’ll be better or worse off after the budget.</li></ul><p>We are also opening access to the code powering these digital components. They’re only one thing among many others that our team does, but they provide examples of some of the challenges of working in news and coding against a deadline.</p><p>This post represents the discussion and review process that we go through when releasing code in the newsroom. <a href="https://twitter.com/chrishutchinson">Chris</a> and I highlight specific lines or blocks of code in these two projects, and consider the decisions made in the moment, in order to achieve the rapid turnaround required in the newsroom. Each decision is assessed for its value and purpose, and with the benefit of hindsight (and more time ⏰), we provide a neater, more maintainable examples of writing this code. It’s worth noting that much of our code is written to work within the structures of The Times website, which in these cases rely on using Web Components (via Polymer), although the code samples are applicable to all front end development, no matter your framework of choice.</p><h3>Our interactive budget calculator</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRJJVA584dIovf5XdClCtA.png" /></figure><p>Unhappy with our third-party calculator from last year, the Business desk asked if we could build our own to replicate the tables published in print every year. PWC provides us with this data, and our goal was to display simple figures from it.</p><h3><strong>Polymer conditional template and naming conventions</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/index.html#L13">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/index.html#L13</a></p><p><strong>Basile</strong>: “Render this thing if there is not no headline” is really what I’m telling the app here. You can read that sentence again: it will make sense but is highly illogical. My purpose here was simple: by calling this parameter this way, I give the production people two options:</p><ul><li>Omit the parameters and the component will render as expected: with a headline</li><li>Or, for those in the know, pass in noheadline=&quot;true&quot;and it will remove it. This makes sense and is intuitive.</li></ul><p><strong>Chris</strong>: Writing web components is like creating custom HTML elements. To make the user experience as easy as possible, passing a property like &lt;my-component no-headline&gt;<em> </em>makes a lot of sense. It’s clearly defines the behaviour, especially to non-technical users. Unfortunately, this can create confusing double negatives in your codebase. This can be mitigated by creating an internal-only property (often referred to as a computed property), which is more meaningfully named. In this case, we might create a property called showHeadline, which stores the reverse boolean value of noHeadline. This means our template can be much simpler, and can eliminate the double negative. The below code example demonstrates how this could work:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f95cfe801d2355f265574d25d497564e/href">https://medium.com/media/f95cfe801d2355f265574d25d497564e/href</a></iframe><h3><strong>A very manual &lt;form&gt;</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/index.html#L18">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/index.html#L18</a></p><p><strong>Basile</strong>: It’s not the best form in the world. After faffing with formData() for a while, I had to give up when I noticed its rather poor browser support and wasn’t sure how well polyfilled it was. Plus, you know, iterators are pretty but still hurt my head.</p><p><strong>Chris</strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData">FormData</a> is a great way of managing data in forms, and can make it much easier to access your data where you have multiple fields. Unfortunately, as Basile has raised, the browser support for all of FormData’s features isn’t great, and in the newsroom context, loading in and testing an untested Polyfill can be a recipe for disaster. In this case, where we only had one or two inputs, access their values directly (using .value) is not a bad approach. If the form was to grow in any way or need to be submitted multiple times, I’d advise putting more time into researching available FormData polyfills.</p><h3><strong>Handlers bound in Javascript, not in HTML</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L92">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L92</a></p><p><strong>Chris</strong>: Here we manually set up a submit<em> </em>EventListener in our JavaScript code, while in Polymer (and many other JavaScript frameworks), we can set that up in our template/ HTML code. This makes for clearer code, allowing us to see directly on the &lt;form&gt; tag, what method handles a submit. When we revisit this code in the future, it’ll be much easier to see by just looking at the &lt;form&gt; what is happening when it’s submitted.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/385356e28c1f5b570ae17a62ac631733/href">https://medium.com/media/385356e28c1f5b570ae17a62ac631733/href</a></iframe><h3><strong>Defending against a free text input</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L115">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L115</a></p><p><strong>Basile</strong>: Two minutes before deadline, we opened the calculator on one of the editors’ computer, who typed in her income, with a comma. Like Brits do. Oh my, I thought, no way that’s going to work, I’ve never tried with a comma in there. Turns out I did defend against this and cleaned the input when I wrote this line the first time round. It also turns out that I didn’t plan that some people would put a £ sign before their income.<br>As a bonus, note the very artisanal so-called error handling process below.</p><p><strong>Chris</strong>: Handling user input is always an area worth extra consideration. If your user input is being delivered to an external service (possibly an API or database) you should be validating and escaping it, to prevent any malicious activity. In this case, it was all handled internally on the client (in browser). The code here that processes and cleans the input, and sets the error states could be cleared up. We might consider breaking this up into a set of smaller, well named functions, which might run something like this:</p><ol><li>Reset error state</li><li>Clean input data</li><li>Validate input data</li><li>If invalid, show error</li><li>If valid, show results and send analytics event</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10c341c496a9d054421af4c07c030510/href">https://medium.com/media/10c341c496a9d054421af4c07c030510/href</a></iframe><h3><strong>Semantic HTML where art thou</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/index.html#L66">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/index.html#L66</a></p><p><strong>Chris</strong>: Writing semantic HTML can sometimes be a chore, but it’s really worthwhile, and can help in more ways than just improving the readability of your code. In this example, a &lt;div&gt; was used, despite this being a clickable element. In almost all cases, a &lt;button&gt; would be preferred here, because:</p><ul><li>It’s natively clickable</li><li>Your intention is much clearer in your HTML</li><li>It’s got accessibility support built in 🙌</li><li>You can tab to it, and use your keyboard to press it, without writing a single line of code</li></ul><p>Again, as with the form earlier, we would also want to bind our click handler to it directly, using an on-click attribute (or similar in other JavaScript frameworks).</p><h3><strong>Writing things by hand</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L28">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L28</a></p><p><strong>Basile</strong>: I didn’t know what I’d get from PWC. I had dummy data, but… you simply never know. That error-prone copy-pasting was done when I received the data, and it’s dirty but works. ¯\_(ツ)_/¯</p><p><strong>Chris</strong>: This one is always tricky due to the nature of not knowing your source data until the last minute. In this case there was little that could have been done to make it easier, however writing a mapping array like this at least means we have a structured approach to handling the incoming data. One thing to highlight, the notes key in each example is empty, and actually wasn’t used in the final product. In reality, we’d want to remove this from our codebase, as it’s unnecessary, and adds complexity if we wanted to come back and look at this code in the coming weeks and months.</p><h3><strong>A magical dropdown</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L144">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L144</a></p><p><strong>Basile</strong>: Our dropdown options are dynamically created in Javascript based on the copy-pasta above. It sucks. From the HTML file above, it is impossible to know how the dropdown will be populated. Comment your code.</p><p><strong>Chris</strong>: This is another case where we can use our template / HTML code to be clearer about the behaviour and intention of our application. If you only look at the HTML, there’s no understanding that the &lt;select&gt; box will ever have more than one item in it. In many templating languages you can use a loop or map to create your options inside your HTML, based on some dynamic data (this is, for example, how you would do this in React). However, in Polymer 1.x, this isn’t actually possible, and so the way it was done here is best.</p><h3><strong>Scrolling like you don’t know where you’re going</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L160">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L160</a></p><p><strong>Basile</strong>: Design wants the app to nudge down on mobile when searching, to make sure readers see something’s going on. Let me check if I can do that properly in five minutes. Wait no I can’t, it’s deadline day, I’m struggling to target the element I want, oh sod it I’ll scroll them 200px down. Seems about right: 100px is too little, 300px is too much. Commit, push, deploy. Typical lazy deadline work.</p><p><strong>Chris</strong>: Here we were able to use <a href="http://iamdustan.com/smoothscroll/">a great polyfill</a> for the window.scrollBy() method, which allows us to implement smooth browser scrolling with little effort. Unfortunately, this method only takes exact pixel values, meaning, when working to deadline, providing a rough estimate is usually fine. This, however, might breakdown following further testing across a wider variety of device types. To get the scroll distance right, we might first look to calculate the offset between our current scroll position, and the element we want to scroll into view. Once we have this value, we would then pass it to scrollBy() to scroll the correct amount.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47d327952347e0fe7511a2c4dfaaa723/href">https://medium.com/media/47d327952347e0fe7511a2c4dfaaa723/href</a></iframe><h3><strong>Unclear requirements that we forgot to check</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L181">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L181</a><br><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L185">https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L185</a></p><p><strong>Basile</strong>: PWC gave us figures for £10,000, £20,000 annual income, and so on. Not the maths in between. Which means that we don’t know what to tell to readers who tell us they make £27,000 per annum. Initially, we rounded things down. It became apparent after deadline that this was wrong, and that we should give readers the closest possible number.<br>So we refactored and it took me way too long because I’m no good at algos since I studied law at uni. I didn’t even realise it was useless to keep the bit above that sorts the array of objects in ascending order of income. Or maybe I didn’t dare to remove it.</p><p><strong>Chris</strong>: This sort of issue is really common with short deadline work. We can only do our best to try and get everything right first time, but naturally things will be missed, or it’s difficult to recognise the importance of the calculation we perform until we’ve built a started testing the end product.</p><h3><strong>For loops and conditionals</strong></h3><p><a href="https://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L200">ttps://github.com/times/budget-calculator/blob/master/app/budget-calculator/script.js#L200</a></p><p><strong>Basile</strong>: I didn’t know how to manipulate these integers and render them properly in Polymer. So I went for a fragile set of conditionals and iterations that rely solely on my knowledge of the dataset. It shouldn’t be like that.</p><p><strong>Chris</strong>: Let’s admit, this code isn’t <em>that</em> fun. It’s not as clear as it could be, there are a bunch of nested ifs and elses, all wrapped in a glorious forloop. Modern JavaScript encourages us to use the Array.prototype methods, instead of forloops, which we can implement here to help with some of the complex formatting requirements.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0307cf7ee68f32a87cd016689340b48/href">https://medium.com/media/f0307cf7ee68f32a87cd016689340b48/href</a></iframe><h3>Our money in/out treemap</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E1TwB4BcT7TNidoy7mcJaw.png" /></figure><h3><strong>I use automation, except when I’ve got to type in JSON datasets</strong></h3><p><a href="https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/data/budget.json">https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/data/budget.json</a></p><p><strong>Basile</strong>: This commit is simply shocking. But for me, the quickest way to have the budget data was to type this in once the documents got released. I had the Spring budget to model this, but still. Let me know if there is a typo, please.</p><p><strong>Chris</strong>: This, again, is often a necessary evil. Hosting the CSV or JSON file separately, and loading it in would be an option here, but it introduces another HTTP request we might otherwise choose to avoid. I find that across the different projects we do, managing external (but otherwise core) data is an ongoing challenge. Thankfully in this case, it’s not a huge amount of data in the first place, so while hard coding it might not be pretty, it may be the lesser of two evils.</p><h3><strong>I use automation, except when I’m using a template</strong></h3><p><a href="https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L168">https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L168</a></p><p><strong>Basile</strong>: The key is manually created. One of these legacy things. Oh, and it was the wrong way round when it hit the website.</p><p><strong>Chris</strong>: This would benefit from having a function at the beginning of our code that automatically helps us generate things like keys, basic on the incoming data. For one-off projects, that’s unrealistic, but as we continue to use this codebase, we should start to look at how we can add these convenience methods, which will help introduce more consistency in the code, reduce bugs, and make it easier to maintain.</p><h3><strong>Taking the time to rewrite</strong></h3><p><a href="https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L6">https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L6</a></p><p><strong>Basile</strong>: These treemaps were created for the January 2017 transfer window… and they used to be a bit complicated. When it became clear we’d be using them for the budget again we felt it was necessary to spend some time cleaning up that code and making it better. For example, by using d3v4’s modular approach instead of shipping the whole library…</p><p><strong>Chris</strong>: Making ongoing improvements to our code is great, and finding ways to use what we’ve built already is an excellent way of doing this. Naturally it’s hard to see from the outset how code might be reused, but as we’ve used this template a number of times now, it’s clear to see the improvements we’ve already made, and can continue to make. Next steps here might include:</p><ul><li>Breaking the code up into smaller helper functions, such as createLegend(), or processData()</li><li>Moving our D3 dependencies into HTML imports, a feature used extensively in web components (and Polymer) to allow for caching of our external resources</li><li>Separating our transitions and interactions away from our core business logic</li><li>Optimising for use in responsive context (relying on percentage widths, rather than fixed values)</li></ul><h3><strong>Dirty classes</strong></h3><p><a href="https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L102">https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L102</a></p><p><strong>Basile</strong>: To decide whether we’ll label an area of the treemap, we’re checking that there’s actually enough space. Regardless of the label length or other practical consideration… I end up tweaking these numbers to find a sweet spot.</p><p><strong>Chris</strong>: Setting classes, then checking them later (and relying on nearby DOM elements) is incredibly fragile, and could break for any number of unexpected reasons. In addition, this sort of tight coupling makes it really hard to know if a change in one place is likely to cause a bug or regression in another part of the codebase. In this case, we might look to:</p><ul><li>Always render the label text, and use CSS to conditionally hide it</li><li>Make each cell check it’s own size, and determine whether or not is large enough to show the text</li><li>Create a helper function that can encapsulate some of this logic, so it’s easier to change across the application</li></ul><h3><strong>Responsive</strong></h3><p><a href="https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L160">https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L160</a></p><p><strong>Basile</strong>: After several iterations of the chart, we’re still not at a fully responsive, percentage-based version. For shame.</p><p><strong>Chris</strong>: This isn’t something that common in D3, and perhaps because of the complexity involved, however I’m keen to see more of the charts we produce work using percentage values, rather than fixed pixel values. By doing this, we’ll be in a better position to render our charts in the best way across all the devices we serve our readers on, including those devices and screen sizes we might support in the future. In most cases, this involves writing calculation function that turn our bound data into percentages, and correctly setting the width and transform properties of our D3 selections. I think this chart is a prime candidate for this as we continue our rewrite.</p><h3><strong>The legendary manual legend</strong></h3><p><a href="https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L182">https://github.com/times/times-treemap-budget/blob/master/app/times-treemap/script.js#L182</a></p><p><strong>Chris</strong>: This legend is, effectively, a UI element. If this code wasn’t written using D3, the legend would live in HTML, and arguably we should be doing the same here. This would mean we could use normal DOM elements ( &lt;h1&gt;, &lt;div&gt;, &lt;aside&gt; ), and CSS to provide our styling. Not only would this simplify our D3 code (we would rely on our templating engine to bind our data to our legend’s DOM), but it would also make it much easier to understand how the legend is created, and how we can make changes to it. HTML is a templating language, and as such, we should use it where it is best suited.</p><p><strong>👋 If you made it to the bottom of this long article, you probably should check out the three job ads we’ve got going to join our team!</strong></p><p><em>Junior newsroom developer:</em><br><a href="https://newscareers.broadbeantech.com/jobs/view/2654.html">https://newscareers.broadbeantech.com/jobs/view/2654.html</a></p><p><em>Newsroom developer:</em><br><a href="https://newscareers.broadbeantech.com/jobs/view/2655.html">https://newscareers.broadbeantech.com/jobs/view/2655.html</a></p><p><em>Interactive journalist:</em><br><a href="https://www.gorkanajobs.co.uk/job/75549/the-times-and-the-sunday-times-interactive-journalist/">https://www.gorkanajobs.co.uk/job/75549/the-times-and-the-sunday-times-interactive-journalist/</a></p><p><strong>👇👀 Here are the two repos containing all the code powering these two projects, for your perusal.</strong></p><ul><li><a href="https://github.com/times/budget-calculator">times/budget-calculator</a></li><li><a href="https://github.com/times/times-treemap-budget">times/times-treemap-budget</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cf4f0700456" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/open-sourcing-our-budget2017-work-4cf4f0700456">Open sourcing our #Budget2017 work</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[General election 2017 at the Times: what we built and how]]></title>
            <link>https://medium.com/digital-times/general-election-2017-at-the-times-what-we-built-and-how-341e461ac6c9?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/341e461ac6c9</guid>
            <category><![CDATA[britain]]></category>
            <category><![CDATA[journalism]]></category>
            <category><![CDATA[elections]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Thu, 06 Jul 2017 09:41:06 GMT</pubDate>
            <atom:updated>2017-07-06T13:36:44.713Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*LBdVxk4fZdobzZYBHVMOQQ.gif" /><figcaption>The results as they unfolded through the night</figcaption></figure><p>In April this year, British newsrooms were given just six weeks to prepare their coverage of the snap election. A big event like this usually requires months of planning and careful cross-departmental execution, so it was a rush to pull everything together and give our readers an election experience worth paying for.</p><p>We’re very proud of what we managed to produce at such short notice, and just in case you missed it in the scramble, we’ve put together a short summary of what we published and how.</p><h3>What we built</h3><p>Several projects deserve a mention for our pre-election coverage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cFSzU1rEw19_sDYPyMkDRQ.png" /><figcaption>Our “five for 5” daily briefing</figcaption></figure><p>We brought readers <strong>a daily briefing</strong> from the Times and Sunday Times political teams,<strong> </strong>published every day at 5pm, for the five weeks leading up to the election. An important complement to Matt Chorley’s morning Red Box political newsletter, this evening briefing was a good spot to promote other articles from the paper and capture a different audience — those on the commute home rather than the commute in. It also featured a bespoke “poll of polls”, as well as a constituency of the day highlighting key data (such as the Leave vote share and demographic indicators).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*XaSwdawf2HyC3-t9EELIHg.jpeg" /></figure><p><strong>Chatbot<br></strong>As an experiment, we also created a chatbot based on Facebook Messenger. Pure R&amp;D projects are rare at The Times — our focus is on satisfying our subscribers on a daily basis — but the snap election was an excellent opportunity to flesh out a template and to try out interesting editorial approaches.</p><p>In this instance, <a href="https://medium.com/digital-times/busting-election-filter-bubbles-with-a-facebook-chatbot-ac43ba966dbb">we wanted to help readers burst their ‘filter bubble’</a> and send them content they would not necessarily see outside of their immediate social circle. We sent a list of articles to readers each day based on declared vote record and voting intention for June 8. From the readers’ postcodes, we sent them server-side rendered images of our daily updated poll of polls, as well as some data about their constituency (MP, 2015 vote, Brexit vote, some demographic indicators).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*atY9x5EWCsG2_SwLIdv9qA.gif" /><figcaption>Our results page’s mobile experience was entirely different from on desktop</figcaption></figure><p><strong>The prized element of our coverage on the night was of course our results page</strong>. It’s the moment interactive and web teams from across the country look at each other to see what the competition has prepared.</p><p>Our results page included everything readers would have needed, whether they came to us in the morning or followed the results coming in through the night. Seamlessly redrawing and updating itself, the page provided near real-time information about the latest declared constituencies, as well as how the national results looked at any given moment.</p><p>The top of the page boasted a bar and dots chart, which we saw as an innovative way to display the exit poll and the results — both in terms of vote share (bar chart) and of seats (dots in the bar).</p><p>The Data Journalism team assisted this work by putting together key datasets to be used by the apps. They compiled and analysed constituency data, including demographics from multiple sources including the ONS and Parliamentary Petitions. In addition to this, they wrote two analysis pieces: one explaining <a href="https://www.thetimes.co.uk/article/general-election-2017-understanding-the-flaws-with-polling-2tft2j7r5">the different approaches being taken by polling firms</a>, the other one, which proved to be insightful, outlining how the mobilisation of young voters <a href="https://www.thetimes.co.uk/article/general-election-2017-whats-the-best-labour-can-hope-for-d3kwgzkmj">could narrow the Conservative lead</a>, among other factors.</p><p>Our post-election coverage and analysis was led by the Data Journalism team, making good use of the results data collated overnight. They plotted the results against demographics data, using an innovative ternary chart illustrating <a href="https://www.thetimes.co.uk/edition/news/general-election-2017-conservatives-v-labour-the-two-party-system-is-back-tqr9ct3p2">how Britain was more polarised than ever</a>.</p><h3>Stefano Ceccon on Twitter</h3><p>So..here is our brill #GE2017 analysis piece with a #ternary animation on the polarisation of UK politics #newsankey https://t.co/uzvVJy7IoN https://t.co/Sw6ViUh9e7</p><p>We produced a series of gifs and videos based on screen recordings annotated by the Social and Multimedia teams.</p><h3>The Times of London on Twitter</h3><p>Here are the UK #GE2017 results in full https://t.co/7INPJWAX8w</p><h3>The technology behind the election</h3><p>Our results page and our 5pm briefing were built in React thanks to our fantastic generator that scaffolds a custom app in minutes — and makes getting going very easy. This generator pulls in the basics of a React app, as well as all the furniture from thetimes.co.uk so we can inherit styles and work in an environment mirroring production.</p><p>All the features of these pages are built as separate components for maximum compartmentalisation. Practically, it also allowed the developers to work on separate components in a manner much similar to <em>git-flow</em>, based on feature branches of the code periodically merged into a master one ready for release.</p><p>We’re particularly happy to have invested into building things this way. We were able to pull out components as needed, relatively effortlessly. For the chatbot, for example, we needed to generate and render constituency results as an image. We forked the constituency component from the 5-for-5 page to recreate, server-side, 650 versions of it (one per constituency) to screenshot with the newly released Headless Chrome.</p><p>In terms of workflow, both the 5-for-5 and results page were built based on Sketch designs and specifications drawn by digital designer Jake Cox, which served as reference. Matt Taylor, leading the Development team, scoped these designs in detail to order features by priority, ranking some of them as part of the MVP, and some others as enhancements, given limited timescales and resource.</p><p>The charts and plots were built prior to being included in the final designs, in order to ensure it was feasible for the team to produce them up to standard. The results chart at the top was a particular cause for worry, and the prototypes studied both the need for SVG or Canvas due to potentially thousands of DOM elements.</p><p>A set of helper functions running in the background of the React app maintained our results page up to date. Server-side services were in charge of the polling for new data from the Press Association feed, while the front-end app loaded the resulting data every 30 seconds, feeding those down the page for seamless redraws. Refreshing the page is so 2011.</p><p>Finally, feedback on the pages was limited to a handful of people this time, as to limit the number of last-minute interventions from all corners of the newsroom. While clearly being an anti-pattern to what a feedback process should look like, it put more pressure on a core group of people and allowed us to work through the changes quicker.</p><p>We put a couple of days work into the chatbot. The quickest way off the mark for Callum Christie, our developer, was to crack on with familiar PHP and cron tasks. The bulk of Callum’s time was spent getting the right format to talk to Facebook’s API, and to fit the dialogue script.</p><p>In the future, we’d love to have a crack at <a href="http://bbcnewslabs.co.uk/2017/04/06/serverless-patterns/">Serverless patterns</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*zGJu_4ki_H4ujYK0W0jTHg.png" /><figcaption>An example of constituency results from our coverage</figcaption></figure><h3>Stats, analytics, subs</h3><p>From our results page, a number of people subscribed to the Times. The page gathered well over 100,000 views and our readers spent a good deal of time with us (around nine minutes on average). There were a few interactive elements on the page, such as the menus, constituency search, and constituency carousels — which 60 per cent of our readers interacted with. Our readers weren’t skim-reading, they were highly engaged.</p><p>The results are similar for our 5-for-5 page, except that we noticed a very high conversion rate from non-subscribers to Registered Access (whereby a reader registers their email address to get two complimentary articles a week).</p><p>A <a href="https://www.thetimes.co.uk/article/general-election-2017-which-party-manifesto-should-i-vote-for-r5vs3ttxj">manifesto quiz</a> collected massive registrations as well, and had significant traffic — all thanks to the Social team’s efforts to boost up the SEO.</p><p>Our chatbot, launched on May 22, attracted 400 users, 93 per cent of whom stayed with us until polling day.</p><p>“We chose to keep these pages behind our paywall because we believe this is content worth paying for. The number of readers who registered for access and subscribed to The Times and The Sunday Times proved us right,” said Alan Hunter, head of digital.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XUU_peiYDxw-vkkS-YXVlw.png" /><figcaption>An example of the “Constituency of the day” from our five-for-5 daily briefing</figcaption></figure><h3>Performance analysis</h3><p>Chris Hutchinson, senior developer in the Development team, worked on accessibility features for our web apps.</p><p>The 5-for-5 page was the first time we implemented full static rendering, while journalists were still given their familiar CMS to change and update the copy. This gave us a huge improvement in time to first meaningful paint, and time to interactive.</p><p>We also focused on ensuring we implemented appropriate keyboard navigation, among other accessibility features. We also optimised our resultant Webpack bundle to ensure we served a minimal amount of Javascript to the readers. Oh, we also use Preact to help reduce the bundle size even further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vsrYwbtzbjlWOwlurg6thg.png" /></figure><h3>Lessons learned</h3><ol><li><strong>The collaboration between Design, Development, and Data teams</strong>, led by Sam Joiner of the Interactives team, was a big success.</li><li><strong>Tasks and areas of responsibility need to be clearly defined so teams can work in parallel</strong>. In this case, the Data team was able to work on collating datasets based on a structure defined by the Dev team, while the devs were able to build with predictable, mock data.</li><li><strong>Inverting the feedback process to keep it under control</strong> is sometimes necessary and helped us to keep it manageable under a tight deadline.</li><li><strong>Precise scoping of features and hierarchisation manages everyone’s expectations.</strong></li><li><strong>Build re-usables</strong>. And when the project is done, invest more time in abstracting those and keeping it ready for next time.</li><li><strong>If your own results page performs so well that the top editorial team uses it to get their news, you’re winning.</strong></li></ol><p><strong>EDITORIAL AND PRODUCTION:</strong> SAM JOINER AND MATT TAYLOR <br><strong>DEVELOPMENT:</strong> BASILE SIMON, CALLUM CHRISTIE AND CHRIS HUTCHINSON <br><strong>DATA: </strong>TOM WILLS, LOUIS GODDARD AND STEFANO CECCON<strong><br>DESIGN:</strong> JAKE COX</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=341e461ac6c9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/general-election-2017-at-the-times-what-we-built-and-how-341e461ac6c9">General election 2017 at the Times: what we built and how</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Times poll of polls in d3]]></title>
            <link>https://medium.com/digital-times/the-times-poll-of-polls-in-d3-e69577314acb?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/e69577314acb</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[interactive-journalism]]></category>
            <category><![CDATA[d3js]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Thu, 27 Apr 2017 00:00:00 GMT</pubDate>
            <atom:updated>2017-04-29T17:40:56.491Z</atom:updated>
            <content:encoded><![CDATA[<p>There was quite a bit of excitement in the newsroom when news came in that prime minister Theresa May, contrary to her promises, was calling for a snap election on June 8, 2017.</p><p>For us, well, that means a slight change of plans. Throwing the forward planning stuff away and focusing on the big event to come.</p><p>For me, that meant jumping on building our lead graphics for the weeks to come: <strong>the poll of polls.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*IRkmrF_C6DNCKMiU0YNfWA.png" /></figure><h3>Creating the canvas</h3><p>The canvas itself is nothing fancy: just a set of axes to host our visualisation.</p><p>Note that we hard-code the y axis to run between 0 and 50% polling intentions.</p><p>Also, we’re making our x axis show the abbreviated month name or the full year instead of January.</p><pre>// Scales and their respective domains<br>const x = d3j.scaleTime().range([0, width]);<br>const y = d3j.scaleLinear().range([height, 0]);<br><br>const var xExtent = d3j.extent(dataset.averages, d3j.f(&#39;date&#39;));<br>const var yExtent = d3j.extent([0, 50]);<br><br>x.domain(xExtent);<br>y.domain(yExtent);<br><br>// X-axis<br>g<br>  .append(&#39;g&#39;)<br>  .attr(&#39;class&#39;, &#39;axis axis--x&#39;)<br>  .attr(&#39;transform&#39;, &#39;translate(0,&#39; + height + &#39;)&#39;)<br>  .call(<br>    d3j.axisBottom(x).ticks(config.ticksCount).tickFormat(function(dataset) {<br>      const months = d3j.timeFormat(&#39;%-b&#39;)(dataset);<br>      if (months === &#39;Jan&#39;) {<br>        return d3j.timeFormat(&#39;%Y&#39;)(dataset);<br>      } else {<br>        return months;<br>      }<br>    })<br>  );<br><br>// Y-axis<br>g<br>   .append(&#39;g&#39;)<br>   .attr(&#39;class&#39;, &#39;axis axis--y&#39;).call(<br>   d3j<br>    .axisLeft(y)<br>    .ticks(5)<br>    .tickSize(-width)<br>    .tickPadding(20)<br>    .tickFormat(d =&gt; `${d}%`)<br>);</pre><h3>The EU referendum</h3><p>Annotations are important. We want to explain visually and immediately the change in the polls that followed the very important referendum on exiting the EU that took place on June 23 last year. We thus draw a vertical line at this date, with a label on top.</p><p>No interactivity needed, it’s all there on first paint.</p><pre>const rule = g.append(&quot;line&quot;)<br>  .at({ class: &quot;rule&quot;,<br>        x1: x(new Date(&quot;06-23-2016&quot;)),<br>        x2: x(new Date(&quot;06-23-2016&quot;)),<br>        y1: -20,<br>        y2: height })<br>  .st({stroke: &quot;#666&quot;, strokeWidth: 1});<br>g.append(&quot;text&quot;)<br>  .at({ class: &quot;ruleLabel&quot;,<br>        x: x(new Date(&quot;04-10-2016&quot;)),<br>        y: -15,<br>        dy: &quot;-1rem&quot; })<br>  .html(&quot;EU referendum&quot;);</pre><h3>Adding the scatterplot</h3><p>For each party in the dataset we append a set of dots for each poll we receive. Nothing terribly exciting here, the x/y coordinates of the dots are date and polling intentions.</p><pre>for (var i = 0; i &lt; parties.length; i++) {<br>  g<br>    .selectAll(&#39;dot&#39;)<br>    .data(dataset.raw)<br>    .attr(&#39;class&#39;, &#39;dots &#39; + parties[i].name)<br>    .enter()<br>    .append(&#39;circle&#39;)<br>    .attr(&#39;r&#39;, 5) <br>    .at({<br>      cx: function(d) {<br>        return x(d.date);<br>      },<br>      cy: function(d) {<br>        return y(d[parties[i].name]);<br>      },<br>    })<br>    .st({<br>      fill: parties[i].color,<br>      opacity: config.opacity,<br>    });</pre><h3>Adding the line and handling missing values</h3><p>d3 <a href="https://github.com/d3/d3-shape/blob/master/README.md#line_defined">defined()</a> was a life saver here.</p><p>Read <a href="https://bocoup.com/blog/showing-missing-data-in-line-charts">Showing missing data in line charts</a> for more about this.</p><pre>var popline = d3j<br>  .line()<br>  .defined(d =&gt; {d.averages[parties[i].name] != null})<br>  .x(d =&gt; x(d.date))<br>  .y(d =&gt; y(d.averages[parties[i].name]));<br><br>var filteredData = dataset.averages.filter(popline.defined());<br><br>g<br>  .append(&#39;path&#39;)<br>  .datum(filteredData)<br>  .at({<br>    d: popline,<br>    fill: &#39;none&#39;,<br>    strokeWidth: 1.5,<br>    stroke: parties[i].color,<br>  })<br>  .style(&#39;stroke-dasharray&#39;, &#39;3, 3&#39;);<br>g.append(&#39;path&#39;).datum(dataset.averages).at({<br>  fill: &#39;none&#39;,<br>  stroke: parties[i].color,<br>  strokeWidth: 1.5,<br>  d: popline,<br>});</pre><h3>Wait, objects?</h3><p>I’m using <a href="https://github.com/gka/d3-jetpack">d3-jetpack</a> to do some bits in here, and the result will look a tad confusing to those used to the rather standardised d3 code we read on bl.ocks.org every day. That said, passing object of attributes and of camel-cased CSS styles to d3 selections looks rather attractive to me.</p><p>d3-jetpack is rather brutal in inserting its methods directly onto d3 itself, but if you can live with it, you get this:</p><p>Instead of:</p><pre>.attr(&#39;d&#39;, line)<br>.attr(&#39;fill&#39;, &#39;none&#39;)<br>.attr(&#39;stroke-width&#39;, 1.5)<br>.attr(&#39;stroke&#39;, parties[i].color)</pre><p>We can do:</p><pre>.at({<br>  d: line,<br>  fill: &#39;none&#39;,<br>  strokeWidth: 1.5,<br>  stroke: parties[i].color,<br>})</pre><p>Also, d3-jetpack has a Tom Gauld cartoon in its README.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*BA2TGNwfOoktsCfB." /></figure><p><em>Originally published at </em><a href="https://blog.basilesimon.fr/2017/04/27/times-ge2017-poll-of-polls-d3/"><em>blog.basilesimon.fr</em></a><em> on April 27, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e69577314acb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/the-times-poll-of-polls-in-d3-e69577314acb">The Times poll of polls in d3</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Times and The Sunday Times are now HTTPS]]></title>
            <link>https://medium.com/digital-times/the-times-and-the-sunday-times-are-now-https-78963f7dd46f?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/78963f7dd46f</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Fri, 07 Apr 2017 10:00:22 GMT</pubDate>
            <atom:updated>2017-04-07T10:59:03.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/284/0*XViKYDfpeBzKs8Hb." /></figure><p>Two days ago, many months of hard work by multiple teams in our Technology department came to fruition. At 1am they flipped a switch which added an “s” and a tiny green lock in the address bar when you visit our website, accompanied by a reassuring message: “Secure.”</p><p>We moved the Times and Sunday Times domains to HTTPS, and here is why we’re quietly celebrating.</p><blockquote><strong>As a reader of The Times and The Sunday Times, why does this matter</strong>?</blockquote><p>Your traffic and web browsing history is constantly logged by internet service providers (ISPs) under the provisions of the Investigatory Powers Act 2016. Even if you don’t care about intelligence agencies looking at your history, this data is valuable and a premium product, as Americans are realising since President Trump repealed rules that required ISPs to seek and obtain permission from customers to collect and use such data on browsing habits.</p><p>HTTPs is a first step in protecting readers against this.</p><h3><strong>You know it’s us</strong></h3><p>HTTPS prevents someone tampering with our journalism before you see it.</p><p>When you read us, we want to be sure our words reach you unaltered.</p><h3><strong>More privacy for you</strong></h3><p>It is generally easy if you’re connected to a computer network to listen to what’s going on. Think of a coffee shop, the Tube wifi, or your office. What you read says a lot about you, and HTTPS will protect you against eavesdropping.</p><p>Our domain (thetimes.co.uk) will still be sent unencrypted on the network, but specific articles or search keywords that would reveal what you’re looking at won’t.</p><h3><strong>Safer handling of your information</strong></h3><p>We have protected personal details such as your email address, postal address and credit card in this way for years; now all your browsing and reading will be as safe as your login and personal information.</p><h3><strong>Malware injection</strong></h3><p>Malware and code that could harm your computer, as well as unwanted ads, can be injected by many parties when you look at an unsecured website. For example, free wifi hotspots at airports sell big ad banners they’ll sneakily inject on the websites you’re looking at. Ad spaces can be targeted by hackers to exploit their legitimate placement on trusted websites to inject code directly inside your browser.</p><p>Not any more on HTTPS.</p><p>With a complex website like ours, containing articles, interactive content and ads from many different systems, this simple switch has taken several months of hard work. But we’re proud to be able to make the web safer for our readers. Later this year, we’ll be building on HTTPS to offer new ways for sources to contact The Times and The Sunday Times in confidence — putting privacy and security at the heart of our journalism.</p><h3><strong>Better performance and enhanced functionality</strong></h3><p>With HTTPS we’ve also enabled HTTP/2.0, a major revision of the HTTP network protocol used by the World Wide Web. For our readers, it means better browser performance and the unlocking of additional browser functionality that will enable us to further enhance the reader experience. Or in layman’s terms, our pages will load faster.</p><p><em>Thanks to Patrick Malins, the HTTPS Project Manager, and the TNL Technology and Operations teams for their hard work over the past few months.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78963f7dd46f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/the-times-and-the-sunday-times-are-now-https-78963f7dd46f">The Times and The Sunday Times are now HTTPS</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[January Transfer Window graphics in The Times]]></title>
            <link>https://medium.com/digital-times/january-transfer-window-graphics-in-the-times-9be3987a5df4?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/9be3987a5df4</guid>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[data-journalism]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Mon, 06 Feb 2017 14:42:27 GMT</pubDate>
            <atom:updated>2017-02-06T16:52:09.943Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NGT_Mp0tRsh-aFic.png" /></figure><p>I never thought I’d talk about football this much, but here you go.</p><p>I spent the last weeks working on a rather massive piece looking at the January Transfer Window, this time of year where extraordinary sums are spent to convince men to come kick in a ball somewhere else.</p><p><a href="https://blog.basilesimon.fr/2017/02/02/january-transfer-window-on-the-times/www.thetimes.co.uk/article/january-transfer-window-s9br65rj6">Read the whole piece and the club-by-club analysis</a> on The Times. Note: you can now register for free and benefit from two free articles.</p><h3>Scatterplots</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DJOJpSqbzBLi1_zl.png" /></figure><p>We elected to set the y-axis domain manually, so it would be identical for both charts. Fixing the y-axis (instead of running it from minimum to maximum) shows how the Oscar transfer to a Chinese club skews the analysis.</p><p>French midfielder Morgan Schneiderlin’s £24m fee seem little in comparison to Oscar’s £60m.</p><h3>Snakey chart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*jA3vqY0y7WZO0ifI.png" /></figure><p>Inspired by <a href="https://blog.basilesimon.fr/2017/02/02/january-transfer-window-on-the-times/www.wsj.com/graphics/elections/2016/how-is-your-state-swinging/">this WSJ piece about swing in US states</a>, we decided to try to flip the coordinates of a rather standard line chart, so to display it vertically.</p><p>We decided to call them <em>Snakey charts</em>. And here’s <a href="https://bl.ocks.org/basilesimon/e72a435920fffaf2f88a74790e076320">an implementation of them in D3.js</a>.</p><p>Oh, and that was also the first time the Times played with <a href="http://1wheel.github.io/swoopy-drag/">annotations</a>. Unconvinced by the traditional bendy arrows, the designers asked us to go for straight lines, with a bubble at the top. Which apprently looks more Times-y.</p><p><em>(Apologies for the Times fonts being lost in the bl.ock…)</em></p><h3>Treemaps</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ukgUGnMP5IUsCjkr.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*gs-MjLsAiFL1n-HJ.png" /></figure><p>To illustrate where players were coming from as well as the positiong they occupy on the pitch, we produced a set of treemaps, complete with hover-click states, and a mobile view. I must say the Times colour palette produced decent looking results.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9be3987a5df4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/january-transfer-window-graphics-in-the-times-9be3987a5df4">January Transfer Window graphics in The Times</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Patiently waiting or hastily prototyping: how we built our latest bespoke interactive in React and…]]></title>
            <link>https://medium.com/digital-times/patiently-waiting-or-hastily-prototyping-how-we-built-our-latest-bespoke-interactive-in-react-and-a432b4900532?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a432b4900532</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Wed, 11 Jan 2017 17:40:05 GMT</pubDate>
            <atom:updated>2017-01-13T17:42:40.021Z</atom:updated>
            <content:encoded><![CDATA[<h3>Patiently waiting or hastily prototyping: how we built our latest bespoke interactive in React and D3</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-2nVNDXlFP-B-PYmFanXqA.png" /></figure><p>Saturday 7th January’s edition of The Times revealed that <a href="http://www.thetimes.co.uk/past-six-days/2017-01-07/news/ambulance-trusts-use-loophole-to-claim-faster-response-times-9mt7hgbp5">ten out of 11 NHS trusts had been accused of routinely manipulating 999 response times</a> by using a loophole to claim that they reached life-threatening emergencies in less than ten seconds.</p><p>In addition to this, results from a Freedom of Information request <a href="http://www.thetimes.co.uk/article/patiently-waiting-ambulance-response-times-in-your-area-gdrw9vwzc">showed that only one of the 13 trusts</a> met the target of eight minutes to respond to life or death calls.</p><p>For us in the dev team, this project was the occasion to try out a few things.</p><h3>A dev-led project</h3><p>In November, I allocated time to start building a prototype of what I thought we could do with the sort of dataset <a href="https://twitter.com/ltrgoddard">Louis</a> was working on. I wanted the basic functionalities sorted before handing it over to Design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*fPvIPnSSdV-pLk-L43xbVQ.png" /><figcaption>Keen observers will note the very FT-looking salmon background colour.</figcaption></figure><p>Framing the project right from the start, from a data and developer perspective, eventually made our life easier. The first iteration, seen above, led the project through its life.</p><p>It is a fine line, however, as we didn’t want to allow this to restrict the story. The goal of my first prototype was to make the rest of the dev work much more efficient.</p><p>And it sort of did. I will spare you the details of the constant back and forth between us, the news desk, and design, and just tell you that while the colours were being decided, the designs were being designed, and the feed back being fed back, I was doing the plumbing and behind-the-scenes work. Parallelising feels great for everyone, since nobody is really waiting any more.</p><p>Having a working prototype early put me in a position where I could also have a pretty good idea of what I wanted on the data side. I worked closely with the data team on tweaking and massaging the data structure to be handy and avoid client-side computations.</p><p>But crucially, I wanted technical feasibility to drive the project, in collaboration with the data and design teams. Bonus points if this could be done in a short amount of time.</p><h3>React and D3 together</h3><p>Upon starting this project, I focused solely on the bar chart. All the code lived in a prototype branch, which was dirty simple HTML and JS files. Once satisfied, I would immediately reimplement everything in React.</p><p>Making it work, by increments.</p><p>Architecturally speaking, a <a href="https://medium.com/@learnreact/container-components-c0e67432e005#.glulmmq89">container</a> was in charge of fetching the data and handling a basic d3.csv() operation, passing a nested data structure down to the chart component:</p><pre>fetchData() {    <br>  const _this = this;    </pre><pre>  d3.csv(&quot;data/data_new2.csv&quot;, function(error, data) {       <br>    // takes our data and groups it by postcode      <br>    // we end up with one row per year      <br>    const data_nest = d3.nest()        <br>      .key(function(d) { return d.postcode})        <br>      .entries(data);       </pre><pre>    _this.setState ({        <br>       dataset: data_nest      <br>    })    <br>  });  <br>}</pre><p>The chart component would render an SVG chart, and on componentDidMount() / componentDidUpdate() call a standard draw() function, in which we wrote our standard D3 code.</p><pre>// Component lifecycle handling  <br>componentDidMount() {    <br>  const dataset = this.props.dataset();  <br>}   </pre><pre>componentDidUpdate() {    <br>  const postcode = this.props.postcode;    <br>  const _this = this;    <br>  for (let i=0; i&lt;this.props.data.length; i++) {      <br>    if(this.props.data[i].key === postcode) {        <br>      _this.draw(this.props.data[i].values, &quot;year&quot;, &quot;median&quot;);      <br>    }    <br>  }</pre><p>Yes, I know. const _this = this; is particularly inelegant. Both React and D3 make quite a big use of this, and an under-rated underscore allows us to jump the scope and hopefully get away with it if there’s no code review.</p><h3>Results: a staggering engagement rate</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*_pVI8zwE-fLXqKF-XtsDpw.png" /></figure><p>This React app was embedded as an in-article component into the articles on both desktop and tablet. Out of 16,000 views, we had more than 14,000 postcode searches. Which amounts to an 87% engagement rate!</p><p>The two suggested postcodes (SE1 and N16) were respectively first and fifth most searched overall. Stratford-upon-Avon (CV37) was curiously the second most searched.</p><p>More to the point, 87% engagement is massive, and it means that our time was well invested in this project.</p><p>A similar “explore our data” React app we put up earlier in December had a single-digit engagement rate:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*9ty6hlR9fHdGZ8Qbc3CVXw.png" /></figure><p>It seems like the wording could have played an important role. From very open choices in the foreign aid app, we then went for the rather direct “enter your postcode”. We did suggest searches for both projects.</p><p><em>By </em><a href="https://twitter.com/katie_gibbons1"><em>Katie Gibbons</em></a><em>, </em><a href="https://twitter.com/ltrgoddard"><em>Louis Goddard</em></a><em>, </em><a href="https://twitter.com/samjoiner"><em>Sam Joiner</em></a><em> and myself.<br>You can read the two stories here through registering and access up to two articles a week for free:</em></p><h3><a href="http://www.thetimes.co.uk/past-six-days/2017-01-07/news/ambulance-trusts-use-loophole-to-claim-faster-response-times-9mt7hgbp5">Ambulance trusts use loophole to claim faster response times</a></h3><h3><a href="http://www.thetimes.co.uk/article/patiently-waiting-ambulance-response-times-in-your-area-gdrw9vwzc">Patiently waiting: ambulance response times in your area</a></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a432b4900532" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/patiently-waiting-or-hastily-prototyping-how-we-built-our-latest-bespoke-interactive-in-react-and-a432b4900532">Patiently waiting or hastily prototyping: how we built our latest bespoke interactive in React and…</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning React in two weeks]]></title>
            <link>https://medium.com/digital-times/learning-react-in-two-weeks-89ade28a67d7?source=rss-2a1ea80539bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/89ade28a67d7</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[journalism]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Basile Simon]]></dc:creator>
            <pubDate>Fri, 14 Oct 2016 13:43:27 GMT</pubDate>
            <atom:updated>2016-10-14T13:43:27.061Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*uEs18QFmWRaLh0mA3bZZ2g.gif" /></figure><p>For those who know as little as I do: the Ryder Cup apparently is a golf competition between teams from Europe and the USA. Despite some jargon in this article, this piece is not about golf at all. If you’re disappointed and want to hear about Team Europe’s prowesses*, I’ll refer you to The Times’ coverage of the competition.</p><p>Indeed, we’ll rather discuss passing data through state and props up and down the components ladder than foursomes, singles and fourballs.</p><p>Because, you see, a week or so into my new position at <em>The Times</em> and <em>Sunday Times</em>, this larger-than-usual project about the Ryder Cup came up, and as some of my colleagues were on leave or booked out, I had to give a hand.</p><p>Maybe I could learn React in the process ; maybe I’ll just have to, an unnamed colleague — Chris Hutchinson — proposed without really leaving me a choice.</p><p>Heck, I figured ; React will go well with my beard, my fixie, and my home-grown sourdough culture.</p><p><em>*note: they lost. 17–11.</em></p><p>A bit of context: <a href="https://facebook.github.io/react/">React.js</a> is an open-source Javascript framework, maintained by Facebook. React is pretty much used everywhere these days, and it embodies the hype in web-dev communities.</p><p>I had a few things to get started on this interactive newsgame project:</p><ul><li>The (brilliant) <a href="https://facebook.github.io/react/docs/tutorial.html">React docs</a></li><li>And a template app implementing a basic ticker component.</li></ul><p>I found the docs to be actually very good and useful. <a href="https://facebook.github.io/react/docs/thinking-in-react.html">“Thinking in React”</a>, in particular, was an excellent read that really allowed me to understand what I’d have to do and how I’d go about doing it.</p><p>Designing a (provisional) components structure was super valuable in order to get to grips with the way to build an app with React.</p><p>I ended up tweaking it a little bit later on in the week, but it remained (surprisingly) stable for a quick day one draft.</p><p>The objective here is to structure your app into smaller chunks with clear and separate purposes. Most of them don’t need to know about each other, and the parents pass on properties and data to their children.</p><p>A navbar at the top, for example, doesn’t need to know anything about what’s happening below it, really. Your main container in charge of rendering and piloting your interactive doesn’t need to know everything that happens inside it at any given moment: you just need to tell it when and how to render which component. See below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q64Gq1jTV-IoibtI25YdMw.jpeg" /></figure><p>As usual, the best way to learn is to try your hand at building something. For me, this was the landing page of <a href="http://thetimes.co.uk/rydercup2016">our game</a>. I started with the bare minimum: a navbar (already built) and a title, just to get the hang of the syntax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*1sPV25KVY-mQlDg42qGvmQ.png" /></figure><p>And so, after building the landing page, it soon became necessary to implement a team-picker functionality, so our users could choose whether they’d captain Europe or the US in the game. It probably took me two days before I got this working and passing the resulting data up to the app — a signal that the game itself had to be launched.</p><p>Don’t just copy and paste or jump to the line you want to edit: re-write everything, from <strong>const React = require(‘react’)</strong>; to creating your <strong>component’s Class()</strong> and its mandatory <strong>render()</strong> method. The rationale behind this is that it will make you memorise these and understand how similarly your components are built.</p><p>Surely enough, as you do so you will gain confidence in seeing your data and variables flow down the fold and the methods you wrote two components up being triggered when you click a tiny button further down your app.</p><p>But do not get over-confident just yet, for your colleagues are looking over your shoulder and reading your commits; elegance and DRY still count.</p><p>I found helpful to refer to the hierarchy I drew on day one and to think about ownership of the different chunks of my project, and about which of these should know what.</p><blockquote>Does the main game view need to know the result at any given moment, or isn’t it better just to let it know the final result, as an instruction for rendering the last result page?</blockquote><p>Knowing where your data must live is helpful when it comes to building the separate parts. In the example above, I decided that the main game view needs not to know the result of every round at any given moment. This decision allowed me to build this game view as a container: it would start the game and let it run its course up to the point where the game would send back a full results list. The reception of this list is the signal that the game is over, and that the results page must be rendered.<br>Oh, and it must be rendered with — guess what? — the results data we just received!</p><p>Next stop on this two-week journey was confusion. React bundles Javascript and HTML into an unfamiliar XML-like soup — that compiles (transpiles?) to Javascript: <a href="https://facebook.github.io/react/docs/jsx-in-depth.html">JSX</a>. If you feel strongly about writing vanilla Javascript, you don’t have to write your code in JSX, but again… why miss out?</p><p>Well, for one, you may be utterly confused for a while about what you’re actually writing. I mean, check this bit out of the official docs:</p><blockquote>Since JSX is JavaScript, identifiers such as class and for are discouraged as XML attribute names. Instead, React DOM components expect DOM property names like className and htmlFor, respectively.</blockquote><p>Learn not to worry. You’re rendering components by writing them as HTML tags — or is it XML? — in your code, and if the Facebook folks think it’s good for you, then so it must be.</p><pre>&lt;GameContainer<br>    userTeam   = {this.state.userTeam}<br>    cpuTeam    = {this.state.cpuTeam}<br>    onFinished = {this.finished}<br>    finished   = {this.state.finished} /&gt;</pre><p>I know. Missing Python yet?</p><p>In the end, your ability to write in React will be a function of your ability to think logically and to slice a problem into smaller chunks. Coming from a non-technical background myself and having picked up a little bit of coding at some point, learning how to think in a functional way and with inheritance over scope in mind was kind of a game-changer. This is to me the single great take-away of these two weeks.</p><p>The whole surrounding ecosystem I did not touch too much. At the Times, Chris has put together a generator that sorts you out with React and Webpack, as well as scaffolding a full project from scratch. Everything was there and ready, and it only took a bit* of pestering Chris to be up and running.</p><p><em>*note: a lot</em></p><p>In short: React’s nice. Get hype. Try it. <a href="https://signalvnoise.com/posts/3124-give-it-five-minutes">Give it five minutes</a>.</p><p><em>P.S. I still ignore much of what golfing is about.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89ade28a67d7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-times/learning-react-in-two-weeks-89ade28a67d7">Learning React in two weeks</a> was originally published in <a href="https://medium.com/digital-times">Digital Times</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>