Skip to content

Commit

Permalink
Use all place types in contained in (child) place relation (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
shifucun authored Jul 23, 2020
1 parent 4448a9d commit 3315dfa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion server/routes/api/place.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def child_fetch(dcid):
'dcid': place['dcid'],
'pop': pop.get(place['dcid'], 0)
})
break
return result


Expand Down
17 changes: 12 additions & 5 deletions static/js/browser/kg.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,6 @@ function renderKGPage(
(t) => t["objectId"] == dcid && t["subjectId"] != dcid
);
inArcs = inArcs.map((t) => {
if (t["subjectTypes"]) {
t["subjectType"] = t["subjectTypes"][0];
}
t["dcid"] = t["subjectId"];
t["prov"] = t["provenanceId"];
t["src"] = provDomain[t["provenanceId"]];
Expand All @@ -694,10 +691,20 @@ function renderKGPage(
// Do not show observation in in-arcs as they are handled later.
inArcs = inArcs.filter((t) => t["subjectType"] != "Observation");

const inArcsGroup = _.groupBy(inArcs, (arc) => arc["subjectType"]);
let inArcsGroup = {};
for (let inArc of inArcs) {
for (let sType of inArc["subjectTypes"]) {
if (!(sType in inArcsGroup)) {
inArcsGroup[sType] = [];
}
inArcsGroup[sType].push(inArc);
}
}

const inArcsGroupsElem = document.getElementById("in-arcs-groups");
for (let parentType in inArcsGroup) {
let sortedTypes = Object.keys(inArcsGroup);
sortedTypes.sort();
for (const parentType of sortedTypes) {
if (util.isPopulation(parentType)) continue;
const nodesByPred = _.groupBy(
inArcsGroup[parentType],
Expand Down
2 changes: 1 addition & 1 deletion static/js/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const POPULATION = "StatisticalPopulation";
const OBSERVATION = "Observation";
const COMPARATIVE_OBSERVATION = "ComparativeObservation";

const MAX_CARD_HEIGHT = 600;
const MAX_CARD_HEIGHT = 400;

const /** !Array<string> */ STATS = [
"measuredValue",
Expand Down
3 changes: 1 addition & 2 deletions static/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");
const config = {
entry: {
dev: [__dirname + "/js/dev.ts", __dirname + "/css/dev.scss"],
dev_menu: __dirname + "/js/tools/dev_menu.ts",
download: __dirname + "/js/tools/download.js",
dev_menu: [
__dirname + "/js/tools/dev_menu.ts",
__dirname + "/css/dev_menu.scss",
],
download: __dirname + "/js/tools/download.js",
kg: [__dirname + "/js/browser/kg.js", __dirname + "/css/kg.scss"],
mcf_playground: __dirname + "/js/mcf_playground.js",
place: [
Expand Down

0 comments on commit 3315dfa

Please sign in to comment.