|
| 1 | +# Beacon Aggregations for Data Summaries |
| 2 | + |
| 3 | +!!! warn "WiP" |
| 4 | + |
| 5 | + Beacon aggregations are currently in preview and may change without deprecation. |
| 6 | + Use with caution and follow related PRs. |
| 7 | + |
| 8 | +## Overview and Use Cases |
| 9 | + |
| 10 | +While the `Beacon` API provides different ways to discover and potentially retrieve |
| 11 | +data in biomedical genomics resources, with version 2.n responses were limited to |
| 12 | +global content (boolean or overall count of matched data and static collection information) |
| 13 | +or full record level access which for most resources would not be possible in a |
| 14 | +public context. Responses under the new `aggregated` granularity level allow to: |
| 15 | + |
| 16 | +* provide granular data overwiews about the content of resources and their collections, |
| 17 | + e.g. numbers of samples with individual features or combinations of features |
| 18 | +* profile query responses for multiple (single or intersected) parameters |
| 19 | + |
| 20 | +## Response Format |
| 21 | + |
| 22 | +Aggregation are provided inside the `responseAggregation` property of the response and consist |
| 23 | +of array of objects with the following structure: |
| 24 | + |
| 25 | +* a required, ordered list of one or more `concepts` objects, describing the |
| 26 | +parameters for which the aggregation is provided |
| 27 | +* summaries for the single or interssected concepts |
| 28 | + - a count of the distinct values for single or intersected concepts and/or |
| 29 | + - a count for all records with existing values and/or |
| 30 | + - a distribution of all distinct values/combinations with the count of their occurrence |
| 31 | +* an optional `scope` parameter to indicate the entity the results refer to (usually the current entry type but might be variable for collection and overview aggregations) |
| 32 | + |
| 33 | +### Examples |
| 34 | + |
| 35 | +The following examples display different aggregation objects (which would be items in the `responseAggregation` array). Note that **id values are for demonstration only** and do not have a normative function. |
| 36 | + |
| 37 | +**Aggregations and Queries:** For most of the example cases one can envision both a use in "data overview context" (e.g. to profile the content of a resource or collection) and in "query context" (e.g. to profile the response for a specific query). |
| 38 | + |
| 39 | +#### Minimal Representation of Distinct Values Count `distinctValuesCount` |
| 40 | + |
| 41 | +How many different diseases are represented in the data? |
| 42 | + |
| 43 | +```json |
| 44 | +{ |
| 45 | + "concepts": [ |
| 46 | + {"id": "disease", "label": "Disease"} |
| 47 | + ], |
| 48 | + "distinctValuesCount": 89 |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +#### Informative Values `anyValueCount` |
| 53 | + |
| 54 | +How many individuals in the data have a follow-up time? |
| 55 | + |
| 56 | +```json |
| 57 | +{ |
| 58 | + "scope": "individual", |
| 59 | + "concepts": [ |
| 60 | + {"id": "followUpTime", "label": "Follow-up time"} |
| 61 | + ], |
| 62 | + "anyValueCount": 1200 |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +#### Value Distribution `distribution`, Single Concept |
| 67 | + |
| 68 | +What is the distribution of diseases in the samples? |
| 69 | + |
| 70 | +```json |
| 71 | +{ |
| 72 | + "scope": "biosample", |
| 73 | + "concepts": [ |
| 74 | + { |
| 75 | + "id": "sampleDiagnoses", |
| 76 | + "label": "Diagnoses of selected carcinoma types", |
| 77 | + "property": "biosample.histologicalDiagnosis.id" |
| 78 | + } |
| 79 | + ], |
| 80 | + "distribution": [ |
| 81 | + { |
| 82 | + "conceptValues": [ |
| 83 | + {"id": "NCIT:C2919", "label": "Prostate Adenocarcinoma"} |
| 84 | + ], |
| 85 | + "count": 426 |
| 86 | + }, |
| 87 | + { |
| 88 | + "conceptValues": [ |
| 89 | + {"id": "NCIT:C4017", "label": "Breast Ductal Carcinoma"} |
| 90 | + ], |
| 91 | + "count": 423 |
| 92 | + }, |
| 93 | + { |
| 94 | + "conceptValues": [ |
| 95 | + {"id": "NCIT:C3512", "label": "Lung Adenocarcinoma"} |
| 96 | + ], |
| 97 | + "count": 317 |
| 98 | + } |
| 99 | + ] |
| 100 | +} |
| 101 | +``` |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
0 commit comments