View jhu_initial_pull.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ogr2ogr -overwrite -f "PostGreSQL" | |
PG:"host=$host user=$user dbname=$database password=$pw" | |
'https://services1.arcgis.com/0MSEUqKaxRlEPj5g/ArcGIS/rest/services/ncov_cases_US/FeatureServer/0/query?where=1%3D1&outFields=*&f=geojson&token=' | |
-nln jhu_county |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Drawing; | |
using System.IO; | |
using System.Net; | |
using System.Threading.Tasks; | |
using Amazon.Rekognition; | |
using Amazon.Rekognition.Model; | |
using Newtonsoft.Json; | |
namespace fulcrumRek |
View mvw_cell_tower_names.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Materialized View: public.mvw_cellular_test | |
CREATE MATERIALIZED VIEW public.mvw_cellular_test AS | |
SELECT cellular_test.id, | |
cellular_test.geom, | |
cellular_test.licensee, | |
cellular_test.loccity, | |
us_states_lookup.name AS state_name | |
FROM cellular_test | |
INNER JOIN us_states_lookup ON cellular_test.locstate::text = us_states_lookup.abbr::text |
View mvw_hex_freq_geom.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE MATERIALIZED VIEW public.mvw_cellular_count_geom_hex AS | |
SELECT uuid_generate_v4() AS oid, | |
vw_cellular_count_geom_hex.id, | |
vw_cellular_count_geom_hex.shape, | |
COALESCE(vw_cellular_count_geom_hex.features, 0::bigint)::integer AS features | |
FROM vw_cellular_count_geom_hex | |
WITH DATA; | |
CREATE INDEX sidx_mvw_cellular_count_geom_hex_shape | |
ON public.mvw_cellular_count_geom_hex |
View hex_freq_geom.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE VIEW public.vw_cellular_count_geom_hex AS | |
SELECT us_hex_grid.id, | |
us_hex_grid.shape, | |
vw_cellular_freq_hex.features | |
FROM us_hex_grid | |
LEFT JOIN vw_cellular_freq_hex ON us_hex_grid.id = vw_cellular_freq_hex.id; |
View hew_freq.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT us_hex_grid.id, | |
count(cellular.id) AS features | |
FROM us_hex_grid, | |
cellular | |
WHERE st_contains(us_hex_grid.shape, cellular.geom) | |
GROUP BY us_hex_grid.id; |
View sample_output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ type: 'Feature', | |
geometry: { type: 'Point', coordinates: [ -76.6955, 38.3754 ] }, | |
properties: | |
{ message: 'insert', | |
schema: 'public', | |
table: 'simple_table', | |
id: '12' } } | |
--------------------------------- | |
{"type":"Feature","geometry":{"type":"Point","coordinates":[-76.6955,38.3754]},"properties":{"message":"insert","schema":"public","table":"simple_table","id":"12"}} |
View insert_data.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO simple_table(message, shape) | |
VALUES('test message', ST_GeomFromText('POINT(-76.6955 38.3754)', 4326)); |
View pubsub.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PGPubsub = require('pg-pubsub'); | |
var pubsubInstance = new PGPubsub('postgres://postgres:user@localhost:5432/database'); | |
pubsubInstance.addChannel('actions', function (channelPayload) { | |
console.log(channelPayload); | |
console.log('---------------------------------'); | |
console.log(JSON.stringify(channelPayload)); | |
}); |
View notify_trigger.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TRIGGER sample_table_trigger | |
AFTER INSERT | |
ON public.simple_table | |
FOR EACH ROW | |
EXECUTE PROCEDURE public.sample_notify(); |