diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5b59984..8be6d79 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,13 +1,11 @@
name: Main import action
on:
- push:
- branches:
- - "*"
-
+ push:
jobs:
- docker:
- uses: Gravitate-Health/reusable-workflows/.github/workflows/main.yml@main
- secrets:
- REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
- REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
\ No newline at end of file
+ main-GH-workflow:
+ uses: Gravitate-Health/reusable-workflows/.github/workflows/main.yml@main
+ secrets:
+ REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
+ REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
+ KUBECONFIG_DEV: ${{ secrets.KUBECONFIG_DEV }}
\ No newline at end of file
diff --git a/src/lenses/lens-selector-mvp2_allergy.js b/src/lenses/lens-selector-mvp2_allergyintollerance.js
similarity index 78%
rename from src/lenses/lens-selector-mvp2_allergy.js
rename to src/lenses/lens-selector-mvp2_allergyintollerance.js
index 04030eb..76f6c06 100644
--- a/src/lenses/lens-selector-mvp2_allergy.js
+++ b/src/lenses/lens-selector-mvp2_allergyintollerance.js
@@ -8,6 +8,75 @@ let getSpecification = () => {
return "1.0.0";
};
+let enhance = async () => {
+ // Proves that IPS exists
+ if (ips == "" || ips == null) {
+ throw new Error("Failed to load IPS: the LEE is getting a empty IPS");
+ }
+
+ // Instantiates the array of condition codes
+ let arrayOfConditionCodes = [];
+
+ // Iterates through the IPS entry searching for conditions
+ ips.entry.forEach((element) => {
+ if (element.resource.resourceType == "AllergyIntolerance") {
+ if (element.resource.code != undefined) {
+ element.resource.code.coding.forEach((coding) => {
+ arrayOfConditionCodes.push({
+ code: coding.code,
+ system: coding.system,
+ });
+ });
+ }
+ }
+ });
+
+ // If there are no conditions, return the ePI as it is
+ if (arrayOfConditionCodes.length == 0) {
+ return htmlData;
+ }
+
+ // ePI traslation from terminology codes to their human redable translations in the sections
+ let compositions = 0;
+ let categories = [];
+ epi.entry.forEach((entry) => {
+ if (entry.resource.resourceType == "Composition") {
+ compositions++;
+ //Iterated through the Condition element searching for conditions
+ entry.resource.extension.forEach((element) => {
+
+ // Check if the position of the extension[1] is correct
+ if (element.extension[1].url == "concept") {
+ // Search through the different terminologies that may be avaible to check in the condition
+ if (element.extension[1].valueCodeableReference.concept != undefined) {
+ element.extension[1].valueCodeableReference.concept.coding.forEach(
+ (coding) => {
+ console.log("Extension: " + element.extension[0].valueString + ":" + coding.code + " - " + coding.system)
+ // Check if the code is in the list of categories to search
+ if (equals(arrayOfConditionCodes, { code: coding.code, system: coding.system })) {
+ // Check if the category is already in the list of categories
+ categories.push(element.extension[0].valueString);
+ }
+ }
+ );
+ }
+ }
+ });
+ }
+ });
+
+ if (compositions == 0) {
+ throw new Error('Bad ePI: no category "Composition" found');
+ }
+
+ if (categories.length == 0) {
+ return htmlData;
+ }
+
+ //Focus (adds highlight class) the html applying every category found
+ return await annotateHTMLsection(categories, "highlight");
+};
+
let annotationProcess = (listOfCategories, enhanceTag, document, response) => {
listOfCategories.forEach((check) => {
if (response.includes(check)) {
@@ -55,67 +124,11 @@ let annotateHTMLsection = async (listOfCategories, enhanceTag) => {
}
};
-let enhance = async () => {
-
- let listOfCategoriesToSearch = [
- "NUT-ALLERGY" // dummy allergy
- ];
-
- // Get IPS gender and check if is female
- let gender;
-
- if (ips == "" || ips == null) {
- throw new Error("Failed to load IPS: the LEE is getting a empty IPS");
- }
- ips.entry.forEach((element) => {
- if (element.resource.resourceType == "Patient") {
- gender = element.resource.gender;
- if (gender != "female") {
- return htmlData;
- }
- }
+let equals = (array, object) => {
+ return array.some((element) => {
+ return (element.code === object.code) && (element.system === object.system);
});
-
- // ePI traslation from terminology codes to their human redable translations in the sections
- let compositions = 0;
- let categories = [];
- epi.entry.forEach((entry) => {
- if (entry.resource.resourceType == "Composition") {
- compositions++;
- //Iterated through the Condition element searching for conditions
- entry.resource.extension.forEach((element) => {
-
- // Check if the position of the extension[1] is correct
- if (element.extension[1].url == "concept") {
- // Search through the different terminologies that may be avaible to check in the condition
- if (element.extension[1].valueCodeableReference.concept != undefined) {
- element.extension[1].valueCodeableReference.concept.coding.forEach(
- (coding) => {
- console.log("Extension: " + element.extension[0].valueString + ":" + coding.code)
- // Check if the code is in the list of categories to search
- if (listOfCategoriesToSearch.includes(coding.code)) {
- // Check if the category is already in the list of categories
- categories.push(element.extension[0].valueString);
- }
- }
- );
- }
- }
- });
- }
- });
-
- if (compositions == 0) {
- throw new Error('Bad ePI: no category "Composition" found');
- }
-
- if (categories.length == 0) {
- // throw new Error("No categories found", categories);
- return htmlData;
- }
- //Focus (adds highlight class) the html applying every category found
- return await annotateHTMLsection(categories, "highlight");
-};
+}
return {
enhance: enhance,
diff --git a/src/lenses/lens-selector-mvp2_HIV.js b/src/lenses/lens-selector-mvp2_conditions.js
similarity index 83%
rename from src/lenses/lens-selector-mvp2_HIV.js
rename to src/lenses/lens-selector-mvp2_conditions.js
index bd98779..f5b92dd 100644
--- a/src/lenses/lens-selector-mvp2_HIV.js
+++ b/src/lenses/lens-selector-mvp2_conditions.js
@@ -8,75 +8,31 @@ let getSpecification = () => {
return "1.0.0";
};
-let annotationProcess = (listOfCategories, enhanceTag, document, response) => {
- listOfCategories.forEach((check) => {
- if (response.includes(check)) {
- let elements = document.getElementsByClassName(check);
- for (let i = 0; i < elements.length; i++) {
- elements[i].classList.add(enhanceTag);
- }
- if (document.getElementsByTagName("head").length > 0) {
- document.getElementsByTagName("head")[0].remove();
- }
- if (document.getElementsByTagName("body").length > 0) {
- response = document.getElementsByTagName("body")[0].innerHTML;
- console.log("Response: " + response);
- } else {
- console.log("Response: " + document.documentElement.innerHTML);
- response = document.documentElement.innerHTML;
- }
- }
- });
-
- if (response == null || response == "") {
- throw new Error(
- "Annotation proccess failed: Returned empty or null response"
- );
- //return htmlData
- } else {
- console.log("Response: " + response);
- return response;
- }
-}
-
-let annotateHTMLsection = async (listOfCategories, enhanceTag) => {
- let response = htmlData;
- let document;
-
- if (typeof window === "undefined") {
- let jsdom = await import("jsdom");
- let { JSDOM } = jsdom;
- let dom = new JSDOM(htmlData);
- document = dom.window.document;
- return annotationProcess(listOfCategories, enhanceTag, document, response);
- } else {
- document = window.document;
- return annotationProcess(listOfCategories, enhanceTag, document, response);
- }
-};
-
let enhance = async () => {
- let listOfCategoriesToSearch = ["B90", "86406008"];
-
+ // Proves that IPS exists
if (ips == "" || ips == null) {
throw new Error("Failed to load IPS: the LEE is getting a empty IPS");
}
- //Search for the condition in the IPS
- let patientHasCondition = false;
+ // Instantiates the array of condition codes
+ let arrayOfConditionCodes = [];
+
+ // Iterates through the IPS entry searching for conditions
ips.entry.forEach((element) => {
if (element.resource.resourceType == "Condition") {
if (element.resource.code != undefined) {
element.resource.code.coding.forEach((coding) => {
- if (listOfCategoriesToSearch.includes(coding.code)) {
- patientHasCondition = true;
- }
+ arrayOfConditionCodes.push({
+ code: coding.code,
+ system: coding.system,
+ });
});
}
}
});
- if (!patientHasCondition) {
+ // If there are no conditions, return the ePI as it is
+ if (arrayOfConditionCodes.length == 0) {
return htmlData;
}
@@ -95,9 +51,9 @@ let enhance = async () => {
if (element.extension[1].valueCodeableReference.concept != undefined) {
element.extension[1].valueCodeableReference.concept.coding.forEach(
(coding) => {
- console.log("Extension: " + element.extension[0].valueString + ":" + coding.code)
+ console.log("Extension: " + element.extension[0].valueString + ":" + coding.code + " - " + coding.system)
// Check if the code is in the list of categories to search
- if (listOfCategoriesToSearch.includes(coding.code)) {
+ if (equals(arrayOfConditionCodes, { code: coding.code, system: coding.system })) {
// Check if the category is already in the list of categories
categories.push(element.extension[0].valueString);
}
@@ -114,12 +70,66 @@ let enhance = async () => {
}
if (categories.length == 0) {
- //throw new Error("No categories found", categories);
return htmlData;
}
+
//Focus (adds highlight class) the html applying every category found
return await annotateHTMLsection(categories, "highlight");
};
+
+let annotationProcess = (listOfCategories, enhanceTag, document, response) => {
+ listOfCategories.forEach((check) => {
+ if (response.includes(check)) {
+ let elements = document.getElementsByClassName(check);
+ for (let i = 0; i < elements.length; i++) {
+ elements[i].classList.add(enhanceTag);
+ }
+ if (document.getElementsByTagName("head").length > 0) {
+ document.getElementsByTagName("head")[0].remove();
+ }
+ if (document.getElementsByTagName("body").length > 0) {
+ response = document.getElementsByTagName("body")[0].innerHTML;
+ console.log("Response: " + response);
+ } else {
+ console.log("Response: " + document.documentElement.innerHTML);
+ response = document.documentElement.innerHTML;
+ }
+ }
+ });
+
+ if (response == null || response == "") {
+ throw new Error(
+ "Annotation proccess failed: Returned empty or null response"
+ );
+ //return htmlData
+ } else {
+ console.log("Response: " + response);
+ return response;
+ }
+}
+
+let annotateHTMLsection = async (listOfCategories, enhanceTag) => {
+ let response = htmlData;
+ let document;
+
+ if (typeof window === "undefined") {
+ let jsdom = await import("jsdom");
+ let { JSDOM } = jsdom;
+ let dom = new JSDOM(htmlData);
+ document = dom.window.document;
+ return annotationProcess(listOfCategories, enhanceTag, document, response);
+ } else {
+ document = window.document;
+ return annotationProcess(listOfCategories, enhanceTag, document, response);
+ }
+};
+
+let equals = (array, object) => {
+ return array.some((element) => {
+ return (element.code === object.code) && (element.system === object.system);
+ });
+}
+
return {
enhance: enhance,
getSpecification: getSpecification,
diff --git a/src/lenses/lens-selector-mvp2_interaction.js b/src/lenses/lens-selector-mvp2_interaction.js
index 60138b6..0cce3d5 100644
--- a/src/lenses/lens-selector-mvp2_interaction.js
+++ b/src/lenses/lens-selector-mvp2_interaction.js
@@ -8,6 +8,80 @@ let getSpecification = () => {
return "1.0.0";
};
+let enhance = async () => {
+ // Proves that IPS exists
+ if (ips == "" || ips == null) {
+ throw new Error("Failed to load IPS: the LEE is getting a empty IPS");
+ }
+
+ // Instantiates the array of condition codes
+ let arrayOfIngredientCodes = [];
+
+ // Iterates through the IPS entry searching for conditions
+ ips.entry.forEach((element) => {
+ if (element.resource.resourceType == "Medication") {
+ if (element.resource.ingredient != undefined) {
+ element.resource.ingredient.forEach((ingredient) => {
+ if (ingredient.itemCodeableConcept != undefined) {
+ ingredient.itemCodeableConcept.coding.forEach((coding) => {
+ console.log("Ingredient: " + coding.code + " - " + coding.system)
+ arrayOfIngredientCodes.push({
+ code: coding.code,
+ system: "",
+ });
+ });
+ }
+ })
+ }
+ }
+ });
+
+ // If there are no conditions, return the ePI as it is
+ if (arrayOfIngredientCodes.length == 0) {
+ return htmlData;
+ }
+
+ // ePI traslation from terminology codes to their human redable translations in the sections
+ let compositions = 0;
+ let categories = [];
+ epi.entry.forEach((entry) => {
+ if (entry.resource.resourceType == "Composition") {
+ compositions++;
+ //Iterated through the Condition element searching for conditions
+ entry.resource.extension.forEach((element) => {
+
+ // Check if the position of the extension[1] is correct
+ if (element.extension[1].url == "concept") {
+ // Search through the different terminologies that may be avaible to check in the condition
+ if (element.extension[1].valueCodeableReference.concept != undefined) {
+ element.extension[1].valueCodeableReference.concept.coding.forEach(
+ (coding) => {
+ console.log("Extension: " + element.extension[0].valueString + ":" + coding.code + " - " + coding.system)
+ // Check if the code is in the list of categories to search
+ if (equals(arrayOfIngredientCodes, { code: coding.code, system: "" })) {
+ // Check if the category is already in the list of categories
+ categories.push(element.extension[0].valueString);
+ }
+ }
+ );
+ }
+ }
+ });
+ }
+ });
+
+ if (compositions == 0) {
+ throw new Error('Bad ePI: no category "Composition" found');
+ }
+
+ if (categories.length == 0) {
+ return htmlData;
+ }
+
+ //Focus (adds highlight class) the html applying every category found
+ return await annotateHTMLsection(categories, "highlight");
+};
+
let annotationProcess = (listOfCategories, enhanceTag, document, response) => {
listOfCategories.forEach((check) => {
if (response.includes(check)) {
@@ -55,68 +129,11 @@ let annotateHTMLsection = async (listOfCategories, enhanceTag) => {
}
};
-let enhance = async () => {
-
- let listOfCategoriesToSearch = [
- "XK4IUX8MNB", // contra-indication-hypericum
- "SY7Q814VUP", // contra-indication-calcium
- ];
-
- // Get IPS gender and check if is female
- let gender;
-
- if (ips == "" || ips == null) {
- throw new Error("Failed to load IPS: the LEE is getting a empty IPS");
- }
- ips.entry.forEach((element) => {
- if (element.resource.resourceType == "Patient") {
- gender = element.resource.gender;
- if (gender != "female") {
- return htmlData;
- }
- }
+let equals = (array, object) => {
+ return array.some((element) => {
+ return (element.code === object.code) && (element.system === object.system);
});
-
- // ePI traslation from terminology codes to their human redable translations in the sections
- let compositions = 0;
- let categories = [];
- epi.entry.forEach((entry) => {
- if (entry.resource.resourceType == "Composition") {
- compositions++;
- //Iterated through the Condition element searching for conditions
- entry.resource.extension.forEach((element) => {
-
- // Check if the position of the extension[1] is correct
- if (element.extension[1].url == "concept") {
- // Search through the different terminologies that may be avaible to check in the condition
- if (element.extension[1].valueCodeableReference.concept != undefined) {
- element.extension[1].valueCodeableReference.concept.coding.forEach(
- (coding) => {
- console.log("Extension: " + element.extension[0].valueString + ":" + coding.code)
- // Check if the code is in the list of categories to search
- if (listOfCategoriesToSearch.includes(coding.code)) {
- // Check if the category is already in the list of categories
- categories.push(element.extension[0].valueString);
- }
- }
- );
- }
- }
- });
- }
- });
-
- if (compositions == 0) {
- throw new Error('Bad ePI: no category "Composition" found');
- }
-
- if (categories.length == 0) {
- // throw new Error("No categories found", categories);
- return htmlData;
- }
- //Focus (adds highlight class) the html applying every category found
- return await annotateHTMLsection(categories, "highlight");
-};
+}
return {
enhance: enhance,
diff --git a/src/lenses/lens-selector-mvp2_intolerance.js b/src/lenses/lens-selector-mvp2_intolerance.js
deleted file mode 100644
index 4e596f4..0000000
--- a/src/lenses/lens-selector-mvp2_intolerance.js
+++ /dev/null
@@ -1,123 +0,0 @@
-let pvData = pv;
-let htmlData = html;
-
-let epiData = epi;
-let ipsData = ips;
-
-let getSpecification = () => {
- return "1.0.0";
-};
-
-let annotationProcess = (listOfCategories, enhanceTag, document, response) => {
- listOfCategories.forEach((check) => {
- if (response.includes(check)) {
- let elements = document.getElementsByClassName(check);
- for (let i = 0; i < elements.length; i++) {
- elements[i].classList.add(enhanceTag);
- }
- if (document.getElementsByTagName("head").length > 0) {
- document.getElementsByTagName("head")[0].remove();
- }
- if (document.getElementsByTagName("body").length > 0) {
- response = document.getElementsByTagName("body")[0].innerHTML;
- console.log("Response: " + response);
- } else {
- console.log("Response: " + document.documentElement.innerHTML);
- response = document.documentElement.innerHTML;
- }
- }
- });
-
- if (response == null || response == "") {
- throw new Error(
- "Annotation proccess failed: Returned empty or null response"
- );
- //return htmlData
- } else {
- console.log("Response: " + response);
- return response;
- }
-}
-
-let annotateHTMLsection = async (listOfCategories, enhanceTag) => {
- let response = htmlData;
- let document;
-
- if (typeof window === "undefined") {
- let jsdom = await import("jsdom");
- let { JSDOM } = jsdom;
- let dom = new JSDOM(htmlData);
- document = dom.window.document;
- return annotationProcess(listOfCategories, enhanceTag, document, response);
- } else {
- document = window.document;
- return annotationProcess(listOfCategories, enhanceTag, document, response);
- }
-};
-
-let enhance = async () => {
-
- let listOfCategoriesToSearch = [
- "190751001" // lactose intolerance
- ];
-
- // Get IPS gender and check if is female
- let gender;
-
- if (ips == "" || ips == null) {
- throw new Error("Failed to load IPS: the LEE is getting a empty IPS");
- }
- ips.entry.forEach((element) => {
- if (element.resource.resourceType == "Patient") {
- gender = element.resource.gender;
- if (gender != "female") {
- return htmlData;
- }
- }
- });
-
- // ePI traslation from terminology codes to their human redable translations in the sections
- let compositions = 0;
- let categories = [];
- epi.entry.forEach((entry) => {
- if (entry.resource.resourceType == "Composition") {
- compositions++;
- //Iterated through the Condition element searching for conditions
- entry.resource.extension.forEach((element) => {
-
- // Check if the position of the extension[1] is correct
- if (element.extension[1].url == "concept") {
- // Search through the different terminologies that may be avaible to check in the condition
- if (element.extension[1].valueCodeableReference.concept != undefined) {
- element.extension[1].valueCodeableReference.concept.coding.forEach(
- (coding) => {
- console.log("Extension: " + element.extension[0].valueString + ":" + coding.code)
- // Check if the code is in the list of categories to search
- if (listOfCategoriesToSearch.includes(coding.code)) {
- // Check if the category is already in the list of categories
- categories.push(element.extension[0].valueString);
- }
- }
- );
- }
- }
- });
- }
- });
-
- if (compositions == 0) {
- throw new Error('Bad ePI: no category "Composition" found');
- }
-
- if (categories.length == 0) {
- // throw new Error("No categories found", categories);
- return htmlData;
- }
- //Focus (adds highlight class) the html applying every category found
- return await annotateHTMLsection(categories, "highlight");
-};
-
-return {
- enhance: enhance,
- getSpecification: getSpecification,
-};
diff --git a/target/fhir-lens-HIV.json b/target/fhir-lens-HIV.json
new file mode 100644
index 0000000..dfd507c
--- /dev/null
+++ b/target/fhir-lens-HIV.json
@@ -0,0 +1,65 @@
+{
+ "resourceType" : "Library",
+ "id" : "fhir-lens-HIV",
+ "meta" : {
+ "profile" : ["http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lens"]
+ },
+ "text" : {
+ "status" : "generated",
+ "div" : "
Parameters
| in | | | CodeableConcept | parameter documentation |
Contents
application/javascript
Classic Pregnancy Lens
"
+ },
+ "extension" : [{
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lee-version",
+ "valueString" : "0.1"
+ }],
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/Library/mock-lib",
+ "identifier" : [{
+ "system" : "http://gravitate-health.lst.tfo.upm.es",
+ "value" : "fhir-lens-HIV"
+ }],
+ "version" : "0.1.0",
+ "name" : "fhir-lens-HIV",
+ "title" : "HIV Lens - Now in FHIR format and with metadata",
+ "status" : "draft",
+ "experimental" : true,
+ "type" : {
+ "coding" : [{
+ "code" : "logical-library"
+ }]
+ },
+ "date" : "2024-02-29T10:54:27+00:00",
+ "publisher" : "Gravitate Health Project - UPM Team",
+ "contact" : [{
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ },
+ {
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ }],
+ "description" : "This lens is intended to be used by patients to identify relevant information about information related to HIV.",
+ "jurisdiction" : [{
+ "coding" : [{
+ "system" : "urn:iso:std:iso:3166",
+ "code" : "AD"
+ }]
+ }],
+ "purpose" : "This lens is intended to be used by patients to identify relevant information about information related to HIV.",
+ "usage" : "Just apply it on the app",
+ "copyright" : "copyright label",
+ "parameter" : [{
+ "use" : "in",
+ "documentation" : "parameter documentation",
+ "type" : "CodeableConcept"
+ }],
+ "content" : [{
+ "contentType" : "application/javascript",
+ "data" : "bGV0IHB2RGF0YSA9IHB2OwpsZXQgaHRtbERhdGEgPSBodG1sOwoKbGV0IGVwaURhdGEgPSBlcGk7CmxldCBpcHNEYXRhID0gaXBzOwoKbGV0IGdldFNwZWNpZmljYXRpb24gPSAoKSA9PiB7CiAgICByZXR1cm4gIjEuMC4wIjsKfTsKCmxldCBhbm5vdGF0aW9uUHJvY2VzcyA9IChsaXN0T2ZDYXRlZ29yaWVzLCBlbmhhbmNlVGFnLCBkb2N1bWVudCwgcmVzcG9uc2UpID0+IHsKICAgIGxpc3RPZkNhdGVnb3JpZXMuZm9yRWFjaCgoY2hlY2spID0+IHsKICAgICAgICBpZiAocmVzcG9uc2UuaW5jbHVkZXMoY2hlY2spKSB7CiAgICAgICAgICAgIGxldCBlbGVtZW50cyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoY2hlY2spOwogICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICBlbGVtZW50c1tpXS5jbGFzc0xpc3QuYWRkKGVuaGFuY2VUYWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiaGVhZCIpLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJoZWFkIilbMF0ucmVtb3ZlKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJib2R5IikubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiYm9keSIpWzBdLmlubmVySFRNTDsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIHJlc3BvbnNlKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5pbm5lckhUTUwpOwogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuaW5uZXJIVE1MOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSk7CgogICAgaWYgKHJlc3BvbnNlID09IG51bGwgfHwgcmVzcG9uc2UgPT0gIiIpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoCiAgICAgICAgICAgICJBbm5vdGF0aW9uIHByb2NjZXNzIGZhaWxlZDogUmV0dXJuZWQgZW1wdHkgb3IgbnVsbCByZXNwb25zZSIKICAgICAgICApOwogICAgICAgIC8vcmV0dXJuIGh0bWxEYXRhCiAgICB9IGVsc2UgewogICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIHJlc3BvbnNlKTsKICAgICAgICByZXR1cm4gcmVzcG9uc2U7CiAgICB9Cn0KCmxldCBhbm5vdGF0ZUhUTUxzZWN0aW9uID0gYXN5bmMgKGxpc3RPZkNhdGVnb3JpZXMsIGVuaGFuY2VUYWcpID0+IHsKICAgIGxldCByZXNwb25zZSA9IGh0bWxEYXRhOwogICAgbGV0IGRvY3VtZW50OwoKICAgIGlmICh0eXBlb2Ygd2luZG93ID09PSAidW5kZWZpbmVkIikgewogICAgICAgIGxldCBqc2RvbSA9IGF3YWl0IGltcG9ydCgianNkb20iKTsKICAgICAgICBsZXQgeyBKU0RPTSB9ID0ganNkb207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gICAgaWYgKGxpc3RPZkNhdGVnb3JpZXNUb1NlYXJjaC5pbmNsdWRlcyhjb2RpbmcuY29kZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aWVudEhhc0NvbmRpdGlvbiA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9KTsKCiAgICBpZiAoIXBhdGllbnRIYXNDb25kaXRpb24pIHsKICAgICAgICByZXR1cm4gaHRtbERhdGE7CiAgICB9CgogICAgLy8gZVBJIHRyYXNsYXRpb24gZnJvbSB0ZXJtaW5vbG9neSBjb2RlcyB0byB0aGVpciBodW1hbiByZWRhYmxlIHRyYW5zbGF0aW9ucyBpbiB0aGUgc2VjdGlvbnMKICAgIGxldCBjb21wb3NpdGlvbnMgPSAwOwogICAgbGV0IGNhdGVnb3JpZXMgPSBbXTsKICAgIGVwaS5lbnRyeS5mb3JFYWNoKChlbnRyeSkgPT4gewogICAgICAgIGlmIChlbnRyeS5yZXNvdXJjZS5yZXNvdXJjZVR5cGUgPT0gIkNvbXBvc2l0aW9uIikgewogICAgICAgICAgICBjb21wb3NpdGlvbnMrKzsKICAgICAgICAgICAgLy9JdGVyYXRlZCB0aHJvdWdoIHRoZSBDb25kaXRpb24gZWxlbWVudCBzZWFyY2hpbmcgZm9yIGNvbmRpdGlvbnMKICAgICAgICAgICAgZW50cnkucmVzb3VyY2UuZXh0ZW5zaW9uLmZvckVhY2goKGVsZW1lbnQpID0+IHsKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLy8gQ2hlY2sgaWYgdGhlIHBvc2l0aW9uIG9mIHRoZSBleHRlbnNpb25bMV0gaXMgY29ycmVjdAogICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQuZXh0ZW5zaW9uWzFdLnVybCA9PSAiY29uY2VwdCIpIHsKICAgICAgICAgICAgICAgICAgICAvLyBTZWFyY2ggdGhyb3VnaCB0aGUgZGlmZmVyZW50IHRlcm1pbm9sb2dpZXMgdGhhdCBtYXkgYmUgYXZhaWJsZSB0byBjaGVjayBpbiB0aGUgY29uZGl0aW9uCiAgICAgICAgICAgICAgICAgICAgaWYgKGVsZW1lbnQuZXh0ZW5zaW9uWzFdLnZhbHVlQ29kZWFibGVSZWZlcmVuY2UuY29uY2VwdCAhPSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5leHRlbnNpb25bMV0udmFsdWVDb2RlYWJsZVJlZmVyZW5jZS5jb25jZXB0LmNvZGluZy5mb3JFYWNoKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNvZGluZykgPT4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJFeHRlbnNpb246ICIgKyBlbGVtZW50LmV4dGVuc2lvblswXS52YWx1ZVN0cmluZyArICI6IiArIGNvZGluZy5jb2RlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHRoZSBjb2RlIGlzIGluIHRoZSBsaXN0IG9mIGNhdGVnb3JpZXMgdG8gc2VhcmNoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxpc3RPZkNhdGVnb3JpZXNUb1NlYXJjaC5pbmNsdWRlcyhjb2RpbmcuY29kZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ2hlY2sgaWYgdGhlIGNhdGVnb3J5IGlzIGFscmVhZHkgaW4gdGhlIGxpc3Qgb2YgY2F0ZWdvcmllcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRlZ29yaWVzLnB1c2goZWxlbWVudC5leHRlbnNpb25bMF0udmFsdWVTdHJpbmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH0pOwoKICAgIGlmIChjb21wb3NpdGlvbnMgPT0gMCkgewogICAgICAgIHRocm93IG5ldyBFcnJvcignQmFkIGVQSTogbm8gY2F0ZWdvcnkgIkNvbXBvc2l0aW9uIiBmb3VuZCcpOwogICAgfQoKICAgIGlmIChjYXRlZ29yaWVzLmxlbmd0aCA9PSAwKSB7CiAgICAgICAgLy90aHJvdyBuZXcgRXJyb3IoIk5vIGNhdGVnb3JpZXMgZm91bmQiLCBjYXRlZ29yaWVzKTsKICAgICAgICByZXR1cm4gaHRtbERhdGE7CiAgICB9CiAgICAvL0ZvY3VzIChhZGRzIGhpZ2hsaWdodCBjbGFzcykgdGhlIGh0bWwgYXBwbHlpbmcgZXZlcnkgY2F0ZWdvcnkgZm91bmQKICAgIHJldHVybiBhd2FpdCBhbm5vdGF0ZUhUTUxzZWN0aW9uKGNhdGVnb3JpZXMsICJoaWdobGlnaHQiKTsKfTsKcmV0dXJuIHsKICAgIGVuaGFuY2U6IGVuaGFuY2UsCiAgICBnZXRTcGVjaWZpY2F0aW9uOiBnZXRTcGVjaWZpY2F0aW9uLAp9Ow=="
+ }]
+ }
\ No newline at end of file
diff --git a/target/fhir-lens-allergy.json b/target/fhir-lens-allergy.json
new file mode 100644
index 0000000..df73da6
--- /dev/null
+++ b/target/fhir-lens-allergy.json
@@ -0,0 +1,65 @@
+{
+ "resourceType" : "Library",
+ "id" : "fhir-lens-allergy",
+ "meta" : {
+ "profile" : ["http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lens"]
+ },
+ "text" : {
+ "status" : "generated",
+ "div" : "Parameters
| in | | | CodeableConcept | parameter documentation |
Contents
application/javascript
Classic Pregnancy Lens
"
+ },
+ "extension" : [{
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lee-version",
+ "valueString" : "0.1"
+ }],
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/Library/mock-lib",
+ "identifier" : [{
+ "system" : "http://gravitate-health.lst.tfo.upm.es",
+ "value" : "fhir-lens-allergy"
+ }],
+ "version" : "0.1.0",
+ "name" : "fhir-lens-allergy",
+ "title" : "Allergy Lens - Now in FHIR format and with metadata",
+ "status" : "draft",
+ "experimental" : true,
+ "type" : {
+ "coding" : [{
+ "code" : "logical-library"
+ }]
+ },
+ "date" : "2024-02-29T10:54:27+00:00",
+ "publisher" : "Gravitate Health Project - UPM Team",
+ "contact" : [{
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ },
+ {
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ }],
+ "description" : "This lens is intended to be used by patients to identify relevant information about information related to allergies.",
+ "jurisdiction" : [{
+ "coding" : [{
+ "system" : "urn:iso:std:iso:3166",
+ "code" : "AD"
+ }]
+ }],
+ "purpose" : "This lens is intended to be used by patients to identify relevant information about information related to allergies.",
+ "usage" : "Just apply it on the app",
+ "copyright" : "copyright label",
+ "parameter" : [{
+ "use" : "in",
+ "documentation" : "parameter documentation",
+ "type" : "CodeableConcept"
+ }],
+ "content" : [{
+ "contentType" : "application/javascript",
+ "data" : "bGV0IHB2RGF0YSA9IHB2OwpsZXQgaHRtbERhdGEgPSBodG1sOwoKbGV0IGVwaURhdGEgPSBlcGk7CmxldCBpcHNEYXRhID0gaXBzOwoKbGV0IGdldFNwZWNpZmljYXRpb24gPSAoKSA9PiB7CiAgICByZXR1cm4gIjEuMC4wIjsKfTsKCmxldCBhbm5vdGF0aW9uUHJvY2VzcyA9IChsaXN0T2ZDYXRlZ29yaWVzLCBlbmhhbmNlVGFnLCBkb2N1bWVudCwgcmVzcG9uc2UpID0+IHsKICAgIGxpc3RPZkNhdGVnb3JpZXMuZm9yRWFjaCgoY2hlY2spID0+IHsKICAgICAgICBpZiAocmVzcG9uc2UuaW5jbHVkZXMoY2hlY2spKSB7CiAgICAgICAgICAgIGxldCBlbGVtZW50cyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoY2hlY2spOwogICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICBlbGVtZW50c1tpXS5jbGFzc0xpc3QuYWRkKGVuaGFuY2VUYWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiaGVhZCIpLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJoZWFkIilbMF0ucmVtb3ZlKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJib2R5IikubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiYm9keSIpWzBdLmlubmVySFRNTDsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIHJlc3BvbnNlKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5pbm5lckhUTUwpOwogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuaW5uZXJIVE1MOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSk7CgogICAgaWYgKHJlc3BvbnNlID09IG51bGwgfHwgcmVzcG9uc2UgPT0gIiIpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoCiAgICAgICAgICAgICJBbm5vdGF0aW9uIHByb2Nj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VBTIGdlbmRlciBhbmQgY2hlY2sgaWYgaXMgZmVtYWxlCiAgICBsZXQgZ2VuZGVyOwoKICAgIGlmIChpcHMgPT0gIiIgfHwgaXBzID09IG51bGwpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIkZhaWxlZCB0byBsb2FkIElQUzogdGhlIExFRSBpcyBnZXR0aW5nIGEgZW1wdHkgSVBTIik7CiAgICB9CiAgICBpcHMuZW50cnkuZm9yRWFjaCgoZWxlbWVudCkgPT4gewogICAgICAgIGlmIChlbGVtZW50LnJlc291cmNlLnJlc291cmNlVHlwZSA9PSAiUGF0aWVudCIpIHsKICAgICAgICAgICAgZ2VuZGVyID0gZWxlbWVudC5yZXNvdXJjZS5nZW5kZXI7CiAgICAgICAgICAgIGlmIChnZW5kZXIgIT0gImZlbWFsZSIpIHsKICAgICAgICAgICAgICAgIHJldHVybiBodG1sRGF0YTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0pOwoKICAgIC8vIGVQSSB0cmFzbGF0aW9uIGZyb20gdGVybWlub2xvZ3kgY29kZXMgdG8gdGhlaXIgaHVtYW4gcmVkYWJsZSB0cmFuc2xhdGlvbnMgaW4gdGhlIHNlY3Rpb25zCiAgICBsZXQgY29tcG9zaXRpb25zID0gMDsKICAgIGxldCBjYXRlZ29yaWVzID0gW107CiAgICBlcGkuZW50cnkuZm9yRWFjaCgoZW50cnkpID0+IHsKICAgICAgICBpZiAoZW50cnkucmVzb3VyY2UucmVzb3VyY2VUeXBlID09ICJDb21wb3NpdGlvbiIpIHsKICAgICAgICAgICAgY29tcG9zaXRpb25zKys7CiAgICAgICAgICAgIC8vSXRlcmF0ZWQgdGhyb3VnaCB0aGUgQ29uZGl0aW9uIGVsZW1lbnQgc2VhcmNoaW5nIGZvciBjb25kaXRpb25zCiAgICAgICAgICAgIGVudHJ5LnJlc291cmNlLmV4dGVuc2lvbi5mb3JFYWNoKChlbGVtZW50KSA9PiB7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHRoZSBwb3NpdGlvbiBvZiB0aGUgZXh0ZW5zaW9uWzFdIGlzIGNvcnJlY3QKICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LmV4dGVuc2lvblsxXS51cmwgPT0gImNvbmNlcHQiKSB7CiAgICAgICAgICAgICAgICAgICAgLy8gU2VhcmNoIHRocm91Z2ggdGhlIGRpZmZlcmVudCB0ZXJtaW5vbG9naWVzIHRoYXQgbWF5IGJlIGF2YWlibGUgdG8gY2hlY2sgaW4gdGhlIGNvbmRpdGlvbgogICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LmV4dGVuc2lvblsxXS52YWx1ZUNvZGVhYmxlUmVmZXJlbmNlLmNvbmNlcHQgIT0gdW5kZWZpbmVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuZXh0ZW5zaW9uWzFdLnZhbHVlQ29kZWFibGVSZWZlcmVuY2UuY29uY2VwdC5jb2RpbmcuZm9yRWFjaCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb2RpbmcpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygiRXh0ZW5zaW9uOiAiICsgZWxlbWVudC5leHRlbnNpb25bMF0udmFsdWVTdHJpbmcgKyAiOiIgKyBjb2RpbmcuY29kZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiB0aGUgY29kZSBpcyBpbiB0aGUgbGlzdCBvZiBjYXRlZ29yaWVzIHRvIHNlYXJjaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsaXN0T2ZDYXRlZ29yaWVzVG9TZWFyY2guaW5jbHVkZXMoY29kaW5nLmNvZGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHRoZSBjYXRlZ29yeSBpcyBhbHJlYWR5IGluIHRoZSBsaXN0IG9mIGNhdGVnb3JpZXMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKGVsZW1lbnQuZXh0ZW5zaW9uWzBdLnZhbHVlU3RyaW5nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9KTsKCiAgICBpZiAoY29tcG9zaXRpb25zID09IDApIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0JhZCBlUEk6IG5vIGNhdGVnb3J5ICJDb21wb3NpdGlvbiIgZm91bmQnKTsKICAgIH0KCiAgICBpZiAoY2F0ZWdvcmllcy5sZW5ndGggPT0gMCkgewogICAgICAgIC8vIHRocm93IG5ldyBFcnJvcigiTm8gY2F0ZWdvcmllcyBmb3VuZCIsIGNhdGVnb3JpZXMpOwogICAgICAgIHJldHVybiBodG1sRGF0YTsKICAgIH0KICAgIC8vRm9jdXMgKGFkZHMgaGlnaGxpZ2h0IGNsYXNzKSB0aGUgaHRtbCBhcHBseWluZyBldmVyeSBjYXRlZ29yeSBmb3VuZAogICAgcmV0dXJuIGF3YWl0IGFubm90YXRlSFRNTHNlY3Rpb24oY2F0ZWdvcmllcywgImhpZ2hsaWdodCIpOwp9OwoKcmV0dXJuIHsKICAgIGVuaGFuY2U6IGVuaGFuY2UsCiAgICBnZXRTcGVjaWZpY2F0aW9uOiBnZXRTcGVjaWZpY2F0aW9uLAp9Owo="
+ }]
+ }
\ No newline at end of file
diff --git a/target/fhir-lens-diabetes.json b/target/fhir-lens-diabetes.json
new file mode 100644
index 0000000..dfc2055
--- /dev/null
+++ b/target/fhir-lens-diabetes.json
@@ -0,0 +1,65 @@
+{
+ "resourceType" : "Library",
+ "id" : "fhir-lens-diabetes",
+ "meta" : {
+ "profile" : ["http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lens"]
+ },
+ "text" : {
+ "status" : "generated",
+ "div" : "Parameters
| in | | | CodeableConcept | parameter documentation |
Contents
application/javascript
Classic Pregnancy Lens
"
+ },
+ "extension" : [{
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lee-version",
+ "valueString" : "0.1"
+ }],
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/Library/mock-lib",
+ "identifier" : [{
+ "system" : "http://gravitate-health.lst.tfo.upm.es",
+ "value" : "fhir-lens-diabetes"
+ }],
+ "version" : "0.1.0",
+ "name" : "fhir-lens-diabetes",
+ "title" : "Diabetes Lens - Now in FHIR format and with metadata",
+ "status" : "draft",
+ "experimental" : true,
+ "type" : {
+ "coding" : [{
+ "code" : "logical-library"
+ }]
+ },
+ "date" : "2024-02-29T10:54:27+00:00",
+ "publisher" : "Gravitate Health Project - UPM Team",
+ "contact" : [{
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ },
+ {
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ }],
+ "description" : "This lens is intended to be used by patients to identify relevant information about information related to diabetes.",
+ "jurisdiction" : [{
+ "coding" : [{
+ "system" : "urn:iso:std:iso:3166",
+ "code" : "AD"
+ }]
+ }],
+ "purpose" : "This lens is intended to be used by patients to identify relevant information about information related to diabetes.",
+ "usage" : "Just apply it on the app",
+ "copyright" : "copyright label",
+ "parameter" : [{
+ "use" : "in",
+ "documentation" : "parameter documentation",
+ "type" : "CodeableConcept"
+ }],
+ "content" : [{
+ "contentType" : "application/javascript",
+ "data" : "CmxldCBwdkRhdGEgPSBwdgpsZXQgaHRtbERhdGEgPSBodG1sCgpsZXQgZXBpRGF0YSA9IGVwaTsKbGV0IGlwc0RhdGEgPSBpcHM7CgpsZXQgZ2V0U3BlY2lmaWNhdGlvbiA9ICgpID0+IHsKICAgIHJldHVybiAiMS4wLjAiCn0KCmxldCBhbm5vdGF0aW9uUHJvY2VzcyA9IChsaXN0T2ZDYXRlZ29yaWVzLCBlbmhhbmNlVGFnLCBkb2N1bWVudCwgcmVzcG9uc2UpID0+IHsKICAgIGxpc3RPZkNhdGVnb3JpZXMuZm9yRWFjaCgoY2hlY2spID0+IHsKICAgICAgICBpZiAocmVzcG9uc2UuaW5jbHVkZXMoY2hlY2spKSB7CiAgICAgICAgICAgIGxldCBlbGVtZW50cyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoY2hlY2spOwogICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICBlbGVtZW50c1tpXS5jbGFzc0xpc3QuYWRkKGVuaGFuY2VUYWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiaGVhZCIpLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJoZWFkIilbMF0ucmVtb3ZlKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJib2R5IikubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiYm9keSIpWzBdLmlubmVySFRNTDsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIHJlc3BvbnNlKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5pbm5lckhUTUwpOwogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuaW5uZXJIVE1MOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSk7CgogICAgaWYgKHJlc3BvbnNlID09IG51bGwgfHwgcmVzcG9uc2UgPT0gIiIpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoCiAgICAgICAgICAgICJBbm5vdGF0aW9uIHByb2NjZXNzIGZhaWxlZDogUmV0dXJuZWQgZW1wdHkgb3IgbnVsbCByZXNwb25zZSIKICAgICAgICApOwogICAgICAgIC8vcmV0dXJuIGh0bWxEYXRhCiAgICB9IGVsc2UgewogICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIHJlc3BvbnNlKTsKICAgICAgICByZXR1cm4gcmVzcG9uc2U7CiAgICB9Cn0KCmxldCBhbm5vdGF0ZUhUTUxzZWN0aW9uID0gYXN5bmMgKGxpc3RPZkNhdGVnb3JpZXMsIGVuaGFuY2VUYWcpID0+IHsKICAgIGxldCByZXNwb25zZSA9IGh0bWxEYXRhOwogICAgbGV0IGRvY3VtZW50OwoKICAgIGlmICh0eXBlb2Ygd2luZG93ID09PSAidW5kZWZpbmVkIikgewogICAgICAgIGxldCBqc2RvbSA9IGF3YWl0IGltcG9ydCgianNkb20iKTsKICAgICAgICBsZXQgeyBKU0RPTSB9ID0ganNkb207CiAgICAgICAgbGV0IGRvbSA9IG5ldyBKU0RPTShodG1sRGF0YSk7CiAgICAgICAgZG9jdW1lbnQgPSBkb20ud2luZG93LmRvY3VtZW50OwogICAgICAgIHJldHVybiBhbm5vdGF0aW9uUHJvY2VzcyhsaXN0T2ZDYXRlZ29yaWVzLCBlbmhhbmNlVGFnLCBkb2N1bWVudCwgcmVzcG9uc2UpOwogICAgfSBlbHNlIHsKICAgICAgICBkb2N1bWVudCA9IHdpbmRvdy5kb2N1bWVudDsKICAgICAgICByZXR1cm4gYW5ub3RhdGlvblByb2Nlc3MobGlzdE9mQ2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Bmb3VuZCIsIGNhdGVnb3JpZXMpOwogICAgICAgIHJldHVybiBodG1sRGF0YQogICAgfQogICAgLy9Gb2N1cyAoYWRkcyBoaWdobGlnaHQgY2xhc3MpIHRoZSBodG1sIGFwcGx5aW5nIGV2ZXJ5IGNhdGVnb3J5IGZvdW5kCiAgICByZXR1cm4gYXdhaXQgYW5ub3RhdGVIVE1Mc2VjdGlvbihjYXRlZ29yaWVzLCAiaGlnaGxpZ2h0Iik7Cn0KcmV0dXJuIHsKICAgIGVuaGFuY2U6IGVuaGFuY2UsCiAgICBnZXRTcGVjaWZpY2F0aW9uOiBnZXRTcGVjaWZpY2F0aW9uCn0="
+ }]
+ }
\ No newline at end of file
diff --git a/target/fhir-lens-interaction.json b/target/fhir-lens-interaction.json
new file mode 100644
index 0000000..192f0b3
--- /dev/null
+++ b/target/fhir-lens-interaction.json
@@ -0,0 +1,65 @@
+{
+ "resourceType" : "Library",
+ "id" : "fhir-lens-interaction",
+ "meta" : {
+ "profile" : ["http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lens"]
+ },
+ "text" : {
+ "status" : "generated",
+ "div" : "Parameters
| in | | | CodeableConcept | parameter documentation |
Contents
application/javascript
Classic Pregnancy Lens
"
+ },
+ "extension" : [{
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lee-version",
+ "valueString" : "0.1"
+ }],
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/Library/mock-lib",
+ "identifier" : [{
+ "system" : "http://gravitate-health.lst.tfo.upm.es",
+ "value" : "fhir-lens-interaction"
+ }],
+ "version" : "0.1.0",
+ "name" : "fhir-lens-interaction",
+ "title" : "Interaction Lens - Now in FHIR format and with metadata",
+ "status" : "draft",
+ "experimental" : true,
+ "type" : {
+ "coding" : [{
+ "code" : "logical-library"
+ }]
+ },
+ "date" : "2024-02-29T10:54:27+00:00",
+ "publisher" : "Gravitate Health Project - UPM Team",
+ "contact" : [{
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ },
+ {
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ }],
+ "description" : "This lens is intended to be used by patients to identify relevant information about interaction between drugs in the leaflets.",
+ "jurisdiction" : [{
+ "coding" : [{
+ "system" : "urn:iso:std:iso:3166",
+ "code" : "AD"
+ }]
+ }],
+ "purpose" : "This lens is intended to be used by patients to identify relevant information about interaction between drugs in the leaflets.",
+ "usage" : "Just apply it on the app",
+ "copyright" : "copyright label",
+ "parameter" : [{
+ "use" : "in",
+ "documentation" : "parameter documentation",
+ "type" : "CodeableConcept"
+ }],
+ "content" : [{
+ "contentType" : "application/javascript",
+ "data" : "bGV0IHB2RGF0YSA9IHB2OwpsZXQgaHRtbERhdGEgPSBodG1sOwoKbGV0IGVwaURhdGEgPSBlcGk7CmxldCBpcHNEYXRhID0gaXBzOwoKbGV0IGdldFNwZWNpZmljYXRpb24gPSAoKSA9PiB7CiAgICByZXR1cm4gIjEuMC4wIjsKfTsKCmxldCBhbm5vdGF0aW9uUHJvY2VzcyA9IChsaXN0T2ZDYXRlZ29yaWVzLCBlbmhhbmNlVGFnLCBkb2N1bWVudCwgcmVzcG9uc2UpID0+IHsKICAgIGxpc3RPZkNhdGVnb3JpZXMuZm9yRWFjaCgoY2hlY2spID0+IHsKICAgICAgICBpZiAocmVzcG9uc2UuaW5jbHVkZXMoY2hlY2spKSB7CiAgICAgICAgICAgIGxldCBlbGVtZW50cyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoY2hlY2spOwogICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICBlbGVtZW50c1tpXS5jbGFzc0xpc3QuYWRkKGVuaGFuY2VUYWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiaGVhZCIpLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJoZWFkIilbMF0ucmVtb3ZlKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJib2R5IikubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiYm9keSIpWzBdLmlubmVySFRNTDsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIHJlc3BvbnNlKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5pbm5lckhUTUwpOwogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuaW5uZXJIVE1MOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSk7CgogICAgaWYgKHJlc3BvbnNlID09IG51bGwgfHwgcmVzcG9uc2UgPT0gIiIpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoCiAgICAgICAgICAgICJBbm5vdGF0aW9uIHByb2NjZXNzIGZhaWxlZDogUmV0dXJuZWQgZW1wdHkgb3IgbnVsbCByZXNwb25zZSIKICAgICAgICApOwogICAgICAgIC8vcmV0dXJuIGh0bWxEYXRhCiAgICB9IGVsc2UgewogICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIHJlc3BvbnNlKTsKICAgICAgICByZXR1cm4gcmVzcG9uc2U7CiAgICB9Cn0KCmxldCBhbm5vdGF0ZUhUTUxzZWN0aW9uID0gYXN5bmMgKGxpc3RPZkNhdGVnb3JpZXMs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BTIik7CiAgICB9CiAgICBpcHMuZW50cnkuZm9yRWFjaCgoZWxlbWVudCkgPT4gewogICAgICAgIGlmIChlbGVtZW50LnJlc291cmNlLnJlc291cmNlVHlwZSA9PSAiUGF0aWVudCIpIHsKICAgICAgICAgICAgZ2VuZGVyID0gZWxlbWVudC5yZXNvdXJjZS5nZW5kZXI7CiAgICAgICAgICAgIGlmIChnZW5kZXIgIT0gImZlbWFsZSIpIHsKICAgICAgICAgICAgICAgIHJldHVybiBodG1sRGF0YTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0pOwoKICAgIC8vIGVQSSB0cmFzbGF0aW9uIGZyb20gdGVybWlub2xvZ3kgY29kZXMgdG8gdGhlaXIgaHVtYW4gcmVkYWJsZSB0cmFuc2xhdGlvbnMgaW4gdGhlIHNlY3Rpb25zCiAgICBsZXQgY29tcG9zaXRpb25zID0gMDsKICAgIGxldCBjYXRlZ29yaWVzID0gW107CiAgICBlcGkuZW50cnkuZm9yRWFjaCgoZW50cnkpID0+IHsKICAgICAgICBpZiAoZW50cnkucmVzb3VyY2UucmVzb3VyY2VUeXBlID09ICJDb21wb3NpdGlvbiIpIHsKICAgICAgICAgICAgY29tcG9zaXRpb25zKys7CiAgICAgICAgICAgIC8vSXRlcmF0ZWQgdGhyb3VnaCB0aGUgQ29uZGl0aW9uIGVsZW1lbnQgc2VhcmNoaW5nIGZvciBjb25kaXRpb25zCiAgICAgICAgICAgIGVudHJ5LnJlc291cmNlLmV4dGVuc2lvbi5mb3JFYWNoKChlbGVtZW50KSA9PiB7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHRoZSBwb3NpdGlvbiBvZiB0aGUgZXh0ZW5zaW9uWzFdIGlzIGNvcnJlY3QKICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LmV4dGVuc2lvblsxXS51cmwgPT0gImNvbmNlcHQiKSB7CiAgICAgICAgICAgICAgICAgICAgLy8gU2VhcmNoIHRocm91Z2ggdGhlIGRpZmZlcmVudCB0ZXJtaW5vbG9naWVzIHRoYXQgbWF5IGJlIGF2YWlibGUgdG8gY2hlY2sgaW4gdGhlIGNvbmRpdGlvbgogICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LmV4dGVuc2lvblsxXS52YWx1ZUNvZGVhYmxlUmVmZXJlbmNlLmNvbmNlcHQgIT0gdW5kZWZpbmVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuZXh0ZW5zaW9uWzFdLnZhbHVlQ29kZWFibGVSZWZlcmVuY2UuY29uY2VwdC5jb2RpbmcuZm9yRWFjaCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb2RpbmcpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygiRXh0ZW5zaW9uOiAiICsgZWxlbWVudC5leHRlbnNpb25bMF0udmFsdWVTdHJpbmcgKyAiOiIgKyBjb2RpbmcuY29kZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiB0aGUgY29kZSBpcyBpbiB0aGUgbGlzdCBvZiBjYXRlZ29yaWVzIHRvIHNlYXJjaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsaXN0T2ZDYXRlZ29yaWVzVG9TZWFyY2guaW5jbHVkZXMoY29kaW5nLmNvZGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHRoZSBjYXRlZ29yeSBpcyBhbHJlYWR5IGluIHRoZSBsaXN0IG9mIGNhdGVnb3JpZXMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKGVsZW1lbnQuZXh0ZW5zaW9uWzBdLnZhbHVlU3RyaW5nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9KTsKCiAgICBpZiAoY29tcG9zaXRpb25zID09IDApIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0JhZCBlUEk6IG5vIGNhdGVnb3J5ICJDb21wb3NpdGlvbiIgZm91bmQnKTsKICAgIH0KCiAgICBpZiAoY2F0ZWdvcmllcy5sZW5ndGggPT0gMCkgewogICAgICAgIC8vIHRocm93IG5ldyBFcnJvcigiTm8gY2F0ZWdvcmllcyBmb3VuZCIsIGNhdGVnb3JpZXMpOwogICAgICAgIHJldHVybiBodG1sRGF0YTsKICAgIH0KICAgIC8vRm9jdXMgKGFkZHMgaGlnaGxpZ2h0IGNsYXNzKSB0aGUgaHRtbCBhcHBseWluZyBldmVyeSBjYXRlZ29yeSBmb3VuZAogICAgcmV0dXJuIGF3YWl0IGFubm90YXRlSFRNTHNlY3Rpb24oY2F0ZWdvcmllcywgImhpZ2hsaWdodCIpOwp9OwoKcmV0dXJuIHsKICAgIGVuaGFuY2U6IGVuaGFuY2UsCiAgICBnZXRTcGVjaWZpY2F0aW9uOiBnZXRTcGVjaWZpY2F0aW9uLAp9Ow=="
+ }]
+ }
\ No newline at end of file
diff --git a/target/fhir-lens-intolerance.json b/target/fhir-lens-intolerance.json
new file mode 100644
index 0000000..c8a2575
--- /dev/null
+++ b/target/fhir-lens-intolerance.json
@@ -0,0 +1,65 @@
+{
+ "resourceType" : "Library",
+ "id" : "fhir-lens-intolerance",
+ "meta" : {
+ "profile" : ["http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lens"]
+ },
+ "text" : {
+ "status" : "generated",
+ "div" : "Parameters
| in | | | CodeableConcept | parameter documentation |
Contents
application/javascript
Classic Pregnancy Lens
"
+ },
+ "extension" : [{
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lee-version",
+ "valueString" : "0.1"
+ }],
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/Library/mock-lib",
+ "identifier" : [{
+ "system" : "http://gravitate-health.lst.tfo.upm.es",
+ "value" : "fhir-lens-intolerance"
+ }],
+ "version" : "0.1.0",
+ "name" : "fhir-lens-intolerance",
+ "title" : "Intolerance Lens - Now in FHIR format and with metadata",
+ "status" : "draft",
+ "experimental" : true,
+ "type" : {
+ "coding" : [{
+ "code" : "logical-library"
+ }]
+ },
+ "date" : "2024-02-29T10:54:27+00:00",
+ "publisher" : "Gravitate Health Project - UPM Team",
+ "contact" : [{
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ },
+ {
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ }],
+ "description" : "This is a lens that highlights information about intolerance in the ePIs. It is intended to be used by patients to identify relevant information about intolerance in the leaflets.",
+ "jurisdiction" : [{
+ "coding" : [{
+ "system" : "urn:iso:std:iso:3166",
+ "code" : "AD"
+ }]
+ }],
+ "purpose" : "This lens is intended to be used by patients to identify relevant information about intolerance in the leaflets.",
+ "usage" : "Just apply it on the app",
+ "copyright" : "copyright label",
+ "parameter" : [{
+ "use" : "in",
+ "documentation" : "parameter documentation",
+ "type" : "CodeableConcept"
+ }],
+ "content" : [{
+ "contentType" : "application/javascript",
+ "data" : "bGV0IHB2RGF0YSA9IHB2OwpsZXQgaHRtbERhdGEgPSBodG1sOwoKbGV0IGVwaURhdGEgPSBlcGk7CmxldCBpcHNEYXRhID0gaXBzOwoKbGV0IGdldFNwZWNpZmljYXRpb24gPSAoKSA9PiB7CiAgICByZXR1cm4gIjEuMC4wIjsKfTsKCmxldCBhbm5vdGF0aW9uUHJvY2VzcyA9IChsaXN0T2ZDYXRlZ29yaWVzLCBlbmhhbmNlVGFnLCBkb2N1bWVudCwgcmVzcG9uc2UpID0+IHsKICAgIGxpc3RPZkNhdGVnb3JpZXMuZm9yRWFjaCgoY2hlY2spID0+IHsKICAgICAgICBpZiAocmVzcG9uc2UuaW5jbHVkZXMoY2hlY2spKSB7CiAgICAgICAgICAgIGxldCBlbGVtZW50cyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoY2hlY2spOwogICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICBlbGVtZW50c1tpXS5jbGFzc0xpc3QuYWRkKGVuaGFuY2VUYWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiaGVhZCIpLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJoZWFkIilbMF0ucmVtb3ZlKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJib2R5IikubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiYm9keSIpWzBdLmlubmVySFRNTDsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIHJlc3BvbnNlKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCJSZXNwb25zZTogIiArIGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5pbm5lckhUTUwpOwogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuaW5uZXJIVE1MOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSk7CgogICAgaWYgKHJlc3BvbnNlID09IG51bGwgfHwgcmVzcG9uc2UgPT0gIiIpIHsKICAgICAgICB0aH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GVuc2lvbi5mb3JFYWNoKChlbGVtZW50KSA9PiB7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHRoZSBwb3NpdGlvbiBvZiB0aGUgZXh0ZW5zaW9uWzFdIGlzIGNvcnJlY3QKICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LmV4dGVuc2lvblsxXS51cmwgPT0gImNvbmNlcHQiKSB7CiAgICAgICAgICAgICAgICAgICAgLy8gU2VhcmNoIHRocm91Z2ggdGhlIGRpZmZlcmVudCB0ZXJtaW5vbG9naWVzIHRoYXQgbWF5IGJlIGF2YWlibGUgdG8gY2hlY2sgaW4gdGhlIGNvbmRpdGlvbgogICAgICAgICAgICAgICAgICAgIGlmIChlbGVtZW50LmV4dGVuc2lvblsxXS52YWx1ZUNvZGVhYmxlUmVmZXJlbmNlLmNvbmNlcHQgIT0gdW5kZWZpbmVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQuZXh0ZW5zaW9uWzFdLnZhbHVlQ29kZWFibGVSZWZlcmVuY2UuY29uY2VwdC5jb2RpbmcuZm9yRWFjaCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb2RpbmcpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygiRXh0ZW5zaW9uOiAiICsgZWxlbWVudC5leHRlbnNpb25bMF0udmFsdWVTdHJpbmcgKyAiOiIgKyBjb2RpbmcuY29kZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiB0aGUgY29kZSBpcyBpbiB0aGUgbGlzdCBvZiBjYXRlZ29yaWVzIHRvIHNlYXJjaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsaXN0T2ZDYXRlZ29yaWVzVG9TZWFyY2guaW5jbHVkZXMoY29kaW5nLmNvZGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHRoZSBjYXRlZ29yeSBpcyBhbHJlYWR5IGluIHRoZSBsaXN0IG9mIGNhdGVnb3JpZXMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKGVsZW1lbnQuZXh0ZW5zaW9uWzBdLnZhbHVlU3RyaW5nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9KTsKCiAgICBpZiAoY29tcG9zaXRpb25zID09IDApIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0JhZCBlUEk6IG5vIGNhdGVnb3J5ICJDb21wb3NpdGlvbiIgZm91bmQnKTsKICAgIH0KCiAgICBpZiAoY2F0ZWdvcmllcy5sZW5ndGggPT0gMCkgewogICAgICAgIC8vIHRocm93IG5ldyBFcnJvcigiTm8gY2F0ZWdvcmllcyBmb3VuZCIsIGNhdGVnb3JpZXMpOwogICAgICAgIHJldHVybiBodG1sRGF0YTsKICAgIH0KICAgIC8vRm9jdXMgKGFkZHMgaGlnaGxpZ2h0IGNsYXNzKSB0aGUgaHRtbCBhcHBseWluZyBldmVyeSBjYXRlZ29yeSBmb3VuZAogICAgcmV0dXJuIGF3YWl0IGFubm90YXRlSFRNTHNlY3Rpb24oY2F0ZWdvcmllcywgImhpZ2hsaWdodCIpOwp9OwoKcmV0dXJuIHsKICAgIGVuaGFuY2U6IGVuaGFuY2UsCiAgICBnZXRTcGVjaWZpY2F0aW9uOiBnZXRTcGVjaWZpY2F0aW9uLAp9Owo="
+ }]
+ }
\ No newline at end of file
diff --git a/target/fhir-lens-pregnancy.json b/target/fhir-lens-pregnancy.json
new file mode 100644
index 0000000..07eeebf
--- /dev/null
+++ b/target/fhir-lens-pregnancy.json
@@ -0,0 +1,65 @@
+{
+ "resourceType" : "Library",
+ "id" : "fhir-lens-pregnancy",
+ "meta" : {
+ "profile" : ["http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lens"]
+ },
+ "text" : {
+ "status" : "generated",
+ "div" : "Parameters
| in | | | CodeableConcept | parameter documentation |
Contents
application/javascript
Classic Pregnancy Lens
"
+ },
+ "extension" : [{
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lee-version",
+ "valueString" : "0.1"
+ }],
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/Library/mock-lib",
+ "identifier" : [{
+ "system" : "http://gravitate-health.lst.tfo.upm.es",
+ "value" : "fhir-lens-pregnancy"
+ }],
+ "version" : "0.1.0",
+ "name" : "fhir-lens-pregnancy",
+ "title" : "Pregnancy Lens - Now in FHIR format and with metadata",
+ "status" : "draft",
+ "experimental" : true,
+ "type" : {
+ "coding" : [{
+ "code" : "logical-library"
+ }]
+ },
+ "date" : "2024-02-29T10:54:27+00:00",
+ "publisher" : "Gravitate Health Project - UPM Team",
+ "contact" : [{
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ },
+ {
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ }],
+ "description" : "if a person is female and between 18 and 70 years, information about pregnancy is going to be highlighted. if a person is a man, the information is collapsed",
+ "jurisdiction" : [{
+ "coding" : [{
+ "system" : "urn:iso:std:iso:3166",
+ "code" : "AD"
+ }]
+ }],
+ "purpose" : "The Pregnancy Lens is a lens that highlights information about pregnancy in the ePIs. It is intended to be used by patients to identify relevant information about pregnancy in the leaflets.",
+ "usage" : "Just apply it on the app",
+ "copyright" : "copyright label",
+ "parameter" : [{
+ "use" : "in",
+ "documentation" : "parameter documentation",
+ "type" : "CodeableConcept"
+ }],
+ "content" : [{
+ "contentType" : "application/javascript",
+ "data" :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aW5uZXJIVE1MOwogICAgICAgICAgICAgICAgY29uc29sZS5sb2coIlJlc3BvbnNlOiAiICsgcmVzcG9uc2UpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgY29uc29sZS5sb2coIlJlc3BvbnNlOiAiICsgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LmlubmVySFRNTCk7CiAgICAgICAgICAgICAgICByZXNwb25zZSA9IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5pbm5lckhUTUw7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9KTsKCiAgICBpZiAocmVzcG9uc2UgPT0gbnVsbCB8fCByZXNwb25zZSA9PSAiIikgewogICAgICAgIHRocm93IG5ldyBFcnJvcigKICAgICAgICAgICAgIkFubm90YXRpb24gcHJvY2Nlc3MgZmFpbGVkOiBSZXR1cm5lZCBlbXB0eSBvciBudWxsIHJlc3BvbnNlIgogICAgICAgICk7CiAgICAgICAgLy9yZXR1cm4gaHRtbERhdGEKICAgIH0gZWxzZSB7CiAgICAgICAgY29uc29sZS5sb2coIlJlc3BvbnNlOiAiICsgcmVzcG9uc2UpOwogICAgICAgIHJldHVybiByZXNwb25zZTsKICAgIH0KfQoKbGV0IGFubm90YXRlSFRNTHNlY3Rpb24gPSBhc3luYyAobGlzdE9mQ2F0ZWdvcmllcywgZW5oYW5jZVRhZykgPT4gewogICAgbGV0IHJlc3BvbnNlID0gaHRtbERhdGE7CiAgICBsZXQgZG9jdW1lbnQ7CgogICAgaWYgKHR5cGVvZiB3aW5kb3cgPT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgbGV0IGpzZG9tID0gYXdhaXQgaW1wb3J0KCJqc2RvbSIpOwogICAgICAgIGxldCB7IEpTRE9NIH0gPSBqc2RvbTsKICAgICAgICBsZXQgZG9tID0gbmV3IEpTRE9NKGh0bWxEYXRhKTsKICAgICAgICBkb2N1bWVudCA9IGRvbS53aW5kb3cuZG9jdW1lbnQ7CiAgICAgICAgcmV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AgICAgICAgICAgICByZXR1cm4gaHRtbERhdGE7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9KTsKCiAgICAvLyBlUEkgdHJhc2xhdGlvbiBmcm9tIHRlcm1pbm9sb2d5IGNvZGVzIHRvIHRoZWlyIGh1bWFuIHJlZGFibGUgdHJhbnNsYXRpb25zIGluIHRoZSBzZWN0aW9ucwogICAgbGV0IGNvbXBvc2l0aW9ucyA9IDA7CiAgICBsZXQgY2F0ZWdvcmllcyA9IFtdOwogICAgZXBpLmVudHJ5LmZvckVhY2goKGVudHJ5KSA9PiB7CiAgICAgICAgaWYgKGVudHJ5LnJlc291cmNlLnJlc291cmNlVHlwZSA9PSAiQ29tcG9zaXRpb24iKSB7CiAgICAgICAgICAgIGNvbXBvc2l0aW9ucysrOwogICAgICAgICAgICAvL0l0ZXJhdGVkIHRocm91Z2ggdGhlIENvbmRpdGlvbiBlbGVtZW50IHNlYXJjaGluZyBmb3IgY29uZGl0aW9ucwogICAgICAgICAgICBlbnRyeS5yZXNvdXJjZS5leHRlbnNpb24uZm9yRWFjaCgoZWxlbWVudCkgPT4gewogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiB0aGUgcG9zaXRpb24gb2YgdGhlIGV4dGVuc2lvblsxXSBpcyBjb3JyZWN0CiAgICAgICAgICAgICAgICBpZiAoZWxlbWVudC5leHRlbnNpb25bMV0udXJsID09ICJjb25jZXB0IikgewogICAgICAgICAgICAgICAgICAgIC8vIFNlYXJjaCB0aHJvdWdoIHRoZSBkaWZmZXJlbnQgdGVybWlub2xvZ2llcyB0aGF0IG1heSBiZSBhdmFpYmxlIHRvIGNoZWNrIGluIHRoZSBjb25kaXRpb24KICAgICAgICAgICAgICAgICAgICBpZiAoZWxlbWVudC5leHRlbnNpb25bMV0udmFsdWVDb2RlYWJsZVJlZmVyZW5jZS5jb25jZXB0ICE9IHVuZGVmaW5lZCkgewogICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmV4dGVuc2lvblsxXS52YWx1ZUNvZGVhYmxlUmVmZXJlbmNlLmNvbmNlcHQuY29kaW5nLmZvckVhY2goCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoY29kaW5nKSA9PiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIkV4dGVuc2lvbjogIiArIGVsZW1lbnQuZXh0ZW5zaW9uWzBdLnZhbHVlU3RyaW5nICsgIjoiICsgY29kaW5nLmNvZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ2hlY2sgaWYgdGhlIGNvZGUgaXMgaW4gdGhlIGxpc3Qgb2YgY2F0ZWdvcmllcyB0byBzZWFyY2gKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGlzdE9mQ2F0ZWdvcmllc1RvU2VhcmNoLmluY2x1ZGVzKGNvZGluZy5jb2RlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBpZiB0aGUgY2F0ZWdvcnkgaXMgYWxyZWFkeSBpbiB0aGUgbGlzdCBvZiBjYXRlZ29yaWVzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaChlbGVtZW50LmV4dGVuc2lvblswXS52YWx1ZVN0cmluZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgfQogICAgfSk7CgogICAgaWYgKGNvbXBvc2l0aW9ucyA9PSAwKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdCYWQgZVBJOiBubyBjYXRlZ29yeSAiQ29tcG9zaXRpb24iIGZvdW5kJyk7CiAgICB9CgogICAgaWYgKGNhdGVnb3JpZXMubGVuZ3RoID09IDApIHsKICAgICAgICAvLyB0aHJvdyBuZXcgRXJyb3IoIk5vIGNhdGVnb3JpZXMgZm91bmQiLCBjYXRlZ29yaWVzKTsKICAgICAgICByZXR1cm4gaHRtbERhdGE7CiAgICB9CiAgICAvL0ZvY3VzIChhZGRzIGhpZ2hsaWdodCBjbGFzcykgdGhlIGh0bWwgYXBwbHlpbmcgZXZlcnkgY2F0ZWdvcnkgZm91bmQKICAgIHJldHVybiBhd2FpdCBhbm5vdGF0ZUhUTUxzZWN0aW9uKGNhdGVnb3JpZXMsICJoaWdobGlnaHQiKTsKfTsKCnJldHVybiB7CiAgICBlbmhhbmNlOiBlbmhhbmNlLAogICAgZ2V0U3BlY2lmaWNhdGlvbjogZ2V0U3BlY2lmaWNhdGlvbiwKfTs="
+ }]
+ }
\ No newline at end of file
diff --git a/target/fhir-lens-proxy-pregnancy.json b/target/fhir-lens-proxy-pregnancy.json
new file mode 100644
index 0000000..9c961c7
--- /dev/null
+++ b/target/fhir-lens-proxy-pregnancy.json
@@ -0,0 +1,65 @@
+{
+ "resourceType" : "Library",
+ "id" : "fhir-lens-proxy-pregnancy",
+ "meta" : {
+ "profile" : ["http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lens"]
+ },
+ "text" : {
+ "status" : "generated",
+ "div" : "Parameters
| in | | | CodeableConcept | parameter documentation |
Contents
application/javascript
Classic Pregnancy Lens
"
+ },
+ "extension" : [{
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/StructureDefinition/lee-version",
+ "valueString" : "0.1"
+ }],
+ "url" : "http://hl7.eu/fhir/ig/gravitate-health/Library/mock-lib",
+ "identifier" : [{
+ "system" : "http://gravitate-health.lst.tfo.upm.es",
+ "value" : "fhir-lens-proxy-pregnancy"
+ }],
+ "version" : "0.1.0",
+ "name" : "fhir-lens-proxy-pregnancy",
+ "title" : "Proxy Pregnancy Lens - Now in FHIR format and with metadata",
+ "status" : "draft",
+ "experimental" : true,
+ "type" : {
+ "coding" : [{
+ "code" : "logical-library"
+ }]
+ },
+ "date" : "2024-02-29T10:54:27+00:00",
+ "publisher" : "Gravitate Health Project - UPM Team",
+ "contact" : [{
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ },
+ {
+ "name" : "Gravitate Health Project",
+ "telecom" : [{
+ "system" : "url",
+ "value" : "https://www.gravitatehealth.eu/"
+ }]
+ }],
+ "description" : "Original Lens made on Python. This lens connect with a service that executes the core computiong of the lens. If a person is female and between 18 and 70 years, information about pregnancy is going to be highlighted. if a person is a man, the information is collapsed",
+ "jurisdiction" : [{
+ "coding" : [{
+ "system" : "urn:iso:std:iso:3166",
+ "code" : "AD"
+ }]
+ }],
+ "purpose" : "The Pregnancy Lens is a lens that highlights information about pregnancy in the ePIs. It is intended to be used by patients to identify relevant information about pregnancy in the leaflets.",
+ "usage" : "Deploy the external service. Just apply it on the app",
+ "copyright" : "copyright label",
+ "parameter" : [{
+ "use" : "in",
+ "documentation" : "parameter documentation",
+ "type" : "CodeableConcept"
+ }],
+ "content" : [{
+ "contentType" : "application/javascript",
+ "data" : "bGV0IHB2RGF0YSA9IHB2OwpsZXQgaHRtbERhdGEgPSBodG1sOwoKbGV0IGVwaURhdGEgPSBlcGk7CmxldCBpcHNEYXRhID0gaXBzOwoKbGV0IGdldFNwZWNpZmljYXRpb24gPSAoKSA9PiB7CiAgICByZXR1cm4gIjEuMC4wIjsKfTsKCmxldCBlbmhhbmNlID0gYXN5bmMgKCkgPT4gewogICAgCiAgICBjb25zdCBob3N0ID0gcHJvY2Vzcy5lbnYuUFJPWFlfTEVOU19FTlYgPT0gImRldiIgPyAiaHR0cHM6Ly9ncmF2aXRhdGUtaGVhbHRoLmxzdC50Zm8udXBtLmVzIiA6ICJodHRwczovL2dyYXZpdGF0ZS1oZWFsdGgubHN0LnRmby51cG0uZXMiIC8vImh0dHBzOi8vZm9zcHMuZ3Jhdml0YXRlaGVhbHRoLmV1LyI7CiAgICBjb25zdCB1cmwgPSBgJHtob3N0fS9leHRlcm5hbC9wcmVnbmFuY3lgCiAgICBjb25zdCBvcHRpb25zID0gewogICAgICAgIG1ldGhvZDogIlBPU1QiLAogICAgICAgIGhlYWRlcnM6IHsKICAgICAgICAgICAgIkNvbnRlbnQtVHlwZSI6ICJhcHBsaWNhdGlvbi9qc29uIiwKICAgICAgICAgICAgIkFjY2VwdCI6ICJhcHBsaWNhdGlvbi9qc29uIgogICAgICAgIH0sCiAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoewogICAgICAgICAgICBwdkRhdGE6IHB2LAogICAgICAgICAgICBodG1sRGF0YTogaHRtbCwKICAgICAgICAgICAgZXBpRGF0YTogSlNPTi5zdHJpbmdpZnkoZXBpKSwKICAgICAgICAgICAgaXBzRGF0YTogSlNPTi5zdHJpbmdpZnkoaXBzKQogICAgICAgIH0pCiAgICB9OwoKICAgIGxldCByZXNwb25zZSA9IGF3YWl0IGZldGNoKHVybCwgb3B0aW9ucykKICAgIC50aGVuKChyZXNwb25zZSkgPT4gewogICAgICAgIHJldHVybiByZXNwb25zZS5qc29uKCk7CiAgICB9KS5jYXRjaCgoZXJyb3IpID0+IHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZXJyb3IpOwogICAgfSk7CgogICAgcmV0dXJuIHJlc3BvbnNlLmh0bWxTdHJpbmc7Cn07CgpyZXR1cm4gewogICAgZW5oYW5jZTogZW5oYW5jZSwKICAgIGdldFNwZWNpZmljYXRpb246IGdldFNwZWNpZmljYXRpb24sCn07"
+ }]
+ }
\ No newline at end of file