generio-sdk 1.0.59 → 1.0.61

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 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.None=0]=`None`,e[e.Left=1]=`Left`,e[e.Right=2]=`Right`,e[e.Bottom=3]=`Bottom`,e[e.Top=4]=`Top`,e}({}),u=function(e){return e[e.None=0]=`None`,e[e.Coronal=1]=`Coronal`,e[e.Sagittal=2]=`Sagittal`,e[e.Transverse=3]=`Transverse`,e}({}),d=function(e){return e[e.None=0]=`None`,e[e.Left=1]=`Left`,e[e.Right=2]=`Right`,e[e.Bottom=3]=`Bottom`,e[e.Top=4]=`Top`,e}({}),f=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 p=class{constructor(){}ConvertExaminationDataToGeneratorRows(e){let t=[],n=0,r={subRows:[]},i=[],a=[];do{do{do{if(e[n]?.formType==f.NewLine)break;if(e[n])switch(e[n].formType){case f.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==f.DropDownList&&n<e.length);t.elementSelectOptions=r,a.push(t),n--;break}case f.Text:case f.Append:if(e[n]?.formValue){let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n,a.push(t)}break;case f.InputText:{let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n,t.isDistance=this.IsDistanceDefinition(e[n+1]?.formValue??``),a.push(t);break}case f.BoldText:case f.CheckBox:case f.Button:case f.DigitBox:case f.RememberedText:case f.InputTable:case f.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==f.NewLine&&e[n]?.formValue?r.showHideElementId=e[n].formValue??``:r.showHideElementId=``,e[n]?.formType==f.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 m=`https://localhost:7052`,h=`generio-is-logged-in`,g=`generio-logged-in-email`;async function _(e){let t=await fetch(m+`/api/cookiesAuth/login`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(t.ok){let e=t.headers.get(`set-cookie`);return{isSuccess:!0,cookie:e?e.split(`;`)[0]:void 0}}return{isSuccess:!1}}async function v(){let e=await fetch(m+`/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 y(e){m+``;let t=await fetch(`https://localhost:7052/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 b(e,t){let n=await fetch(m+`/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 x(e){m+``;let t=await fetch(`https://localhost:7052/api/datasetsCookiesAuth/getExtParamValueByStudyInstanceUId`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{}}async function S(e,t){let n=await fetch(m+`/api/annotationPlacements/getAnnotationPlacements`,{method:`POST`,credentials:`include`,headers:k(t),body:JSON.stringify(e)});return n.ok?n.json():{isSuccess:!1,errorMessage:n.statusText,annotationPlacements:[]}}async function C(e){m+``;let t=await fetch(`https://localhost:7052/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 w(e,t){e.postMessage({action:`setExtParams`,model:t},{targetOrigin:m})}async function T(e){m+``;let t=await fetch(`https://localhost:7052/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 E(e){m+``;let t=await fetch(`https://localhost:7052/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 D(e){window.addEventListener(`message`,t=>{if(m==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 O(e,t,n,r){let i=`${m}/generator/recognizeExamination?studyInstanceUId=${e}&modality=${t}`;return n&&(i+=`&studyDescription=${n}`),r&&(i+=`&bodyPartExamined=${r}`),i}function k(e){let t={"Content-Type":`application/json`};return e&&(t.Cookie=e),t}exports.ExaminationDataHelpers=p,exports.FormTypeEnum=f,exports.GENERIO_IS_LOGGED_IN=`generio-is-logged-in`,exports.GENERIO_LOGGED_IN_EMAIL=`generio-logged-in-email`,exports.GENERIO_ORIGIN=m,exports.PlaneFromDicomEnum=u,exports.PositioningNoAiEnum=d,exports.SiteFromDicomEnum=l,exports.getAnnotationPlacements=S,exports.getExaminationMessage=E,exports.getExtParamValueByStudyInstanceUId=x,exports.getGenerioRecognizeExaminationUrl=O,exports.loadExamination=b,exports.login=_,exports.logout=v,exports.recognizeExamination=y,exports.sendMeasurements=T,exports.setExtParams=C,exports.setExtParamsPostMessage=w,exports.setupPostMessageListeners=D;
@@ -0,0 +1,296 @@
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
+ errorMessage?: string;
86
+ }
87
+ //#endregion
88
+ //#region src/models/LogoutOutputModel.d.ts
89
+ interface LogoutOutputModel {
90
+ isSuccess: boolean;
91
+ }
92
+ //#endregion
93
+ //#region src/models/GenerioReadyOutputModel.d.ts
94
+ interface GenerioReadyOutputModel {
95
+ studyInstanceUId: string;
96
+ }
97
+ //#endregion
98
+ //#region src/models/FormTypeEnum.d.ts
99
+ declare enum FormTypeEnum {
100
+ NewLine = 0,
101
+ Text = 1,
102
+ BoldText = 2,
103
+ CheckBox = 3,
104
+ DropDownList = 4,
105
+ InputText = 5,
106
+ ConditionAndOr = 6,
107
+ Function = 7,
108
+ Condition = 8,
109
+ Button = 9,
110
+ Append = 10,
111
+ DigitBox = 11,
112
+ Merge = 12,
113
+ Listing = 13,
114
+ Bilateral = 14,
115
+ Matrix = 15,
116
+ RememberedText = 17,
117
+ InputTable = 18,
118
+ AppendDiagnose = 19,
119
+ // TODO: check if not deprecated
120
+ MoveByExtParams = 20,
121
+ }
122
+ //#endregion
123
+ //#region src/models/OriginDataItem.d.ts
124
+ interface OriginDataItem {
125
+ index: number;
126
+ formType: FormTypeEnum;
127
+ formValue?: string;
128
+ finding?: string;
129
+ conclusion?: string;
130
+ guid: string;
131
+ radLexId?: string;
132
+ extParam?: string;
133
+ }
134
+ //#endregion
135
+ //#region src/models/OriginElementDetail.d.ts
136
+ interface OriginElementDetail {
137
+ /**
138
+ * ExaminationId
139
+ */
140
+ id: number;
141
+ sortConclusion: string;
142
+ normalConclusion: string;
143
+ examinationElementSectionName: string;
144
+ examinationElementName: string;
145
+ languageCode: string;
146
+ loggedUserEmail: string;
147
+ loggedUserId: number;
148
+ loggedUserSawWholeTour: boolean;
149
+ examinationElementCreatedByUserEmail: string;
150
+ examinationElementCreatedByUserName: string;
151
+ bottomBanner: string;
152
+ isMachineTranslated: boolean;
153
+ roundDecimalsToIntegers: boolean;
154
+ addSpaceBeforeUnit: boolean;
155
+ isEnabledImagesAndExport: boolean;
156
+ isHiddenOtherActions: boolean;
157
+ copyResultCount: number;
158
+ copyResultLimit: number;
159
+ isExceededLimit: boolean;
160
+ exceededLimitText: string;
161
+ }
162
+ //#endregion
163
+ //#region src/models/OriginDetail.d.ts
164
+ interface OriginDetail {
165
+ element: OriginElementDetail;
166
+ data: OriginDataItem[];
167
+ cultureShort: string;
168
+ }
169
+ //#endregion
170
+ //#region src/models/GetExaminationMessageInputModel.d.ts
171
+ interface GetExaminationMessageInputModel {
172
+ studyInstanceUId: string;
173
+ }
174
+ //#endregion
175
+ //#region src/models/GetAnnotationPlacementsInputModel.d.ts
176
+ interface GetAnnotationPlacementsInputModel {
177
+ examinationId: number;
178
+ }
179
+ //#endregion
180
+ //#region src/models/GetAnnotationPlacementsOutputModel.d.ts
181
+ interface GetAnnotationPlacementsOutputModel {
182
+ isSuccess: boolean;
183
+ errorMessage?: string;
184
+ annotationPlacements: AnnotationPlacement[];
185
+ }
186
+ interface AnnotationPlacement {
187
+ examinationId: number;
188
+ siteFromDicom: SiteFromDicomEnum;
189
+ planeFromDicom: PlaneFromDicomEnum;
190
+ positioningNoAi: PositioningNoAiEnum;
191
+ imagesNoAi: string;
192
+ coordinatesAi: string;
193
+ imagesAi: string;
194
+ guids: string;
195
+ }
196
+ declare enum SiteFromDicomEnum {
197
+ None = 0,
198
+ Left = 1,
199
+ Right = 2,
200
+ Bottom = 3,
201
+ Top = 4,
202
+ }
203
+ declare enum PlaneFromDicomEnum {
204
+ None = 0,
205
+ Coronal = 1,
206
+ Sagittal = 2,
207
+ Transverse = 3,
208
+ }
209
+ declare enum PositioningNoAiEnum {
210
+ None = 0,
211
+ Left = 1,
212
+ Right = 2,
213
+ Bottom = 3,
214
+ Top = 4,
215
+ }
216
+ //#endregion
217
+ //#region src/models/Column.d.ts
218
+ interface Column {
219
+ formTypeId: FormTypeEnum;
220
+ formValue?: string;
221
+ finding?: string;
222
+ conclusion?: string;
223
+ guid: string;
224
+ radLexId?: string;
225
+ extParam?: string;
226
+ columnIndex?: number;
227
+ elementIndex?: number;
228
+ visualizeColumn?: boolean;
229
+ }
230
+ //#endregion
231
+ //#region src/models/ElementColumn.d.ts
232
+ interface ElementColumn extends Column {
233
+ elementSelectOptions?: Column[];
234
+ isDistance?: boolean;
235
+ preselected?: boolean;
236
+ }
237
+ //#endregion
238
+ //#region src/models/ElementSubRow.d.ts
239
+ interface ElementSubRow {
240
+ columns: Array<ElementColumn>;
241
+ }
242
+ //#endregion
243
+ //#region src/models/ElementRow.d.ts
244
+ interface ElementRow {
245
+ showHideElementId: string;
246
+ hrBeforeRow: boolean;
247
+ rowIndex: number;
248
+ visualizeRow: boolean;
249
+ subRows: Array<ElementSubRow>;
250
+ }
251
+ //#endregion
252
+ //#region src/models/AppendDiagnoseFormHandlebarsModel.d.ts
253
+ interface AppendDiagnoseFormHandlebarsModel {
254
+ index: number;
255
+ }
256
+ //#endregion
257
+ //#region src/models/FindingGeneratorFormHandlebarsModel.d.ts
258
+ interface FindingGeneratorFormHandlebarsModel {
259
+ formRows: ElementRow[];
260
+ appendDiagnoses: AppendDiagnoseFormHandlebarsModel[];
261
+ }
262
+ //#endregion
263
+ //#region src/services/ExaminationDataHelpers.d.ts
264
+ declare class ExaminationDataHelpers {
265
+ constructor();
266
+ /**
267
+ * Convert DB items into hbs object. Used in FindingGenerator.handlebars
268
+ * @param items ExaminationData entries
269
+ * @returns entry array for hbs
270
+ */
271
+ ConvertExaminationDataToGeneratorRows(items: OriginDataItem[]): ElementRow[];
272
+ CreateColumn(formType: FormTypeEnum, formValue?: string, finding?: string, conclusion?: string, guid?: string, radLexId?: string, extParam?: string): Column;
273
+ CreateColumnFromExaminationData(item: OriginDataItem): Column;
274
+ IsDistanceDefinition(originFormValue: string): boolean;
275
+ }
276
+ //#endregion
277
+ //#region src/index.d.ts
278
+ declare const GENERIO_ORIGIN = "https://localhost:7052";
279
+ declare const GENERIO_IS_LOGGED_IN = "generio-is-logged-in";
280
+ declare const GENERIO_LOGGED_IN_EMAIL = "generio-logged-in-email";
281
+ declare function login(model: LoginInputModel): Promise<LoginOutputModel & {
282
+ cookie?: string;
283
+ }>;
284
+ declare function logout(): Promise<LogoutOutputModel>;
285
+ declare function recognizeExamination(model: RecognizeExaminationInputModel): Promise<RecognizeExaminationOutputModel>;
286
+ declare function loadExamination(examinationId: number, studyInstanceUId: string): Promise<OriginDetail>;
287
+ declare function getExtParamValueByStudyInstanceUId(model: GetExtParamValueByStudyInstanceUIdInputModel): Promise<GetExtParamValueByStudyInstanceUIdOutputModel>;
288
+ declare function getAnnotationPlacements(model: GetAnnotationPlacementsInputModel, cookie?: string): Promise<GetAnnotationPlacementsOutputModel>;
289
+ declare function setExtParams(model: SetExtParamsInputModel): Promise<SetExtParamsOutputModel>;
290
+ declare function setExtParamsPostMessage(window: Window, model: SetExtParamsInputModel): void;
291
+ declare function sendMeasurements(model: SendMeasurementsInputModel): Promise<SendMeasurementsOutputModel>;
292
+ declare function getExaminationMessage(model: GetExaminationMessageInputModel): Promise<GetExaminationMessageOutputModel>;
293
+ declare function setupPostMessageListeners(generioReadyHandler?: (model: GenerioReadyOutputModel, event: MessageEvent) => void): void;
294
+ declare function getGenerioRecognizeExaminationUrl(studyInstanceUId: string, modality: string, studyDescription?: string, bodyPartExamined?: string): string;
295
+ //#endregion
296
+ export { AnnotationPlacement, 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, GetAnnotationPlacementsInputModel, GetAnnotationPlacementsOutputModel, GetExaminationMessageInputModel, GetExaminationMessageOutputModel, GetExtParamValueByStudyInstanceUIdInputModel, GetExtParamValueByStudyInstanceUIdOutputModel, KeyValueModel, LoginInputModel, LoginOutputModel, LogoutOutputModel, MeasurementModel, type OriginDataItem, type OriginDetail, type OriginElementDetail, PlaneFromDicomEnum, PositioningNoAiEnum, RecognizeExaminationInputModel, RecognizeExaminationOutputModel, SendMeasurementsInputModel, SendMeasurementsOutputModel, SetExtParamsInputModel, SetExtParamsOutputModel, SiteFromDicomEnum, getAnnotationPlacements, getExaminationMessage, getExtParamValueByStudyInstanceUId, getGenerioRecognizeExaminationUrl, loadExamination, login, logout, recognizeExamination, sendMeasurements, setExtParams, setExtParamsPostMessage, setupPostMessageListeners };
package/dist/index.d.ts CHANGED
@@ -82,6 +82,7 @@ interface LoginInputModel {
82
82
  //#region src/models/LoginOutputModel.d.ts
83
83
  interface LoginOutputModel {
84
84
  isSuccess: boolean;
85
+ errorMessage?: string;
85
86
  }
86
87
  //#endregion
87
88
  //#region src/models/LogoutOutputModel.d.ts
@@ -171,6 +172,48 @@ interface GetExaminationMessageInputModel {
171
172
  studyInstanceUId: string;
172
173
  }
173
174
  //#endregion
175
+ //#region src/models/GetAnnotationPlacementsInputModel.d.ts
176
+ interface GetAnnotationPlacementsInputModel {
177
+ examinationId: number;
178
+ }
179
+ //#endregion
180
+ //#region src/models/GetAnnotationPlacementsOutputModel.d.ts
181
+ interface GetAnnotationPlacementsOutputModel {
182
+ isSuccess: boolean;
183
+ errorMessage?: string;
184
+ annotationPlacements: AnnotationPlacement[];
185
+ }
186
+ interface AnnotationPlacement {
187
+ examinationId: number;
188
+ siteFromDicom: SiteFromDicomEnum;
189
+ planeFromDicom: PlaneFromDicomEnum;
190
+ positioningNoAi: PositioningNoAiEnum;
191
+ imagesNoAi: string;
192
+ coordinatesAi: string;
193
+ imagesAi: string;
194
+ guids: string;
195
+ }
196
+ declare enum SiteFromDicomEnum {
197
+ None = 0,
198
+ Left = 1,
199
+ Right = 2,
200
+ Bottom = 3,
201
+ Top = 4,
202
+ }
203
+ declare enum PlaneFromDicomEnum {
204
+ None = 0,
205
+ Coronal = 1,
206
+ Sagittal = 2,
207
+ Transverse = 3,
208
+ }
209
+ declare enum PositioningNoAiEnum {
210
+ None = 0,
211
+ Left = 1,
212
+ Right = 2,
213
+ Bottom = 3,
214
+ Top = 4,
215
+ }
216
+ //#endregion
174
217
  //#region src/models/Column.d.ts
175
218
  interface Column {
176
219
  formTypeId: FormTypeEnum;
@@ -232,14 +275,17 @@ declare class ExaminationDataHelpers {
232
275
  }
233
276
  //#endregion
234
277
  //#region src/index.d.ts
235
- declare const GENERIO_ORIGIN = "https://gener.io";
278
+ declare const GENERIO_ORIGIN = "https://localhost:7052";
236
279
  declare const GENERIO_IS_LOGGED_IN = "generio-is-logged-in";
237
280
  declare const GENERIO_LOGGED_IN_EMAIL = "generio-logged-in-email";
238
- declare function login(model: LoginInputModel): Promise<LoginOutputModel>;
281
+ declare function login(model: LoginInputModel): Promise<LoginOutputModel & {
282
+ cookie?: string;
283
+ }>;
239
284
  declare function logout(): Promise<LogoutOutputModel>;
240
285
  declare function recognizeExamination(model: RecognizeExaminationInputModel): Promise<RecognizeExaminationOutputModel>;
241
286
  declare function loadExamination(examinationId: number, studyInstanceUId: string): Promise<OriginDetail>;
242
287
  declare function getExtParamValueByStudyInstanceUId(model: GetExtParamValueByStudyInstanceUIdInputModel): Promise<GetExtParamValueByStudyInstanceUIdOutputModel>;
288
+ declare function getAnnotationPlacements(model: GetAnnotationPlacementsInputModel, cookie?: string): Promise<GetAnnotationPlacementsOutputModel>;
243
289
  declare function setExtParams(model: SetExtParamsInputModel): Promise<SetExtParamsOutputModel>;
244
290
  declare function setExtParamsPostMessage(window: Window, model: SetExtParamsInputModel): void;
245
291
  declare function sendMeasurements(model: SendMeasurementsInputModel): Promise<SendMeasurementsOutputModel>;
@@ -247,4 +293,4 @@ declare function getExaminationMessage(model: GetExaminationMessageInputModel):
247
293
  declare function setupPostMessageListeners(generioReadyHandler?: (model: GenerioReadyOutputModel, event: MessageEvent) => void): void;
248
294
  declare function getGenerioRecognizeExaminationUrl(studyInstanceUId: string, modality: string, studyDescription?: string, bodyPartExamined?: string): string;
249
295
  //#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 };
296
+ export { AnnotationPlacement, 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, GetAnnotationPlacementsInputModel, GetAnnotationPlacementsOutputModel, GetExaminationMessageInputModel, GetExaminationMessageOutputModel, GetExtParamValueByStudyInstanceUIdInputModel, GetExtParamValueByStudyInstanceUIdOutputModel, KeyValueModel, LoginInputModel, LoginOutputModel, LogoutOutputModel, MeasurementModel, type OriginDataItem, type OriginDetail, type OriginElementDetail, PlaneFromDicomEnum, PositioningNoAiEnum, RecognizeExaminationInputModel, RecognizeExaminationOutputModel, SendMeasurementsInputModel, SendMeasurementsOutputModel, SetExtParamsInputModel, SetExtParamsOutputModel, SiteFromDicomEnum, getAnnotationPlacements, getExaminationMessage, getExtParamValueByStudyInstanceUId, getGenerioRecognizeExaminationUrl, loadExamination, login, logout, recognizeExamination, sendMeasurements, setExtParams, setExtParamsPostMessage, setupPostMessageListeners };
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(){}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};
1
+ import{v4 as e}from"uuid";let t=function(e){return e[e.None=0]=`None`,e[e.Left=1]=`Left`,e[e.Right=2]=`Right`,e[e.Bottom=3]=`Bottom`,e[e.Top=4]=`Top`,e}({}),n=function(e){return e[e.None=0]=`None`,e[e.Coronal=1]=`Coronal`,e[e.Sagittal=2]=`Sagittal`,e[e.Transverse=3]=`Transverse`,e}({}),r=function(e){return e[e.None=0]=`None`,e[e.Left=1]=`Left`,e[e.Right=2]=`Right`,e[e.Bottom=3]=`Bottom`,e[e.Top=4]=`Top`,e}({}),i=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 a=class{constructor(){}ConvertExaminationDataToGeneratorRows(e){let t=[],n=0,r={subRows:[]},a=[],o=[];do{do{do{if(e[n]?.formType==i.NewLine)break;if(e[n])switch(e[n].formType){case i.DropDownList:{let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n;let r=[],a=1;do{let i=this.CreateColumnFromExaminationData(e[n]);i.elementIndex=n;let o=e[n]?.formValue?.trim();a===1&&o&&!o.startsWith(`-`)&&!o.endsWith(`-`)&&(t.preselected=!0),r.push(i),n++,a++}while(e[n]?.formType==i.DropDownList&&n<e.length);t.elementSelectOptions=r,o.push(t),n--;break}case i.Text:case i.Append:if(e[n]?.formValue){let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n,o.push(t)}break;case i.InputText:{let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n,t.isDistance=this.IsDistanceDefinition(e[n+1]?.formValue??``),o.push(t);break}case i.BoldText:case i.CheckBox:case i.Button:case i.DigitBox:case i.RememberedText:case i.InputTable:case i.MoveByExtParams:{let t=this.CreateColumnFromExaminationData(e[n]);t.elementIndex=n,o.push(t);break}default:break}n++}while(n<e.length);if(o.length>0){let e={columns:o};a.push(e)}if(o=[],!r.showHideElementId||!e[n]?.formValue||r.showHideElementId!=e[n]?.formValue)break;n++}while(n<e.length);a.length>0&&(r.subRows=a,t.push(r)),a=[],r={},e[n]?.formType==i.NewLine&&e[n]?.formValue?r.showHideElementId=e[n].formValue??``:r.showHideElementId=``,e[n]?.formType==i.NewLine&&e[n]?.conclusion&&e[n]?.conclusion==`hr`?r.hrBeforeRow=!0:r.hrBeforeRow=!1,n++}while(n<e.length);return t}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 o=`https://localhost:7052`,s=`generio-is-logged-in`,c=`generio-logged-in-email`;async function l(e){let t=await fetch(o+`/api/cookiesAuth/login`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(t.ok){let e=t.headers.get(`set-cookie`);return{isSuccess:!0,cookie:e?e.split(`;`)[0]:void 0}}return{isSuccess:!1}}async function u(){let e=await fetch(o+`/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 d(e){o+``;let t=await fetch(`https://localhost:7052/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 f(e,t){let n=await fetch(o+`/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 p(e){o+``;let t=await fetch(`https://localhost:7052/api/datasetsCookiesAuth/getExtParamValueByStudyInstanceUId`,{method:`POST`,credentials:`include`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}});return t.ok?t.json():{}}async function m(e,t){let n=await fetch(o+`/api/annotationPlacements/getAnnotationPlacements`,{method:`POST`,credentials:`include`,headers:x(t),body:JSON.stringify(e)});return n.ok?n.json():{isSuccess:!1,errorMessage:n.statusText,annotationPlacements:[]}}async function h(e){o+``;let t=await fetch(`https://localhost:7052/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 g(e,t){e.postMessage({action:`setExtParams`,model:t},{targetOrigin:o})}async function _(e){o+``;let t=await fetch(`https://localhost:7052/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 v(e){o+``;let t=await fetch(`https://localhost:7052/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 y(e){window.addEventListener(`message`,t=>{if(o==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 b(e,t,n,r){let i=`${o}/generator/recognizeExamination?studyInstanceUId=${e}&modality=${t}`;return n&&(i+=`&studyDescription=${n}`),r&&(i+=`&bodyPartExamined=${r}`),i}function x(e){let t={"Content-Type":`application/json`};return e&&(t.Cookie=e),t}export{a as ExaminationDataHelpers,i as FormTypeEnum,s as GENERIO_IS_LOGGED_IN,c as GENERIO_LOGGED_IN_EMAIL,o as GENERIO_ORIGIN,n as PlaneFromDicomEnum,r as PositioningNoAiEnum,t as SiteFromDicomEnum,m as getAnnotationPlacements,v as getExaminationMessage,p as getExtParamValueByStudyInstanceUId,b as getGenerioRecognizeExaminationUrl,f as loadExamination,l as login,u as logout,d as recognizeExamination,_ as sendMeasurements,h as setExtParams,g as setExtParamsPostMessage,y as setupPostMessageListeners};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generio-sdk",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
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.js",
18
+ "main": "./dist/index.cjs",
19
19
  "module": "./dist/index.js",
20
- "types": "./dist/index.d.ts",
20
+ "types": "./dist/index.d.cts",
21
21
  "exports": {
22
- ".": "./dist/index.js",
22
+ ".": {
23
+ "import": "./dist/index.js",
24
+ "require": "./dist/index.cjs"
25
+ },
23
26
  "./package.json": "./package.json"
24
27
  },
25
28
  "scripts": {