generio-sdk 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v4 as e}from"uuid";let t=function(e){return e[e.NewLine=0]=`NewLine`,e[e.Text=1]=`Text`,e[e.BoldText=2]=`BoldText`,e[e.CheckBox=3]=`CheckBox`,e[e.DropDownList=4]=`DropDownList`,e[e.InputText=5]=`InputText`,e[e.ConditionAndOr=6]=`ConditionAndOr`,e[e.Function=7]=`Function`,e[e.Condition=8]=`Condition`,e[e.Button=9]=`Button`,e[e.Append=10]=`Append`,e[e.DigitBox=11]=`DigitBox`,e[e.Merge=12]=`Merge`,e[e.Listing=13]=`Listing`,e[e.Bilateral=14]=`Bilateral`,e[e.Matrix=15]=`Matrix`,e[e.RememberedText=17]=`RememberedText`,e[e.InputTable=18]=`InputTable`,e[e.AppendDiagnose=19]=`AppendDiagnose`,e[e.MoveByExtParams=20]=`MoveByExtParams`,e}({});var n=class{constructor(){}ConvertExaminationDataToElementRows(e){let n=[],r=0,i={subRows:[]},a=[],o=[];do{do{do{if(e[r]?.formType==t.NewLine)break;if(e[r])switch(e[r].formType){case t.DropDownList:{let n=this.CreateColumnFromExaminationData(e[r]);n.elementIndex=r;let i=[],a=1;do{let t=this.CreateColumnFromExaminationData(e[r]);t.elementIndex=r;let o=e[r]?.formValue?.trim();a===1&&o&&!o.startsWith(`-`)&&!o.endsWith(`-`)&&(n.preselected=!0),i.push(t),r++,a++}while(e[r]?.formType==t.DropDownList&&r<e.length);n.elementSelectOptions=i,o.push(n),r--;break}case t.Text:case t.Append:if(e[r]?.formValue){let t=this.CreateColumnFromExaminationData(e[r]);t.elementIndex=r,o.push(t)}break;case t.InputText:{let t=this.CreateColumnFromExaminationData(e[r]);t.elementIndex=r,t.isDistance=this.IsDistanceDefinition(e[r+1]?.formValue??``),o.push(t);break}case t.BoldText:case t.CheckBox:case t.Button:case t.DigitBox:case t.RememberedText:case t.InputTable:case t.MoveByExtParams:{let t=this.CreateColumnFromExaminationData(e[r]);t.elementIndex=r,o.push(t);break}default:break}r++}while(r<e.length);if(o.length>0){let e={columns:o};a.push(e)}if(o=[],!i.showHideElementId||!e[r]?.formValue||i.showHideElementId!=e[r]?.formValue)break;r++}while(r<e.length);a.length>0&&(i.subRows=a,n.push(i)),a=[],i={},e[r]?.formType==t.NewLine&&e[r]?.formValue?i.showHideElementId=e[r].formValue??``:i.showHideElementId=``,e[r]?.formType==t.NewLine&&e[r]?.conclusion&&e[r]?.conclusion==`hr`?i.hrBeforeRow=!0:i.hrBeforeRow=!1,r++}while(r<e.length);return n}CreateColumn(t,n,r,i,a,o,s){return{formTypeId:t,formValue:n,finding:r,conclusion:i,guid:a??e(),radLexId:o,extParam:s}}CreateColumnFromExaminationData(e){return this.CreateColumn(e.formType,e.formValue,e.finding,e.conclusion,e.guid,e.radLexId,e.extParam)}IsDistanceDefinition(e){return e?e.includes(`mm`)||e.trim()===`x`:!1}};let r=`https://gener.io`;function i(e){r=e}const a=`generio-is-logged-in`,o=`generio-logged-in-email`;async function s(e){return(await fetch(r+`/api/cookiesAuth/login`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).ok?{isSuccess:!0}:{isSuccess:!1}}async function c(){let e=await fetch(r+`/api/cookiesAuth/logout`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`}});return e.ok||e.status===401||e.status===403?{isSuccess:!0}:{isSuccess:!1}}async function l(e){let t=r+`/api/generioApp/recognizeExaminationCookiesAuth`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}async function u(e,t){let n=await fetch(r+`/api/GenerioApp/LoadExamination`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({examinationId:e,studyInstanceUId:t})});if(!n.ok)throw Error(`Failed to load examination data`);return await n.json()}async function d(e){let t=r+`/api/generioApp/getExtParamValueByStudyInstanceUId`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}async function f(e){let t=r+`/api/generioApp/setExtParamsCookiesAuth`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}async function p(e){let t=r+`/api/generioApp/sendMeasurementsCookiesAuth`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}async function m(e){let t=r+`/api/generioApp/getExaminationMessageCookiesAuth`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}function h(e){window.addEventListener(`message`,t=>{r==t.origin&&
|
|
1
|
+
import{v4 as e}from"uuid";let t=function(e){return e[e.NewLine=0]=`NewLine`,e[e.Text=1]=`Text`,e[e.BoldText=2]=`BoldText`,e[e.CheckBox=3]=`CheckBox`,e[e.DropDownList=4]=`DropDownList`,e[e.InputText=5]=`InputText`,e[e.ConditionAndOr=6]=`ConditionAndOr`,e[e.Function=7]=`Function`,e[e.Condition=8]=`Condition`,e[e.Button=9]=`Button`,e[e.Append=10]=`Append`,e[e.DigitBox=11]=`DigitBox`,e[e.Merge=12]=`Merge`,e[e.Listing=13]=`Listing`,e[e.Bilateral=14]=`Bilateral`,e[e.Matrix=15]=`Matrix`,e[e.RememberedText=17]=`RememberedText`,e[e.InputTable=18]=`InputTable`,e[e.AppendDiagnose=19]=`AppendDiagnose`,e[e.MoveByExtParams=20]=`MoveByExtParams`,e}({});var n=class{constructor(){}ConvertExaminationDataToElementRows(e){let n=[],r=0,i={subRows:[]},a=[],o=[];do{do{do{if(e[r]?.formType==t.NewLine)break;if(e[r])switch(e[r].formType){case t.DropDownList:{let n=this.CreateColumnFromExaminationData(e[r]);n.elementIndex=r;let i=[],a=1;do{let t=this.CreateColumnFromExaminationData(e[r]);t.elementIndex=r;let o=e[r]?.formValue?.trim();a===1&&o&&!o.startsWith(`-`)&&!o.endsWith(`-`)&&(n.preselected=!0),i.push(t),r++,a++}while(e[r]?.formType==t.DropDownList&&r<e.length);n.elementSelectOptions=i,o.push(n),r--;break}case t.Text:case t.Append:if(e[r]?.formValue){let t=this.CreateColumnFromExaminationData(e[r]);t.elementIndex=r,o.push(t)}break;case t.InputText:{let t=this.CreateColumnFromExaminationData(e[r]);t.elementIndex=r,t.isDistance=this.IsDistanceDefinition(e[r+1]?.formValue??``),o.push(t);break}case t.BoldText:case t.CheckBox:case t.Button:case t.DigitBox:case t.RememberedText:case t.InputTable:case t.MoveByExtParams:{let t=this.CreateColumnFromExaminationData(e[r]);t.elementIndex=r,o.push(t);break}default:break}r++}while(r<e.length);if(o.length>0){let e={columns:o};a.push(e)}if(o=[],!i.showHideElementId||!e[r]?.formValue||i.showHideElementId!=e[r]?.formValue)break;r++}while(r<e.length);a.length>0&&(i.subRows=a,n.push(i)),a=[],i={},e[r]?.formType==t.NewLine&&e[r]?.formValue?i.showHideElementId=e[r].formValue??``:i.showHideElementId=``,e[r]?.formType==t.NewLine&&e[r]?.conclusion&&e[r]?.conclusion==`hr`?i.hrBeforeRow=!0:i.hrBeforeRow=!1,r++}while(r<e.length);return n}CreateColumn(t,n,r,i,a,o,s){return{formTypeId:t,formValue:n,finding:r,conclusion:i,guid:a??e(),radLexId:o,extParam:s}}CreateColumnFromExaminationData(e){return this.CreateColumn(e.formType,e.formValue,e.finding,e.conclusion,e.guid,e.radLexId,e.extParam)}IsDistanceDefinition(e){return e?e.includes(`mm`)||e.trim()===`x`:!1}};let r=`https://gener.io`;function i(e){r=e}const a=`generio-is-logged-in`,o=`generio-logged-in-email`;async function s(e){return(await fetch(r+`/api/cookiesAuth/login`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).ok?{isSuccess:!0}:{isSuccess:!1}}async function c(){let e=await fetch(r+`/api/cookiesAuth/logout`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`}});return e.ok||e.status===401||e.status===403?{isSuccess:!0}:{isSuccess:!1}}async function l(e){let t=r+`/api/generioApp/recognizeExaminationCookiesAuth`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}async function u(e,t){let n=await fetch(r+`/api/GenerioApp/LoadExamination`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({examinationId:e,studyInstanceUId:t})});if(!n.ok)throw Error(`Failed to load examination data`);return await n.json()}async function d(e){let t=r+`/api/generioApp/getExtParamValueByStudyInstanceUId`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}async function f(e){let t=r+`/api/generioApp/setExtParamsCookiesAuth`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}async function p(e){let t=r+`/api/generioApp/sendMeasurementsCookiesAuth`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}async function m(e){let t=r+`/api/generioApp/getExaminationMessageCookiesAuth`,n=await fetch(t,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return n.ok?n.json():{}}function h(e){window.addEventListener(`message`,t=>{r==t.origin&&t.data.action==`generioReady`&&e&&e(t.data.payload,t)},!1)}function g(e,t,n,i){let a=`${r}/generator/recognizeExamination?studyInstanceUId=${e}&modality=${t}`;return n&&(a+=`&studyDescription=${n}`),i&&(a+=`&bodyPartExamined=${i}`),a}export{n as ExaminationDataHelpers,t as FormTypeEnum,a as GENERIO_IS_LOGGED_IN,o as GENERIO_LOGGED_IN_EMAIL,r as GENERIO_ORIGIN,i as SET_GENERIO_ORIGIN,m as getExaminationMessage,d as getExtParamValueByStudyInstanceUId,g as getGenerioRecognizeExaminationUrl,u as loadExamination,s as login,c as logout,l as recognizeExamination,p as sendMeasurements,f as setExtParams,h as setupPostMessageListeners};
|