Published
Edited
Apr 23, 2021
5 stars
Also listed in…
Biotech & Pharma
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
relations.view(5);
Insert cell
Insert cell
toksByLabel.view(5);
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tokLabelCounts.view(5);
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
jsonEntities = FileAttachment("clinical_trials_annotation_entities.json").json()
Insert cell
jsonRelations = FileAttachment("clinical_trials_annotation_relations@5.json").json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tokFreqsJs = {
const freqs = {};
for (let i = 0; i < jsonEntities.length; i++) {
const toks = jsonEntities[i].span.toLowerCase().split(" ");
for (let j = 0; j < toks.length; j++) {
const tok = toks[j];
if (tok in freqs) freqs[tok] += 1;
else freqs[tok] = 1;
}
}
return Object.entries(freqs);
}
Insert cell
tokFreqs = aq.from(tokFreqsJs);
Insert cell
toksByLabelPivot = tokFreqs
.join(entities.unroll('tokens'), ['0', 'tokens'])
.filter(d => op.length(d.tokens) > 3)
.groupby('tokens', 'type')
.count()
.groupby('tokens')
.pivot('type', { value: d => op.sum(d.count) });
Insert cell
toksByLabel = tokFreqs
.join(entities.unroll('tokens'), ['0', 'tokens'])
.filter(d => op.length(d.tokens) > 3)
.groupby('tokens', 'type','metatype')
.count();
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more