@persei/perseed-api 5.0.27 → 5.0.28

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.
Files changed (62) hide show
  1. package/dist/src/Services/AiService.d.ts.map +1 -1
  2. package/dist/src/Services/FileService.d.ts +1 -1
  3. package/dist/src/Services/FileService.d.ts.map +1 -1
  4. package/dist/src/app.d.ts.map +1 -1
  5. package/dist/src/controllers/IntrospectionController.d.ts +10 -1
  6. package/dist/src/controllers/IntrospectionController.d.ts.map +1 -1
  7. package/dist/src/schemas/container_widget/widgetTypes/PatientListProps.d.ts +20 -0
  8. package/dist/src/schemas/container_widget/widgetTypes/PatientListProps.d.ts.map +1 -1
  9. package/dist/src/test/test-helpers.d.ts.map +1 -1
  10. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts +22 -4
  11. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts.map +1 -1
  12. package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts +14 -14
  13. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts +4 -4
  14. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts +5 -0
  15. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts.map +1 -1
  16. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts +4 -4
  17. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts +9 -2
  18. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts.map +1 -1
  19. package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts +16 -0
  20. package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts.map +1 -1
  21. package/dist/src/v2/modules/ecosystem/alert/alert.model.d.ts +42 -0
  22. package/dist/src/v2/modules/ecosystem/alert/alert.model.d.ts.map +1 -1
  23. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.d.ts +52 -0
  24. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.d.ts.map +1 -0
  25. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.test.d.ts +2 -0
  26. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.test.d.ts.map +1 -0
  27. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.d.ts +36 -0
  28. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.d.ts.map +1 -0
  29. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.test.d.ts +2 -0
  30. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.test.d.ts.map +1 -0
  31. package/dist/src/v2/modules/ecosystem/alert/{alert.service.d.ts → alert.service/alert.service.d.ts} +5 -5
  32. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert.service.d.ts.map +1 -0
  33. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert.service.test.d.ts.map +1 -0
  34. package/dist/src/v2/modules/ecosystem/alert/alert.service/index.d.ts +5 -0
  35. package/dist/src/v2/modules/ecosystem/alert/alert.service/index.d.ts.map +1 -0
  36. package/dist/src/v2/modules/ecosystem/alert/index.d.ts +3 -2
  37. package/dist/src/v2/modules/ecosystem/alert/index.d.ts.map +1 -1
  38. package/dist/src/v2/modules/project/forms-data/forms-data.helper.d.ts +52 -1
  39. package/dist/src/v2/modules/project/forms-data/forms-data.helper.d.ts.map +1 -1
  40. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.d.ts +64 -0
  41. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.d.ts.map +1 -0
  42. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.test.d.ts +2 -0
  43. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.test.d.ts.map +1 -0
  44. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.d.ts +22 -0
  45. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.d.ts.map +1 -0
  46. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.test.d.ts.map +1 -0
  47. package/dist/src/v2/modules/project/forms-data/forms-data.service/index.d.ts +4 -0
  48. package/dist/src/v2/modules/project/forms-data/forms-data.service/index.d.ts.map +1 -0
  49. package/dist/src/v2/modules/project/forms-data/index.d.ts +1 -0
  50. package/dist/src/v2/modules/project/forms-data/index.d.ts.map +1 -1
  51. package/dist/v1/perseed-api.cjs +9 -0
  52. package/dist/v1/perseed-api.cjs.map +1 -1
  53. package/dist/v1/perseed-api.mjs +9 -0
  54. package/dist/v1/perseed-api.mjs.map +1 -1
  55. package/package.json +1 -1
  56. package/dist/src/v2/modules/ecosystem/alert/alert.service.d.ts.map +0 -1
  57. package/dist/src/v2/modules/ecosystem/alert/alert.service.test.d.ts.map +0 -1
  58. package/dist/src/v2/modules/project/forms-data/forms-data.service.d.ts +0 -12
  59. package/dist/src/v2/modules/project/forms-data/forms-data.service.d.ts.map +0 -1
  60. package/dist/src/v2/modules/project/forms-data/forms-data.service.test.d.ts.map +0 -1
  61. /package/dist/src/v2/modules/ecosystem/alert/{alert.service.test.d.ts → alert.service/alert.service.test.d.ts} +0 -0
  62. /package/dist/src/v2/modules/project/forms-data/{forms-data.service.test.d.ts → forms-data.service/forms-data.service.test.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alert-listing.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-listing.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { FormListDataConfig } from '../../../../../schemas';
3
+ /** One alert of a patient, in the shape the listing merges a repeatable source from. */
4
+ export interface AlertPatientRow {
5
+ patient_id: number;
6
+ data: {
7
+ form: {
8
+ name: string;
9
+ isMultiple: () => true;
10
+ };
11
+ };
12
+ values: Record<string, unknown>;
13
+ }
14
+ /**
15
+ * The alerts of a set of patients, as the rows of a repeatable source associated to a listing.
16
+ *
17
+ * It is the counterpart of `HealthDataService.getDataForPatients` for alerts: the listing asks for
18
+ * the patients of its page, and each alert becomes a row merged into the one of its patient — which
19
+ * is what lets a column count, or otherwise aggregate, the alerts of each patient.
20
+ *
21
+ * **Only the alerts the caller may read.** The query starts from `scopedQuery`, so it is narrowed to
22
+ * the project of the request and to the read scope of the caller before anything the configuration
23
+ * asks for: a user without `alerts_management` counts only the alerts they could open.
24
+ *
25
+ * The configuration of the source card applies as it does to a form associated to a listing: its
26
+ * conditions narrow which alerts are loaded, `sortBy` orders them and `limit` caps them **per
27
+ * patient**. The conditions name the columns of `alert` unprefixed, as the card builds them.
28
+ *
29
+ * Every column of the alert travels, keyed `<sourceKey>.<column>`, the same as on the alert axis.
30
+ */
31
+ declare function getDataForPatients(ctx: RequestContext, patientIds: number[], key: string, config: FormListDataConfig, paramValues: Record<string, unknown>): Promise<AlertPatientRow[]>;
32
+ export declare const AlertPatientDataService: {
33
+ getDataForPatients: typeof getDataForPatients;
34
+ };
35
+ export {};
36
+ //# sourceMappingURL=alert-patient-data.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-patient-data.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAU,MAAM,aAAa,CAAA;AAM7D,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE;QAAE,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,IAAI,CAAA;SAAE,CAAA;KAAE,CAAA;IACxD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAKD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAe,kBAAkB,CAC/B,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,MAAM,EAAE,EACpB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,eAAe,EAAE,CAAC,CAsC5B;AAED,eAAO,MAAM,uBAAuB;;CAEnC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alert-patient-data.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-patient-data.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.test.ts"],"names":[],"mappings":""}
@@ -1,8 +1,8 @@
1
- import { default as RequestContext } from '../../../../models/request/RequestContext';
2
- import { PaginatedQuery } from '../../global/pagination';
3
- import { AlertReadScope } from './alert.helper';
4
- import { Alert } from './alert.model';
5
- import { CreateAlertData, ListAlertQuery, UpdateAlertData } from './alert.schema';
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { PaginatedQuery } from '../../../global/pagination';
3
+ import { AlertReadScope } from '../alert.helper';
4
+ import { Alert } from '../alert.model';
5
+ import { CreateAlertData, ListAlertQuery, UpdateAlertData } from '../alert.schema';
6
6
  /**
7
7
  * Lists the alerts the request reaches, newest first, narrowed by the optional filters.
8
8
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AAKnE,OAAO,EAAE,cAAc,EAAiB,MAAM,6BAA6B,CAAA;AAE3E,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAe,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE9G;;;;;GAKG;AACH,iBAAe,UAAU,CACvB,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,cAAc,GAAG,IAAI,4CAa7B;AAED;;;;;;GAMG;AACH,iBAAe,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,8BAExF;AA+DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,iBAAe,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,eAAe,kBAkBpE;AA2FD,iBAAe,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,kBAahF;AAED;;;;;;;GAOG;AACH,iBAAe,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,kBAyB1F;AAED,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export { AlertService } from './alert.service';
2
+ export { AlertListingService, isAlertAxis } from './alert-listing.service';
3
+ export { AlertPatientDataService } from './alert-patient-data.service';
4
+ export type { AlertPatientRow } from './alert-patient-data.service';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA"}
@@ -1,7 +1,8 @@
1
- export { AlertService } from './alert.service';
1
+ export { AlertService, AlertListingService, AlertPatientDataService, isAlertAxis } from './alert.service';
2
+ export type { AlertPatientRow } from './alert.service';
2
3
  export { Alert } from './alert.model';
3
4
  export { AlertController } from './alert.controller';
4
- export { requireAlertsManagement } from './alert.helper';
5
+ export { requireAlertsManagement, resolveAlertReadScope, scopedQuery } from './alert.helper';
5
6
  export { AlertStatus, AlertSeverity, AlertEmitterType } from './alert.schema';
6
7
  export type { AlertData, AlertEmitterData, AlertEntityRefData, CreateAlertData, CreateAlertRequestBody, UpdateAlertData, } from './alert.schema';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC7E,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,GAChB,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACzG,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC7E,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,GAChB,MAAM,gBAAgB,CAAA"}
@@ -9,8 +9,59 @@ interface SqlCompiler<Q> {
9
9
  interface FilterableConfig {
10
10
  filterParams?: FilterParamsBlock[];
11
11
  }
12
+ /**
13
+ * The base name of a datasource configuration key: a source added more than once gets an instance
14
+ * suffix (`health_data_discrete-1`), which names the same table.
15
+ */
16
+ export declare function getCrfBaseName(key: string): string;
17
+ /**
18
+ * The sources a JsonLogic node names directly — not counting the ones its children name.
19
+ *
20
+ * Three shapes carry one, and they are the same three `extractFormNamesFromConditions` reads to
21
+ * build the join list. **The two have to agree exactly**, or a source would be pruned from the tree
22
+ * while still being joined, or the reverse: the join list is derived from the pruned tree, so a
23
+ * name this function misses is a name that survives into it.
24
+ *
25
+ * It returns every source a node names, not the first: a `ConditionExpression` node carries one key
26
+ * per condition (`{"patient.a": …, "alert.b": …}`), and stopping at the first would leave the rest
27
+ * in a tree that the join list still reads them from.
28
+ */
29
+ export declare function sourcesNamedBy(node: Record<string, unknown>): string[];
30
+ /**
31
+ * Extracts the source names referenced in conditions, to build the query's join list — the crf
32
+ * forms joined to a crf axis, or the relations joined to an alert one.
33
+ *
34
+ * Which node shapes name a form is `sourcesNamedBy`'s to decide, and deliberately not restated
35
+ * here: the pruning of unfilterable sources reads the same answer, and this walks the tree that
36
+ * pruning produced. A shape one of the two recognised and the other did not would put a source in
37
+ * the join list that the tree no longer constrains on, or the reverse — which is exactly what
38
+ * happened while this was written twice.
39
+ *
40
+ * This one recurses; `sourcesNamedBy` answers for a single node.
41
+ */
42
+ export declare function extractFormNamesFromConditions(conditions: unknown): Set<string>;
12
43
  export declare function validateRequiredFilterParams(configByKey: Record<string, FilterableConfig | undefined>, paramValues: Record<string, unknown>): void;
13
- export declare function getAppliedRuleTrees(conditions: Record<string, unknown> | undefined, configByKey: Record<string, FilterableConfig | undefined>, paramValues: Record<string, unknown>): Record<string, unknown>[];
44
+ /**
45
+ * Options of `getAppliedRuleTrees`.
46
+ *
47
+ * `isFilterable` decides which sources a condition may constrain on (see
48
+ * `pruneUnfilterableSources`). Omitted, every source is filterable and the trees come back as they
49
+ * were — the shape the callers that compile a single relation's own filter need, where the tree is
50
+ * already scoped to one source.
51
+ */
52
+ interface AppliedRuleTreesOptions {
53
+ isFilterable?: (source: string) => boolean;
54
+ onDroppedSources?: (sources: string[]) => void;
55
+ }
56
+ export declare function getAppliedRuleTrees(conditions: Record<string, unknown> | undefined, configByKey: Record<string, FilterableConfig | undefined>, paramValues: Record<string, unknown>, options?: AppliedRuleTreesOptions): Record<string, unknown>[];
57
+ /**
58
+ * Compiles a source's own conditions onto the query of that source.
59
+ *
60
+ * Takes no pruning options, and does not need them: its only caller is `filterRelationsDataV2`,
61
+ * which is handed a crf already resolved from the database, so the tree cannot name a source the
62
+ * query is unable to filter by. The listing's main form is the one that needs the pruning, and it
63
+ * compiles the trees `getAppliedRuleTrees` returns directly.
64
+ */
14
65
  export declare function applyConditionsAndFilterParams<Q>(query: Q, conditions: Record<string, unknown> | undefined, configByKey: Record<string, FilterableConfig | undefined>, paramValues: Record<string, unknown>, compiler: SqlCompiler<Q>): void;
15
66
  export declare function deriveFinalParams(data: Record<string, FormListDataConfig> | undefined, designers: Record<string, any> | null | undefined): FinalParam[];
16
67
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"forms-data.helper.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/project/forms-data/forms-data.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAkB,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAQpG,qBAAa,2BAA4B,SAAQ,KAAK;IACjC,aAAa,EAAE,MAAM,EAAE;gBAAvB,aAAa,EAAE,MAAM,EAAE;CAI3C;AAED,UAAU,WAAW,CAAC,CAAC;IACrB,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CACxD;AAqBD,UAAU,gBAAgB;IACxB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACnC;AA+GD,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,IAAI,CA6BN;AA8DD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAmC3B;AAED,wBAAgB,8BAA8B,CAAC,CAAC,EAC9C,KAAK,EAAE,CAAC,EACR,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GACvB,IAAI,CAKN;AA0HD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,SAAS,EACpD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,GAChD,UAAU,EAAE,CAwCd"}
1
+ {"version":3,"file":"forms-data.helper.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/project/forms-data/forms-data.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAkB,kBAAkB,EAAE,MAAM,aAAa,CAAA;AASpG,qBAAa,2BAA4B,SAAQ,KAAK;IACjC,aAAa,EAAE,MAAM,EAAE;gBAAvB,aAAa,EAAE,MAAM,EAAE;CAI3C;AAED,UAAU,WAAW,CAAC,CAAC;IACrB,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CACxD;AAqBD,UAAU,gBAAgB;IACxB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACnC;AA8FD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,UAGzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAgCtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAqB/E;AAyGD,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,IAAI,CA6BN;AA8DD;;;;;;;GAOG;AACH,UAAU,uBAAuB;IAC/B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAA;IAC1C,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CAC/C;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,GAAE,uBAA4B,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CA0D3B;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAC9C,KAAK,EAAE,CAAC,EACR,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GACvB,IAAI,CAKN;AA0HD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,SAAS,EACpD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,GAChD,UAAU,EAAE,CAwCd"}
@@ -0,0 +1,64 @@
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { default as FormService } from '../../../../../Services/FormService';
3
+ import { FormListDataConfig } from '../../../../../schemas';
4
+ type PatientsDataResponse = Awaited<ReturnType<typeof FormService.formsData>>[number];
5
+ /**
6
+ * The sources a listing loads for the patient of each of its rows, split by how they are fetched.
7
+ *
8
+ * - `sqlConfigMap`: forms of the project, read through `FormService`.
9
+ * - `externalConfigMap`: sources read outside `FormService`, one service each — `health_data_*`
10
+ * from the external service, and `alert` from the ecosystem database (`isPatientLoadedSource`).
11
+ */
12
+ export interface AssociatedSources {
13
+ sqlConfigMap: Record<string, FormListDataConfig>;
14
+ externalConfigMap: Record<string, FormListDataConfig>;
15
+ }
16
+ /**
17
+ * Whether a source is loaded for the patients of a listing by a service of its own, outside
18
+ * `FormService`: `health_data_*` and, when it is not the main source, `alert`.
19
+ */
20
+ export declare function isPatientLoadedSource(key: string): boolean;
21
+ /** Whether there is anything to load at all, so a listing without associated sources skips the queries. */
22
+ export declare function hasAssociatedSources({ sqlConfigMap, externalConfigMap }: AssociatedSources): boolean;
23
+ /**
24
+ * The fields `FormService` loads for a set of SQL-backed sources: every configured field of each,
25
+ * plus its `id`, which merging and aggregations like COUNT rely on.
26
+ */
27
+ export declare function collectFields(sqlConfigMap: Record<string, FormListDataConfig>): {
28
+ crfName: string;
29
+ field: string;
30
+ }[];
31
+ /**
32
+ * Reads every source loaded outside `FormService` for a set of patients, each from its own service,
33
+ * in the shape `FormService` returns so that `mergeForms` aggregates them alike (each item becomes a
34
+ * row of a repeatable source).
35
+ */
36
+ export declare function loadExternalRows(ctx: RequestContext, patientIds: number[], externalConfigMap: Record<string, FormListDataConfig>, paramValues: Record<string, unknown>): Promise<PatientsDataResponse[]>;
37
+ /**
38
+ * The key each configured external source always emits, empty when the patient has no data for it.
39
+ *
40
+ * Without it the key is absent and the front falls back to the base name, mixing two aliased
41
+ * discrete sources (e.g. steps vs sleep). SQL repeatable forms are unaffected: their shape is driven
42
+ * entirely by `mergeForms`.
43
+ */
44
+ export declare function externalDefaults(externalConfigMap: Record<string, FormListDataConfig>): Record<string, unknown[]>;
45
+ /**
46
+ * Loads the associated sources of a listing for the given patients, and answers with the values to
47
+ * spread into the row of each patient.
48
+ *
49
+ * **The patients are narrowed to the ones the caller may see first.** An axis other than a form of
50
+ * the project does not come from the patient subquery — an alert listing reaches patients through
51
+ * the alerts its reader may see, and a manager of alerts sees alerts of patients they cannot open in
52
+ * the project. `FormService` does not check access again, so without this a row would carry the
53
+ * forms of a patient its reader has no access to. A patient left out gets the same values as one
54
+ * with no data.
55
+ *
56
+ * Only the configured forms are merged into the row. `FormService` also reads the forms of the
57
+ * profile's patient list; the crf axis spreads those too, but here nothing asked for them.
58
+ */
59
+ declare function loadForReachablePatients(ctx: RequestContext, projectId: number, patientIds: number[], sources: AssociatedSources, paramValues: Record<string, unknown>): Promise<(patientId: number | null | undefined) => Record<string, unknown>>;
60
+ export declare const AssociatedSourcesService: {
61
+ loadForReachablePatients: typeof loadForReachablePatients;
62
+ };
63
+ export {};
64
+ //# sourceMappingURL=associated-sources.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"associated-sources.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAG9D,OAAO,WAAW,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAA4C,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAK1F,KAAK,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAIrF;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAChD,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;CACtD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED,2GAA2G;AAC3G,wBAAgB,oBAAoB,CAAC,EAAE,YAAY,EAAE,iBAAiB,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAEpG;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAmBpH;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,MAAM,EAAE,EACpB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACrD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAgBjC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAEjH;AAED;;;;;;;;;;;;;GAaG;AACH,iBAAe,wBAAwB,CACrC,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,EAAE,iBAAiB,EAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAiC5E;AAED,eAAO,MAAM,wBAAwB;;CAEpC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=associated-sources.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"associated-sources.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { FormsDataQuery } from '../forms-data.schema';
3
+ /**
4
+ * Whether the main form's filter can constrain on a source.
5
+ *
6
+ * It can when the source is a crf of the project, which is what the compiled query is built over.
7
+ * A table of the platform is not one, so a condition naming it has nothing to compile against and
8
+ * gets pruned — see `pruneUnfilterableSources` for why that is a prune and not a rejection.
9
+ *
10
+ * The name arrives as it appears in the tree, which may carry the alias suffix a repeated source
11
+ * gets (`alert-2`), so it is compared by its base name.
12
+ */
13
+ export declare function isFilterableSource(name: string): boolean;
14
+ declare function get(ctx: RequestContext, { dashboardWidgetId, paramValues, ...pagination }: FormsDataQuery): Promise<{
15
+ results: any[];
16
+ total: number;
17
+ }>;
18
+ export declare const FormsDataService: {
19
+ get: typeof get;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=forms-data.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms-data.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/forms-data.service.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AA0B9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAOrD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,iBAAe,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,GAAG,UAAU,EAAE,EAAE,cAAc;;;GAyLxG;AAED,eAAO,MAAM,gBAAgB;;CAE5B,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms-data.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/forms-data.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { FormsDataService, isFilterableSource } from './forms-data.service';
2
+ export { AssociatedSourcesService, hasAssociatedSources, isPatientLoadedSource } from './associated-sources.service';
3
+ export type { AssociatedSources } from './associated-sources.service';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpH,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './forms-data.controller';
2
2
  export * from './forms-data.schema';
3
+ export * from './forms-data.helper';
3
4
  export * from './forms-data.service';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/project/forms-data/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/project/forms-data/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
@@ -1247,6 +1247,14 @@ var DataLoaderType = /* @__PURE__ */ ((DataLoaderType2) => {
1247
1247
  return DataLoaderType2;
1248
1248
  })(DataLoaderType || {});
1249
1249
  const EXTERNAL_SOURCE_KEYS = ["health_data_daily", "health_data_discrete"];
1250
+ const PLATFORM_TABLE_SOURCE_KEYS = [
1251
+ "user",
1252
+ "user_profile",
1253
+ "patient_adherence",
1254
+ "process_log",
1255
+ "alert",
1256
+ ...EXTERNAL_SOURCE_KEYS
1257
+ ];
1250
1258
  var ColumnType = /* @__PURE__ */ ((ColumnType2) => {
1251
1259
  ColumnType2["TEXT"] = "text";
1252
1260
  ColumnType2["NUMBER"] = "number";
@@ -1493,6 +1501,7 @@ exports.NotifiedAboutInfo = NotifiedAboutInfo;
1493
1501
  exports.OBJECT_TYPE = OBJECT_TYPE;
1494
1502
  exports.OrderType = OrderType;
1495
1503
  exports.PATIENT_CREATION_ABOUT = PATIENT_CREATION_ABOUT;
1504
+ exports.PLATFORM_TABLE_SOURCE_KEYS = PLATFORM_TABLE_SOURCE_KEYS;
1496
1505
  exports.PresentationWidget = PresentationWidget;
1497
1506
  exports.ProcessLogType = ProcessLogType;
1498
1507
  exports.QUESTIONNAIRE_DATE = QUESTIONNAIRE_DATE;