Skip to content

Commit

Permalink
Getting rid of expansionConcepts as concepts to hide. What would be
Browse files Browse the repository at this point in the history
useful is just hiding everything that's not a definition concept
  • Loading branch information
Sigfried committed Oct 23, 2024
1 parent 50f50c7 commit 5f2fc59
Show file tree
Hide file tree
Showing 4 changed files with 286 additions and 957 deletions.
2 changes: 1 addition & 1 deletion frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ textarea {
}

.stats-and-options .rdt_TableHead {
display: none;
/*display: none;*/
}

/* html table styles from https://www.htmltables.io/. can modify there */
Expand Down
23 changes: 2 additions & 21 deletions frontend/src/components/CsetComparisonPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,8 @@ export async function fetchGraphData(props) {
Object.values(csmi).map(d => Object.values(d)),
).filter(d => d.item).map(d => d.concept_id));

const expansionConcepts = uniq(flatten(
Object.values(csmi).map(d => Object.values(d)),
// concepts that are in expansion but not definition
).filter(d => d.csm && !d.item).map(d => d.concept_id + ''));

let specialConcepts = {
definitionConcepts: definitionConcepts.map(String),
expansionConcepts: expansionConcepts.map(String),
nonStandard: uniq(Object.values(conceptLookup).
filter(c => !c.standard_concept).
map(c => c.concept_id)),
Expand All @@ -159,18 +153,6 @@ export async function fetchGraphData(props) {
addedCids: cids.map(String),
};

for (let cid in conceptLookup) { // why putting all the specialConcepts membership as properties on the concept?
let c = {...conceptLookup[cid]}; // don't want to mutate the cached concepts
if (specialConcepts.definitionConcepts.includes(cid + '')) c.isItem = true;
if (specialConcepts.expansionConcepts.includes(cid + '')) c.isMember = true;
if ((specialConcepts.added || []).includes(cid + '')) c.added = true;
if ((specialConcepts.removed || []).includes(cid + '')) c.removed = true;
c.status = [
c.isItem && 'In definition', c.isMember && 'In Expansion',
c.added && 'Added', c.removed && 'Removed'].filter(d => d).join(', ');
conceptLookup[cid] = c;
}

const concepts = Object.values(conceptLookup);
return {
...graphData,
Expand Down Expand Up @@ -258,10 +240,9 @@ export function CsetComparisonPage() {
debugger;
}
graphOptions = newGraphOptions;
let displayedRows = _gc.getDisplayedRows(graphOptions);

let {displayedRows, allRows} = _gc.getDisplayedRows(graphOptions);

newGraphOptions = _gc.setGraphDisplayConfig(graphOptions);
newGraphOptions = _gc.setGraphDisplayConfig(graphOptions, allRows, displayedRows);
if (!isEqual(graphOptions, newGraphOptions)) {
debugger;
// save the options to state. todo: why is this necessary?
Expand Down
16 changes: 9 additions & 7 deletions frontend/src/state/GraphState.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class GraphContainer {
removed showThoughCollapsed false
allButFirstOccurrence hideThoughExpanded true
expansionConcepts hideThoughExpanded false
nonDefinitionConcepts hideThoughExpanded false
nonStandard hideThoughExpanded false
zeroRecord hideThoughExpanded false
Expand Down Expand Up @@ -325,7 +325,7 @@ export class GraphContainer {
displayedRows = displayedRows.filter(r => r.display.result !== 'hide');

// return this.displayedRows.filter(r => r.depth < 3);
return displayedRows;
return {displayedRows, allRows};
// return this.getDisplayedRowsOLD(graphOptions);
}
insertShowThoughCollapsed(path, shown, nodeRows) {
Expand Down Expand Up @@ -531,7 +531,7 @@ export class GraphContainer {
return this.graph.copy();
}

setGraphDisplayConfig(graphOptions) {
setGraphDisplayConfig(graphOptions, allRows=[], displayedRows=[]) {
// these are all options that appear in Show Stats/Options

const displayedConcepts = this.displayedRows || []; // first time through, don't have displayed rows yet
Expand Down Expand Up @@ -589,15 +589,17 @@ export class GraphContainer {
specialTreatmentDefault: false,
specialTreatmentRule: 'show though collapsed',
},
expansionConcepts: {
/*
nonDefinitionConcepts: {
name: "Expansion only concepts", displayOrder: displayOrder++,
value: this.gd.specialConcepts.expansionConcepts.length,
value: this.gd.specialConcepts.nonDefinitionConcepts.length,
// value: uniq(flatten(Object.values(this.gd.csmi).map(Object.values)) .filter(c => c.csm).map(c => c.concept_id)).length,
displayedConceptCnt: setOp('intersection', this.gd.specialConcepts.expansionConcepts, displayedConceptIds).length,
hiddenConceptCnt: setOp('difference', this.gd.specialConcepts.expansionConcepts, displayedConceptIds).length,
specialTreatmentDefault: false,
specialTreatmentRule: 'hide though expanded',
},
*/
added: {
name: "Added to compared", displayOrder: displayOrder++,
value: get(this.gd.specialConcepts, 'added.length', undefined),
Expand Down Expand Up @@ -659,11 +661,11 @@ export class GraphContainer {
for (let type in displayOptions) {
let displayOption = {...get(this, ['graphDisplayConfig', type], {}), ...displayOptions[type]}; // don't lose stuff previously set
// if (typeof(displayOption.value) === 'undefined') // don't show displayOptions that don't represent any concepts
if (!displayOption.value) { // addedCids was 0 instead of undefined. will this hide things that shouldn't be hidden?
/* if (!displayOption.value) { // addedCids was 0 instead of undefined. will this hide things that shouldn't be hidden?
// console.log(`deleting ${type} from statsopts`);
delete displayOptions[type];
continue;
}
} */
displayOption.type = type;
if (typeof(displayOption.specialTreatmentDefault) !== 'undefined') {
if (typeof (displayOption.specialTreatment) === 'undefined') {
Expand Down
Loading

0 comments on commit 5f2fc59

Please sign in to comment.