Reaches Meteor 2.3 building + running against Mongo 3.2, REST smoke test
byte-identical to the 1.6.1.1 baseline (all 12 Flutter endpoints green).
Dead/abandoned Atmosphere packages removed or replaced (the upgrade blockers):
- arkham:comments-ui (no Meteor 2.x build; pinned accounts-password@1.x):
reimplemented the fire-page comments as a React feature:
imports/api/Comments/ (collection, server methods, publication, media
analyzers, new-fire-comment email) + imports/ui/components/Comments/CommentsBox.
Comment text now rendered as safe plain text + image/youtube embed (was
markdown-to-HTML). Wired into Fires.js; sitemaps.js + migration v11 updated
to the new collection. Old Blaze/startup comments files deleted.
- nimble:restivus (REST API; pinned accounts-password@1.3.3, CoffeeScript source
that crashes this build host): vendored as a local package
packages/nimble-restivus with the .coffee precompiled to plain JS and the
accounts-password constraint loosened to 2.x. REST behavior unchanged
(verified by smoke test). This also dropped the entire iron:router stack.
- maximum:server-transform (+ peerlibrary:*, meteorhacks:zones/inject-initial):
unused; removal broke Meteor.publishTransformed in FalsePositives publications
-> replaced with plain Meteor.publish (no transform was configured).
- less, markdown (no source files), and the dead test stack
(meteortesting:mocha, practicalmeteor:chai, xolvio:cleaner) which transitively
pulled coffeescript@1.0.17 — the build plugin that crashed meteor-tool
(node_contextify assertion) on this machine. Removing it unblocked the build.
- fourseven:scss 4.5.4 -> 4.14.1 (node-sass 4.5.3 doesn't build on node 12).
npm-mongo driver at 2.3 is 3.9.x — still compatible with the production Mongo
3.2 replica set.
105 lines
3.3 KiB
JavaScript
105 lines
3.3 KiB
JavaScript
/* global Counter */
|
|
/* eslint-disable import/no-absolute-path */
|
|
/* eslint-disable prefer-arrow-callback */
|
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
import { check } from 'meteor/check';
|
|
import { NumberBetween } from '/imports/modules/server/other-checks';
|
|
import '/imports/startup/server/leaflet-workaround.js';
|
|
import L from 'leaflet';
|
|
import calcUnion from '/imports/ui/components/Maps/SubsUnion/Unify';
|
|
import Industries from '/imports/api/Industries/Industries';
|
|
import FalsePositives from '../FalsePositives';
|
|
|
|
const counter = new Counter('countFalsePositives', FalsePositives.find({}));
|
|
|
|
Meteor.publish('falsePositivesTotal', function total() {
|
|
return counter;
|
|
});
|
|
|
|
export const firesUnion = (fires) => {
|
|
const firesArray = Array.isArray(fires) ? fires : fires.fetch(); // if not is a cursor
|
|
const remap = firesArray.map(function remap(doc) {
|
|
const isNASA = doc.type === 'modis' || doc.type === 'viirs';
|
|
const pixelSize = doc.type === 'viirs' ? 0.375 : 1; // viirs has 375m pixel size, modis 1000m
|
|
// default 1 km for neightbor alerts
|
|
const map = {
|
|
location: { lat: doc.lat, lon: doc.lon },
|
|
distance: isNASA ? doc.scan * pixelSize : 1,
|
|
distanceY: isNASA ? doc.track * pixelSize : 1
|
|
};
|
|
// console.log(map);
|
|
return map;
|
|
});
|
|
const union = calcUnion(L, remap, sub => sub, false);
|
|
return union;
|
|
};
|
|
|
|
export const zoneToUnion = (lat, lon, distance) => {
|
|
const remap = [{ location: { lat, lon }, distance }];
|
|
const union = calcUnion(L, remap, sub => sub, true);
|
|
return union;
|
|
};
|
|
|
|
export const whichAreFalsePositives = (collection, union) => {
|
|
const result = collection.find({
|
|
geo: {
|
|
$geoWithin: {
|
|
$geometry: union[0].geometry
|
|
}
|
|
}
|
|
}, {
|
|
fields: {
|
|
geo: 1,
|
|
// type: 1,
|
|
// when: 1,
|
|
fireId: 1
|
|
}
|
|
});
|
|
|
|
/* console.log(`False positive total: ${falsePos.count()}`);
|
|
console.log(`False positives: ${JSON.stringify(falsePos.fetch())}`); */
|
|
return result;
|
|
};
|
|
|
|
const find = (collection, northEastLng, northEastLat, southWestLng, southWestLat) => {
|
|
const fires = collection.find({
|
|
geo: {
|
|
$geoWithin: {
|
|
$box: [
|
|
[southWestLng, southWestLat],
|
|
[northEastLng, northEastLat]
|
|
]
|
|
}
|
|
}
|
|
}, {
|
|
fields: {
|
|
geo: 1,
|
|
// type: 1,
|
|
// when: 1,
|
|
fireId: 1
|
|
}
|
|
});
|
|
// console.log(`Fires total: ${fires.count()}`);
|
|
return fires;
|
|
};
|
|
|
|
Meteor.publish('falsePositivesMyloc', function falsePositivesInMyLoc(northEastLng, northEastLat, southWestLng, southWestLat) {
|
|
// latitude -90 and 90 and the longitude between -180 and 180
|
|
check(northEastLng, NumberBetween(-180, 180));
|
|
check(southWestLat, NumberBetween(-90, 90));
|
|
check(southWestLng, NumberBetween(-180, 180));
|
|
check(northEastLat, NumberBetween(-90, 90));
|
|
|
|
return find(FalsePositives, northEastLng, northEastLat, southWestLng, southWestLat);
|
|
});
|
|
|
|
Meteor.publish('industriesMyloc', function industriesInMyLoc(northEastLng, northEastLat, southWestLng, southWestLat) {
|
|
// latitude -90 and 90 and the longitude between -180 and 180
|
|
check(northEastLng, NumberBetween(-180, 180));
|
|
check(southWestLat, NumberBetween(-90, 90));
|
|
check(southWestLng, NumberBetween(-180, 180));
|
|
check(northEastLat, NumberBetween(-90, 90));
|
|
|
|
return find(Industries, northEastLng, northEastLat, southWestLng, southWestLat);
|
|
});
|