Added more industries

This commit is contained in:
vjrj 2018-02-27 16:50:26 +01:00
parent dc92574bc3
commit a3bdcb3982
4 changed files with 63 additions and 0 deletions

16
bin/au-dee-npi.awk Executable file
View file

@ -0,0 +1,16 @@
# cat file.csv| ./au-dee-npi.awk | mongoimport -d "fuegos" -c "industries"
gawk -F',' 'NR>1 { \
gsub(/"/,"",$5);
gsub(/"/,"",$6);
gsub(/\t/,"",$13);
gsub(/\t/,"",$14);
gsub(/\x1a/,"",$13);
gsub(/\x1a/,"",$14);
lon = $14+0;
lat = $13+0;
name= $5", "$6
gsub(/^, /,"",name);
if (lon != 0 && lat != 0 && lon > -180 && lon < 180 && lat >= -90 && lat <= 90)
printf("{name:\"%s\",geo:{type:\"Point\",coordinates:[%s,%s]},registry:\"4\"}\n" \
,name,lon,lat)}'

19
bin/ca-godp-npri.awk Executable file
View file

@ -0,0 +1,19 @@
# cat file.csv| ./ca-godp-npri.awk | uniq | mongoimport -d "fuegos" -c "industries"
gawk -F',' 'NR>1 { \
gsub(/"/,"",$3);
gsub(/"/,"",$4);
gsub(/\t/,"",$3);
gsub(/\t/,"",$4);
gsub(/\x1a/,"",$3);
gsub(/\x1a/,"",$4);
lon = $16+0;
lat = $15+0;
if ($3 != $4)
name= $3", "$4
else
name=$3
gsub(/^, /,"",name);
# if (lon != 0 && lat != 0 && lon > -180 && lon < 180 && lat >= -90 && lat <= 90)
printf("{name:\"%s\",geo:{type:\"Point\",coordinates:[%s,%s]},registry:\"3\"}\n" \
,name,lon,lat)}'

View file

@ -6,10 +6,25 @@ import LocationSchema from '/imports/api/Utility/LocationSchema.js';
const Industries = new Mongo.Collection('industries'); const Industries = new Mongo.Collection('industries');
// https://prtr.unece.org/prtr-global-map
// For now using: // For now using:
// AUSTRALIA
// https://data.gov.au/dataset/npi#
//
// EUROPE
// https://www.eea.europa.eu/data-and-maps/data/member-states-reporting-art-7-under-the-european-pollutant-release-and-transfer-register-e-prtr-regulation-16 // https://www.eea.europa.eu/data-and-maps/data/member-states-reporting-art-7-under-the-european-pollutant-release-and-transfer-register-e-prtr-regulation-16
//
// CANADA
// https://www.canada.ca/en/environment-climate-change/services/national-pollutant-release-inventory/tools-resources-data/access.html
//
// USA
// https://www.epa.gov/enviro/epa-frs-facilities-state-single-file-csv-download // https://www.epa.gov/enviro/epa-frs-facilities-state-single-file-csv-download
// TODO:
// http://www.nite.go.jp/
// http://www.retc.cl/datos-retc/
Industries.allow({ Industries.allow({
insert: () => false, insert: () => false,
update: () => false, update: () => false,

View file

@ -145,6 +145,19 @@ Meteor.startup(() => {
} }
}); });
Migrations.add({
version: 10,
up: function siteSettingsAddIndex() {
IndustryRegistries.insert({
_id: '3', name: 'NPRI', agency: 'GCODP', region: 'Canada'
});
IndustryRegistries.insert({
_id: '4', name: 'NPI', agency: 'DEE', region: 'Australia'
});
}
});
// Set createdAt in users & subs // Set createdAt in users & subs
Migrations.migrateTo('latest'); Migrations.migrateTo('latest');