-
Notifications
You must be signed in to change notification settings - Fork 0
/
rmm-lens.json
73 lines (73 loc) · 11.1 KB
/
rmm-lens.json
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
{
"resourceType": "Library",
"meta": {
"profile": [
"http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lens"
]
},
"extension": [
{
"url": "http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lee-version",
"valueString": "dev"
}
],
"url": "http://hl7.eu/fhir/ig/gravitate-health/Library/mock-lib",
"identifier": [
{
"system": "http://gravitate-health.lst.tfo.upm.es",
"value": "rmm-lens"
}
],
"version": "0.0.2",
"name": "rmm-lens",
"date": "2024-07-30T10:17:53.758Z",
"title": "Risk Minimization Material",
"status": "draft",
"experimental": true,
"type": {
"coding": [
{
"code": "logical-library"
}
]
},
"publisher": "Gravitate Health Project - UPM Team",
"contact": [
{
"name": "Gravitate Health",
"telecom": [
{
"system": "url",
"value": "https://www.gravitatehealth.eu/"
}
]
}
],
"description": "Lens that aplies RMM to a leaflet",
"jurisdiction": [
{
"coding": [
{
"code": "US",
"system": "urn:iso:std:iso:3166"
}
]
}
],
"purpose": "Match the RMM of an ePI to a leaflet",
"usage": "Apply this lens into a leaflet to search for its RMM",
"copyright": "© 2024 Gravitate Health",
"parameter": [
{
"use": "in",
"documentation": "parameter if it exists",
"type": "CodeableConcept"
}
],
"content": [
{
"contentType": "application/javascript",
"data": "bGV0IHB2RGF0YSA9IHB2OwpsZXQgaHRtbERhdGEgPSBodG1sOwoKbGV0IGVwaURhdGEgPSBlcGk7CmxldCBpcHNEYXRhID0gaXBzOwoKbGV0IGdldFNwZWNpZmljYXRpb24gPSAoKSA9PiB7CiAgICByZXR1cm4gIjEuMC4wIjsKfTsKCmxldCBlbmhhbmNlID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ICAgICAgbGV0IHNtUmVmZXJlbmNlID0gc20ucmVzb3VyY2Uuc3ViamVjdC5yZWZlcmVuY2U7CiAgICAgICAgCiAgICAgICAgaWYgKHNtUmVmZXJlbmNlID09IGVwaVJlZmVyZW5jZSkgewogICAgICAgICAgICBjb25zb2xlLmxvZygiU00gUmVmZXJlbmNlOiAiLCBzbVJlZmVyZW5jZSwgIiBtYXRjaGVkIHdpdGggRVBJIFJlZmVyZW5jZTogIiwgZXBpUmVmZXJlbmNlKTsKICAgICAgICAgICAgCiAgICAgICAgICAgIC8vIENyZWF0ZSB0aGUgZXh0ZW5zaW9uIGF0IHRoZSBiZWdnaW5pbmcuIFRPRE8gc2VlIHdoZXJlIGl0IHNob3VsZCBiZQogICAgICAgICAgICBpZiAoZXBpLmVudHJ5WzBdLnJlc291cmNlLnNlY3Rpb25bMF0uc2VjdGlvblswXS5leHRlbnNpb24gPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICAgICAgZXBpLmVudHJ5WzBdLnJlc291cmNlLnNlY3Rpb25bMF0uc2VjdGlvblswXS5leHRlbnNpb24gPSBbXTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgbGV0IHNtQXR0YWNobWVudCA9IHNtLnJlc291cmNlLmNvbnRlbnRbMF0uYXR0YWNobWVudAoKICAgICAgICAgICAgbGV0IGNvZGVBbmREaXNwbGF5ID0gZ2V0Q29kZUFuZERpc3BsYXkoc21BdHRhY2htZW50KTsKICAgICAgICAgICAgY29uc29sZS5sb2coIkdldENvZGVBbmREaXNwbGF5OiAiLCBjb2RlQW5kRGlzcGxheSkKICAgICAgICAgICAgaWYgKGNvZGVBbmREaXNwbGF5ID09PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CgogICAgICAgICAgICBsZXQgbmV3RXh0ZW5zaW9uOwoKICAgICAgICAgICAgLy9pZiAoY29kZUFuZERpc3BsYXkuY29kZS5pbmNsdWRlcygiaW5hcHAiKSkgewogICAgICAgICAgICBpZiAoc21BdHRhY2htZW50LmRhdGEgIT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICAgICAgbmV3RXh0ZW5zaW9uID0gewogICAgICAgICAgICAgICAgICAgIGV4dGVuc2lvbjogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICJ0eXBlIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlQ29kZWFibGVDb25jZXB0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kaW5nOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN5c3RlbTogImh0dHA6Ly9obDcuZXUvZmhpci9pZy9ncmF2aXRhdGUtaGVhbHRoL0NvZGVTeXN0ZW0vdHlwZS1vZi1kYXRhLWNzIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6IGNvZGVBbmREaXNwbGF5LmNvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiBjb2RlQW5kRGlzcGxheS5kaXNwbGF5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogImNvbmNlcHQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVCYXNlNjRCaW5hcnk6IHNtQXR0YWNobWVudC5kYXRhCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIHVybDogImh0dHA6Ly9obDcuZXUvZmhpci9pZy9ncmF2aXRhdGUtaGVhbHRoL1N0cnVjdHVyZURlZmluaXRpb24vQWRkaXRpb25hbEluZm9ybWF0aW9uIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAvL30gZWxzZSB7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoc21BdHRhY2htZW50LnVybCAhPT0gdW5kZWZpbmVkKSB7CiAgICAgICAgICAgICAgICBuZXdFeHRlbnNpb24gPSB7CiAgICAgICAgICAgICAgICAgICAgZXh0ZW5zaW9uOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogInR5cGUiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVDb2RlYWJsZUNvbmNlcHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2Rpbmc6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3lzdGVtOiAiaHR0cDovL2hsNy5ldS9maGlyL2lnL2dyYXZpdGF0ZS1oZWFsdGgvQ29kZVN5c3RlbS90eXBlLW9mLWRhdGEtY3MiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogY29kZUFuZERpc3BsYXkuY29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6IGNvZGVBbmREaXNwbGF5LmRpc3BsYXkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogImNvbmNlcHQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVVcmw6IHNtQXR0YWNobWVudC51cmwKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgdXJsOiAiaHR0cDovL2hsNy5ldS9maGlyL2lnL2dyYXZpdGF0ZS1oZWFsdGgvU3RydWN0dXJlRGVmaW5pdGlvbi9BZGRpdGlvbmFsSW5mb3JtYXRpb24iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGNvbnNvbGUubG9nKCJORVcgRVhURU5TSU9OOiAiLCBuZXdFeHRlbnNpb24pCgogICAgICAgICAgICAvLyBDaGVjayBpZiBleHRlbnNpb24gYWxyZWFkeSBleGlzdHMgYmVmb3JlIGFkZGluZyBpdAogICAgICAgICAgICBsZXQgY3VycmVudEV4dGVuc2lvbnMgPSBlcGkuZW50cnlbMF0ucmVzb3VyY2Uuc2VjdGlvblswXS5zZWN0aW9uWzBdLmV4dGVuc2lvbiB8fCBbXTsKICAgICAgICAgICAgaWYgKGN1cnJlbnRFeHRlbnNpb25zICE9IHVuZGVmaW5lZCB8fCBjdXJyZW50RXh0ZW5zaW9ucy5sZW5ndGggPiAwKSB7CiAgICAgICAgICAgICAgICBsZXQgZXh0ZW5zaW9uRXhpc3RzID0gZmFsc2U7CiAgICAgICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGN1cnJlbnRFeHRlbnNpb25zLmxlbmd0aDsgaisrKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGRlZXBFcXVhbChjdXJyZW50RXh0ZW5zaW9uc1tqXSwgbmV3RXh0ZW5zaW9uKSkgewogICAgICAgICAgICAgICAgICAgICAgICBleHRlbnNpb25FeGlzdHMgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIWV4dGVuc2lvbkV4aXN0cykgZXBpLmVudHJ5WzBdLnJlc291cmNlLnNlY3Rpb25bMF0uc2VjdGlvblswXS5leHRlbnNpb24ucHVzaChuZXdFeHRlbnNpb24pOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZXBpLmVudHJ5WzBdLnJlc291cmNlLnNlY3Rpb25bMF0uc2VjdGlvblswXS5leHRlbnNpb24ucHVzaChuZXdFeHRlbnNpb24pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vZXBpLmVudHJ5WzBdLnJlc291cmNlLnNlY3Rpb25bMF0uc2VjdGlvblswXS5leHRlbnNpb24ucHVzaChuZXdFeHRlbnNpb24pOwoKICAgICAgICB9CiAgICB9CgogICAgY29uc29sZS5sb2coIl9fX19fX19fX18gUk1NIExFTlMgRVhFQ1VUSU9OIEZJTklTSEVEIF9fX19fX19fX19fX18iKQogICAgcmV0dXJuIGh0bWxEYXRhOwoKfTsKCmdldE1lZGljaW5hbFByb2R1Y3REZWZpbml0aW9uSWQgPSAoYnVuZGxlKSA9PiB7CiAgICBmb3IgKGxldCBpID0gMDsgaSA8IGJ1bmRsZS5lbnRyeS5sZW5ndGg7IGkrKykgewogICAgICAgIGlmIChidW5kbGUuZW50cnlbaV0ucmVzb3VyY2UucmVzb3VyY2VUeXBlID09PSAiTWVkaWNpbmFsUHJvZHVjdERlZmluaXRpb24iKSB7CiAgICAgICAgICAgIHJldHVybiBidW5kbGUuZW50cnlbaV0ucmVzb3VyY2UuaWQ7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIG51bGw7Cn0KCmdldENvZGVBbmREaXNwbGF5ID0gKGF0dGFjaG1lbnQpID0+IHsKICAgIGNvbnNvbGUubG9nKCJGdW5jdGlvbiBnZXRDb2RlQW5kRGlzcGxheSIpCiAgICBjb25zb2xlLmxvZygiQXR0YWNobWVudDogIiwgYXR0YWNobWVudCkKICAgIGlmIChhdHRhY2htZW50LmNvbnRlbnRUeXBlID09PSAidGV4dC9odG1sIikgewogICAgICAgIGlmIChhdHRhY2htZW50LmR1cmF0aW9uKSB7CiAgICAgICAgICAgIGlmIChhdHRhY2htZW50LnVybC5pbmNsdWRlcygieW91dHViZSIpKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgIGNvZGU6ICJ2aWRlby1pbmFwcCIsCiAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogIlZJREVPIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBjb2RlOiAiYXVkaW8taW5hcHAiLAogICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICJBVURJTyIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQoKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgY29kZTogImltYWdlLWluYXBwIiwKICAgICAgICAgICAgICAgIGRpc3BsYXk6ICJJTUciCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9IGVsc2UgewogICAgICAgIHN3aXRjaCAoYXR0YWNobWVudC5jb250ZW50VHlwZSkgewogICAgICAgICAgICBjYXNlICJ2aWRlby9tcDQiOgogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBjb2RlOiAidmlkZW8iLAogICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICJWSURFTyIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgY2FzZSAiYXBwbGljYXRpb24vcGRmIjoKICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgY29kZTogInBkZiIsCiAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogIlBERiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgY2FzZSAiYXVkaW8vbXBlZyI6CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgIGNvZGU6ICJhdWRpbyIsCiAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogIkFVRElPIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBjYXNlICJpbWFnZS9qcGciOgogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBjb2RlOiAiaW1hZ2UiLAogICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICJJTUciCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIGNhc2UgImltYWdlL2pwZWciOgogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBjb2RlOiAiaW1hZ2UiLAogICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICJJTUciCiAgICAgICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQp9CgpmdW5jdGlvbiBkZWVwRXF1YWwob2JqZWN0MSwgb2JqZWN0MikgewogICAgY29uc3Qga2V5czEgPSBPYmplY3Qua2V5cyhvYmplY3QxKTsKICAgIGNvbnN0IGtleXMyID0gT2JqZWN0LmtleXMob2JqZWN0Mik7CiAgCiAgICBpZiAoa2V5czEubGVuZ3RoICE9PSBrZXlzMi5sZW5ndGgpIHsKICAgICAgcmV0dXJuIGZhbHNlOwogICAgfQogIAogICAgZm9yIChjb25zdCBrZXkgb2Yga2V5czEpIHsKICAgICAgY29uc3QgdmFsMSA9IG9iamVjdDFba2V5XTsKICAgICAgY29uc3QgdmFsMiA9IG9iamVjdDJba2V5XTsKICAgICAgY29uc3QgYXJlT2JqZWN0cyA9IGlzT2JqZWN0KHZhbDEpICYmIGlzT2JqZWN0KHZhbDIpOwogICAgICBpZiAoCiAgICAgICAgYXJlT2JqZWN0cyAmJiAhZGVlcEVxdWFsKHZhbDEsIHZhbDIpIHx8CiAgICAgICAgIWFyZU9iamVjdHMgJiYgdmFsMSAhPT0gdmFsMgogICAgICApIHsKICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgIH0KICAgIH0KICAKICAgIHJldHVybiB0cnVlOwogIH0KICAKICBmdW5jdGlvbiBpc09iamVjdChvYmplY3QpIHsKICAgIHJldHVybiBvYmplY3QgIT0gbnVsbCAmJiB0eXBlb2Ygb2JqZWN0ID09PSAnb2JqZWN0JzsKICB9CgpyZXR1cm4gewogICAgZW5oYW5jZTogZW5oYW5jZSwKICAgIGdldFNwZWNpZmljYXRpb246IGdldFNwZWNpZmljYXRpb24sCn07"
}
]
}