gregrs-uk / python-fhrs-osm

Python tools and Leaflet maps for downloading, comparing and visualising Food Hygiene Rating Scheme (FHRS) and OpenStreetMap data
http://gregrs.dev.openstreetmap.org/fhrs/
GNU General Public License v3.0
8 stars 2 forks source link

Stirling is missing #43

Closed gregrs-uk closed 7 years ago

gregrs-uk commented 7 years ago

fitzsimons reports that Stirling is missing from the list of districts.

gregrs-uk commented 7 years ago
select gid, name from districts where name like 'Stirling';
 gid |   name
-----+----------
 334 | Stirling
(1 row)
select count("FHRSID") from fhrs_establishments where district_id = 334;
 count
-------
     9
(1 row)

Looks like only 9 establishments are within the BoundaryLine district and the current threshold for inclusion is 10.

select count("FHRSID"), district_id, name from fhrs_establishments
left join districts on fhrs_establishments.district_id = districts.gid
where "LocalAuthorityCode" = 790 group by district_id, name;
 count | district_id |     name
-------+-------------+--------------
  1263 |             |
     4 |         334 | Stirling
     1 |         303 | Glasgow City
(3 rows)

Something fishy going on as virtually all the Stirling FHRS records seem to fall outside a BoundaryLine district.

Looking at the establishments table, these FHRS establishments don't have a location associated with them so the problem is with the underlying data fetched from the FHRS API.

gregrs-uk commented 7 years ago

Number of FHRS establishments by BoundaryLine district:

 count |                     name
-------+----------------------------------------------
     1 | Dumfries and Galloway
     1 | Blaenau Gwent - Blaenau Gwent
     9 | Stirling
    20 | Inverclyde
    71 | Isles of Scilly

Other districts above also appear to have problems with FHRS data, but Isles of Scilly are correct.