Skip to content

Commit

Permalink
Merge pull request #1047 from DataUSA/geoservice-update
Browse files Browse the repository at this point in the history
Geo Service update
  • Loading branch information
nicolasnetz committed Sep 13, 2023
2 parents 0d20315 + 842fc6d commit e21adbb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions api/crosswalks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const naics2io = loadJSON("/static/data/pums_naics_to_iocode.json");
const naics2bls = loadJSON("/static/data/pums_bls_industry_crosswalk.json");
const soc2bls = loadJSON("/static/data/pums_bls_occupation_crosswalk.json");

const {CANON_API, CANON_LOGICLAYER_CUBE} = process.env;
const {CANON_API, CANON_GEOSERVICE_API} = process.env;
const geoOrder = ["Nation", "State", "County", "MSA", "Place", "PUMA"];

module.exports = function(app) {
Expand Down Expand Up @@ -43,7 +43,7 @@ module.exports = function(app) {
drilldown = "MSA-Tract";
}
else {
const url = `${CANON_LOGICLAYER_CUBE}/geoservice-api/relations/intersects/${id}?targetLevels=state&overlapSize=true`;
const url = `${CANON_GEOSERVICE_API}/api/relations/intersects/${id}?targetLevels=state&overlapSize=true`;
const cuts = await axios.get(url)
.then(resp => resp.data)
.then(resp => {
Expand Down Expand Up @@ -101,7 +101,7 @@ module.exports = function(app) {
level = "State";
}
else if (prefix === "310") {
const url = `${CANON_LOGICLAYER_CUBE}/geoservice-api/relations/intersects/${id}?targetLevels=state&overlapSize=true`;
const url = `${CANON_GEOSERVICE_API}/api/relations/intersects/${id}?targetLevels=state&overlapSize=true`;
const parents = await axios.get(url)
.then(resp => resp.data)
.then(resp => {
Expand Down Expand Up @@ -199,8 +199,8 @@ module.exports = function(app) {
: false;

const url = targetLevels
? `${CANON_LOGICLAYER_CUBE}/geoservice-api/relations/intersects/${id}?targetLevels=${targetLevels}`
: `${CANON_LOGICLAYER_CUBE}/geoservice-api/relations/intersects/${id}`;
? `${CANON_GEOSERVICE_API}/api/relations/intersects/${id}?targetLevels=${targetLevels}`
: `${CANON_GEOSERVICE_API}/api/relations/intersects/${id}`;

let ids = await axios.get(url)
.then(resp => resp.data)
Expand Down Expand Up @@ -487,8 +487,8 @@ module.exports = function(app) {
: false;

const url = targetLevels
? `${CANON_LOGICLAYER_CUBE}/geoservice-api/relations/intersects/${attr.id}?targetLevels=${targetLevels}&overlapSize=true`
: `${CANON_LOGICLAYER_CUBE}/geoservice-api/relations/intersects/${attr.id}&overlapSize=true`;
? `${CANON_GEOSERVICE_API}/api/relations/intersects/${attr.id}?targetLevels=${targetLevels}&overlapSize=true`
: `${CANON_GEOSERVICE_API}/api/relations/intersects/${attr.id}&overlapSize=true`;

const parents = await axios.get(url)
.then(resp => resp.data)
Expand Down Expand Up @@ -562,7 +562,7 @@ module.exports = function(app) {

if (dimension === "Geography") {

const url = `${CANON_LOGICLAYER_CUBE}/geoservice-api/neighbors/${id}`;
const url = `${CANON_GEOSERVICE_API}/api/neighbors/${id}`;
const neighbors = await axios.get(url)
.then(resp => resp.data)
.then(resp => {
Expand Down
4 changes: 2 additions & 2 deletions api/election.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const candidates = {
representative: loadJSON("/static/data/representatives.json")
};

const {CANON_LOGICLAYER_CUBE} = process.env;
const {CANON_GEOSERVICE_API} = process.env;

module.exports = function(app) {

Expand All @@ -24,7 +24,7 @@ module.exports = function(app) {

if (!geo.startsWith("040")) {
const targetLevels = type === "senator" ? "state" : "state,congressionaldistrict";
const url = `${CANON_LOGICLAYER_CUBE}/geoservice-api/relations/intersects/${geo}?targetLevels=${targetLevels}&overlapSize=true`;
const url = `${CANON_GEOSERVICE_API}/api/relations/intersects/${geo}?targetLevels=${targetLevels}&overlapSize=true`;
const parents = await axios.get(url)
.then(resp => resp.data)
.then(resp => {
Expand Down
6 changes: 3 additions & 3 deletions canon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const d3Array = require("d3-array");

const {CANON_API, CANON_LOGICLAYER_CUBE} = process ? process.env : {};
const {CANON_API, CANON_GEOSERVICE_API} = process ? process.env : {};

const geoRelations = {
children: {
Expand All @@ -19,7 +19,7 @@ const geoRelations = {
url: id => `${CANON_API}/api/geo/childrenCounty/${id}/`
},
neighbors: {
url: id => `${CANON_LOGICLAYER_CUBE}/geoservice-api/neighbors/${id}`,
url: id => `${CANON_GEOSERVICE_API}/api/neighbors/${id}`,
callback: resp => {
if (resp.error) {
console.error("[geoservice error]");
Expand Down Expand Up @@ -148,7 +148,7 @@ module.exports = {
},
url: (id, level) => {
const targetLevel = level.toLowerCase();
return `${CANON_LOGICLAYER_CUBE}/geoservice-api/relations/intersects/${id}?targetLevels=${targetLevel}&overlapSize=true`;
return `${CANON_GEOSERVICE_API}/api/relations/intersects/${id}?targetLevels=${targetLevel}&overlapSize=true`;
},
callback: resp => {
let arr = [];
Expand Down

0 comments on commit e21adbb

Please sign in to comment.