@tekkare/romulus 0.1.286 → 0.1.287

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.285",
7
+ "version": "0.1.286",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -0,0 +1,237 @@
1
+ <!--
2
+ Fiche du remboursement AIFA d'un produit italien (Italy One, type
3
+ ItDrugReimbursement), par son `_id` dans le repertoire AIFA (code AIC) :
4
+ identite du produit, puis le remboursement SSN national de sa classe ATC4,
5
+ par canal (total, officine, hopital), en montant ou en unites.
6
+
7
+ L'AIFA ne publie le remboursement que par classe ATC4 : la fiche le dit, les
8
+ chiffres ne sont pas ceux du produit seul.
9
+
10
+ Montee par le tiroir des projets ; le lien vers l'app passe par le slot
11
+ `title-link`.
12
+ -->
13
+ <template>
14
+ <div class="oip-italy">
15
+ <RmPageHeader :eyebrow="en ? 'Reimbursement, Italy' : 'Remboursement, Italie'">
16
+ <template #title>
17
+ <span class="oip-italy__title">{{ product?.drug_label || product?.brand || `AIC ${id}` }}</span>
18
+ <slot name="title-link" />
19
+ </template>
20
+ </RmPageHeader>
21
+
22
+ <div class="oip-italy__body">
23
+ <RmLoadingState v-if="loading" spinner />
24
+ <RmEmptyState v-else-if="!product" icon="Prohibit" :title="en ? 'Product not found' : 'Produit introuvable'" />
25
+ <template v-else>
26
+ <div class="oip-italy__tags">
27
+ <RmTag v-if="product.brand" variant="indigo">{{ product.brand }}</RmTag>
28
+ <RmTag v-if="product.atc4_code" variant="blue">ATC4 · {{ product.atc4_code }}</RmTag>
29
+ <RmTag variant="gray">AIC {{ id }}</RmTag>
30
+ </div>
31
+
32
+ <RmCard padding="md">
33
+ <dl class="oip-italy__rows">
34
+ <template v-for="row in rows" :key="row.label">
35
+ <dt>{{ row.label }}</dt>
36
+ <dd>{{ row.value }}</dd>
37
+ </template>
38
+ </dl>
39
+ </RmCard>
40
+
41
+ <p class="oip-italy__note">
42
+ {{
43
+ en
44
+ ? `AIFA publishes reimbursement by ATC4 class only: the figures below cover the whole class ${classLabel}, not this product alone.`
45
+ : `L'AIFA ne publie le remboursement que par classe ATC4 : les chiffres ci-dessous couvrent toute la classe ${classLabel}, pas ce seul produit.`
46
+ }}
47
+ </p>
48
+
49
+ <div class="oip-italy__controls">
50
+ <RmSegmented v-model="measure" size="sm" :options="measureOptions" :aria-label="en ? 'Measure' : 'Mesure'" />
51
+ <RmSegmented v-model="granularity" size="sm" :options="granularityOptions" :aria-label="en ? 'Period' : 'Période'" />
52
+ </div>
53
+
54
+ <RmChartCard
55
+ :title="chartTitle"
56
+ :source="source"
57
+ :verified="verified"
58
+ :lang="lang"
59
+ >
60
+ <RmLineChart
61
+ v-if="chart.series.length"
62
+ :categories="chart.categories"
63
+ :series="chart.series"
64
+ :value-formatter="format"
65
+ :height="320"
66
+ />
67
+ <RmEmptyState
68
+ v-else
69
+ icon="MagnifyingGlassMinus"
70
+ :title="en ? 'No data' : 'Aucune donnée'"
71
+ :text="en ? 'No AIFA reimbursement for this class.' : 'Aucun remboursement AIFA pour cette classe.'"
72
+ />
73
+ </RmChartCard>
74
+ </template>
75
+ </div>
76
+ </div>
77
+ </template>
78
+
79
+ <script setup lang="ts">
80
+ import { oipEsGet, oipEsSearch } from "../../composables/useOipResources";
81
+ import { ITALY_INDEX } from "../../oip-italy/kinds";
82
+ import { useAifaSource } from "../../oip-italy/useAifaSource";
83
+
84
+ const props = withDefaults(
85
+ defineProps<{
86
+ /** Le `resourceId` : `_id` du produit dans le repertoire AIFA (code AIC). */
87
+ id: string;
88
+ type?: string;
89
+ lang?: "fr" | "en";
90
+ highlight?: string[];
91
+ }>(),
92
+ { type: "ItDrugReimbursement", lang: "fr", highlight: () => [] },
93
+ );
94
+
95
+ const en = computed(() => props.lang === "en");
96
+ const { source, verified } = useAifaSource(() => props.lang);
97
+
98
+ /** Le niveau national de l'index, comme la page /drugs d'Italy One. */
99
+ const NATIONAL = "Italy";
100
+ const CHANNELS = ["total", "retail", "hospital"] as const;
101
+
102
+ const loading = ref(true);
103
+ const product = ref<Record<string, any> | null>(null);
104
+ const docs = ref<any[]>([]);
105
+
106
+ const measure = ref<"amount_reimbursed" | "unit_reimbursed">("amount_reimbursed");
107
+ const granularity = ref<"annual" | "monthly">("annual");
108
+
109
+ const measureOptions = computed(() => [
110
+ { value: "amount_reimbursed", label: en.value ? "Amount (€)" : "Montant (€)" },
111
+ { value: "unit_reimbursed", label: en.value ? "Units" : "Unités" },
112
+ ]);
113
+ const granularityOptions = computed(() => [
114
+ { value: "annual", label: en.value ? "Years" : "Années" },
115
+ { value: "monthly", label: en.value ? "Months" : "Mois" },
116
+ ]);
117
+
118
+ const channelName = (channel: (typeof CHANNELS)[number]) =>
119
+ ({
120
+ total: "Total",
121
+ retail: en.value ? "Retail" : "Officine",
122
+ hospital: en.value ? "Hospital" : "Hôpital",
123
+ })[channel];
124
+
125
+ const classLabel = computed(() => {
126
+ const p = product.value ?? {};
127
+ const label = en.value ? p.atc4_english_label : p.atc4_french_label || p.atc4_english_label;
128
+ return [p.atc4_code, label ? `(${label})` : ""].filter(Boolean).join(" ");
129
+ });
130
+
131
+ const chartTitle = computed(() => {
132
+ const what = measure.value === "amount_reimbursed"
133
+ ? en.value ? "Reimbursed amount" : "Montant remboursé"
134
+ : en.value ? "Reimbursed units" : "Unités remboursées";
135
+ return `${what}, ${en.value ? "ATC4 class" : "classe ATC4"} ${product.value?.atc4_code ?? ""}`;
136
+ });
137
+
138
+ const format = (value: unknown) => {
139
+ const n = Number(value);
140
+ if (!Number.isFinite(n)) return "-";
141
+ const text = Math.round(n).toLocaleString(en.value ? "en-GB" : "fr-FR");
142
+ return measure.value === "amount_reimbursed" ? `${text} €` : text;
143
+ };
144
+
145
+ const rows = computed(() => {
146
+ const p = product.value ?? {};
147
+ return [
148
+ { label: en.value ? "Active ingredient" : "Principe actif", value: p.active_ingredient },
149
+ { label: en.value ? "Company" : "Laboratoire", value: p.company_label },
150
+ { label: "ATC5", value: [p.atc5_code, p.atc5_english_label].filter(Boolean).join(" · ") },
151
+ { label: en.value ? "Form" : "Forme", value: p.form_label },
152
+ { label: en.value ? "Supply" : "Délivrance", value: p.supply_type },
153
+ ].filter((row) => row.value);
154
+ });
155
+
156
+ /** Une courbe par canal, sur les periodes de la granularite choisie. */
157
+ const chart = computed(() => {
158
+ const picked = docs.value.filter((doc) => doc.period_type === granularity.value);
159
+ const categories = [...new Set(picked.map((doc) => String(doc.period)))].sort();
160
+ const series = CHANNELS.map((channel) => {
161
+ const byPeriod = new Map(
162
+ picked.filter((doc) => doc.distribution_channel === channel).map((doc) => [String(doc.period), doc[measure.value]]),
163
+ );
164
+ return { name: channelName(channel), data: categories.map((period) => byPeriod.get(period) ?? null) };
165
+ }).filter((serie) => serie.data.some((value) => value != null));
166
+ return { categories, series };
167
+ });
168
+
169
+ async function read() {
170
+ loading.value = true;
171
+ docs.value = [];
172
+ const hit = await oipEsGet<any>("drugs", ITALY_INDEX.directory, props.id).catch(() => null);
173
+ product.value = hit?._source ?? null;
174
+ const atc4 = product.value?.atc4_code;
175
+ if (atc4) {
176
+ // Toutes les annees et tous les mois de la classe au niveau national,
177
+ // les trois canaux : quelques centaines de lignes au plus.
178
+ const res = await oipEsSearch<any>("drugs", ITALY_INDEX.reimbursement, {
179
+ size: 2000,
180
+ _source: ["period", "period_type", "distribution_channel", "amount_reimbursed", "unit_reimbursed"],
181
+ query: {
182
+ bool: {
183
+ must: [{ term: { level: "atc4" } }, { term: { region: NATIONAL } }, { term: { atc_code: atc4 } }],
184
+ },
185
+ },
186
+ }).catch(() => null);
187
+ docs.value = (res?.hits?.hits ?? []).map((row: any) => row._source);
188
+ }
189
+ loading.value = false;
190
+ }
191
+
192
+ watch(() => props.id, read, { immediate: true });
193
+ </script>
194
+
195
+ <style scoped>
196
+ .oip-italy__body {
197
+ display: flex;
198
+ flex-direction: column;
199
+ gap: var(--space-16);
200
+ padding: var(--space-20) var(--space-32) var(--space-32);
201
+ }
202
+ .oip-italy__title {
203
+ margin-right: var(--space-12);
204
+ }
205
+ .oip-italy__tags,
206
+ .oip-italy__controls {
207
+ display: flex;
208
+ flex-wrap: wrap;
209
+ gap: var(--space-6);
210
+ }
211
+ .oip-italy__controls {
212
+ gap: var(--space-12);
213
+ }
214
+ .oip-italy__rows {
215
+ display: grid;
216
+ grid-template-columns: minmax(140px, max-content) 1fr;
217
+ gap: var(--space-8) var(--space-20);
218
+ margin: 0;
219
+ font-size: var(--font-14);
220
+ }
221
+ .oip-italy__rows dt {
222
+ padding-top: 2px;
223
+ color: var(--text-muted);
224
+ font-size: var(--font-12);
225
+ font-weight: var(--weight-semibold);
226
+ text-transform: uppercase;
227
+ }
228
+ .oip-italy__rows dd {
229
+ margin: 0;
230
+ line-height: 1.5;
231
+ }
232
+ .oip-italy__note {
233
+ margin: 0;
234
+ color: var(--text-muted);
235
+ font-size: var(--font-13);
236
+ }
237
+ </style>
@@ -107,6 +107,7 @@ const VIEW_LOADERS: Record<string, () => Promise<any>> = {
107
107
  "germany-molecule": () => import("../components/oip-germany/GkvMolecule.vue"),
108
108
  "italy-aifa-act": () => import("../components/oip-italy/AifaAct.vue"),
109
109
  "italy-price": () => import("../components/oip-italy/ItalyPrice.vue"),
110
+ "italy-reimbursement": () => import("../components/oip-italy/Reimbursement.vue"),
110
111
  };
111
112
 
112
113
  const cache = new Map<string, Component>();
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Les familles qu'Italy One range dans un projet, decrites pour tout le
3
- * portail : actes reglementaires de l'AIFA (Trovanorme) et prix des
4
- * presentations italiennes (Price Tracker). Le tiroir d'un projet les montre
3
+ * portail : actes reglementaires de l'AIFA (Trovanorme), prix des
4
+ * presentations italiennes (Price Tracker) et remboursement AIFA d'un produit. Le tiroir d'un projet les montre
5
5
  * par leurs vues (components/oip-italy) ; la ligne du projet mene a la page
6
6
  * de l'app.
7
7
  *
@@ -19,6 +19,10 @@ const ITALY = { fr: "Italie", en: "Italy" };
19
19
  export const ITALY_INDEX = {
20
20
  aifa: "it__drug_opinion__aifa",
21
21
  prices: "ope__ww_price_tracker__tekkare",
22
+ /** Repertoire des medicaments rembourses, `_id` = code AIC. */
23
+ directory: "it__drug_directory__aifa",
24
+ /** Remboursement SSN par classe ATC4, region, canal et periode. */
25
+ reimbursement: "it__drugs__retail__aifa",
22
26
  };
23
27
 
24
28
  const day = (value: unknown) => String(value ?? "").slice(0, 10);
@@ -62,4 +66,24 @@ export const ITALY_PROJECT_KINDS: RmProjectKind[] = [
62
66
  },
63
67
  titleFromId: (id) => `AIC ${id.replace(/^it_/, "").replace(/_\d+$/, "")}`,
64
68
  },
69
+ {
70
+ // Un produit du repertoire AIFA (`_id` = code AIC). L'index du
71
+ // remboursement n'a qu'un numero de ligne pour `_id`, renumerote a chaque
72
+ // chargement (R-01 des projets) : le produit sert d'ancre, et sa fiche
73
+ // montre le remboursement de sa classe ATC4, seul niveau publie par l'AIFA.
74
+ type: "ItDrugReimbursement",
75
+ index: ITALY_INDEX.directory,
76
+ label: { fr: "Remboursement (Italie)", en: "Reimbursement (Italy)" },
77
+ section: ITALY,
78
+ country: "it",
79
+ icon: "ChartLine",
80
+ source: ["brand", "drug_label", "atc4_code", "atc4_english_label", "company_label"],
81
+ title: (s) => String(s?.drug_label ?? s?.brand ?? ""),
82
+ subtitle: (s, lang) =>
83
+ [s?.atc4_code ? `ATC4 ${s.atc4_code}` : "", s?.company_label, lang === "en" ? "SSN reimbursement of the class" : "Remboursement SSN de la classe"]
84
+ .filter(Boolean)
85
+ .join(" · "),
86
+ path: () => "/drugs",
87
+ titleFromId: (id) => `AIC ${id}`,
88
+ },
65
89
  ];
@@ -201,6 +201,7 @@ function italySpec(kind: RmProjectKind, view: string): OipResourceSpec {
201
201
  const ITALY_VIEWS: Record<string, string> = {
202
202
  ItApproval: "italy-aifa-act",
203
203
  ItDrugPrice: "italy-price",
204
+ ItDrugReimbursement: "italy-reimbursement",
204
205
  };
205
206
 
206
207
  /** La fiche de chaque famille de Germany One (cf. useOipResourceViews). */
@@ -5,6 +5,7 @@ import { oipResourceIndexes, type OipEsCluster } from "../../../app/utils/oipRes
5
5
  import { ES_INDEX } from "../../../app/oip-drugs/esIndices";
6
6
  import { OIP_PATIENT_INDEXES } from "../../../app/oip-patients/indexes";
7
7
  import { GERMANY_INDEX } from "../../../app/oip-germany/kinds";
8
+ import { ITALY_INDEX } from "../../../app/oip-italy/kinds";
8
9
 
9
10
  /**
10
11
  * POST /api/oip/es?cluster=&index=, servi par le layer OIP.
@@ -34,6 +35,12 @@ type KeyGroup = "auth" | "authAssociations" | "authApprovals" | "authVaccines" |
34
35
  /** Index de Germany One : par leur nom, hors du catalogue de fr_drugs_app. */
35
36
  const GERMANY_INDEXES = new Set<string>(Object.values(GERMANY_INDEX));
36
37
 
38
+ /**
39
+ * Index d'Italy One hors du catalogue de fr_drugs_app (repertoire et
40
+ * remboursement AIFA) : par leur nom, avec la cle principale.
41
+ */
42
+ const ITALY_INDEXES = new Set<string>([ITALY_INDEX.directory, ITALY_INDEX.reimbursement]);
43
+
37
44
  const DRUG_IDS = new Set<string>(Object.values(ES_INDEX) as string[]);
38
45
  const ASSOCIATION_IDS = new Set<string>(
39
46
  Object.entries(ES_INDEX)
@@ -52,7 +59,7 @@ const APPROVAL_IDS = new Set<string>(
52
59
  * Vide si l'index n'est pas au catalogue.
53
60
  */
54
61
  async function drugsKeyOf(ref: string): Promise<string> {
55
- if (DRUG_IDS.has(ref) || GERMANY_INDEXES.has(ref)) return ref;
62
+ if (DRUG_IDS.has(ref) || GERMANY_INDEXES.has(ref) || ITALY_INDEXES.has(ref)) return ref;
56
63
  const id = (await findOipEsIndex(ref).catch(() => undefined))?.id;
57
64
  return id && DRUG_IDS.has(id) ? id : "";
58
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.286",
3
+ "version": "0.1.287",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",