Myself and my collaborators have a new publication in the Journal of Environmental Policy and Planning titled “Modes of Governing Canadian Waste Management: a case study of Metro Vancouver’s energy-from-waste controversy”
What it does
iMessageR is a small and simple package for the R statistics package that allows a user to send iMessages to any phone number or email address registered with iMessage service.
I know that there are a number of similar ways that this can be done, such as making a system call to
There are also a number of packages for sending messages from R using gmail. This is great but also requires some amount of additional configuration in R in order to function. I figured iMessages was the lowest friction option for Mac and iOS users.
I suspect this will be especially helpful for R users who run lengthy analyses and would like an alert to their phone (or any other iMessage capable device) indicating when the analysis is complete.
Since you can use this function any number of times and customize the message, you could even take things one step further and use iMessageR to help with debugging. For example, you could insert calls to this function at different locations in your script to indicate progress through your program. Alternatively you could insert it into a trycatch() or some other exception-handling system to alert you of an error.
Since iMessages is available to any user with a Mac, whether or not that user has an iPhone, iMessageR could be used by a Mac user regardless of the type of phone they use. Without an iPhone, the user would, of course, only be able to receive notifications on their Mac (or any other Mac also configured with that iMessage email address or phone number). So while an iPhone (or iPod Touch) is ideal in order to receive the most benefit, even Mac users without an iOS device will likely find some utility here.
The iMessageR package can be downloaded directly from cran or can be installed from within R:
This will give you access to the function
send.imessage(recipient: STRING, message: STRING)
- If the message string contains single or double quotes, the function will fail.
- If the email address or phone number is incorrect or unrecognized, there is no notice to the user.
I’d like to try to make this package more accessible to different platforms. I hope to add support for a wider range of platforms by adding options for different services. Presently I am thinking of Pushbullet or WhatsApp but this will depend on the level of API integration those services expose.
I should note that I am neither a computer programmer nor a habitual R user, so this is very new territory for me in a number of ways! As such I will try and address issues and add enhancements in my spare time, as my nascent skills allow.
Connect with me
Connect with me on github where you can submit an issue or fork away!
Or reach out to me on twitter: @scottisloud.
The CBC’s Marketplace is focusing on retail food waste this week. Yesterday we heard from a former Walmart contractor that a ‘heartbreaking’ amount of food is trashed every day. Today, Marketplace reveals its findings from 12 days of sifting through Walmart dumpsters.
This is a great scoop for the CBC and I think this kind of coverage is just what is needed to bring light to a shameful problem. Food retail accounts for 10% of the food wasted in Canada. This is a small slice of the pie, but in absolute terms, it’s a substantial amount of food (it is, after all, a very big pie). These CBC stories can stand on their own, but I wanted to add some additional commentary and nuance based on some of my experience and research on food waste.
Marketplace found cartons of milk days ahead of their best-before date, and Parmesan cheese with months left before it needed to be thrown away.
Assuming these products are not contaminated or otherwise unsafe, this is troubling. Best-before dates on both of these products are largely unrelated to safety. A solid piece of Parmesan cheese can be safely stored for a very long time. Barring any cross-contamination in a retailer’s or consumer’s fridge, the worst that will happen is the growth of some mould, which is a quality, not a safety, issue, and will not cause someone harm.
Mevawala, formerly with one of the company’s Edmonton stores, says if a piece of fruit or vegetable didn’t look perfect, it had to be thrown in the trash.
Moreover, cosmetic imperfections are a reflection of arbitrary quality standards that are a large reason food is disposed of at the retail level. Retailers will claim that these arbitrary quality standards are the fault of consumers, but this is untrue. This is a marketing failure. There is demand for these products, they just need to be marketed correctly. Loblaws is beginning to dip their toe into this market segment with imperfect apples marketed under their No Name brand. This is also failure of retailers to capitalize on their own value-added departments. These cosmetically imperfect produce items, if not sold to consumers directly, should become part of value-added products in-store. Fruit salads, vegetable trays, pre-chopped vegetables, etc. could all be made from imperfect products.
Over the course of more than 12 visits to the stores, Marketplace staff repeatedly found produce, baked goods, frozen foods, meat and dairy products. Most of the food was still in its packaging, rather than separated for composting.
This quote highlights a significant issue with how retail food waste is often handled. In many cases retailers want to get ‘unsaleable’ goods (however they define that) off their shelves and our of their warehouse as quickly as possible. Typically this means disposing of it directly into their dumpsters or compactors. The above quote draws attention to several problems: all that organic material ends up in landfill where it is a significant source of methane; all that packaging is, to the dismay of brand owners, in-tact and visible to anyone willing to dip their nose into a dumpster or landfill; and that packaging, the majority of which is recyclable, also ends up in landfill.
Retailers regularly fail to take advantage of the services of depackagers. Depackagers, as the name implies, remove food from its packaging. They then send the food to anaerobic digestion, rendering, or some other destination where it is at least marginally more valuable and less environmentally harmful than landfill. They also shred and recycling the packaging, which conveniently obscures the branding (not that that is needed, as most depackagers are very security conscious and discreet, unlike the dumpster!). There is unused depackaging capacity in southern Ontario, and most retailers are not taking advantage of these services because:
- It is disruptive – they are at the mercy of the depackager to pick up products which may not be as fast as the retailer would like. It’s hard to beat the convenience of tossing unsaleable goods directly and immediately into the dumpster or compactor.
- It’s another contract to juggle in addition to standard waste collection.
- It may not be available at 100% of a retail chain’s locations which makes uniform policy and best practice for store managers more difficult.
- For some retailers it just isn’t even a priority, it’s not even on the agenda.
This needs to change. While we need to reduce food waste generation upstream, there will always be some amount of downstream waste. That downstream waste could be handled better, and there’s possibility for that to happen today.
Also in the garbage: bottles of water, frozen cherries that were still cold and tubs of margarine. In a statement, Walmart said it believes the food Marketplace found was unsafe for consumption. In many cases, however, the food was well before its best-before date and appeared to be fresh. Or, if it needed refrigeration or freezing, the food found was still cold.
I have to take issue with the CBC commentary here. Coldness, best-before dates, and appearance are all terrible indicators of safety. None of the indicators listed in the quote provide any particularly useful data to make a decent risk management decision. Best-before dates are often arbitrary, typically refer to quality (at their best) and not safety, and can’t account for variability in storage temperature and handling. Further to this point, just because something that is meant to be cold is cold, doesn’t mean it is safe. There’s simply not enough information for a gleaner to know how long the product has been at a given temperature or if there’s a hazard that can’t be seen.
Our senses are pretty good judges of quality: we can taste soured milk, which is perfectly safe to eat, if perhaps a bit unpleasant. But we can’t taste Hepatitis in still-frozen berries, or an undeclared allergen in a baked good that might result in illness or death if consumed unknowingly by a gleaner or someone that gleaner feeds, or a fresh apple contaminated with Listeria.The reality is, the majority of things that are going to make us sick cannot be seen, smelled, felt, or tasted. Our eyes, fingers, noses, and tongues are bad judges of food safety.
Dumpster-divers, gleaners, freegans, are doing good work recovering perfectly edible food, but it is really risky business unless you take great care (and even then, still risky). There are ways to reduce risks, such as keeping an eye on recall notices before gleaning and becoming familiar with which products are lower risk than others when temperature history and handling are unknowns.
But the reality is, in instances like this, products that look perfectly good may be perfectly bad. Products that are perfectly good may come into contact with harmful products and show no signs of that contact, resulting in cross-contamination. Again, these are things we cannot detect with our own senses. As long as legitimately good food and food recalled for posing a health threat are intermingled in the same bins, it’s impossible to, with any degree of certainty, separate the two.
But even the people in charge don’t necessarily know the difference between quality and safety:
“On some occasions, food which has not passed its best-before date is deemed unsafe for consumption,” Walmart said in its statement. “As a rule we don’t place fresh food items on display for sale if the quality is not acceptable.”
Here, the Walmart spokesperson is dangerously conflating safety and quality. There is a grand canyon that separates what counts as “safe food” and food that possesses “acceptable quality”. A statement like this erroneously reproduces the notion that quality is a safety issue, which is is not (though they may, in some cases be related). It also further occludes the rationale that underlies Walmart’s disposal practice: Is the food in the dumpster dangerous, or does it merely fail to meet some perceived quality expectation? Dangerous food should never be made, and if it is, shouldn’t be sold to consumers. Food that deviates from quality expectations but is safe should be sold and consumed by humans.
Marketplace staff looked for food waste at all the major retailers, including Costco, Metro, Sobeys, Loblaws and Walmart. While staffers found bins full of food at some Walmart locations, other chains had compactors making it impossible to see what they throw out.
This is some seriously bad practice from Walmart. No brand owner wants their products on display to anyone who walks to the back of a store. Retailers also generally “field destroy” recalled products, that is, when there is a product recall, they dispose of it on-site rather than send it back up through the supply chain. Compactors offer security from both a brand and public health perspective inasmuch as dangerous products are destroyed and inaccessible (though, of course, the use of a depackaging service is also secure and environmentally superior, but not typically used by retailers when handling recalled products). An unfortunate side-effect of compactors is that they prohibit informal recovery by gleaners and freegans, but the tradeoff is marginally improved brand and public health security. Walmart needs to prioritize security and switch to compactors. They’re playing a dangerous game with open dumpsters (though, as the CBC story notes, they’ve now started locking those dumpsters at least).
Food waste is a pernicious problem. We waste way too much food. What we can do today is reduce the impact of that waste. However, what is really needed is upstream solutions that reduce the overall generation of food waste. This means reducing contamination and safety problems that lead to product recalls. This means reducing over-production. This means reducing knee-jerk price-hikes that result in surpluses and subsequent blow-outs or disposal. It means disrupting the reproduction of arbitrary quality standards. We have a long way to go towards reducing food waste across the value chain, but what CBC is showing us with these stories is that there are some immediate steps that can be taken to reduce food waste and the attending environmental harm.
The September 1st deadline for public comments on proposed legislation that would allow firms to irradiate beef draws near. While the previous effort to bring irradiation to the beef industry in 2002 failed, there is hope that the events of the intervening 14 years might have shifted public attitudes. However criticisms of the potential plan are already emerging and not just from consumers. While it might be intuitive to assume that the beef industry in Canada is united in their support for this move – it was industry stakeholders who pushed for the first consult in 2002, and again this year – the beef industry itself is divided.
The National Farmers Union (NFU), representing family-owned farms including cattle farms in Canada, has submitted a letter to Health Canada objecting to the potential changes. Their primary concerns are economic. The NFU are concerned that irradiation equipment would be too expensive for smaller beef packers, thus driving them out of business, while JBS and Cargill will easily distribute the capital outlays for irradiation equipment across their sprawling businesses. The ensuing consolidation of an already heavily consolidated industry would further establish Cargill and JBS, who already process 90% of the federally registered beef in Canada, as the only buyers of beef to whom farmers may sell their cattle. Such oligopolistic conditions, they argue, will ultimately produce downward price pressure. This would mean less money per head for farmers. It will limit the number packers to whom cattle ranchers could sell to and thus limit competition, and would further reduce already rather limited consumer choice.
Another concern is that the proposed change would allow for the importing of irradiated beef from the United States where beef processors have been permitted to irradiate beef for over a decade. Not only would this contribute to further downward price pressure on farmers to compete with cheap imported beef, it would displace domestically slaughtered beef and swaths slaughter and packing jobs. The NFU states that because the proposed Canadian regulation is nearly identical to that in the US that “it would effectively erase the Canadian border in regard to ground beef”.
While I am sympathetic to these concerns and I am an enthusiastic proponent of local, small-scale agriculture and family farms, there are some important considerations to make here. The first is that the proposed legislation allows beef processors to irradiate beef should they choose to, it does not require that beef producers irradiate their product. The new legislation isn’t going to suddenly put small firms out of compliance with the law. This is only a problem if irradiated beef is met with massive consumer demand and by not irradiating smaller processors would be severely disadvantaged.
With respect to imports, the majority of beef in the United States currently is not irradiated and thus would not be precluded from import anyway. Harmonizing legislation between Canada and the United States would pertain to the very small percent of US beef that is irradiated, very likely a drop in the bucket overall and not likely to pose an immediate threat to Canadian firms.
It might then be argued that while the proposed legislation doesn’t require irradiation, market demand will serve as an sort of proxy whereby if any firm that wants to compete they must irradiate. This seems to assume widespread, maybe even pent up demand for irradiated beef. The evidence from the United States, however, suggests demand is limited. Irradiated beef is available only under a hand full of brand names at a small number of retailers and restaurants. As I argue in a past post there are also unanswered question regarding what the market impacts are of irradiated beef. Will there be an “irradiated ghetto” off in the corner of the meat case touched by consumers only when the the grocer is out of the non-irradiated cut the consumer desires? Will brands begin competing on the premise of their beef being “non-irradiated” or vice-versa? Will it not matter and will consumers simply ignore the label because they don’t care, grabbing whichever tray of beef they need for tonight’s dinner regardless of the presence of a radura logo?
Given all of this, I can’t help but see the economic concerns of the NFU as a strawman. As I said before, beef producers and the government agencies that support them have an uphill battle. In over a decade in the US, irradiated beef is not a blockbuster, and I don’t think it will be in Canada either.
The NFU also raised concerns that eaters in institutional settings are not positioned to know whether the beef they are served is irradiated or not. Those who prepare the food would know – they’d see the labels on the boxes of course – but those labels won’t leave the kitchen. This is only a problem for human health or food safety if the considerable evidence indicating that irradiation of food does not pose a threat to consumers’ health is ignored. Even if there is a remote chance of human health impacts, there’s a very immediate and potentially fatal threat from fecal pathogens. This does point to a shortcoming with the labelling requirements in that in an institutional setting the labels are largely obscured from institutional eaters. This is something that should be addressed (most likely this will be in the hands of institutions themselves) in the interest of maximizing transparency for all consumers, but it is not an issue of public health or food safety. I imagine poor food handling practices at these retirement homes and schools are a far larger and far more immediate threat to the vulnerable populations that dine in those institutions than any possible threat posed by irradiation. Moreover, I suspect the majority of those institutional eaters have been consuming irradiated spices and onions for years without harm. If we are really concerned about allowing institutional eaters to make better risk management decisions, perhaps we should start posting food safety inspection scores on the doors of restaurants and institutions.
I am, however, sympathetic to the other concerns articulated by the NFU related to food safety. The NFUS are concerned that irradiation may “be used as a final control point to kill some (but not necessarily all) pathogens…that occurs when processing high volumes at high speeds without adequate inspection of lines”. I too am concerned about the possibility of irradiation becoming a food safety crutch. There are commentators who claim “we have run out of regulatory power”, and that it is a necessity to deal with ubiquitous pathogens in the context of a regulatory system that has exhausted all possible options. I couldn’t disagree more with this idea that we’ve run out of regulatory power. The XL Foods recall didn’t take place because we’re at the end of our regulatory rope; it happened because both the CFIA and XL Foods dropped the ball. There is room to improve food safety regulation, the decision is whether that is something that the government wants to do. Claims that we’ve run out of regulatory power is really a disguised claim to shunt responsibility for food safety away from government.
Further to my point, recent changes made by Walmart to reduce the presence of Salmonella and Campylobacter on their chicken have been fairly effective. There is room to improve food safety without irradiation, and Walmart has done it on its own – not in order to comply with direct government regulations. This isn’t to suggest we forbid irradiation, just that there is room to improve food safety upstream given the will to do so, and such improvements can limit how heavily we lean on irradiation as a final kill step. The NFU also point out that while irradiation is permitted in the United States, there have nevertheless been no shortage of outbreaks attributed to pathogen-contaminated beef. Were it to become a crutch it may not be the most reliable.
If Canada’s food safety system hasn’t shown itself to be so easily fallible, and if industry didn’t seem to capable of flouting their commitment to it, I might feel differently. As it stands we are clearly not at the end of the regulatory rope. When Canada’s largest beef processor fails to comply to existing food safety requirements and persistently fails to address corrective action requests from the CFIA who then does nothing to intervene, the idea of irradiation becoming a crutch doesn’t seem too far fetched.
What I do think is that irradiation should be available as a tool in a company’s food safety toolbox. If irradiation can contribute to the reduction of foodborne illness outbreaks and wasteful food recalls, then I think the benefits outweigh the costs. That said, my support is qualified. Any allowance of irradiation needs to coincide with more robust regulation, monitoring, and enforcement. It behooves regulators to demonstrate they can compel those they regulate to make improvements. Walmart has shown that companies have room to improve without relying on radiation, and regulators need to push the rest of the industry to follow suit. (For a similar sentiment, see Coral Beach’s recent article on Food Safety news)
Overall, I don’t think that irradiation poses the economic threat that the NFU assumes it will. Strawman. While I advocate for consumer transparency, I think the NFU’s concerns about the safety of institutional eaters is overblown. However, I share the NFU’s fear of a lack of effort on the part of industry and its regulators to maximize the effectiveness of existing options. Industry has demonstrated how much more can be done to improve food safety. There are a lot of unanswered questions about what irradiation might mean for the beef industry, but I don’t believe it is the threat it is being made out to be. In fact, I suspect any impact, positive or negative, will be disappointingly modest.
Stericycle this month published their Q2 report on product recalls in the United States, which they’ve called “Tainted Table”. I love these quarterly reports from Stericycle, and I think this one has some interesting bits worth highlighting.
In Q2 there were over 80 times more FDA recalls (measured in “units”) and 45 times more USDA recalls (measured in pounds) compared to Q1. The USDA recalled 1.1 million pounds in Q1, and a whopping 53.3 million pounds in Q2. (I always appreciated the USDA’s use of mass compared to the FDA’s reliance on “units”).
Of the FDA recalls, there were more pathogen-related recalls than in any of the past two years. This could likely be a result of increased testing and a large number of recalls linked to past outbreaks thanks to whole genome sequencing.
The report also highlights the role played by the “multiplier effect”, which I have written about here. Their example of the sunflower seed recalls that resulted in over 600,000 units of product being recalled highlights this multiplier effect well. Not only were many brands of plain-ol’ sunflower seeds affected, so were cereals, granola bars, and store-prepared salads. It was a mess. It shows one of the consequences of the immense consolidation and centralization of certain aspects of the food industry as well as just how serious “ingredient” recalls can be.
More recently, and not covered by the report, the recent E. coli contaminated flour recalls (see here, here, here, here, and here, and the original recall here) demonstrates this phenomenon well. The spread of this recall across so many different brands and products is quite remarkable. The original recall took place on July 1, and here we are 6 weeks later and we are still seeing recalls related to this flour.
It’s shaping up to be an interesting year for recalls in the United States. Looking forward to Q3!
A spat of spice recalls have taken place over the last few weeks in the United States.
The JM recall seems to be small, affecting only small amount of product from a Georgia farmers’ market. The Gel recall expanded considerably over time, from a single lot to several different brand labels and lots. The Oriental Packing Company has recalled a whopping 188.5 tons of the stuff. While there doesn’t appear to be any official statement to suggest a link between the two turmeric recalls, nor between the turmeric and the curry powder, it seems likely to me that there is a single common source for all of them. Turmeric frequently appears in large quantities in curry powder, in part because it’s a traditional ingredient in many Indian spice blends, but also because it is relatively cheap compared to other common Indian spices and can bulk up a curry powder nicely.
There are a couple of possible explanations for these elevated lead levels. Since most spices are sold wholesale by mass, the addition of a substance like lead oxide could be a way to add bulk and thus increase margins. This is similar to a comment made in a blog post at The Acheson Group (which has subsequently been removed) suggesting the possibility that the spat of spice recalls in 2014-2015 due to the presence of peanut powder was also economically motivated food fraud. Peanut powder and ground cumin look awfully similar after all. The addition of lead oxide is, in fact, an old habit of less-than-scrupulous spice millers for a good long time. If this turns out to be the cause of the current contamination, it’s a reminder that old food habits die hard.
Another possible explanation is that turmeric, which is a rhizome like ginger, could have taken up lead that had (naturally or unnaturally) been present in the soil. The ability for plants to take up lead has been documented by the University of Minnesota.
Either way, a couple tons of turmeric and cumin powder are headed towards destruction. I wouldn’t be surprised if we see a recall in Canada for turmeric or turmeric-based products in the coming weeks, similar to the sprawl of the nut-allergen cumin last year.
Lidl has recalled some of its yoghurt and peanuts because the packets don't warn customers that they contain milk and nuts.
Allergen labels are immensely important in ensuring the safety of customers with allergies. No doubt there needs to be close monitoring to ensure that consumers with allergies can shop with confidence. Customers with allergies aren’t dummies. This recall is borderline insulting.
Either that or it’s a scary sign of just how far processed food has come and that consumers have now been trained to know that just because the label says the product is “nuts and yogurt” doesn’t mean it contains either of those things.
All of the recalled ground beef was produced on July 26. They all have the establishment number “EST. 337” printed inside the USDA mark or on the product packaging seam.
Note that this 30 tons of beef in a single day of production. I have always been curious about the impact of production scale on the size of food recalls. Being able to narrow down the affected product to a specific day of production – or detect an issue and resolve it within a day – is fairly remarkable. However, if a single day of production is 30 tons of product, perhaps we need to narrow this window even further. Food processors are stunningly efficient at making massive quantities of product very quickly. It seems to me that there is a need to step up detection and traceability to keep pace.
Regarding the recent signing of the DARK act:
In fact, according to Obama’s own Food and Drug Administration (FDA), if enacted, the bill would exempt most current GMO foods from being labeled at all. The FDA further commented that it “may be difficult” for any GMO food to qualify for labeling under the bill. And even for any GE foods that might be covered, the bill allows for food to be “labeled” through a digital system of QR codes that can only be accessed if the consumer has a smart phone and reliable internet connectivity.
This is a shame. Regardless of how you feel about GMOs, denying choice and transparency is a bad move. When it comes down to it, no regulation is sometimes better than bad regulation, as it stands this flaccid new regulation just consumes resources with no returns.
My regular reader will have noticed recent change to the appearance of Recall These Thoughts. For the second time in one year I’ve changed blog platforms. You, dear reader, will likely remember the move away from Squarespace over to Wordpress. This was motivated as both a cost-saving measure and a way to gain a bit of additional flexibility. I love Squarespace, but a big part of having a blog for me is having a little toy to tinker with. Wordpress offered a bit more of that type of freedom.
But Wordpress has its downsides. For one, it was very difficult to modify templates. The CSS was was already condensed and extremely complex – thus largely inscrutable. This made some template modifications difficult to make. Moreover, if you neglected to make a child template prior to making all of your changes (as I did) and an update is issued to your template, you’re in for a world of hurt.
I also found the backend to be “weighty”. There was a lot of stuff back there, a lot of things I didn’t need. The editor was a bit fussy, it didn’t always handle markdown very well, and it really just offered more than I needed.
Overall Wordpress was just too much and not really that fun to play with. It is a powerful and popular platform, but it didn’t offer me the type of tinkering I really yearned for. I wanted something a little simpler, a little faster, a little more fun to play with for this amateur coder.
I had tried to install Jekyll about a year ago. Jekyll is a Ruby and Liquid based static website generator. Having no familiarity with Ruby and only the most basic competence with the command line, I got hung up and frustrated with Jekyll.
Fast forward about a year. During an evening of being unable to sleep I poked around and worked on installing Jekyll once more. Sure enough I was able to get it installed, located a template that would make a good foundation for my site, and off I went learning and tweaking. At this point things moved quickly. While unfamiliar with SASS as a styling language, it’s a lot like CSS with which I am extremely familiar. I found my way around the single CSS file quickly and learned with little trouble the classes that were used in the various layout files.
I also got the hang of the Liquid variables that Jekyll uses, making theme modification even easier. I even went ahead and created a few conditional loops to auto-detect when I make a “linked list” style post and have it format that correctly and offer a permalink.
I used Ben Balter’s Jekyll Exporter Wordpress plugin to export my posts from Wordpress, which it did with amazing accuracy. There were a few things that needed tidying that got a bit messed up converting from HTML to markdown, but most of that could be accomplished using find and replace. Beyond that I had all my old posts locked and loaded, my theme thoroughly customized, and was ready to pull the trigger. I synced the built site from my development directory to my host, and the new site launched with only a couple hitches.
So what is the payoff? The biggest payoff is, perhaps, that the site loads about 4X faster and is about 1/8th the size. This is important for me because I have extremely cheap hosting, and I value the experience of my one regular reader.
The other payoff is portability. My posts are written in markdown and live in a directory on my computer. They are not in an SQL database with a bunch of auto-generated HTML. While there are ways to write and backup posts for Wordpress, Jekyll’s workflow has easy writing, local storage, and portability built into the process.
There is still work to be done, for sure. I have to migrate some more content over, fix a few posts that broke way back during the Squarespace migration, and I have a lot of little styling tweaks. But overall I’m very pleased with Jekyll and I look forward to making lots more content to enjoy.