# Metadata Quality for Biobanks
## 6 Metadata Quality Characteristics and Metrics
### Metadata Completeness
#### Sample-Level Metadata Completeness  
We define sample-level metadata completeness as _a degree of presence of sample-level metadata values for a sample._ It means that we assume that the sample itself is a metadata holder. We propose to calculate this metadata metric as a ratio of a total number of instantiated sample-level metadata values to a total number of all metadata values declared for a sample (e.g., on the collection level). This completeness metric is calculated as follows:  
\[MCompl_{s}^{\text{samp}}=\frac{n(A_{c(s)}^{M})-\sum\limits_{a^{M}\in A_{c(s)}^ {M}}f_{s}^{M}(a^{M})}{n(A_{c(s)}^{M})},s\in S_{c} \tag{3}\]  
where \(A_{c(s)}^{M}\) is a set of metadata attributes declared for a collection \(c(s)\) owning the sample \(s\), \(f_{s}^{M}(a^{M})\) is a negative metadata value instantiation function which can be equal to 0 if the value for a metadata attribute \(a^{M}\in A_{c(s)}^{M}\) is instantiated for \(s\), or 1 otherwise. Suppose there exists a collection \(c_{1}\) which metadata configuration (specification) includes data item completeness, data item accuracy, data item timeliness, and data item precision, and all values except the data item completeness value are missing for the specific sample \(s_{1}\). Then \(MCompl_{s_{1}}^{\text{samp}}=(4-3)/4=0.25\). Collection-Level Metadata Completeness  
Metadata completeness metrics that characterize the biobank collection can be calculated as:  
1. _Sample-based collection-level metadata completeness_ by aggregating metadata completeness values calculated for all or a subset of the samples in a collection;
2. _Data attribute-scoped collection-level metadata completeness_ over the values for a specific set of data attributes instantiated for all or a subset of the samples belonging to a biobank collection; such set can contain a single data attribute, a subset of or all data attributes defined for a biobank collection. 3. _Metadata attribute-scoped collection-level metadata completeness_ over the values for a specific set of metadata attributes instantiated for all or a subset of the samples in a collection; such set can contain a single metadata attribute, a subset of or all metadata attributes defined for a biobank collection. Sample-Based Collection-Level Metadata Completeness  
Such metadata completeness metric is calculated by applying the aggregate function (e.g., average, minimum/maximum, or median) to a set of metadata completeness values calculated for all or the subset of the samples in a given collection. For example, _sample-average-based collection-level metadata completeness_ is calculated by applying the following formula:  
\[ \begin{split} MCompl_{c}^{avgS}=\frac{\sum\limits_{s\in S_{c}}MC _{sc}^{samp}}{n(S_{c})},\end{split}  \tag{4}\]  
where \(S_{c}\) is a set of all samples in a collection \(c\), \(MC_{sc}^{samp}\) is a value of a sample metadata completeness calculated for a sample \(s\) belonging to the biobank collection \(c\). Suppose there is a collection \(c_{1}\) which contains 100 samples, where 70 samples have sample-level metadata completeness of 0.6, and 30 samples have sample-level metadata completeness of 0.9 (to simplify calculations, we restricted the set of possible sample-level metadata completeness values to two members). Then \(MCompl_{c_{1}}^{avgS}=(0.6\cdot 70+0.9\cdot 30)/100=0.69\). Data Attribute-Soped Collection-Level Metadata Completeness  
We define such completeness as _a degree of metadata value presence for a specific data item attribute in a specific collection_. For example, such completeness could characterize the presence of all metadata values (for all defined data item quality characteristics) for the patient age data item attribute for a specific collection (patient age reliability, patient age accuracy, etc., taken together). It is calculated by applying the following formula:  
\[ \begin{split} MCompl_{ac}^{altr}=\frac{n(S_{c})\cdot n(A_{c}^{M})- \sum\limits_{s\in S_{c}}\sum\limits_{a^{M}\in A_{c}^{M}}f_{sa}^{M}(a^{M})}{n( S_{c})\cdot n(A_{c}^{M})},a\in A_{c}\end{split}