generio-sdk 1.0.58 → 1.0.60
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.cjs +1 -0
- package/dist/index.d.cts +250 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +7 -4
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`uuid`);c=s(c);let l=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 u=class{constructor(){}ConvertExaminationDataToGeneratorRows(e){let t=[],n=0,r={subRows:[]},i=[],a=[];do{do{do{if(e[n]?.formType==l.NewLine)break;if(e[n])switch(e[n].formType){case l.DropDownList:{let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n;let r=[],i=1;do{let a=this.CreateColumnFromExaminationData(e[n]);a.elementIndex=n;let o=e[n]?.formValue?.trim();i===1&&o&&!o.startsWith(`-`)&&!o.endsWith(`-`)&&(t.preselected=!0),r.push(a),n++,i++}while(e[n]?.formType==l.DropDownList&&n<e.length);t.elementSelectOptions=r,a.push(t),n--;break}case l.Text:case l.Append:if(e[n]?.formValue){let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n,a.push(t)}break;case l.InputText:{let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n,t.isDistance=this.IsDistanceDefinition(e[n+1]?.formValue??``),a.push(t);break}case l.BoldText:case l.CheckBox:case l.Button:case l.DigitBox:case l.RememberedText:case l.InputTable:case l.MoveByExtParams:{let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n,a.push(t);break}default:break}n++}while(n<e.length);if(a.length>0){let e={columns:a};i.push(e)}if(a=[],!r.showHideElementId||!e[n]?.formValue||r.showHideElementId!=e[n]?.formValue)break;n++}while(n<e.length);i.length>0&&(r.subRows=i,t.push(r)),i=[],r={},e[n]?.formType==l.NewLine&&e[n]?.formValue?r.showHideElementId=e[n].formValue??``:r.showHideElementId=``,e[n]?.formType==l.NewLine&&e[n]?.conclusion&&e[n]?.conclusion==`hr`?r.hrBeforeRow=!0:r.hrBeforeRow=!1,n++}while(n<e.length);return t}CreateColumn(e,t,n,r,i,a,o){return{formTypeId:e,formValue:t,finding:n,conclusion:r,guid:i??(0,c.v4)(),radLexId:a,extParam:o}}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}};const d=`https://gener.io`,f=`generio-is-logged-in`,p=`generio-logged-in-email`;async function m(e){return(await fetch(d+`/api/cookiesAuth/login`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).ok?{isSuccess:!0}:{isSuccess:!1}}async function h(){let e=await fetch(d+`/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 g(e){d+``;let t=await fetch(`https://gener.io/api/generioApp/recognizeExaminationCookiesAuth`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{isSuccess:!1}}async function _(e,t){let n=await fetch(d+`/api/GenerioApp/LoadExamination`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({examinationId:e,studyInstanceUId:t})});return n.ok?n.json():Promise.reject(Error(`Network issue`))}async function v(e){d+``;let t=await fetch(`https://gener.io/api/datasetsCookiesAuth/getExtParamValueByStudyInstanceUId`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{}}async function y(e){d+``;let t=await fetch(`https://gener.io/api/generioApp/setExtParamsCookiesAuth`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{isSuccess:!1,errorMessage:`Network issue`}}function b(e,t){e.postMessage({action:`setExtParams`,model:t},{targetOrigin:d})}async function x(e){d+``;let t=await fetch(`https://gener.io/api/generioApp/sendMeasurementsCookiesAuth`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{isSuccess:!1,errorMessage:`Network issue`}}async function S(e){d+``;let t=await fetch(`https://gener.io/api/generioApp/getExaminationMessageCookiesAuth`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{isSuccess:!1,errorMessage:`Network issue`}}function C(e){window.addEventListener(`message`,t=>{if(d==t.origin&&(console.info(`PostMessageListener: Received message from origin: ${t.origin}`,t.data),t.data.action==`generioReady`)){e&&e(t.data.model,t);return}},!1)}function w(e,t,n,r){let i=`${d}/generator/recognizeExamination?studyInstanceUId=${e}&modality=${t}`;return n&&(i+=`&studyDescription=${n}`),r&&(i+=`&bodyPartExamined=${r}`),i}exports.ExaminationDataHelpers=u,exports.FormTypeEnum=l,exports.GENERIO_IS_LOGGED_IN=`generio-is-logged-in`,exports.GENERIO_LOGGED_IN_EMAIL=`generio-logged-in-email`,exports.GENERIO_ORIGIN=d,exports.getExaminationMessage=S,exports.getExtParamValueByStudyInstanceUId=v,exports.getGenerioRecognizeExaminationUrl=w,exports.loadExamination=_,exports.login=m,exports.logout=h,exports.recognizeExamination=g,exports.sendMeasurements=x,exports.setExtParams=y,exports.setExtParamsPostMessage=b,exports.setupPostMessageListeners=C;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
//#region src/models/RecognizeExaminationInputModel.d.ts
|
|
2
|
+
interface RecognizeExaminationInputModel {
|
|
3
|
+
modality: string;
|
|
4
|
+
studyDescription?: string;
|
|
5
|
+
bodyPartExamined?: string;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/models/RecognizeExaminationOutputModel.d.ts
|
|
9
|
+
interface RecognizeExaminationOutputModel {
|
|
10
|
+
isSuccess: boolean;
|
|
11
|
+
isRecognized: boolean;
|
|
12
|
+
examinationElementId?: number;
|
|
13
|
+
sectionId?: number;
|
|
14
|
+
url?: string;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/models/SetExtParamsInputModel.d.ts
|
|
18
|
+
interface SetExtParamsInputModel {
|
|
19
|
+
studyInstanceUId: string;
|
|
20
|
+
keyValues: KeyValueModel[];
|
|
21
|
+
}
|
|
22
|
+
interface KeyValueModel {
|
|
23
|
+
key: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/models/SetExtParamsOutputModel.d.ts
|
|
28
|
+
interface SetExtParamsOutputModel {
|
|
29
|
+
isSuccess: boolean;
|
|
30
|
+
errorMessage?: string;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/models/SendMeasurementsOutputModel.d.ts
|
|
34
|
+
interface SendMeasurementsOutputModel {
|
|
35
|
+
isSuccess: boolean;
|
|
36
|
+
errorMessage?: string;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/models/SendMeasurementsInputModel.d.ts
|
|
40
|
+
interface SendMeasurementsInputModel {
|
|
41
|
+
studyInstanceUId: string;
|
|
42
|
+
measurements: MeasurementModel[];
|
|
43
|
+
}
|
|
44
|
+
interface MeasurementModel {
|
|
45
|
+
value: string;
|
|
46
|
+
unit: string;
|
|
47
|
+
tool: string;
|
|
48
|
+
objectId?: string;
|
|
49
|
+
sopInstanceUId?: string;
|
|
50
|
+
seriesInstanceUId?: string;
|
|
51
|
+
seriesNumber?: string;
|
|
52
|
+
instanceNumber?: string;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/models/GetExtParamValueByStudyInstanceUIdInputModel.d.ts
|
|
56
|
+
interface GetExtParamValueByStudyInstanceUIdInputModel {
|
|
57
|
+
studyInstanceUId: string;
|
|
58
|
+
extParam: string;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/models/GetExtParamValueByStudyInstanceUIdOutputModel.d.ts
|
|
62
|
+
interface GetExtParamValueByStudyInstanceUIdOutputModel {
|
|
63
|
+
examinationId: number;
|
|
64
|
+
studyInstanceUId: string;
|
|
65
|
+
extParam: string;
|
|
66
|
+
value: string;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/models/GetExaminationMessageOutputModel.d.ts
|
|
70
|
+
interface GetExaminationMessageOutputModel {
|
|
71
|
+
examinationMessage: string;
|
|
72
|
+
isSuccess: boolean;
|
|
73
|
+
errorMessage?: string;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/models/LoginInputModel.d.ts
|
|
77
|
+
interface LoginInputModel {
|
|
78
|
+
email: string;
|
|
79
|
+
password: string;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/models/LoginOutputModel.d.ts
|
|
83
|
+
interface LoginOutputModel {
|
|
84
|
+
isSuccess: boolean;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/models/LogoutOutputModel.d.ts
|
|
88
|
+
interface LogoutOutputModel {
|
|
89
|
+
isSuccess: boolean;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/models/GenerioReadyOutputModel.d.ts
|
|
93
|
+
interface GenerioReadyOutputModel {
|
|
94
|
+
studyInstanceUId: string;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/models/FormTypeEnum.d.ts
|
|
98
|
+
declare enum FormTypeEnum {
|
|
99
|
+
NewLine = 0,
|
|
100
|
+
Text = 1,
|
|
101
|
+
BoldText = 2,
|
|
102
|
+
CheckBox = 3,
|
|
103
|
+
DropDownList = 4,
|
|
104
|
+
InputText = 5,
|
|
105
|
+
ConditionAndOr = 6,
|
|
106
|
+
Function = 7,
|
|
107
|
+
Condition = 8,
|
|
108
|
+
Button = 9,
|
|
109
|
+
Append = 10,
|
|
110
|
+
DigitBox = 11,
|
|
111
|
+
Merge = 12,
|
|
112
|
+
Listing = 13,
|
|
113
|
+
Bilateral = 14,
|
|
114
|
+
Matrix = 15,
|
|
115
|
+
RememberedText = 17,
|
|
116
|
+
InputTable = 18,
|
|
117
|
+
AppendDiagnose = 19,
|
|
118
|
+
// TODO: check if not deprecated
|
|
119
|
+
MoveByExtParams = 20,
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/models/OriginDataItem.d.ts
|
|
123
|
+
interface OriginDataItem {
|
|
124
|
+
index: number;
|
|
125
|
+
formType: FormTypeEnum;
|
|
126
|
+
formValue?: string;
|
|
127
|
+
finding?: string;
|
|
128
|
+
conclusion?: string;
|
|
129
|
+
guid: string;
|
|
130
|
+
radLexId?: string;
|
|
131
|
+
extParam?: string;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/models/OriginElementDetail.d.ts
|
|
135
|
+
interface OriginElementDetail {
|
|
136
|
+
/**
|
|
137
|
+
* ExaminationId
|
|
138
|
+
*/
|
|
139
|
+
id: number;
|
|
140
|
+
sortConclusion: string;
|
|
141
|
+
normalConclusion: string;
|
|
142
|
+
examinationElementSectionName: string;
|
|
143
|
+
examinationElementName: string;
|
|
144
|
+
languageCode: string;
|
|
145
|
+
loggedUserEmail: string;
|
|
146
|
+
loggedUserId: number;
|
|
147
|
+
loggedUserSawWholeTour: boolean;
|
|
148
|
+
examinationElementCreatedByUserEmail: string;
|
|
149
|
+
examinationElementCreatedByUserName: string;
|
|
150
|
+
bottomBanner: string;
|
|
151
|
+
isMachineTranslated: boolean;
|
|
152
|
+
roundDecimalsToIntegers: boolean;
|
|
153
|
+
addSpaceBeforeUnit: boolean;
|
|
154
|
+
isEnabledImagesAndExport: boolean;
|
|
155
|
+
isHiddenOtherActions: boolean;
|
|
156
|
+
copyResultCount: number;
|
|
157
|
+
copyResultLimit: number;
|
|
158
|
+
isExceededLimit: boolean;
|
|
159
|
+
exceededLimitText: string;
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/models/OriginDetail.d.ts
|
|
163
|
+
interface OriginDetail {
|
|
164
|
+
element: OriginElementDetail;
|
|
165
|
+
data: OriginDataItem[];
|
|
166
|
+
cultureShort: string;
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/models/GetExaminationMessageInputModel.d.ts
|
|
170
|
+
interface GetExaminationMessageInputModel {
|
|
171
|
+
studyInstanceUId: string;
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/models/Column.d.ts
|
|
175
|
+
interface Column {
|
|
176
|
+
formTypeId: FormTypeEnum;
|
|
177
|
+
formValue?: string;
|
|
178
|
+
finding?: string;
|
|
179
|
+
conclusion?: string;
|
|
180
|
+
guid: string;
|
|
181
|
+
radLexId?: string;
|
|
182
|
+
extParam?: string;
|
|
183
|
+
columnIndex?: number;
|
|
184
|
+
elementIndex?: number;
|
|
185
|
+
visualizeColumn?: boolean;
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/models/ElementColumn.d.ts
|
|
189
|
+
interface ElementColumn extends Column {
|
|
190
|
+
elementSelectOptions?: Column[];
|
|
191
|
+
isDistance?: boolean;
|
|
192
|
+
preselected?: boolean;
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/models/ElementSubRow.d.ts
|
|
196
|
+
interface ElementSubRow {
|
|
197
|
+
columns: Array<ElementColumn>;
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/models/ElementRow.d.ts
|
|
201
|
+
interface ElementRow {
|
|
202
|
+
showHideElementId: string;
|
|
203
|
+
hrBeforeRow: boolean;
|
|
204
|
+
rowIndex: number;
|
|
205
|
+
visualizeRow: boolean;
|
|
206
|
+
subRows: Array<ElementSubRow>;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/models/AppendDiagnoseFormHandlebarsModel.d.ts
|
|
210
|
+
interface AppendDiagnoseFormHandlebarsModel {
|
|
211
|
+
index: number;
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/models/FindingGeneratorFormHandlebarsModel.d.ts
|
|
215
|
+
interface FindingGeneratorFormHandlebarsModel {
|
|
216
|
+
formRows: ElementRow[];
|
|
217
|
+
appendDiagnoses: AppendDiagnoseFormHandlebarsModel[];
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/services/ExaminationDataHelpers.d.ts
|
|
221
|
+
declare class ExaminationDataHelpers {
|
|
222
|
+
constructor();
|
|
223
|
+
/**
|
|
224
|
+
* Convert DB items into hbs object. Used in FindingGenerator.handlebars
|
|
225
|
+
* @param items ExaminationData entries
|
|
226
|
+
* @returns entry array for hbs
|
|
227
|
+
*/
|
|
228
|
+
ConvertExaminationDataToGeneratorRows(items: OriginDataItem[]): ElementRow[];
|
|
229
|
+
CreateColumn(formType: FormTypeEnum, formValue?: string, finding?: string, conclusion?: string, guid?: string, radLexId?: string, extParam?: string): Column;
|
|
230
|
+
CreateColumnFromExaminationData(item: OriginDataItem): Column;
|
|
231
|
+
IsDistanceDefinition(originFormValue: string): boolean;
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/index.d.ts
|
|
235
|
+
declare const GENERIO_ORIGIN = "https://gener.io";
|
|
236
|
+
declare const GENERIO_IS_LOGGED_IN = "generio-is-logged-in";
|
|
237
|
+
declare const GENERIO_LOGGED_IN_EMAIL = "generio-logged-in-email";
|
|
238
|
+
declare function login(model: LoginInputModel): Promise<LoginOutputModel>;
|
|
239
|
+
declare function logout(): Promise<LogoutOutputModel>;
|
|
240
|
+
declare function recognizeExamination(model: RecognizeExaminationInputModel): Promise<RecognizeExaminationOutputModel>;
|
|
241
|
+
declare function loadExamination(examinationId: number, studyInstanceUId: string): Promise<OriginDetail>;
|
|
242
|
+
declare function getExtParamValueByStudyInstanceUId(model: GetExtParamValueByStudyInstanceUIdInputModel): Promise<GetExtParamValueByStudyInstanceUIdOutputModel>;
|
|
243
|
+
declare function setExtParams(model: SetExtParamsInputModel): Promise<SetExtParamsOutputModel>;
|
|
244
|
+
declare function setExtParamsPostMessage(window: Window, model: SetExtParamsInputModel): void;
|
|
245
|
+
declare function sendMeasurements(model: SendMeasurementsInputModel): Promise<SendMeasurementsOutputModel>;
|
|
246
|
+
declare function getExaminationMessage(model: GetExaminationMessageInputModel): Promise<GetExaminationMessageOutputModel>;
|
|
247
|
+
declare function setupPostMessageListeners(generioReadyHandler?: (model: GenerioReadyOutputModel, event: MessageEvent) => void): void;
|
|
248
|
+
declare function getGenerioRecognizeExaminationUrl(studyInstanceUId: string, modality: string, studyDescription?: string, bodyPartExamined?: string): string;
|
|
249
|
+
//#endregion
|
|
250
|
+
export { type AppendDiagnoseFormHandlebarsModel, type Column, type ElementColumn, type ElementRow, type ElementSubRow, ExaminationDataHelpers, type FindingGeneratorFormHandlebarsModel, FormTypeEnum, GENERIO_IS_LOGGED_IN, GENERIO_LOGGED_IN_EMAIL, GENERIO_ORIGIN, GenerioReadyOutputModel, GetExaminationMessageInputModel, GetExaminationMessageOutputModel, GetExtParamValueByStudyInstanceUIdInputModel, GetExtParamValueByStudyInstanceUIdOutputModel, KeyValueModel, LoginInputModel, LoginOutputModel, LogoutOutputModel, MeasurementModel, type OriginDataItem, type OriginDetail, type OriginElementDetail, RecognizeExaminationInputModel, RecognizeExaminationOutputModel, SendMeasurementsInputModel, SendMeasurementsOutputModel, SetExtParamsInputModel, SetExtParamsOutputModel, getExaminationMessage, getExtParamValueByStudyInstanceUId, getGenerioRecognizeExaminationUrl, loadExamination, login, logout, recognizeExamination, sendMeasurements, setExtParams, setExtParamsPostMessage, setupPostMessageListeners };
|
package/dist/index.d.ts
CHANGED
|
@@ -225,7 +225,7 @@ declare class ExaminationDataHelpers {
|
|
|
225
225
|
* @param items ExaminationData entries
|
|
226
226
|
* @returns entry array for hbs
|
|
227
227
|
*/
|
|
228
|
-
|
|
228
|
+
ConvertExaminationDataToGeneratorRows(items: OriginDataItem[]): ElementRow[];
|
|
229
229
|
CreateColumn(formType: FormTypeEnum, formValue?: string, finding?: string, conclusion?: string, guid?: string, radLexId?: string, extParam?: string): Column;
|
|
230
230
|
CreateColumnFromExaminationData(item: OriginDataItem): Column;
|
|
231
231
|
IsDistanceDefinition(originFormValue: string): boolean;
|
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(){}
|
|
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(){}ConvertExaminationDataToGeneratorRows(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}};const r=`https://gener.io`,i=`generio-is-logged-in`,a=`generio-logged-in-email`;async function o(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 s(){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 c(e){r+``;let t=await fetch(`https://gener.io/api/generioApp/recognizeExaminationCookiesAuth`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{isSuccess:!1}}async function l(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})});return n.ok?n.json():Promise.reject(Error(`Network issue`))}async function u(e){r+``;let t=await fetch(`https://gener.io/api/datasetsCookiesAuth/getExtParamValueByStudyInstanceUId`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{}}async function d(e){r+``;let t=await fetch(`https://gener.io/api/generioApp/setExtParamsCookiesAuth`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{isSuccess:!1,errorMessage:`Network issue`}}function f(e,t){e.postMessage({action:`setExtParams`,model:t},{targetOrigin:r})}async function p(e){r+``;let t=await fetch(`https://gener.io/api/generioApp/sendMeasurementsCookiesAuth`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{isSuccess:!1,errorMessage:`Network issue`}}async function m(e){r+``;let t=await fetch(`https://gener.io/api/generioApp/getExaminationMessageCookiesAuth`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{isSuccess:!1,errorMessage:`Network issue`}}function h(e){window.addEventListener(`message`,t=>{if(r==t.origin&&(console.info(`PostMessageListener: Received message from origin: ${t.origin}`,t.data),t.data.action==`generioReady`)){e&&e(t.data.model,t);return}},!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,i as GENERIO_IS_LOGGED_IN,a as GENERIO_LOGGED_IN_EMAIL,r as GENERIO_ORIGIN,m as getExaminationMessage,u as getExtParamValueByStudyInstanceUId,g as getGenerioRecognizeExaminationUrl,l as loadExamination,o as login,s as logout,c as recognizeExamination,p as sendMeasurements,d as setExtParams,f as setExtParamsPostMessage,h as setupPostMessageListeners};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generio-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.60",
|
|
4
4
|
"description": "SDK library for generio integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,11 +15,14 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
|
-
"main": "./dist/index.
|
|
18
|
+
"main": "./dist/index.cjs",
|
|
19
19
|
"module": "./dist/index.js",
|
|
20
|
-
"types": "./dist/index.d.
|
|
20
|
+
"types": "./dist/index.d.cts",
|
|
21
21
|
"exports": {
|
|
22
|
-
".":
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
},
|
|
23
26
|
"./package.json": "./package.json"
|
|
24
27
|
},
|
|
25
28
|
"scripts": {
|