How Answers Aggregate

The interview.html script saves saves questions and answers as a path attached to the same script but inducing it to "replay" the interview. A second aggregate.html script will scan any number of saved interviews creating "aspect" graphs to be browsed by the Solo plugin.

Here we annotate the aggregate.html script in progressive detail where "..." represents parts subsequently explained.

code

We collect all the paths present on a given page.

const context = await frame.context() const paths = context.page.story .map(item => item.path) .filter(path => path) ...

We iterate over each path filling aspects to be sourced.

const aspects = [] for (const path of paths) { ... } const message = { action: "publishSourceData", name: "aspect", sourceData: aspects } window.parent.postMessage(message,'*')

We run down each path distributing asks among aspects for each page of questions.

let prev for (const step of path) { let aspect = aspects .find(aspect => aspect.name == step.title) if(!aspect) { aspect = {name:step.title, graph:new Graph()} aspects.push(aspect) } if(step.ask && step.report) { ... prev = {nid,aspect} } }

We add a node to the relevant aspect for each question asked and answered.

const props = { name:step.report, site:step.site, title:step.title } const nid = aspect.graph .addUniqNode(step.ask.summary,props) ...

We link to the previous node, if any, and duplicate it in the current aspect if this has changed.

if(prev) { if(prev.aspect === aspect) { aspect.graph.addRel('',prev.nid,nid) } else { const other = prev.aspect.graph.nodes[prev.nid] const onid = aspect.graph .addUniqNode(other.type,other.props) aspect.graph.addRel('',onid,nid) } }

.

See published source and Graph docs .