@tekkare/romulus 0.1.336 → 0.1.337
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 +1 -1
- package/layer/app/components/oip-drugs/fiches/BrandFiche.vue +22 -7
- package/layer/app/components/oip-drugs/heart/mitm/details/Overview.vue +147 -300
- package/layer/app/components/oip-drugs/heart/mitm/details/SmrAsmr.vue +291 -0
- package/layer/app/components/oip-drugs/resources/Mitm.vue +2 -1
- package/layer/app/oip-drugs/utils/heartMitmTone.ts +35 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -124,7 +124,12 @@
|
|
|
124
124
|
:avis-count="overviewHistory.length"
|
|
125
125
|
/>
|
|
126
126
|
</div>
|
|
127
|
-
|
|
127
|
+
<!-- MITM et « SMR & ASMR » lisent les memes documents MITM : meme selecteur
|
|
128
|
+
de CIS, la specialite choisie suit d'un onglet a l'autre. -->
|
|
129
|
+
<div
|
|
130
|
+
v-else-if="(chosenTab === mitmTabIndex && mitmTabIndex > 0) || (chosenTab === smrTabIndex && smrTabIndex > 0)"
|
|
131
|
+
class="arg_page_layout"
|
|
132
|
+
>
|
|
128
133
|
<div v-if="resultsQueryMitm.length > 1" class="cis-switch">
|
|
129
134
|
<span class="oip_filter_label cis-switch-label">
|
|
130
135
|
{{ locale === 'en' ? 'Specialty (CIS):' : 'Spécialité (CIS) :' }}
|
|
@@ -140,11 +145,14 @@
|
|
|
140
145
|
{{ heartStripBrandPrefix(m._source.cis_label, brandMatch) }}
|
|
141
146
|
</button>
|
|
142
147
|
</div>
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
<template v-if="selectedMitmCis">
|
|
149
|
+
<OipDrugsHeartMitmDetailsSmrAsmr
|
|
150
|
+
v-if="chosenTab === smrTabIndex"
|
|
151
|
+
:cis="selectedMitmCis"
|
|
152
|
+
@select="drawerRecord = $event"
|
|
153
|
+
/>
|
|
154
|
+
<OipDrugsHeartMitmDetailsOverview v-else :cis="selectedMitmCis" />
|
|
155
|
+
</template>
|
|
148
156
|
</div>
|
|
149
157
|
<div v-else-if="chosenTab === putTabIndex && putTabIndex > 0" class="arg_page_layout">
|
|
150
158
|
<OipDrugsHeartResultsDetailsRecordList
|
|
@@ -329,7 +337,11 @@ const availableTabs = computed(() => {
|
|
|
329
337
|
if (resultsQueryPrice.value.length > 0) tabs.push({ key: 'price', label: t('oipDrugs.heart.details.tabs.price') });
|
|
330
338
|
if (resultsQueryIntlPrice.value.length > 0 || intlDecisionCount.value > 0) tabs.push({ key: 'international', label: en ? 'International view' : 'Regard international' });
|
|
331
339
|
if (resultsQueryAnsm.value.length > 0) tabs.push({ key: 'ansm', label: 'ANSM' });
|
|
332
|
-
if (resultsQueryMitm.value.length > 0)
|
|
340
|
+
if (resultsQueryMitm.value.length > 0) {
|
|
341
|
+
tabs.push({ key: 'mitm', label: 'MITM' });
|
|
342
|
+
// Les avis SMR / ASMR du CIS ont leur onglet, le MITM garde les CIP.
|
|
343
|
+
tabs.push({ key: 'smr', label: 'SMR & ASMR' });
|
|
344
|
+
}
|
|
333
345
|
if (resultsQueryPut.value.length > 0) tabs.push({ key: 'put', label: 'PUT' });
|
|
334
346
|
if (resultsQueryLes.value.length > 0) tabs.push({ key: 'les', label: 'LES' });
|
|
335
347
|
// Les alertes ferment la liste : elles completent la fiche, elles ne la
|
|
@@ -369,6 +381,8 @@ const TAB_ALIASES: Record<string, string> = {
|
|
|
369
381
|
liste_en_sus: 'les',
|
|
370
382
|
regard_international: 'international',
|
|
371
383
|
prix_internationaux: 'international',
|
|
384
|
+
smr_asmr: 'smr',
|
|
385
|
+
asmr: 'smr',
|
|
372
386
|
};
|
|
373
387
|
|
|
374
388
|
const normalizeTab = (rawKey: string) => TAB_ALIASES[String(rawKey).toLowerCase()] ?? rawKey;
|
|
@@ -388,6 +402,7 @@ const priceTabIndex = computed(() => tabIndexOf('price'));
|
|
|
388
402
|
const internationalTabIndex = computed(() => tabIndexOf('international'));
|
|
389
403
|
const ansmTabIndex = computed(() => tabIndexOf('ansm'));
|
|
390
404
|
const mitmTabIndex = computed(() => tabIndexOf('mitm'));
|
|
405
|
+
const smrTabIndex = computed(() => tabIndexOf('smr'));
|
|
391
406
|
const putTabIndex = computed(() => tabIndexOf('put'));
|
|
392
407
|
const lesTabIndex = computed(() => tabIndexOf('les'));
|
|
393
408
|
|
|
@@ -1,161 +1,138 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
Onglet MITM d'une specialite.
|
|
2
|
+
Onglet MITM d'une specialite : les CIP rattaches a la molecule, en tableau.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
SMR et ASMR reunis par code, le texte integral s'ouvrant dans le tiroir.
|
|
4
|
+
`molecule` porte, pour chaque presentation (CIP) partageant la molecule, sa
|
|
5
|
+
marque, son libelle et son code CIS. Le SMR et l'ASMR ne sont pas sur ces
|
|
6
|
+
lignes : ils vivent sur le document MITM de chaque CIS, qu'on relit par
|
|
7
|
+
`cis_code`. Un CIS absent de l'index laisse ses cellules vides. Les avis
|
|
8
|
+
eux-memes sont dans l'onglet « SMR & ASMR » (SmrAsmr.vue).
|
|
10
9
|
-->
|
|
11
10
|
<script setup lang="ts">
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
11
|
+
import { ES_INDEX } from "../../../../../oip-drugs/esIndices";
|
|
12
|
+
import useOipDrugsElastic from "../../../../../oip-drugs/composables/useOipDrugsElastic";
|
|
13
|
+
import {
|
|
14
|
+
heartAsmrTone,
|
|
15
|
+
heartMitmLast,
|
|
16
|
+
heartSmrTone,
|
|
17
|
+
type HeartMitmTone,
|
|
18
|
+
} from "../../../../../oip-drugs/utils/heartMitmTone";
|
|
14
19
|
|
|
15
|
-
// Libelle de source : Directus, comme le panneau « Sources » du rail.
|
|
16
|
-
const { load: loadSourceMeta, metaByUuid } = useDirectusSources();
|
|
17
|
-
loadSourceMeta([HEART_SOURCE_UUIDS.HAS]);
|
|
18
20
|
const props = defineProps<{
|
|
19
21
|
/** Le document MITM du CIS choisi (_source). */
|
|
20
22
|
cis: any;
|
|
21
23
|
}>();
|
|
22
24
|
|
|
23
|
-
const emit = defineEmits<{ (event: "select", record: any): void }>();
|
|
24
|
-
|
|
25
25
|
const { locale } = useI18n();
|
|
26
|
-
const
|
|
27
|
-
() => metaByUuid(HEART_SOURCE_UUIDS.HAS, locale.value === "en" ? "en" : "fr").name,
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
/** `20260708` dans l'index, une date ailleurs. */
|
|
31
|
-
function isoDate(raw: string | null | undefined) {
|
|
32
|
-
if (!raw) return null;
|
|
33
|
-
const value = String(raw);
|
|
34
|
-
if (/^\d{8}$/.test(value)) {
|
|
35
|
-
return `${value.slice(0, 4)}-${value.slice(4, 6)}-${value.slice(6, 8)}`;
|
|
36
|
-
}
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Les libelles d'avis portent des `<br>` : on les rend au lecteur, pas au DOM. */
|
|
41
|
-
function plain(text: string | null | undefined) {
|
|
42
|
-
if (!text) return "";
|
|
43
|
-
return text
|
|
44
|
-
.replace(/<br\s*\/?>/gi, "\n")
|
|
45
|
-
.replace(/<[^>]+>/g, "")
|
|
46
|
-
.trim();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Important, Modere, Faible, Insuffisant. */
|
|
50
|
-
function smrTone(value: string) {
|
|
51
|
-
const v = (value || "").toLowerCase();
|
|
52
|
-
const bad = v.includes("insuffisant");
|
|
53
|
-
const good = v.includes("important");
|
|
54
|
-
// Un avis peut etre important sur une indication et insuffisant sur une autre.
|
|
55
|
-
if (bad && good) return "neutral" as const;
|
|
56
|
-
if (bad) return "bad" as const;
|
|
57
|
-
if (good) return "good" as const;
|
|
58
|
-
return "neutral" as const;
|
|
59
|
-
}
|
|
26
|
+
const { queryCustomElastic } = useOipDrugsElastic();
|
|
60
27
|
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (level === "I" || level === "II") return "good" as const;
|
|
65
|
-
if (level === "III") return "post" as const;
|
|
66
|
-
if (level === "IV") return "warn" as const;
|
|
67
|
-
return "neutral" as const;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Premier niveau renseigne : l'index met des lignes de remplissage nulles en
|
|
71
|
-
// tete de `last_smr`/`last_asmr`, le KPI affichait un tiret a tort.
|
|
72
|
-
const lastSmr = computed(() => (props.cis?.last_smr ?? []).find((s: any) => s?.value) ?? null);
|
|
73
|
-
const lastAsmr = computed(() => (props.cis?.last_asmr ?? []).find((s: any) => s?.value) ?? null);
|
|
74
|
-
|
|
75
|
-
const atcLabel = computed(() =>
|
|
76
|
-
locale.value === "en"
|
|
77
|
-
? props.cis?.atc5_english_code_label
|
|
78
|
-
: props.cis?.atc5_french_code_label,
|
|
28
|
+
/** Les lignes de `molecule` qui disent quelque chose. */
|
|
29
|
+
const attached = computed<any[]>(() =>
|
|
30
|
+
(props.cis?.molecule ?? []).filter((row: any) => row?.brand || row?.drug_label || row?.cis_code),
|
|
79
31
|
);
|
|
80
32
|
|
|
81
|
-
|
|
82
|
-
* Les avis, un par code HAS.
|
|
83
|
-
*
|
|
84
|
-
* SMR et ASMR sont deux listes separees dans l'index alors qu'ils sont rendus
|
|
85
|
-
* dans le meme avis : on les rassemble par `has_code`, sinon chaque decision
|
|
86
|
-
* apparaissait deux fois.
|
|
87
|
-
*/
|
|
88
|
-
const opinions = computed(() => {
|
|
89
|
-
const byCode = new Map<string, any>();
|
|
33
|
+
type Levels = { smr: string | null; asmr: string | null };
|
|
90
34
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (!entry?.has_code && !entry?.has_date && !entry?.label && !entry?.value) return;
|
|
95
|
-
const code = entry.has_code || `${kind}-${entry.has_date}`;
|
|
96
|
-
const found = byCode.get(code) ?? {
|
|
97
|
-
code: entry.has_code || null,
|
|
98
|
-
date: isoDate(entry.has_date),
|
|
99
|
-
reason: entry.has_reason || null,
|
|
100
|
-
};
|
|
101
|
-
// Un meme avis peut rendre plusieurs niveaux (important ici, insuffisant
|
|
102
|
-
// la) : on les cumule au lieu de garder le dernier.
|
|
103
|
-
const previous = found[kind];
|
|
104
|
-
found[kind] = {
|
|
105
|
-
value: [previous?.value, entry.value].filter(Boolean).join(", ") || null,
|
|
106
|
-
label: [previous?.label, plain(entry.label)].filter(Boolean).join("\n\n"),
|
|
107
|
-
};
|
|
108
|
-
byCode.set(code, found);
|
|
109
|
-
};
|
|
35
|
+
/** Derniers niveaux SMR / ASMR par code CIS, relus dans l'index MITM. */
|
|
36
|
+
const levelsByCis = ref<Record<string, Levels>>({});
|
|
37
|
+
const loadingLevels = ref(false);
|
|
110
38
|
|
|
111
|
-
|
|
112
|
-
(
|
|
113
|
-
|
|
114
|
-
// `has_date` peut etre nul : NaN dans le comparateur rendait l'ordre
|
|
115
|
-
// aleatoire, on classe ces avis en fin de liste.
|
|
116
|
-
const time = (d: string | null) => (d ? new Date(d).getTime() : 0);
|
|
117
|
-
return [...byCode.values()].sort((a, b) => time(b.date) - time(a.date));
|
|
39
|
+
const levelsOf = (source: any): Levels => ({
|
|
40
|
+
smr: heartMitmLast(source?.last_smr)?.value ?? null,
|
|
41
|
+
asmr: heartMitmLast(source?.last_asmr)?.value ?? null,
|
|
118
42
|
});
|
|
119
43
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
44
|
+
let generation = 0;
|
|
45
|
+
async function loadLevels() {
|
|
46
|
+
const gen = ++generation;
|
|
47
|
+
const ownCode = String(props.cis?.cis_code ?? "");
|
|
48
|
+
const own: Record<string, Levels> = ownCode ? { [ownCode]: levelsOf(props.cis) } : {};
|
|
49
|
+
const codes = [
|
|
50
|
+
...new Set(attached.value.map((row) => String(row.cis_code ?? "")).filter(Boolean)),
|
|
51
|
+
].filter((code) => code !== ownCode);
|
|
52
|
+
levelsByCis.value = own;
|
|
53
|
+
loadingLevels.value = codes.length > 0;
|
|
54
|
+
if (!codes.length) return;
|
|
55
|
+
|
|
56
|
+
const res = await queryCustomElastic({
|
|
57
|
+
index: ES_INDEX.MITM_BDPM,
|
|
58
|
+
customQuery: {
|
|
59
|
+
size: 1000,
|
|
60
|
+
_source: ["cis_code", "last_smr", "last_asmr", "@timestamp"],
|
|
61
|
+
query: { terms: { "cis_code.keyword": codes } },
|
|
62
|
+
},
|
|
63
|
+
allAnswer: true,
|
|
64
|
+
}).catch((error) => {
|
|
65
|
+
console.error("Error fetching MITM levels:", error);
|
|
66
|
+
return null;
|
|
67
|
+
});
|
|
68
|
+
if (gen !== generation) return;
|
|
69
|
+
|
|
70
|
+
// Plusieurs instantanes d'un meme CIS : on garde le plus recent.
|
|
71
|
+
const time = (source: any) => new Date(source?.["@timestamp"] || 0).getTime();
|
|
72
|
+
const latest = new Map<string, any>();
|
|
73
|
+
for (const hit of res?.hits?.hits ?? []) {
|
|
74
|
+
const code = String(hit._source?.cis_code ?? "");
|
|
75
|
+
const found = latest.get(code);
|
|
76
|
+
if (code && (!found || time(hit._source) > time(found))) latest.set(code, hit._source);
|
|
77
|
+
}
|
|
78
|
+
const next = { ...own };
|
|
79
|
+
latest.forEach((source, code) => {
|
|
80
|
+
next[code] = levelsOf(source);
|
|
81
|
+
});
|
|
82
|
+
levelsByCis.value = next;
|
|
83
|
+
loadingLevels.value = false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
watch(() => props.cis, loadLevels, { immediate: true });
|
|
87
|
+
|
|
88
|
+
const rows = computed(() =>
|
|
89
|
+
attached.value.map((row, index) => {
|
|
90
|
+
const levels = levelsByCis.value[String(row.cis_code ?? "")];
|
|
91
|
+
return {
|
|
92
|
+
key: `${row.drug_code ?? ""}-${row.cis_code ?? ""}-${index}`,
|
|
93
|
+
brand: row.brand || "-",
|
|
94
|
+
label: row.drug_label || "-",
|
|
95
|
+
cip: row.drug_code || "-",
|
|
96
|
+
cisCode: row.cis_code || "-",
|
|
97
|
+
owner: row.owner_regroup || "-",
|
|
98
|
+
smr: levels?.smr ?? null,
|
|
99
|
+
asmr: levels?.asmr ?? null,
|
|
100
|
+
current: String(row.cis_code ?? "") === String(props.cis?.cis_code ?? ""),
|
|
101
|
+
};
|
|
102
|
+
}),
|
|
154
103
|
);
|
|
155
104
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
);
|
|
105
|
+
/** Les colonnes SMR / ASMR n'apparaissent que si au moins un CIP en a un. */
|
|
106
|
+
const hasSmr = computed(() => loadingLevels.value || rows.value.some((row) => row.smr));
|
|
107
|
+
const hasAsmr = computed(() => loadingLevels.value || rows.value.some((row) => row.asmr));
|
|
108
|
+
|
|
109
|
+
const columns = computed(() => {
|
|
110
|
+
const en = locale.value === "en";
|
|
111
|
+
return [
|
|
112
|
+
{ key: "brand", label: en ? "Brand" : "Marque", sortable: true },
|
|
113
|
+
{
|
|
114
|
+
key: "label",
|
|
115
|
+
label: en ? "Presentation" : "Présentation",
|
|
116
|
+
sortable: true,
|
|
117
|
+
rowHeader: true,
|
|
118
|
+
minWidth: "280px",
|
|
119
|
+
},
|
|
120
|
+
{ key: "cip", label: en ? "CIP code" : "Code CIP", sortable: true, width: "140px" },
|
|
121
|
+
{ key: "cisCode", label: en ? "CIS code" : "Code CIS", sortable: true, width: "110px" },
|
|
122
|
+
{ key: "owner", label: en ? "Manufacturer" : "Laboratoire", sortable: true },
|
|
123
|
+
...(hasSmr.value ? [{ key: "smr", label: "SMR", sortable: true }] : []),
|
|
124
|
+
...(hasAsmr.value ? [{ key: "asmr", label: "ASMR", sortable: true }] : []),
|
|
125
|
+
];
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
/** Ton du niveau vers la variante de RmBadge. */
|
|
129
|
+
const BADGE: Record<HeartMitmTone, "active" | "error" | "pending" | "info" | "grey"> = {
|
|
130
|
+
good: "active",
|
|
131
|
+
bad: "error",
|
|
132
|
+
warn: "pending",
|
|
133
|
+
post: "info",
|
|
134
|
+
neutral: "grey",
|
|
135
|
+
};
|
|
159
136
|
</script>
|
|
160
137
|
|
|
161
138
|
<template>
|
|
@@ -164,8 +141,8 @@ const attached = computed(() =>
|
|
|
164
141
|
<RmIcon name="Info" :size="14" />
|
|
165
142
|
{{
|
|
166
143
|
locale === "en"
|
|
167
|
-
?
|
|
168
|
-
:
|
|
144
|
+
? "Presentations (CIP) sharing the molecule of this specialty."
|
|
145
|
+
: "Présentations (CIP) partageant la molécule de cette spécialité."
|
|
169
146
|
}}
|
|
170
147
|
<a
|
|
171
148
|
v-if="cis.url_link"
|
|
@@ -178,68 +155,32 @@ const attached = computed(() =>
|
|
|
178
155
|
</a>
|
|
179
156
|
</p>
|
|
180
157
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
<
|
|
199
|
-
<
|
|
200
|
-
<
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
<RmDate
|
|
208
|
-
v-if="isoDate(lastSmr?.has_date || lastAsmr?.has_date)"
|
|
209
|
-
:date="isoDate(lastSmr?.has_date || lastAsmr?.has_date)!"
|
|
210
|
-
:lang="locale"
|
|
211
|
-
/>
|
|
212
|
-
<template v-else>-</template>
|
|
213
|
-
</p>
|
|
214
|
-
<p class="mi_kpi_label">
|
|
215
|
-
{{ locale === "en" ? "Last assessment" : "Dernière évaluation" }}
|
|
216
|
-
</p>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
|
|
220
|
-
<OipDrugsHeartResultsDetailsRecordList
|
|
221
|
-
:title="locale === 'en' ? 'Transparency Committee opinions' : 'Avis de la Commission de la transparence'"
|
|
222
|
-
:subtitle="locale === 'en' ? 'opinions recorded for this presentation' : 'avis recensés pour cette présentation'"
|
|
223
|
-
:items="records"
|
|
224
|
-
:empty-label="locale === 'en' ? 'No opinion recorded.' : 'Aucun avis recensé.'"
|
|
225
|
-
@select="emit('select', $event)"
|
|
226
|
-
/>
|
|
227
|
-
|
|
228
|
-
<template v-if="attached.length">
|
|
229
|
-
<h3 class="mi_section">
|
|
230
|
-
{{ locale === "en" ? "Products attached to this molecule" : "Produits rattachés à cette molécule" }}
|
|
231
|
-
</h3>
|
|
232
|
-
<ul class="mi_attached">
|
|
233
|
-
<li v-for="row in attached" :key="row.cis_code || row.drug_code">
|
|
234
|
-
<b>{{ row.brand || "-" }}</b>
|
|
235
|
-
<span>{{ row.drug_label }}</span>
|
|
236
|
-
<span class="mi_attached_meta">
|
|
237
|
-
<template v-if="row.cis_code">CIS {{ row.cis_code }}</template>
|
|
238
|
-
<template v-if="row.owner_regroup"> · {{ row.owner_regroup }}</template>
|
|
239
|
-
</span>
|
|
240
|
-
</li>
|
|
241
|
-
</ul>
|
|
242
|
-
</template>
|
|
158
|
+
<RmTable
|
|
159
|
+
:columns="columns"
|
|
160
|
+
:rows="rows"
|
|
161
|
+
:caption="locale === 'en' ? 'Products attached to this molecule' : 'Produits rattachés à cette molécule'"
|
|
162
|
+
row-key="key"
|
|
163
|
+
compact
|
|
164
|
+
search="auto"
|
|
165
|
+
:search-placeholder="
|
|
166
|
+
locale === 'en' ? 'Search a brand, a CIP code...' : 'Rechercher une marque, un code CIP...'
|
|
167
|
+
"
|
|
168
|
+
:page-size="25"
|
|
169
|
+
max-height="600px"
|
|
170
|
+
:empty-text="locale === 'en' ? 'No product attached to this molecule' : 'Aucun produit rattaché à cette molécule'"
|
|
171
|
+
>
|
|
172
|
+
<template #label="{ row }">
|
|
173
|
+
<span :class="{ mi_current: row.current }">{{ row.label }}</span>
|
|
174
|
+
</template>
|
|
175
|
+
<template #smr="{ value }">
|
|
176
|
+
<RmBadge v-if="value" :variant="BADGE[heartSmrTone(value)]">{{ value }}</RmBadge>
|
|
177
|
+
<template v-else>{{ loadingLevels ? "…" : "-" }}</template>
|
|
178
|
+
</template>
|
|
179
|
+
<template #asmr="{ value }">
|
|
180
|
+
<RmBadge v-if="value" :variant="BADGE[heartAsmrTone(value)]">{{ value }}</RmBadge>
|
|
181
|
+
<template v-else>{{ loadingLevels ? "…" : "-" }}</template>
|
|
182
|
+
</template>
|
|
183
|
+
</RmTable>
|
|
243
184
|
|
|
244
185
|
<p class="mi_source">
|
|
245
186
|
<OipDrugsHeartMitmSource
|
|
@@ -257,13 +198,7 @@ const attached = computed(() =>
|
|
|
257
198
|
gap: 16px;
|
|
258
199
|
box-sizing: border-box;
|
|
259
200
|
width: 100%;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
/* La liste d'avis pose deja sa propre gouttiere de 32px ; les autres blocs la
|
|
263
|
-
prennent en marge et non en retrait interne, pour que leur cadre s'aligne sur
|
|
264
|
-
celui des cartes plutot que de le deborder. */
|
|
265
|
-
.mi > :not(.rl) {
|
|
266
|
-
margin-inline: 32px;
|
|
201
|
+
padding-inline: 32px;
|
|
267
202
|
}
|
|
268
203
|
|
|
269
204
|
.mi_scope {
|
|
@@ -281,97 +216,9 @@ const attached = computed(() =>
|
|
|
281
216
|
font-weight: 600;
|
|
282
217
|
}
|
|
283
218
|
|
|
284
|
-
/*
|
|
285
|
-
.
|
|
286
|
-
|
|
287
|
-
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
288
|
-
border: 1px solid var(--light);
|
|
289
|
-
/* Le filet degrade court d'un bord a l'autre : arrondir le haut le tronquait
|
|
290
|
-
a ses extremites. */
|
|
291
|
-
border-radius: 0 0 12px 12px;
|
|
292
|
-
background: var(--white);
|
|
293
|
-
overflow: hidden;
|
|
294
|
-
box-shadow: var(--small-shadow);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
.mi_kpis::before {
|
|
298
|
-
content: "";
|
|
299
|
-
grid-column: 1 / -1;
|
|
300
|
-
height: 3px;
|
|
301
|
-
background: linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 35%, var(--white)));
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.mi_kpi {
|
|
305
|
-
display: flex;
|
|
306
|
-
flex-direction: column;
|
|
307
|
-
align-items: center;
|
|
308
|
-
gap: 6px;
|
|
309
|
-
padding: 20px 16px;
|
|
310
|
-
border-left: 1px solid var(--light);
|
|
311
|
-
text-align: center;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.mi_kpi:first-of-type {
|
|
315
|
-
border-left: none;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
.mi_kpi_value {
|
|
319
|
-
color: var(--primary);
|
|
320
|
-
font-size: 19px;
|
|
321
|
-
font-weight: 800;
|
|
322
|
-
white-space: nowrap;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/* Le niveau porte sa propre lecture : favorable, moyen, insuffisant. */
|
|
326
|
-
.mi_kpi_value.is_good {
|
|
327
|
-
color: var(--system-success-hover);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
.mi_kpi_value.is_bad {
|
|
331
|
-
color: var(--system-alert-hover);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.mi_kpi_value.is_warn {
|
|
335
|
-
color: #b45309;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.mi_kpi_label {
|
|
339
|
-
color: var(--medium);
|
|
340
|
-
font-size: 11px;
|
|
341
|
-
font-weight: 600;
|
|
342
|
-
letter-spacing: 0.04em;
|
|
343
|
-
text-transform: uppercase;
|
|
344
|
-
white-space: nowrap;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.mi_section {
|
|
348
|
-
margin-top: 8px;
|
|
349
|
-
font-size: 16px;
|
|
350
|
-
font-weight: 800;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.mi_attached {
|
|
354
|
-
display: flex;
|
|
355
|
-
flex-direction: column;
|
|
356
|
-
gap: 8px;
|
|
357
|
-
list-style: none;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.mi_attached li {
|
|
361
|
-
display: flex;
|
|
362
|
-
flex-wrap: wrap;
|
|
363
|
-
align-items: baseline;
|
|
364
|
-
gap: 8px;
|
|
365
|
-
padding: 10px 14px;
|
|
366
|
-
border: 1px solid var(--light);
|
|
367
|
-
border-radius: 12px;
|
|
368
|
-
background: var(--white);
|
|
369
|
-
font-size: 14px;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
.mi_attached_meta {
|
|
373
|
-
color: var(--medium);
|
|
374
|
-
font-size: 13px;
|
|
219
|
+
/* La specialite affichee se repere parmi ses voisines de molecule. */
|
|
220
|
+
.mi_current {
|
|
221
|
+
font-weight: 700;
|
|
375
222
|
}
|
|
376
223
|
|
|
377
224
|
.mi_source {
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Onglet « SMR & ASMR » d'une specialite MITM.
|
|
3
|
+
|
|
4
|
+
L'index MITM tient, pour un code CIS, l'integralite des avis de la Commission
|
|
5
|
+
de la transparence : une quarantaine de SMR et autant d'ASMR, chacun avec son
|
|
6
|
+
texte complet. Les deux derniers niveaux se lisent en tete, puis chaque avis
|
|
7
|
+
devient une carte, SMR et ASMR reunis par code, le texte integral s'ouvrant
|
|
8
|
+
dans le tiroir. Les CIP rattaches restent dans l'onglet MITM (Overview).
|
|
9
|
+
-->
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { HEART_SOURCE_UUIDS } from "../../../../../oip-drugs/utils/sourceUuids";
|
|
12
|
+
import useDirectusSources from "../../../../../oip-drugs/composables/useDirectusSources";
|
|
13
|
+
import {
|
|
14
|
+
heartAsmrTone as asmrTone,
|
|
15
|
+
heartMitmLast,
|
|
16
|
+
heartSmrTone as smrTone,
|
|
17
|
+
} from "../../../../../oip-drugs/utils/heartMitmTone";
|
|
18
|
+
|
|
19
|
+
// Libelle de source : Directus, comme le panneau « Sources » du rail.
|
|
20
|
+
const { load: loadSourceMeta, metaByUuid } = useDirectusSources();
|
|
21
|
+
loadSourceMeta([HEART_SOURCE_UUIDS.HAS]);
|
|
22
|
+
const props = defineProps<{
|
|
23
|
+
/** Le document MITM du CIS choisi (_source). */
|
|
24
|
+
cis: any;
|
|
25
|
+
}>();
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits<{ (event: "select", record: any): void }>();
|
|
28
|
+
|
|
29
|
+
const { locale } = useI18n();
|
|
30
|
+
const hasSourceName = computed(
|
|
31
|
+
() => metaByUuid(HEART_SOURCE_UUIDS.HAS, locale.value === "en" ? "en" : "fr").name,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
/** `20260708` dans l'index, une date ailleurs. */
|
|
35
|
+
function isoDate(raw: string | null | undefined) {
|
|
36
|
+
if (!raw) return null;
|
|
37
|
+
const value = String(raw);
|
|
38
|
+
if (/^\d{8}$/.test(value)) {
|
|
39
|
+
return `${value.slice(0, 4)}-${value.slice(4, 6)}-${value.slice(6, 8)}`;
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Les libelles d'avis portent des `<br>` : on les rend au lecteur, pas au DOM. */
|
|
45
|
+
function plain(text: string | null | undefined) {
|
|
46
|
+
if (!text) return "";
|
|
47
|
+
return text
|
|
48
|
+
.replace(/<br\s*\/?>/gi, "\n")
|
|
49
|
+
.replace(/<[^>]+>/g, "")
|
|
50
|
+
.trim();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const lastSmr = computed(() => heartMitmLast(props.cis?.last_smr));
|
|
54
|
+
const lastAsmr = computed(() => heartMitmLast(props.cis?.last_asmr));
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Les avis, un par code HAS.
|
|
58
|
+
*
|
|
59
|
+
* SMR et ASMR sont deux listes separees dans l'index alors qu'ils sont rendus
|
|
60
|
+
* dans le meme avis : on les rassemble par `has_code`, sinon chaque decision
|
|
61
|
+
* apparaissait deux fois.
|
|
62
|
+
*/
|
|
63
|
+
const opinions = computed(() => {
|
|
64
|
+
const byCode = new Map<string, any>();
|
|
65
|
+
|
|
66
|
+
const push = (entry: any, kind: "smr" | "asmr") => {
|
|
67
|
+
// L'index porte des lignes de remplissage entierement nulles : sans ce
|
|
68
|
+
// garde, chacune devenait un avis vide dans la liste.
|
|
69
|
+
if (!entry?.has_code && !entry?.has_date && !entry?.label && !entry?.value) return;
|
|
70
|
+
const code = entry.has_code || `${kind}-${entry.has_date}`;
|
|
71
|
+
const found = byCode.get(code) ?? {
|
|
72
|
+
code: entry.has_code || null,
|
|
73
|
+
date: isoDate(entry.has_date),
|
|
74
|
+
reason: entry.has_reason || null,
|
|
75
|
+
};
|
|
76
|
+
// Un meme avis peut rendre plusieurs niveaux (important ici, insuffisant
|
|
77
|
+
// la) : on les cumule au lieu de garder le dernier.
|
|
78
|
+
const previous = found[kind];
|
|
79
|
+
found[kind] = {
|
|
80
|
+
value: [previous?.value, entry.value].filter(Boolean).join(", ") || null,
|
|
81
|
+
label: [previous?.label, plain(entry.label)].filter(Boolean).join("\n\n"),
|
|
82
|
+
};
|
|
83
|
+
byCode.set(code, found);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
(props.cis?.smr ?? []).forEach((entry: any) => push(entry, "smr"));
|
|
87
|
+
(props.cis?.asmr ?? []).forEach((entry: any) => push(entry, "asmr"));
|
|
88
|
+
|
|
89
|
+
// `has_date` peut etre nul : NaN dans le comparateur rendait l'ordre
|
|
90
|
+
// aleatoire, on classe ces avis en fin de liste.
|
|
91
|
+
const time = (d: string | null) => (d ? new Date(d).getTime() : 0);
|
|
92
|
+
return [...byCode.values()].sort((a, b) => time(b.date) - time(a.date));
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const records = computed(() =>
|
|
96
|
+
opinions.value.map((opinion) => ({
|
|
97
|
+
key: opinion.code || opinion.date,
|
|
98
|
+
typeLabel:
|
|
99
|
+
opinion.reason || (locale.value === "en" ? "Transparency opinion" : "Avis de transparence"),
|
|
100
|
+
icon: "FileText",
|
|
101
|
+
date: opinion.date,
|
|
102
|
+
ref: opinion.code,
|
|
103
|
+
title:
|
|
104
|
+
opinion.smr?.label ||
|
|
105
|
+
opinion.asmr?.label ||
|
|
106
|
+
(locale.value === "en" ? "Transparency opinion" : "Avis de transparence"),
|
|
107
|
+
excerpt: opinion.smr?.label ? opinion.asmr?.label : null,
|
|
108
|
+
status: opinion.smr?.value ? `SMR ${opinion.smr.value}` : null,
|
|
109
|
+
statusTone: smrTone(opinion.smr?.value),
|
|
110
|
+
badge: opinion.asmr?.value ? `ASMR ${opinion.asmr.value}` : null,
|
|
111
|
+
badgeTone: asmrTone(opinion.asmr?.value),
|
|
112
|
+
sourceLabel: hasSourceName.value,
|
|
113
|
+
sections: [
|
|
114
|
+
{
|
|
115
|
+
key: "smr",
|
|
116
|
+
label: locale.value === "en" ? "Actual benefit (SMR)" : "Service médical rendu (SMR)",
|
|
117
|
+
body: opinion.smr?.label ?? "",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
key: "asmr",
|
|
121
|
+
label:
|
|
122
|
+
locale.value === "en"
|
|
123
|
+
? "Improvement in actual benefit (ASMR)"
|
|
124
|
+
: "Amélioration du service médical rendu (ASMR)",
|
|
125
|
+
body: opinion.asmr?.label ?? "",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
})),
|
|
129
|
+
);
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<template>
|
|
133
|
+
<section class="oip-drugs mi">
|
|
134
|
+
<p class="mi_scope">
|
|
135
|
+
<RmIcon name="Info" :size="14" />
|
|
136
|
+
{{
|
|
137
|
+
locale === "en"
|
|
138
|
+
? `Opinions cover the presentation ${cis.cis_label}.`
|
|
139
|
+
: `Les avis portent sur la présentation ${cis.cis_label}.`
|
|
140
|
+
}}
|
|
141
|
+
</p>
|
|
142
|
+
|
|
143
|
+
<!-- Meme bandeau de synthese que l'onglet Prix : les niveaux en vigueur et
|
|
144
|
+
l'ampleur de l'historique, avant d'entrer dans le detail. -->
|
|
145
|
+
<div class="mi_kpis">
|
|
146
|
+
<div class="mi_kpi">
|
|
147
|
+
<p class="mi_kpi_value" :class="`is_${smrTone(lastSmr?.value)}`">
|
|
148
|
+
{{ lastSmr?.value || "-" }}
|
|
149
|
+
</p>
|
|
150
|
+
<p class="mi_kpi_label">{{ locale === "en" ? "Current SMR" : "SMR en vigueur" }}</p>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div class="mi_kpi">
|
|
154
|
+
<p class="mi_kpi_value" :class="`is_${asmrTone(lastAsmr?.value)}`">
|
|
155
|
+
{{ lastAsmr?.value || "-" }}
|
|
156
|
+
</p>
|
|
157
|
+
<p class="mi_kpi_label">{{ locale === "en" ? "Current ASMR" : "ASMR en vigueur" }}</p>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div class="mi_kpi">
|
|
161
|
+
<p class="mi_kpi_value">{{ records.length }}</p>
|
|
162
|
+
<p class="mi_kpi_label">
|
|
163
|
+
{{ locale === "en" ? "Opinions recorded" : "Avis recensés" }}
|
|
164
|
+
</p>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div class="mi_kpi">
|
|
168
|
+
<p class="mi_kpi_value">
|
|
169
|
+
<RmDate
|
|
170
|
+
v-if="isoDate(lastSmr?.has_date || lastAsmr?.has_date)"
|
|
171
|
+
:date="isoDate(lastSmr?.has_date || lastAsmr?.has_date)!"
|
|
172
|
+
:lang="locale"
|
|
173
|
+
/>
|
|
174
|
+
<template v-else>-</template>
|
|
175
|
+
</p>
|
|
176
|
+
<p class="mi_kpi_label">
|
|
177
|
+
{{ locale === "en" ? "Last assessment" : "Dernière évaluation" }}
|
|
178
|
+
</p>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<OipDrugsHeartResultsDetailsRecordList
|
|
183
|
+
:title="locale === 'en' ? 'Transparency Committee opinions' : 'Avis de la Commission de la transparence'"
|
|
184
|
+
:subtitle="locale === 'en' ? 'opinions recorded for this presentation' : 'avis recensés pour cette présentation'"
|
|
185
|
+
:items="records"
|
|
186
|
+
:empty-label="locale === 'en' ? 'No opinion recorded.' : 'Aucun avis recensé.'"
|
|
187
|
+
@select="emit('select', $event)"
|
|
188
|
+
/>
|
|
189
|
+
|
|
190
|
+
<p class="mi_source">
|
|
191
|
+
<OipDrugsHeartMitmSource
|
|
192
|
+
:last-label="$t('oipDrugs.heart.sources.lastUpdate')"
|
|
193
|
+
:last-date="cis?.update_date"
|
|
194
|
+
/>
|
|
195
|
+
</p>
|
|
196
|
+
</section>
|
|
197
|
+
</template>
|
|
198
|
+
|
|
199
|
+
<style scoped>
|
|
200
|
+
.mi {
|
|
201
|
+
display: flex;
|
|
202
|
+
flex-direction: column;
|
|
203
|
+
gap: 16px;
|
|
204
|
+
box-sizing: border-box;
|
|
205
|
+
width: 100%;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* La liste d'avis pose deja sa propre gouttiere de 32px ; les autres blocs la
|
|
209
|
+
prennent en marge et non en retrait interne, pour que leur cadre s'aligne sur
|
|
210
|
+
celui des cartes plutot que de le deborder. */
|
|
211
|
+
.mi > :not(.rl) {
|
|
212
|
+
margin-inline: 32px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.mi_scope {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-wrap: wrap;
|
|
218
|
+
align-items: center;
|
|
219
|
+
gap: 6px;
|
|
220
|
+
color: var(--medium);
|
|
221
|
+
font-size: 13px;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* Bandeau de synthese : meme dessin que celui de l'onglet Prix. */
|
|
225
|
+
.mi_kpis {
|
|
226
|
+
display: grid;
|
|
227
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
228
|
+
border: 1px solid var(--light);
|
|
229
|
+
/* Le filet degrade court d'un bord a l'autre : arrondir le haut le tronquait
|
|
230
|
+
a ses extremites. */
|
|
231
|
+
border-radius: 0 0 12px 12px;
|
|
232
|
+
background: var(--white);
|
|
233
|
+
overflow: hidden;
|
|
234
|
+
box-shadow: var(--small-shadow);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.mi_kpis::before {
|
|
238
|
+
content: "";
|
|
239
|
+
grid-column: 1 / -1;
|
|
240
|
+
height: 3px;
|
|
241
|
+
background: linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 35%, var(--white)));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.mi_kpi {
|
|
245
|
+
display: flex;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
align-items: center;
|
|
248
|
+
gap: 6px;
|
|
249
|
+
padding: 20px 16px;
|
|
250
|
+
border-left: 1px solid var(--light);
|
|
251
|
+
text-align: center;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.mi_kpi:first-of-type {
|
|
255
|
+
border-left: none;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.mi_kpi_value {
|
|
259
|
+
color: var(--primary);
|
|
260
|
+
font-size: 19px;
|
|
261
|
+
font-weight: 800;
|
|
262
|
+
white-space: nowrap;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* Le niveau porte sa propre lecture : favorable, moyen, insuffisant. */
|
|
266
|
+
.mi_kpi_value.is_good {
|
|
267
|
+
color: var(--system-success-hover);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.mi_kpi_value.is_bad {
|
|
271
|
+
color: var(--system-alert-hover);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.mi_kpi_value.is_warn {
|
|
275
|
+
color: #b45309;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.mi_kpi_label {
|
|
279
|
+
color: var(--medium);
|
|
280
|
+
font-size: 11px;
|
|
281
|
+
font-weight: 600;
|
|
282
|
+
letter-spacing: 0.04em;
|
|
283
|
+
text-transform: uppercase;
|
|
284
|
+
white-space: nowrap;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.mi_source {
|
|
288
|
+
color: var(--medium);
|
|
289
|
+
font-size: 13px;
|
|
290
|
+
}
|
|
291
|
+
</style>
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
</p>
|
|
34
34
|
</RmPageHeader>
|
|
35
35
|
|
|
36
|
-
<
|
|
36
|
+
<OipDrugsHeartMitmDetailsSmrAsmr :cis="source" @select="drawerRecord = $event" />
|
|
37
|
+
<OipDrugsHeartMitmDetailsOverview :cis="source" />
|
|
37
38
|
|
|
38
39
|
<OipDrugsHeartResultsDetailsRecordDrawer
|
|
39
40
|
:record="drawerRecord"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lecture des niveaux SMR / ASMR de l'index MITM, partagee par l'onglet
|
|
3
|
+
* « SMR & ASMR » et le tableau des CIP de l'onglet MITM.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type HeartMitmTone = "good" | "bad" | "warn" | "post" | "neutral";
|
|
7
|
+
|
|
8
|
+
/** Important, Modere, Faible, Insuffisant. */
|
|
9
|
+
export function heartSmrTone(value: string | null | undefined): HeartMitmTone {
|
|
10
|
+
const v = (value || "").toLowerCase();
|
|
11
|
+
const bad = v.includes("insuffisant");
|
|
12
|
+
const good = v.includes("important");
|
|
13
|
+
// Un avis peut etre important sur une indication et insuffisant sur une autre.
|
|
14
|
+
if (bad && good) return "neutral";
|
|
15
|
+
if (bad) return "bad";
|
|
16
|
+
if (good) return "good";
|
|
17
|
+
return "neutral";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** ASMR I a V : plus le niveau est haut, plus le progres est net. */
|
|
21
|
+
export function heartAsmrTone(value: string | null | undefined): HeartMitmTone {
|
|
22
|
+
const level = (value || "").trim().match(/^(I{1,3}|IV|V)\b/)?.[1];
|
|
23
|
+
if (level === "I" || level === "II") return "good";
|
|
24
|
+
if (level === "III") return "post";
|
|
25
|
+
if (level === "IV") return "warn";
|
|
26
|
+
return "neutral";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Premier niveau renseigne de `last_smr` / `last_asmr` : l'index met des lignes
|
|
31
|
+
* de remplissage nulles en tete, les lire telles quelles affichait un tiret.
|
|
32
|
+
*/
|
|
33
|
+
export function heartMitmLast(list: any[] | null | undefined): any | null {
|
|
34
|
+
return (list ?? []).find((entry: any) => entry?.value) ?? null;
|
|
35
|
+
}
|