# The Need for Machine-Processable Agreements in Health Data Management +
## 5 A Policy Language for Multi-Privilege Consent
### Conflict Detection  
The consent statement \(c_{i}\) contains a group of individuals, \(P\), identified directly or through relationships that the information should be shared with. It also contains a set of individuals \(N\), identified directly or through relationships, that the information should never be shared with. If an individual is in both \(P\) and \(N\), the individual is not shared with. **Definition 1**. : _For all \(c_{i}\), \(c_{j}\) sharing policy constraints of resource \(d_{n}\), the policy is conflict free if \(P_{c_{i}}\cap N_{c_{j}}=\emptyset\)._  
Algorithm 1, Find Conflicts, is the entry point that is passed a resource ID and returns the results of who should get access or any detected conflicts. Algorithm 2 fetches relevant policies, evaluates them, interprets the semantics of the policies and puts them into a structure that detect conflicts can understand. Meanwhile, in Algorithm 3, given the semantics of policies relevant to a resource, determines the individuals who get access or for which there are conflicts. ```
Input: Resource \(r\) Output: Print out people that passed resource should get shared with and if any conflicts exist
1: policies \(\leftarrow\) findRelevantPolicies(r)
2: results \(\leftarrow\) detectConflitcts(policies)
3: print result
```  
**Algorithm 2**Evaluating policies  
```
Input: Set of policies policies Output: Construct a structure for every policy [Share, Never]
1: results \(\leftarrow\) \(\emptyset\)
2:for all\(p\) in policies do
3: shareRules \(\leftarrow\) getRules(p,\"share\")
4: neverRules \(\leftarrow\) getRules(p,\"never\")
5: share \(\leftarrow\) evaluateShareRules(p.author,shareRules)
6: applyNeverRules \(\leftarrow\) evaluateNeverRules(p.author,neverRules)
7: never \(\leftarrow\) applyNeverRules[0]
8: instead \(\leftarrow\) applyNeverRules[1]
9: share \(\leftarrow\) share \(\cup\) instead
10: res \(\leftarrow\) new RuleResults(policy \(=p\), share \(=\) share, never )
11: results \(\leftarrow\) results \(\cup\) {res}
12: return results
```  
**Algorithm 3**Find Conflicts  
```
Input: Resource \(r\) Output: The user studies \(c_{i}\), \(c_{j}\) sharing policy constraints of resource \(d_{n}\), \(P\), identified directly or through relationships that the information should be shared


```
1:List of Rules Results \(results\),
2:Return a final results, the people who should get access + conflicts
3:result\(\leftarrow\emptyset\)
4:for all\(i\) in results do
5:share\(\leftarrow\) i.share
6:shareWith\(\leftarrow\) i.share
7:for all\(j\) in results do
8: intersection\(\leftarrow\) i.share\(\cap\) j.never
9:if not(intersection\(==\emptyset\)) then
10:result.addConflict(i.policy,j.policy,intersection)
11:alINeverUpdate\(\leftarrow\) allINeverUpdate\(\cup\) intersection
12:shareWith\(\leftarrow\) shareWith\(\setminus\) intersection
13:result.addIndividuals(shareWith)
14:return result
```

**Algorithm 3**Detect conflicts

## 6 Implementation and Evaluation

### Comparison to Other Privacy Management Approaches

There are several privacy and privacy policy languages that can be used to capture either user/patient privacy preferences or organisation policies. These were developed with different objectives, ranging from helping users make decisions to enforcing security guarantees. In this section, we discuss several languages and show that to the best of our knowledge there is no language that address the health data sharing requirements identified in this paper. We present an evaluation of these languages against our criteria in Table 3. Some of the languages we have analysed in this section are open-world while others are closed-word: in a closed system we do not have to guess/predefine a list of purposes, a technical language can be used to implement any purpose as long as one knows the \"schema\" of our data. On the other hand, the privacy languages that were developed in an open world can combine potential uses (however often written in natural language) with predefined vocabularies that try to capture possible future uses of the data.