# Metadata Quality for Biobanks
## 6 Metadata Quality Characteristics and Metrics
### Metadata Provenance
#### 6.7.2 Calculating Metadata Provenance Metrics  
We define metadata standard provenance as a degree of completeness with respect to the information about the metadata standard. As a result, metadata standard provenance metrics are calculated similarly to the metadata completeness metrics. The question it answers is as follows: do we know the standard the metadata values conform to? Sample-Level Metadata Provenance  
This metric is defined as _a degree of instantiation of the metadata standard information for a biobank sample_. We propose to calculate it as a ratio of a number of metadata standards which are instantiated for the metadata attributes of a sample to an overall number of metadata attributes declared for a biobank collection owning the sample:  
\[MPovT_{s}^{sampM}=\frac{n(A_{C(s)}^{M})-\sum\limits_{a^{M}\in A_{C(s)}^{M}}f_{ s}^{T}(a^{M})}{n(A_{C(s)})} \tag{19}\]  
where \(A_{C(s)}^{M}\) is a set of all metadata attributes defined for a biobank collection \(C(s)\) owning the sample \(s\), \(n(A_{C(s)}^{M})\) is its cardinality, \(f_{s}^{T}(a^{M})\) is a negative standard instantiation function over metadata attribute \(a^{M}\in A_{C(s)}^{M}\) which is equal to 0 if the information on the standard is instantiated for \(a^{M}\) in \(s\), or 1 otherwise. Suppose the data item attribute values instantiated by the sample \(s_{1}\) are described by ten metadata attributes, among which the standard information is not instantiated for four metadata attributes, then \(MPovT_{s_{1}}^{sampM}=(10-4)/10=0.6\). Collection-Level Metadata Provenance  
Metadata provenance metrics which characterize the whole biobank collection can be calculated as:  
1. _Sample-based collection-level metadata provenance_ by aggregating sample-level metadata provenance values for all or a subset of the samples in a collection;
2. _Metadata attribute-scoped collection-level metadata provenance_ by aggregating the metadata provenance values for a specific set of metadata attributes describing the data item attribute values instantiated for all or a subset of the samples in a collection; such set can contain a single attribute, a subset of or all metadata attributes defined for a biobank collection. Sample-Based Collection-Level Metadata Provenance  
We propose to calculate such a metric by applying the aggregate function to a set of sample-level metadata provenance values calculated for all the samples in a given collection. For example, _sample-average-based collection-level metadata provenance_ is calculated by applying the following formula:  
\[MProvT_{c}^{avgSM}=\frac{\sum\limits_{s\in S_{c}}MProvT_{sc}^{sampM}}{n(S_{c} )}, \tag{20}\]  
where \(S_{c}\) is a set of all samples belonging to a collection \(c\), \(Prov_{sc}^{samp}\) is a metadata provenance value calculated for a sample \(s\) belonging to \(c\). Suppose there is a collection \(c_{1}\) which contains 100 samples, where 80 samples have the sample-level metadata provenance of 0.75, and 20 samples have the sample-level metadata provenance of 0.95. Then \(MProvT_{c_{1}}^{avgSM}=\left(0.75\cdot 80+0.95\cdot 20\right)/100=0.79\). Metadata Attribute-Scoped Collection-Level Metadata Provenance  
As before, here we limit ourselves to the case when the metadata attribute set contains a single metadata attribute. For this case, this metric can be calculated as _a degree of standard information instantiation for a specific metadata attribute in a specific biobank collection_ by applying the following formula:  
\[MProvT_{a^{M_{c}}}^{attr^{M}}=\frac{n(S_{c})\cdot n(A_{c})-\sum\limits_{s\in S _{c}}\sum\limits_{a\in A_{c}}f_{sa}^{T}(a^{M})}{n(S_{c})\cdot n(A_{c})},a^{M} \in A_{c}^{M} \tag{21}\]  
where \(f_{sa}^{T}(a^{M})\) is a negative metadata standard instantiation function over a sample \(s\in S_{c}\) and a data attribute \(a\in A_{c}\), which is equal to 0 if the information about the metadata standard is instantiated for the metadata attribute \(a^{M}\) describing the value of the data attribute \(a\) instantiated by the sample \(s\), or 1 otherwise.