@phenyxhealth/sdk 1.0.5 → 1.0.8

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/README.md CHANGED
@@ -14,9 +14,9 @@ npm install @phenyxhealth/sdk
14
14
  ## Inicio Rápido
15
15
 
16
16
  ```javascript
17
- import { PhenyxApi } from "@phenyxhealth/sdk";
17
+ import { PhenyxSDK } from "@phenyxhealth/sdk";
18
18
 
19
- const api = new PhenyxApi();
19
+ const api = new PhenyxSDK();
20
20
 
21
21
  // Autenticación
22
22
  await api.login({
@@ -247,8 +247,8 @@ const deptId = api.getSendingDepartmentIdByName("Oncología");
247
247
  // Obtener ID de código CEI9
248
248
  const cei9Id = api.getCei9IdByName("C78.9");
249
249
 
250
- // Obtener ID de código CEI10
251
- const cei10Id = api.getCei10IdByName("C78.9");
250
+ // Obtener ID de código CIE10
251
+ const cie10Id = api.getCie10IdByName("C78.9");
252
252
  ```
253
253
 
254
254
  ## Funciones de Validación
@@ -300,14 +300,14 @@ const token = api.getToken(); // Obtiene el token JWT actual
300
300
 
301
301
  ```javascript
302
302
  import {
303
- PhenyxApi,
303
+ PhenyxSDK,
304
304
  beSureDoctorExists,
305
305
  beSureLinacsExists,
306
306
  checkGlobals,
307
307
  } from "@phenyxhealth/sdk";
308
308
 
309
309
  const setupClinic = async () => {
310
- const api = new PhenyxApi();
310
+ const api = new PhenyxSDK();
311
311
 
312
312
  // Autenticación
313
313
  await api.login({
@@ -341,10 +341,10 @@ setupClinic();
341
341
  ### Ejemplo 2: Crear y Procesar Paciente
342
342
 
343
343
  ```javascript
344
- import { PhenyxApi, today } from "@phenyxhealth/sdk";
344
+ import { PhenyxSDK, today } from "@phenyxhealth/sdk";
345
345
 
346
346
  const processPatient = async () => {
347
- const api = new PhenyxApi();
347
+ const api = new PhenyxSDK();
348
348
  await api.login({
349
349
  /* credentials */
350
350
  });
@@ -355,7 +355,7 @@ const processPatient = async () => {
355
355
  birthDate: "1980-01-15",
356
356
  sendingDepartmentId: api.getSendingDepartmentIdByName("Oncología"),
357
357
  cei9Id: api.getCei9IdByName("C78.9"),
358
- cei10Id: api.getCei10IdByName("C78.9"),
358
+ cie10Id: api.getCie10IdByName("C78.9"),
359
359
  });
360
360
 
361
361
  // Cambiar estado del paciente
@@ -389,7 +389,7 @@ try {
389
389
 
390
390
  try {
391
391
  const cei9Id = api.getCei9IdByName("C00.0");
392
- const cei10Id = api.getCei10IdByName("C00.0");
392
+ const cie10Id = api.getCie10IdByName("C00.0");
393
393
  } catch (error) {
394
394
  console.error("Código CEI no encontrado:", error.message);
395
395
  }
@@ -400,9 +400,9 @@ try {
400
400
  El SDK incluye definiciones TypeScript completas:
401
401
 
402
402
  ```typescript
403
- import { PhenyxApi, PatientData, HumanResourceData } from "@phenyxhealth/sdk";
403
+ import { PhenyxSDK, PatientData, HumanResourceData } from "@phenyxhealth/sdk";
404
404
 
405
- const api: PhenyxApi = new PhenyxApi();
405
+ const api: PhenyxSDK = new PhenyxSDK();
406
406
 
407
407
  const patient: PatientData = await api.getPatient("id");
408
408
  const doctors: HumanResourceData[] = await api.getHumanResources();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phenyxhealth/sdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "description": "SDK oficial para PhenyxHealth - Sistema integral de gestión de radioterapia. Incluye gestión de pacientes, recursos humanos, equipos médicos y configuración global.",
6
6
  "main": "./src/index.js",
package/src/PhenyxApi.js CHANGED
@@ -65,9 +65,13 @@ class PhenyxApi {
65
65
  type: 'Global',
66
66
  name: 'CEI9',
67
67
  },
68
- cei10: {
68
+ cie10: {
69
69
  type: 'Global',
70
- name: 'CEI10',
70
+ name: 'CIE10',
71
+ },
72
+ cie10: {
73
+ type: 'Global',
74
+ name: 'CIE10',
71
75
  },
72
76
  treatmentClass: {
73
77
  type: 'Global',
@@ -436,19 +440,23 @@ class PhenyxApi {
436
440
  }
437
441
 
438
442
  /**
439
- * Obtiene el ID de un CEI10 por nombre
440
- * @param {string} name - Nombre del CEI10
441
- * @returns {string} ID del CEI10
442
- * @throws {Error} Si no se encuentra el CEI10
443
+ * Obtiene el ID de un CIE10 por nombre
444
+ * @param {string} name - Nombre del CIE10
445
+ * @returns {string} ID del CIE10
446
+ * @throws {Error} Si no se encuentra el CIE10
443
447
  * @example
444
- * const cei10Id = api.getCei10IdByName('C78.9');
448
+ * const cie10Id = api.getCie10IdByName('C78.9');
445
449
  */
446
- getCei10IdByName = (name) => {
447
- const cei10 = this.getGlobalInfoElement(this.globalTypes.cei10, name);
448
- if (!cei10) {
449
- throw new Error(`CEI10 ${name} not found`);
450
+ getCie10IdByName = (name) => {
451
+ const cie10 = this.getGlobalInfoElement(this.globalTypes.cie10, name);
452
+ if (!cie10) {
453
+ throw new Error(`CIE10 ${name} not found`);
450
454
  }
451
- return cei10.id;
455
+ return cie10.id;
456
+ }
457
+
458
+ getCie10CodeExists = (name) => {
459
+ return !!this.getGlobalInfoElement(this.globalTypes.cie10, name);
452
460
  }
453
461
 
454
462
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Valida que los médicos especificados existan en el sistema
3
3
  * Si no existen, los crea automáticamente
4
- * @param {PhenyxApi} apiInstance - Instancia autenticada de PhenyxApi
4
+ * @param {PhenyxSDK} apiInstance - Instancia autenticada de PhenyxSDK
5
5
  * @param {Array} toBe - Array de objetos médico con {name, hrGroup}
6
6
  * @param {string} toBe[].name - Nombre del médico
7
7
  * @param {string} toBe[].hrGroup - Grupo de recursos humanos ('RadOnc' o 'MedPhys')
@@ -3,7 +3,7 @@ import { getContrastingColor } from '../utils/colors.js';
3
3
 
4
4
  /**
5
5
  * Valida que los valores globales especificados existan en el sistema
6
- * @param {PhenyxApi} apiInstance - Instancia autenticada de PhenyxApi
6
+ * @param {PhenyxSDK} apiInstance - Instancia autenticada de PhenyxSDK
7
7
  * @param {Object} mustBe - Configuración global requerida
8
8
  * @param {string} mustBe.name - Nombre del tipo global
9
9
  * @param {Object} [mustBe.values={}] - Valores que deben existir
@@ -43,7 +43,7 @@ const checkGlobals = async (apiInstance, mustBe, extraValues = []) => {
43
43
  /**
44
44
  * Asegura que elementos específicos existan en una lista global
45
45
  * Si no existen, los crea automáticamente
46
- * @param {PhenyxApi} apiInstance - Instancia autenticada de PhenyxApi
46
+ * @param {PhenyxSDK} apiInstance - Instancia autenticada de PhenyxSDK
47
47
  * @param {Object} currentList - Lista global actual
48
48
  * @param {string} currentList.id - ID de la lista global
49
49
  * @param {string} currentList.name - Nombre de la lista global
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Valida que los LINACs especificados existan en el sistema
3
3
  * Si no existen, los crea automáticamente
4
- * @param {PhenyxApi} apiInstance - Instancia autenticada de PhenyxApi
4
+ * @param {PhenyxSDK} apiInstance - Instancia autenticada de PhenyxSDK
5
5
  * @param {Array<string>} toBe - Array con nombres de LINACs que deben existir
6
6
  * @returns {Promise<Array>} Lista actualizada de LINACs
7
7
  * @example
package/src/index.js CHANGED
@@ -10,10 +10,10 @@
10
10
  *
11
11
  * @example
12
12
  * // Importar las funciones principales
13
- * import { PhenyxApi, beSureDoctorExists, today } from '@phenyxhealth/sdk';
13
+ * import { PhenyxSDK, beSureDoctorExists, today } from '@phenyxhealth/sdk';
14
14
  *
15
15
  * // Crear instancia y autenticar
16
- * const api = new PhenyxApi();
16
+ * const api = new PhenyxSDK();
17
17
  * await api.login({
18
18
  * apiHost: 'https://demo.phenyxhealth.com',
19
19
  * user: 'admin',
@@ -27,7 +27,7 @@
27
27
  */
28
28
 
29
29
  // Exportaciones principales
30
- export { default as PhenyxApi } from './PhenyxApi.js';
30
+ export { default as PhenyxSDK } from './PhenyxApi.js';
31
31
 
32
32
  // Controladores de validación
33
33
  export { checkGlobals, beSureGlobalExists } from './controllers/global.js';
package/types/index.d.ts CHANGED
@@ -37,6 +37,7 @@ declare module "@phenyxhealth/sdk" {
37
37
  birthDate: string;
38
38
  sendingDepartmentId?: string;
39
39
  cei9Id?: string;
40
+ cie10Id?: string;
40
41
  [key: string]: any;
41
42
  }
42
43
 
@@ -127,7 +128,7 @@ declare module "@phenyxhealth/sdk" {
127
128
  birthDate: string;
128
129
  sendingDepartmentId?: string;
129
130
  cei9Id?: string;
130
- cei10Id?: string;
131
+ cie10Id?: string;
131
132
  [key: string]: any;
132
133
  }
133
134
 
@@ -220,8 +221,7 @@ declare module "@phenyxhealth/sdk" {
220
221
  humanResources: GlobalType;
221
222
  sendingDepartment: GlobalType;
222
223
  cei9: GlobalType;
223
- cei10: GlobalType;
224
- cei10: GlobalType;
224
+ cie10: GlobalType;
225
225
  treatmentClass: GlobalType;
226
226
  treatmentSubClass: GlobalType;
227
227
  treatmentTechnique: GlobalType;
@@ -409,20 +409,20 @@ declare module "@phenyxhealth/sdk" {
409
409
  getSendingDepartmentIdByName(name: string): string;
410
410
 
411
411
  /**
412
- * Obtiene el ID de un CEI9 por nombre
413
- * @param name Nombre del CEI9
414
- * @returns ID del CEI9
415
- * @throws Error si no se encuentra el CEI9
412
+ * Obtiene el ID de un CIE10 por nombre
413
+ * @param name Nombre del CIE10
414
+ * @returns ID del CIE10
415
+ * @throws Error si no se encuentra el CIE10
416
416
  */
417
- getCei9IdByName(name: string): string;
417
+ getCie10IdByName(name: string): string;
418
418
 
419
419
  /**
420
- * Obtiene el ID de un CEI10 por nombre
421
- * @param name Nombre del CEI10
422
- * @returns ID del CEI10
423
- * @throws Error si no se encuentra el CEI10
420
+ * Obtiene el ID de un CIE10 por nombre
421
+ * @param name Nombre del CIE10
422
+ * @returns ID del CIE10
423
+ * @throws Error si no se encuentra el CIE10
424
424
  */
425
- getCei10IdByName(name: string): string;
425
+ getCie10IdByName(name: string): string;
426
426
 
427
427
  /**
428
428
  * Obtiene el estado de peer review formateado
@@ -494,54 +494,55 @@ declare module "@phenyxhealth/sdk" {
494
494
 
495
495
  /**
496
496
  * Valida que los médicos existan en el sistema, los crea si no existen
497
- * @param apiInstance Instancia de PhenyxApi autenticada
497
+ * @param apiInstance Instancia de PhenyxSDK autenticada
498
498
  * @param toBe Array de médicos a validar
499
499
  * @returns Promise con array de recursos humanos actualizados
500
500
  */
501
501
  export function beSureDoctorExists(
502
- apiInstance: PhenyxApi,
502
+ apiInstance: PhenyxSDK,
503
503
  toBe: DoctorValidation[],
504
504
  ): Promise<HumanResourceData[]>;
505
505
 
506
506
  /**
507
507
  * Valida que los LINACs existan en el sistema, los crea si no existen
508
- * @param apiInstance Instancia de PhenyxApi autenticada
508
+ * @param apiInstance Instancia de PhenyxSDK autenticada
509
509
  * @param toBe Array de nombres de LINACs
510
510
  * @returns Promise con array de LINACs actualizados
511
511
  */
512
512
  export function beSureLinacsExists(
513
- apiInstance: PhenyxApi,
513
+ apiInstance: PhenyxSDK,
514
514
  toBe: string[],
515
515
  ): Promise<ResourceData[]>;
516
516
 
517
517
  /**
518
518
  * Valida información global, añade valores faltantes
519
- * @param apiInstance Instancia de PhenyxApi autenticada
519
+ * @param apiInstance Instancia de PhenyxSDK autenticada
520
520
  * @param mustBe Configuración global requerida
521
521
  * @param extraValues Valores adicionales opcionales
522
522
  * @returns Promise que resuelve cuando se valida
523
523
  */
524
524
  export function checkGlobals(
525
- apiInstance: PhenyxApi,
525
+ apiInstance: PhenyxSDK,
526
526
  mustBe: GlobalType,
527
527
  extraValues?: string[],
528
528
  ): Promise<void>;
529
529
 
530
530
  /**
531
531
  * Asegura que elementos globales existan
532
- * @param apiInstance Instancia de PhenyxApi autenticada
532
+ * @param apiInstance Instancia de PhenyxSDK autenticada
533
533
  * @param currentList Lista actual de elementos
534
534
  * @param toBeList Lista de elementos que deben existir
535
535
  * @returns Promise que resuelve cuando se valida
536
536
  */
537
537
  export function beSureGlobalExists(
538
- apiInstance: PhenyxApi,
538
+ apiInstance: PhenyxSDK,
539
539
  currentList: GlobalInfo,
540
540
  toBeList: string[],
541
541
  ): Promise<void>;
542
542
 
543
543
  // ==================== EXPORT DEFAULT ====================
544
544
 
545
+ export { PhenyxApi as PhenyxSDK };
545
546
  export default PhenyxApi;
546
547
  }
547
548