Function Repository Resource:

FindFoodUK

Source Notebook

Find information on food businesses in the UK using the Food Standards Agency database

Contributed by: Jon McLoone

ResourceFunction["FindFoodUK"][query]

searches for businesses that provide food in the UK.

Details and Options

The following keys can be provided to the query Association:
"Name"part of the name of the business
"BusinessType"partial or complete substring indicating the business type
"Address"part of the postal address of the business
"Rating"the food hygiene rating provided by the local authority
GeoCenterthe GeoLocation or Entity to search near
GeoRangethe search distance from GeoCenter
Some possible values for "BusinessType" are: "Restaurant/Cafe/Canteen", "Takeaway/sandwich shop", "Caring Premises", "Mobile caterer", "Retailers - other", "Pub/bar/nightclub", "School/college/university", "Hotel/bed & breakfast/guest house", "Other catering premises", "Distributors/Transporters" or "Retailers - supermarkets/hypermarkets".
In England and Wales, food hygiene ratings go from 0 to 5. In Scotland they are "Pass" or "Fail". LessEqualThan[rating] and GreaterEqualThan[rating] are supported.
ResourceFunction["FindFoodUK"] has the following options:
MaxItemsAutomatichow many items to return (large values are capped by the API)
"PageNumber"Automaticused with MaxItems to return records above MaxItems

Examples

Basic Examples (2) 

Find food providing establishments whose names contain a string:

In[1]:=
ResourceFunction["FindFoodUK"][<|"Name" -> "Fat duck"|>]
Out[1]=

Find establishments in a given location:

In[2]:=
GeoGraphics[{PointSize[0.02], Point[ResourceFunction[
     "FindFoodUK"][<|
      GeoCenter -> Entity["City", {"Oxford", "Oxfordshire", "UnitedKingdom"}]|>][
    All, "Coordinates"]]}]
Out[2]=

Scope (3) 

Multiple keys can be combined in a search:

In[3]:=
ResourceFunction[
 "FindFoodUK"][<|"Name" -> "Fat duck", "BusinessType" -> "Restaurant"|>]
Out[3]=

Search by part of an address:

In[4]:=
ResourceFunction["FindFoodUK"][<|"Address" -> "Steeple Aston"|>]
Out[4]=

Search food hygiene rating as given by the Food Standards Agency. In England, Wales and Northern Ireland, this is given as an integer from 0 (urgent improvement required) to 5 (very good). In Scotland, only "Pass" and "Fail" are given:

In[5]:=
ResourceFunction[
 "FindFoodUK"][<|
  GeoCenter -> Entity["City", {"Oxford", "Oxfordshire", "UnitedKingdom"}], "Rating" -> 0|>]
Out[5]=

LessEqualThan and GreaterEqualThan are supported:

In[6]:=
ResourceFunction[
 "FindFoodUK"][<|
  GeoCenter -> Entity["City", {"Oxford", "Oxfordshire", "UnitedKingdom"}], "Rating" -> LessEqualThan[1]|>]
Out[6]=

GeoCenter and GeoRange can search by location. GeoRange is rounded to whole numbers of miles:

In[7]:=
ResourceFunction[
 "FindFoodUK"][<|
  GeoCenter -> Entity["City", {"Hanborough", "Oxfordshire", "UnitedKingdom"}], GeoRange -> 2 Quantity[1, "Miles"]|>]
Out[7]=

Options (2) 

The API that serves FindFoodUK limits the number of records returned to 5000. You can further reduce this number with MaxItems:

In[8]:=
ResourceFunction["FindFoodUK"][<|"BusinessType" -> "Restaurant"|>, MaxItems -> 10]
Out[8]=

To access more items, you must also use the option "PageNumber" to retrieve blocks of data with multiple queries:

In[9]:=
ResourceFunction["FindFoodUK"][<|"BusinessType" -> "Restaurant"|>, MaxItems -> 5, "PageNumber" -> 1]
Out[9]=
In[10]:=
ResourceFunction["FindFoodUK"][<|"BusinessType" -> "Restaurant"|>, MaxItems -> 5, "PageNumber" -> 2]
Out[10]=

Publisher

Jon McLoone

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 22 February 2019

License Information