Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | 3x 3x 42x 72x 3x 3x 3x 3x 15x 75x 84x 78x 75x 84x 78x 3x 3x 3x 3x 3x 3x | /**
* The hub's standard data-sharing policies (ADR-077, #876).
*
* A minimal set: four policies, one per way health data leaves a holder,
* and a fifth for a bonus programme's yes or no (ADR-090), built from one
* vocabulary of clauses. Each clause names the provisions it
* answers, so the set can be read against the law it implements:
*
* EHDS Regulation (EU) 2025/327
* GDPR Regulation (EU) 2016/679
* DGA Data Governance Act, Regulation (EU) 2022/868
* DA Data Act, Regulation (EU) 2023/2854
* AI Act Regulation (EU) 2024/1689
* ISO/IEC 27001, the security management standard an SPE operator holds
*
* "Compute in Europe" and "confidential SPE" are clauses, not policies: the
* region of processing (GDPR Chapter V, DGA Art. 31, DA Art. 32) and the
* processing environment (EHDS Art. 73, ADR-068) are conditions of every
* policy that lets personal data be processed.
*
* jad/policies/<id>.json holds the same policies for the connector seed
* (jad/seed-data-assets.sh); __tests__/unit/lib/standard-policies.test.ts
* fails when the two differ, and when the hub's own check
* (lib/odrl-validate.ts) finds anything short of "valid" in one of them.
*
* Which clauses the connector enforces and which bind by contract is in
* ADR-077: the connector filters out a constraint it has no function for,
* so most of these are terms the parties agree to, enforced by the permit
* gate, the SPE and audit, not by the negotiation. The one the connector
* decides itself is ehds:attestedPurpose (ADR-090): the bonus programme
* policy admits only a recipient whose DataProcessingPurposeCredential attests
* the bonus payout.
*/
const POLICY_CONTEXT = [
"http://www.w3.org/ns/odrl.jsonld",
{ ehds: "https://w3id.org/ehds/", edc: "https://w3id.org/edc/v0.0.1/ns/" },
];
type Json = Record<string, unknown>;
/** One clause and the provisions it answers. */
export interface Clause {
rule: Json;
basis: string[];
}
export interface StandardPolicy {
id: string;
title: string;
/** When a holder chooses it. */
useWhen: string;
regulations: string[];
/** The policy as the connector stores it (a PolicyDefinition's policy). */
policy: Json;
/** Every constraint, duty and prohibition with its legal basis. */
clauses: { kind: "constraint" | "duty" | "prohibition"; clause: Clause }[];
}
const constraint = (
leftOperand: string,
operator: string,
rightOperand: unknown,
basis: string[],
): Clause => ({ rule: { leftOperand, operator, rightOperand }, basis });
const action = (name: string, basis: string[], extra: Json = {}): Clause => ({
rule: { action: name, ...extra },
basis,
});
/* ── The vocabulary ────────────────────────────────────────────── */
const ART53 = [
"EHDS Art. 53(1)(a) - public interest in public or occupational health",
"EHDS Art. 53(1)(b) - policymaking and regulatory activities",
"EHDS Art. 53(1)(c) - official statistics",
"EHDS Art. 53(1)(d) - education or teaching",
"EHDS Art. 53(1)(e) - scientific research",
"EHDS Art. 53(1)(f) - improvement of the delivery of care",
];
const C = {
purposeArt53: constraint("ehds:purpose", "isAnyOf", ART53, [
"EHDS Art. 53(1)",
"GDPR Art. 5(1)(b)",
]),
dataPermit: constraint(
"ehds:dataPermit",
"eq",
"issued by a health data access body for this dataset",
["EHDS Art. 68", "DGA Art. 5(1)"],
),
dataRequest: constraint(
"ehds:hdabApproval",
"eq",
"health data request answered by the access body",
["EHDS Art. 69"],
),
oneYear: constraint("inForceDate", "lteq", "contractAgreement+365d", [
"EHDS Art. 68(12)",
"GDPR Art. 5(1)(e)",
]),
inEurope: constraint("spatial", "isPartOf", "EU/EEA", [
"GDPR Art. 44",
"DGA Art. 5(10), Art. 31",
"DA Art. 32",
]),
confidentialSpe: constraint(
"ehds:processingEnvironment",
"eq",
"confidential SPE with remote attestation",
["EHDS Art. 73", "DGA Art. 5(3)(b)", "GDPR Art. 32"],
),
iso27001: constraint(
"ehds:certification",
"isAllOf",
["ISO/IEC 27001"],
["EHDS Art. 73(1)", "GDPR Art. 32", "NIS2 Art. 21"],
),
legalBasisPermit: constraint(
"ehds:legalBasis",
"eq",
"GDPR Art. 9(2)(g) to (j) with the data permit",
["GDPR Art. 6(1), Art. 9(2)", "EHDS Art. 68"],
),
legalBasisConsent: constraint(
"ehds:legalBasis",
"eq",
"GDPR Art. 6(1)(a) and Art. 9(2)(a), the user's consent",
["GDPR Art. 6(1)(a), Art. 9(2)(a)", "DA Art. 5(1)"],
),
purposeBonus: constraint(
"ehds:purpose",
"eq",
"EHDS Art. 7(3) - primary use the person directs: the bonus payout of a programme the member joined",
["EHDS Art. 2(2)(d), Art. 7(3)", "GDPR Art. 5(1)(b)"],
),
/** Decided by the hub's connector (ADR-090), not only agreed. */
attestedBonusPurpose: constraint(
"ehds:attestedPurpose",
"eq",
"bonus-payout",
["EHDS Art. 7(3)", "GDPR Art. 5(1)(b)", "ADR-080, decision 5"],
),
legalBasisProgrammeConsent: constraint(
"ehds:legalBasis",
"eq",
"GDPR Art. 9(2)(a), the member's explicit consent to the programme",
["GDPR Art. 6(1)(a), Art. 9(2)(a)", "EHDS Art. 7(3)"],
),
purposeDataAct: constraint(
"ehds:purpose",
"eq",
"Data Act Art. 5 - the use the user agreed with the recipient",
["DA Art. 5(1), Art. 6(1)"],
),
} as const;
const D = {
spe: action("ehds:secureProcessingEnvironment", ["EHDS Art. 73"]),
attest: action("ehds:attestEnvironment", [
"EHDS Art. 73(1)",
"GDPR Art. 32(1)",
]),
pseudonymize: action("ehds:pseudonymize", [
"EHDS Art. 66(3)",
"GDPR Art. 89(1)",
]),
minimize: action("ehds:minimizeData", [
"EHDS Art. 66(1)",
"GDPR Art. 5(1)(c)",
]),
audit: action("ehds:maintainAuditTrail", ["EHDS Art. 73(1)", "GDPR Art. 30"]),
publish: action("ehds:publishResults", ["EHDS Art. 61(4)"]),
attribute: action("attribute", ["EHDS Art. 61(4)"]),
delete: action("delete", [
"GDPR Art. 5(1)(e)",
"DA Art. 6(1)",
"EHDS Art. 68(12)",
]),
deleteAfterPayout: action("delete", ["GDPR Art. 5(1)(c), (e)"], {
constraint: [
{
leftOperand: "event",
operator: "eq",
rightOperand: "after the bonus payout",
},
],
}),
reportIncident: action("ehds:reportIncident", [
"EHDS Art. 61(5)",
"GDPR Art. 33",
]),
anonymizeK10: action("anonymize", ["EHDS Art. 69", "GDPR Recital 26"], {
constraint: [
{ leftOperand: "ehds:kAnonymity", operator: "gteq", rightOperand: 10 },
],
}),
aggregateOnly: action("ehds:aggregateOnly", ["EHDS Art. 69(1)"]),
documentTrainingData: action("ehds:documentTrainingData", [
"AI Act Art. 10(2)",
"AI Act Art. 11",
]),
} as const;
const P = {
reIdentify: action("ehds:reIdentify", [
"EHDS Art. 61(3)",
"DGA Art. 5(5)",
"GDPR Art. 5(1)(b)",
]),
extract: action("extract", ["EHDS Art. 73(2)", "DGA Art. 5(3)(b)"]),
advertise: action("ehds:advertise", ["EHDS Art. 54(c)"]),
insurance: action("ehds:insuranceDecision", ["EHDS Art. 54(b)"]),
detrimental: action("ehds:detrimentalDecision", [
"EHDS Art. 54(a), (d), (e)",
]),
outsideEurope: action("ehds:transferOutsideEU", [
"GDPR Art. 44",
"DGA Art. 5(10), Art. 31",
"DA Art. 32",
]),
extractTrainingData: action("ehds:extractTrainingData", [
"EHDS Art. 61(3)",
"AI Act Art. 10(5)",
]),
prohibitedAi: action("ehds:prohibitedAiPractice", ["AI Act Art. 5"]),
competingProduct: action("ehds:developCompetingProduct", ["DA Art. 6(2)(e)"]),
gatekeeper: action("ehds:shareWithGatekeeper", ["DA Art. 6(2)(d)"]),
profile: action("ehds:profile", ["DA Art. 6(2)(b)", "GDPR Art. 22"]),
} as const;
/* ── The policies ──────────────────────────────────────────────── */
function build(
id: string,
title: string,
useWhen: string,
regulations: string[],
constraints: Clause[],
duties: Clause[],
prohibitions: Clause[],
): StandardPolicy {
return {
id,
title,
useWhen,
regulations,
policy: {
"@context": POLICY_CONTEXT,
"@type": "Set",
"@id": id,
permission: [
{
action: "use",
constraint: constraints.map((c) => c.rule),
duty: duties.map((d) => d.rule),
},
],
prohibition: prohibitions.map((p) => p.rule),
},
clauses: [
...constraints.map((clause) => ({ kind: "constraint" as const, clause })),
...duties.map((clause) => ({ kind: "duty" as const, clause })),
...prohibitions.map((clause) => ({
kind: "prohibition" as const,
clause,
})),
],
};
}
/** Pseudonymised record-level data under a permit, in a confidential SPE. */
const PERMIT_IN_SPE = build(
"mvhd-ehds-permit-spe",
"EHDS secondary use under a data permit, in a confidential SPE",
"Record-level health data, pseudonymised, for any Art. 53(1) purpose a data permit names.",
["EHDS", "GDPR", "DGA", "ISO/IEC 27001"],
[
C.purposeArt53,
C.dataPermit,
C.legalBasisPermit,
C.oneYear,
C.inEurope,
C.confidentialSpe,
C.iso27001,
],
[
D.spe,
D.attest,
D.pseudonymize,
D.minimize,
D.audit,
D.publish,
D.attribute,
D.reportIncident,
D.delete,
],
[
P.reIdentify,
P.extract,
P.advertise,
P.insurance,
P.detrimental,
P.outsideEurope,
],
);
/** Anonymised statistics answered to a health data request. */
const ANONYMISED_REQUEST = build(
"mvhd-ehds-anonymised-request",
"EHDS health data request, anonymised statistics only",
"Aggregated, anonymised answers to a question (Art. 69); no record leaves the holder.",
["EHDS", "GDPR"],
[C.purposeArt53, C.dataRequest, C.oneYear, C.inEurope],
[D.anonymizeK10, D.aggregateOnly, D.attribute, D.publish, D.delete],
[P.reIdentify, P.advertise, P.insurance, P.detrimental],
);
/** Training an AI system: the permit policy plus the AI Act's terms. */
const AI_TRAINING = build(
"mvhd-ehds-ai-training",
"EHDS secondary use for training an AI system, in a confidential SPE",
"Scientific research that trains or validates an AI system on pseudonymised data.",
["EHDS", "GDPR", "DGA", "AI Act", "ISO/IEC 27001"],
[
constraint(
"ehds:purpose",
"eq",
"EHDS Art. 53(1)(e) - scientific research: training and validating an AI system",
["EHDS Art. 53(1)(e)", "AI Act Art. 10"],
),
C.dataPermit,
C.legalBasisPermit,
C.oneYear,
C.inEurope,
C.confidentialSpe,
C.iso27001,
],
[
D.spe,
D.attest,
D.pseudonymize,
D.minimize,
D.audit,
D.documentTrainingData,
D.publish,
D.attribute,
D.reportIncident,
D.delete,
],
[
P.reIdentify,
P.extract,
P.extractTrainingData,
P.prohibitedAi,
P.advertise,
P.insurance,
P.detrimental,
P.outsideEurope,
],
);
/** Device data the user has a recipient fetch (Data Act Art. 5). */
const DEVICE_DATA = build(
"mvhd-da-device-data",
"Data Act: device data shared at the user's request",
"Data a connected device generates (a glucose sensor, a wearable), shared with a recipient the user chose.",
["DA", "GDPR"],
[C.purposeDataAct, C.legalBasisConsent, C.oneYear, C.inEurope],
[D.minimize, D.audit, D.delete],
[P.competingProduct, P.gatekeeper, P.profile, P.outsideEurope],
);
/**
* A bonus programme's yes or no, which the member has the hub send to their
* insurer (#934 step 5, ADR-080 decision 5, ADR-090). Primary use the person
* directs, never secondary use: the insurer may use the answer for the payout
* and for nothing a premium, a profile or an advertisement could be built on.
*/
const BONUS_PROGRAMME = build(
"mvhd-bonus-programme",
"Bonus program: the member's yes or no, for the payout only",
"A program's goal met, yes or no, sent to the insurer that runs it, at the member's instruction.",
["EHDS", "GDPR"],
[C.purposeBonus, C.attestedBonusPurpose, C.legalBasisProgrammeConsent],
[D.deleteAfterPayout],
[P.insurance, P.profile, P.advertise, P.detrimental],
);
export const STANDARD_POLICIES: StandardPolicy[] = [
PERMIT_IN_SPE,
ANONYMISED_REQUEST,
AI_TRAINING,
DEVICE_DATA,
BONUS_PROGRAMME,
];
|