@tekkare/romulus 0.1.292 → 0.1.294

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/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.291",
7
+ "version": "0.1.293",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -5,7 +5,8 @@
5
5
  Repris de France Augmented Science et d'OIP Case Atlas.
6
6
 
7
7
  Les widgets decrivent ce que le projet range, a partir des documents que la
8
- page a deja relus. Ce que le layer ajoute au paquet :
8
+ page a deja relus ; les marques en viennent aussi (`projectBrands` de
9
+ l'app). Ce que le layer ajoute au paquet :
9
10
  - la source de chaque entree : le contenu du projet, lu a l'instant ;
10
11
  - l'export de l'onglet (tuile Export du rail, rapport PDF) : un onglet de
11
12
  classeur par widget, avec ses nombres bruts.
@@ -32,7 +33,7 @@
32
33
  <script setup lang="ts">
33
34
  import type { RmExportSheet } from "@tekkare/romulus/utils/export";
34
35
  import type { RmWidgetSource } from "@tekkare/romulus/utils/dashboard";
35
- import { PROJECT_DASHBOARD_WIDGETS, PROJECT_WORDING } from "#oip-projects";
36
+ import { PROJECT_DASHBOARD_WIDGETS, PROJECT_WORDING, projectBrands } from "#oip-projects";
36
37
  import type { OipProjectWidgetContext as WidgetContext } from "../../oip-defaults/projects";
37
38
  import { visibleExportCharts } from "../../utils/exportPage";
38
39
 
@@ -52,7 +53,7 @@ const { widgets, loading, failed, saving, saveFailed, load, update, retrySave }
52
53
  onMounted(load);
53
54
 
54
55
  const context = computed<WidgetContext>(() => ({
55
- brands: [],
56
+ brands: projectBrands(props.docs),
56
57
  lang: props.lang,
57
58
  groups: props.groups,
58
59
  docs: props.docs,
@@ -149,6 +149,14 @@ export interface OipProjectWidgetContext extends RmWidgetContext {
149
149
  docs: { type: string; source: Record<string, any> }[];
150
150
  }
151
151
 
152
+ /**
153
+ * Les marques du projet, que les widgets `usesBrands` lisent : l'app les tire
154
+ * des documents ranges (`code` des ventes, marques des avis...). Aucune par defaut.
155
+ */
156
+ export function projectBrands(_docs: OipProjectWidgetContext["docs"]): string[] {
157
+ return [];
158
+ }
159
+
152
160
  /** Le widget que toute app sait remplir : le contenu du projet, par famille. */
153
161
  export const PROJECT_RESOURCES_WIDGET: RmWidgetKind<OipProjectWidgetContext> = {
154
162
  kind: "project.resources",
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Les familles que New Zealand One range dans un projet, decrites pour tout le
3
+ * portail : produits du registre Medsafe (Drug approvals), prix des boites de
4
+ * la Pharmaceutical Schedule de Pharmac (Price Tracker) et molecules du marche
5
+ * de ville (Pharmaceutical Collection). Pas encore de vue de tiroir : la ligne
6
+ * du projet mene a la page de l'app.
7
+ *
8
+ * Index lus sur le cluster `drugs` (meme domaine que fr_drugs_app, cle
9
+ * principale ; cf. runtimeConfig.oipEs.drugs).
10
+ *
11
+ * Importe aussi par le serveur : pas d'import propre a Vue ou a Nuxt ici.
12
+ */
13
+
14
+ import type { RmProjectKind } from "@tekkare/romulus/utils/projects";
15
+
16
+ const NEW_ZEALAND = { fr: "Nouvelle-Zélande", en: "New Zealand" };
17
+
18
+ /**
19
+ * Les index des fiches de New Zealand One, par leur id Directus
20
+ * (collection ElasticIndices) : le proxy et l'API en tirent le nom physique,
21
+ * l'index staging en preproduction (le Price Tracker ne porte la
22
+ * Nouvelle-Zelande que dans son index staging aujourd'hui).
23
+ */
24
+ export const NEW_ZEALAND_INDEX = {
25
+ /** Registre Medsafe (ope__nz__medsafe_drug_approval__tekkare), `_id` = product_id. */
26
+ medsafe: "08a72477-6f49-481d-ba85-9131c2303385",
27
+ /** Price Tracker mondial (ope__ww_price_tracker__tekkare), `_id` = nz_<code>_1 (officine) ou _2 (hopital). */
28
+ prices: "fe806bee-7e4e-4714-a329-f25879ce1497",
29
+ /** Marche de ville (ope_nz_retail_national_tekkare), `_id` = code de la Pharmaceutical Collection. */
30
+ retail: "3b6c9dd1-733f-4e05-8dce-947712f7ccc8",
31
+ };
32
+
33
+ const day = (value: unknown) => String(value ?? "").slice(0, 10);
34
+
35
+ export const NEW_ZEALAND_PROJECT_KINDS: RmProjectKind[] = [
36
+ {
37
+ // Un produit du registre Medsafe : nom commercial, forme, dosage.
38
+ type: "NzMedsafeProduct",
39
+ index: NEW_ZEALAND_INDEX.medsafe,
40
+ label: { fr: "Produits Medsafe", en: "Medsafe products" },
41
+ section: NEW_ZEALAND,
42
+ country: "nz",
43
+ icon: "Stamp",
44
+ source: ["trade_name", "dose_form", "strength", "sponsor_name", "regulatory_status", "approval_date"],
45
+ title: (s) => String(s?.trade_name ?? ""),
46
+ subtitle: (s) =>
47
+ [s?.dose_form, s?.strength, s?.regulatory_status, day(s?.approval_date)].filter(Boolean).join(" · "),
48
+ path: (_s, id) => `/approvals/details/${encodeURIComponent(id)}`,
49
+ titleFromId: (id) => `Medsafe ${id}`,
50
+ },
51
+ {
52
+ // Une boite du Price Tracker (`_id` = nz_<code>_1 en officine, _2 a
53
+ // l'hopital : lire `hit._id`, ne jamais le reconstruire).
54
+ type: "NzDrugPrice",
55
+ index: NEW_ZEALAND_INDEX.prices,
56
+ label: { fr: "Prix (Nouvelle-Zélande)", en: "Prices (New Zealand)" },
57
+ section: NEW_ZEALAND,
58
+ country: "nz",
59
+ icon: "Tag",
60
+ source: ["brand", "label_local", "local_drug_id", "price_category"],
61
+ title: (s) => String(s?.label_local ?? s?.brand ?? ""),
62
+ subtitle: (s) =>
63
+ [s?.brand, s?.local_drug_id ? `Pharmac ${s.local_drug_id}` : "", s?.price_category].filter(Boolean).join(" · "),
64
+ path: (_s, id) => `/price-tracker/details/${encodeURIComponent(id)}`,
65
+ titleFromId: (id) => `Pharmac ${id.replace(/^nz_/, "").replace(/_\d+$/, "")}`,
66
+ },
67
+ {
68
+ // Une molecule du marche de ville (document `type: molecule`) : la page
69
+ // Retail Market la rouvre par son libelle.
70
+ type: "NzRetailMolecule",
71
+ index: NEW_ZEALAND_INDEX.retail,
72
+ label: { fr: "Molécules (marché de ville)", en: "Molecules (retail market)" },
73
+ section: NEW_ZEALAND,
74
+ country: "nz",
75
+ icon: "Pill",
76
+ source: ["label", "tg3_label", "tg2_label", "type"],
77
+ title: (s) => String(s?.label ?? ""),
78
+ subtitle: (s) => [s?.tg3_label, s?.tg2_label].filter(Boolean).join(" · "),
79
+ path: (s) => (s?.label ? `/market?molecules=${encodeURIComponent(s.label)}` : "/market"),
80
+ },
81
+ ];
@@ -21,6 +21,7 @@ import { PATIENT_KIND, VACCINE_KIND } from "../oip-patients/kinds";
21
21
  import { GERMANY_PROJECT_KINDS } from "../oip-germany/kinds";
22
22
  import { ITALY_PROJECT_KINDS } from "../oip-italy/kinds";
23
23
  import { AUSTRALIA_PROJECT_KINDS } from "../oip-australia/kinds";
24
+ import { NEW_ZEALAND_PROJECT_KINDS } from "../oip-new-zealand/kinds";
24
25
 
25
26
  /** Les apps qui ont des fiches a montrer, et ou les ouvrir. */
26
27
  export const OIP_RESOURCE_APPS = {
@@ -48,6 +49,10 @@ export const OIP_RESOURCE_APPS = {
48
49
  name: "Australia One",
49
50
  url: "https://australia-one.app.tekkare.com",
50
51
  },
52
+ new_zealand_one_app: {
53
+ name: "New Zealand One",
54
+ url: "https://new-zealand-one.app.tekkare.com",
55
+ },
51
56
  } as const;
52
57
 
53
58
  export type OipResourceApp = keyof typeof OIP_RESOURCE_APPS;
@@ -216,6 +221,23 @@ function australiaSpec(kind: RmProjectKind, view: string): OipResourceSpec {
216
221
  };
217
222
  }
218
223
 
224
+ /**
225
+ * Une fiche de New Zealand One, lue sur le cluster `drugs`. Sans vue ni
226
+ * onglets pour l'instant : la ligne du projet mene a la page de l'app.
227
+ */
228
+ function newZealandSpec(kind: RmProjectKind): OipResourceSpec {
229
+ return {
230
+ type: kind.type,
231
+ app: "new_zealand_one_app",
232
+ cluster: "drugs",
233
+ kind,
234
+ routeId: (id) => id,
235
+ base: () => "",
236
+ tabs: [],
237
+ detailPath: (id, _tab, doc) => kind.path?.(doc ?? {}, id) ?? "",
238
+ };
239
+ }
240
+
219
241
  /** La fiche de chaque famille d'Australia One (cf. useOipResourceViews). */
220
242
  const AUSTRALIA_VIEWS: Record<string, string> = {
221
243
  AuPbacOpinion: "australia-pbac",
@@ -471,6 +493,7 @@ export const OIP_RESOURCE_SPECS: OipResourceSpec[] = [
471
493
  ...GERMANY_PROJECT_KINDS.map((kind) => germanySpec(kind, GERMANY_VIEWS[kind.type]!)),
472
494
  ...ITALY_PROJECT_KINDS.map((kind) => italySpec(kind, ITALY_VIEWS[kind.type]!)),
473
495
  ...AUSTRALIA_PROJECT_KINDS.map((kind) => australiaSpec(kind, AUSTRALIA_VIEWS[kind.type]!)),
496
+ ...NEW_ZEALAND_PROJECT_KINDS.map(newZealandSpec),
474
497
  ];
475
498
 
476
499
  export function oipResourceSpec(type: string): OipResourceSpec | undefined {
@@ -7,6 +7,7 @@ import { OIP_PATIENT_INDEXES } from "../../../app/oip-patients/indexes";
7
7
  import { GERMANY_INDEX } from "../../../app/oip-germany/kinds";
8
8
  import { ITALY_INDEX } from "../../../app/oip-italy/kinds";
9
9
  import { AUSTRALIA_INDEX } from "../../../app/oip-australia/kinds";
10
+ import { NEW_ZEALAND_INDEX } from "../../../app/oip-new-zealand/kinds";
10
11
 
11
12
  /**
12
13
  * POST /api/oip/es?cluster=&index=, servi par le layer OIP.
@@ -49,6 +50,13 @@ const ITALY_INDEXES = new Set<string>([ITALY_INDEX.directory, ITALY_INDEX.reimbu
49
50
  */
50
51
  const AUSTRALIA_INDEXES = new Set<string>([AUSTRALIA_INDEX.pbac, AUSTRALIA_INDEX.items, AUSTRALIA_INDEX.reimbursement]);
51
52
 
53
+ /**
54
+ * Index de New Zealand One hors du catalogue de fr_drugs_app (registre
55
+ * Medsafe, marche de ville), par leur id Directus, avec la cle principale.
56
+ * Les prix passent par le Price Tracker, deja au catalogue.
57
+ */
58
+ const NEW_ZEALAND_INDEXES = new Set<string>([NEW_ZEALAND_INDEX.medsafe, NEW_ZEALAND_INDEX.retail]);
59
+
52
60
  const DRUG_IDS = new Set<string>(Object.values(ES_INDEX) as string[]);
53
61
  const ASSOCIATION_IDS = new Set<string>(
54
62
  Object.entries(ES_INDEX)
@@ -67,7 +75,7 @@ const APPROVAL_IDS = new Set<string>(
67
75
  * Vide si l'index n'est pas au catalogue.
68
76
  */
69
77
  async function drugsKeyOf(ref: string): Promise<string> {
70
- if (DRUG_IDS.has(ref) || GERMANY_INDEXES.has(ref) || ITALY_INDEXES.has(ref) || AUSTRALIA_INDEXES.has(ref)) return ref;
78
+ if (DRUG_IDS.has(ref) || GERMANY_INDEXES.has(ref) || ITALY_INDEXES.has(ref) || AUSTRALIA_INDEXES.has(ref) || NEW_ZEALAND_INDEXES.has(ref)) return ref;
71
79
  const id = (await findOipEsIndex(ref).catch(() => undefined))?.id;
72
80
  return id && DRUG_IDS.has(id) ? id : "";
73
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.292",
3
+ "version": "0.1.294",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",