@tekkare/romulus 0.1.353 → 0.1.354
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
|
@@ -117,6 +117,34 @@
|
|
|
117
117
|
<p v-else class="prj_gd_hint">
|
|
118
118
|
{{ tr("Aucun sujet pour l'instant.", "No subject yet.") }}
|
|
119
119
|
</p>
|
|
120
|
+
|
|
121
|
+
<!-- Les pays des donnees : ils filtrent les sources des trois blocs. -->
|
|
122
|
+
<div class="prj_gd_country_pick">
|
|
123
|
+
<p class="prj_gd_lead">{{ tr("Dans quel(s) pays ?", "In which countr(y/ies)?") }}</p>
|
|
124
|
+
<div class="prj_gd_countries" role="group" :aria-label="tr('Pays', 'Countries')">
|
|
125
|
+
<button
|
|
126
|
+
type="button"
|
|
127
|
+
class="prj_gd_country"
|
|
128
|
+
:class="{ 'is-on': !countries.length }"
|
|
129
|
+
:aria-pressed="!countries.length"
|
|
130
|
+
@click="countries = []"
|
|
131
|
+
>
|
|
132
|
+
{{ tr("Tous", "All") }}
|
|
133
|
+
</button>
|
|
134
|
+
<button
|
|
135
|
+
v-for="entry in GUIDED_COUNTRIES"
|
|
136
|
+
:key="entry.code"
|
|
137
|
+
type="button"
|
|
138
|
+
class="prj_gd_country"
|
|
139
|
+
:class="{ 'is-on': countries.includes(entry.code) }"
|
|
140
|
+
:aria-pressed="countries.includes(entry.code)"
|
|
141
|
+
@click="toggleCountry(entry.code)"
|
|
142
|
+
>
|
|
143
|
+
<RmFlag :code="entry.code" :height="12" />
|
|
144
|
+
{{ entry.label[lang] }}
|
|
145
|
+
</button>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
120
148
|
</section>
|
|
121
149
|
|
|
122
150
|
<!-- 2. Sources -->
|
|
@@ -173,6 +201,18 @@
|
|
|
173
201
|
</li>
|
|
174
202
|
</ul>
|
|
175
203
|
</article>
|
|
204
|
+
|
|
205
|
+
<!-- Les blocs a venir, montres grises : on sait ce qui arrive. -->
|
|
206
|
+
<article v-for="soon in SOON_BLOCKS" :key="soon.key" class="prj_gd_block is-soon" aria-disabled="true">
|
|
207
|
+
<div class="prj_gd_block_main">
|
|
208
|
+
<span class="prj_gd_block_icon"><RmIcon :name="soon.icon" :size="20" /></span>
|
|
209
|
+
<span class="prj_gd_block_head">
|
|
210
|
+
<span class="prj_gd_block_title">{{ soon.label[lang] }}</span>
|
|
211
|
+
<RmBadge variant="grey">{{ tr("Bientôt", "Coming soon") }}</RmBadge>
|
|
212
|
+
</span>
|
|
213
|
+
<span class="prj_gd_block_desc">{{ soon.description[lang] }}</span>
|
|
214
|
+
</div>
|
|
215
|
+
</article>
|
|
176
216
|
</div>
|
|
177
217
|
</section>
|
|
178
218
|
|
|
@@ -232,7 +272,10 @@
|
|
|
232
272
|
|
|
233
273
|
<details v-for="type in phaseTypes" :key="type" class="prj_gd_review" open>
|
|
234
274
|
<summary class="prj_gd_review_head">
|
|
235
|
-
<span class="prj_gd_review_title">
|
|
275
|
+
<span class="prj_gd_review_title">
|
|
276
|
+
<RmFlag :code="guidedFamilyCountry(type)" :height="12" class="prj_gd_review_flag" />
|
|
277
|
+
{{ familyLabel(type) }}
|
|
278
|
+
</span>
|
|
236
279
|
<span class="prj_gd_review_count">
|
|
237
280
|
<span v-if="familyState(type).loading" class="prj_gd_spin" role="status" :aria-label="tr('Recherche en cours', 'Searching')" />
|
|
238
281
|
<template v-else>{{ keptCount(type) }} / {{ familyCount(type) }}</template>
|
|
@@ -378,6 +421,9 @@ import { rmPanelRegister } from "@tekkare/romulus/utils/panels";
|
|
|
378
421
|
import { PROJECT_GUIDED_BLOCKS } from "#oip-projects";
|
|
379
422
|
import {
|
|
380
423
|
GUIDED_BLOCKS,
|
|
424
|
+
GUIDED_COUNTRIES,
|
|
425
|
+
guidedFamilyCountry,
|
|
426
|
+
type GuidedCountry,
|
|
381
427
|
GUIDED_GROUPED_TYPES,
|
|
382
428
|
collectGuided,
|
|
383
429
|
guidedFamilyLabel,
|
|
@@ -413,9 +459,19 @@ const KIND_META: Record<GuidedMatchKind, { label: { fr: string; en: string }; he
|
|
|
413
459
|
deduced: { label: { fr: "Déduction", en: "Deduced" }, help: { fr: "par une marque ou un essai retenu", en: "through a kept brand or trial" }, variant: "info" },
|
|
414
460
|
};
|
|
415
461
|
|
|
462
|
+
/** Les blocs que l'app propose (`PROJECT_GUIDED_BLOCKS`), dans l'ordre du layer. */
|
|
416
463
|
/** Les blocs que l'app propose (`PROJECT_GUIDED_BLOCKS`), dans l'ordre du layer. */
|
|
417
464
|
const blocks = computed<GuidedBlock[]>(() => GUIDED_BLOCKS.filter((block) => (PROJECT_GUIDED_BLOCKS ?? []).includes(block.key)));
|
|
418
465
|
|
|
466
|
+
/** Les pays choisis a l'etape des sujets ; vide : tous. */
|
|
467
|
+
const countries = ref<GuidedCountry[]>([]);
|
|
468
|
+
function toggleCountry(code: GuidedCountry) {
|
|
469
|
+
countries.value = countries.value.includes(code) ? countries.value.filter((entry) => entry !== code) : [...countries.value, code];
|
|
470
|
+
}
|
|
471
|
+
const inCountries = (type: string) => !countries.value.length || countries.value.includes(guidedFamilyCountry(type));
|
|
472
|
+
/** Plusieurs pays en jeu : le libelle d'une famille d'un autre pays que la France le dit. */
|
|
473
|
+
const manyCountries = computed(() => countries.value.length !== 1);
|
|
474
|
+
|
|
419
475
|
const step = ref<Step>("subjects");
|
|
420
476
|
const stepIndex = computed(() => STEPS.findIndex((entry) => entry.key === step.value));
|
|
421
477
|
|
|
@@ -513,11 +569,17 @@ let searchedKey = "";
|
|
|
513
569
|
|
|
514
570
|
const familyState = (type: string): GuidedFamilyState => states.value[type] ?? { loading: true, failed: false, rows: [] };
|
|
515
571
|
const familyCount = (type: string) => familyState(type).rows.length;
|
|
516
|
-
const familyLabel = (type: string) =>
|
|
572
|
+
const familyLabel = (type: string) => {
|
|
573
|
+
const label = guidedFamilyLabel(type, lang.value);
|
|
574
|
+
const code = guidedFamilyCountry(type);
|
|
575
|
+
if (!manyCountries.value || code === "fr") return label;
|
|
576
|
+
const name = GUIDED_COUNTRIES.find((entry) => entry.code === code)?.label[lang.value];
|
|
577
|
+
return name && !label.includes(name) ? `${label} (${name})` : label;
|
|
578
|
+
};
|
|
517
579
|
|
|
518
580
|
const blockOf = (key: GuidedBlockKey) => blocks.value.find((block) => block.key === key)!;
|
|
519
|
-
const blockCount = (key: GuidedBlockKey) => blockOf(key).types.reduce((sum, type) => sum + familyCount(type), 0);
|
|
520
|
-
const blockLoading = (key: GuidedBlockKey) => blockOf(key).types.some((type) => familyState(type).loading);
|
|
581
|
+
const blockCount = (key: GuidedBlockKey) => blockOf(key).types.filter(inCountries).reduce((sum, type) => sum + familyCount(type), 0);
|
|
582
|
+
const blockLoading = (key: GuidedBlockKey) => blockOf(key).types.filter(inCountries).some((type) => familyState(type).loading);
|
|
521
583
|
/** Un bloc se coche de lui-meme quand il a des fiches, tant qu'on n'a rien choisi. */
|
|
522
584
|
const blockOn = (key: GuidedBlockKey) => blockChoice[key] ?? blockCount(key) > 0;
|
|
523
585
|
const toggleBlock = (key: GuidedBlockKey) => {
|
|
@@ -526,12 +588,12 @@ const toggleBlock = (key: GuidedBlockKey) => {
|
|
|
526
588
|
|
|
527
589
|
/** Les familles du bloc, celles qui ont le plus de fiches en tete. */
|
|
528
590
|
const sortedTypes = (block: GuidedBlock) =>
|
|
529
|
-
|
|
591
|
+
block.types.filter(inCountries).sort((a, b) => familyCount(b) - familyCount(a) || block.types.indexOf(a) - block.types.indexOf(b));
|
|
530
592
|
|
|
531
593
|
const countLabel = (count: number) => (count ? tr(`${count} fiches`, `${count} records`) : tr("rien trouvé", "nothing found"));
|
|
532
594
|
|
|
533
595
|
function startSearch() {
|
|
534
|
-
const key = subjects.value.map((subject) => subject.key).sort().join("|");
|
|
596
|
+
const key = [...subjects.value.map((subject) => subject.key).sort(), ...[...countries.value].sort()].join("|");
|
|
535
597
|
if (key === searchedKey) return;
|
|
536
598
|
searchedKey = key;
|
|
537
599
|
states.value = {};
|
|
@@ -543,7 +605,7 @@ function startSearch() {
|
|
|
543
605
|
states.value = { ...states.value, [type]: state };
|
|
544
606
|
// Une famille qui repond se coche si elle a des fiches, sauf choix deja fait.
|
|
545
607
|
if (!state.loading && families[type] === undefined) families[type] = state.rows.length > 0;
|
|
546
|
-
}).finally(() => {
|
|
608
|
+
}, [...countries.value]).finally(() => {
|
|
547
609
|
if (searchedKey === mine) searching.value = false;
|
|
548
610
|
});
|
|
549
611
|
}
|
|
@@ -611,7 +673,11 @@ function propose() {
|
|
|
611
673
|
drugs.length
|
|
612
674
|
? `${tr("Médicaments", "Drugs")}${sep}${drugs.map((subject) => withHint(subject.label, subject.focus === "brand" ? subject.hint.toLowerCase() : subject.hint, subject.focus === "molecule")).join(", ")}.`
|
|
613
675
|
: "",
|
|
614
|
-
tr("Périmètre
|
|
676
|
+
`${tr("Périmètre", "Scope")}${sep}${
|
|
677
|
+
countries.value.length
|
|
678
|
+
? countries.value.map((code) => GUIDED_COUNTRIES.find((entry) => entry.code === code)?.label[lang.value]).join(", ")
|
|
679
|
+
: tr("tous les pays", "all countries")
|
|
680
|
+
}.`,
|
|
615
681
|
followed.length ? `${tr("Sources suivies", "Followed sources")}${sep}${followed.join(", ")}.` : "",
|
|
616
682
|
found.length ? `${tr("À la création", "At creation")}${sep}${found.map(familyCountLabel).join(", ")}.` : "",
|
|
617
683
|
].filter(Boolean);
|
|
@@ -632,6 +698,22 @@ const reviewTypes = computed(() => [...chosenTypes.value].sort((a, b) => Number(
|
|
|
632
698
|
* le reglementaire (les avis HAS donnent les marques), puis les ventes et
|
|
633
699
|
* les prix, puis la science. Un bloc non choisi ne s'affiche pas.
|
|
634
700
|
*/
|
|
701
|
+
/** Les blocs annonces, pas encore branches. */
|
|
702
|
+
const SOON_BLOCKS = [
|
|
703
|
+
{
|
|
704
|
+
key: "epidemiology",
|
|
705
|
+
icon: "ChartLineUp",
|
|
706
|
+
label: { fr: "Épidémiologie", en: "Epidemiology" },
|
|
707
|
+
description: { fr: "Incidence, prévalence, hospitalisations par pays.", en: "Incidence, prevalence, hospitalisations per country." },
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
key: "oncology",
|
|
711
|
+
icon: "Dna",
|
|
712
|
+
label: { fr: "Oncologie", en: "Oncology" },
|
|
713
|
+
description: { fr: "Approbations internationales et données des cancers.", en: "International approvals and cancer data." },
|
|
714
|
+
},
|
|
715
|
+
] as const;
|
|
716
|
+
|
|
635
717
|
const REVIEW_ORDER: GuidedBlockKey[] = ["regulatory", "drugs", "science"];
|
|
636
718
|
const reviewBlocks = computed(() =>
|
|
637
719
|
REVIEW_ORDER.map((key) => blocks.value.find((block) => block.key === key))
|
|
@@ -889,6 +971,7 @@ function requestClose(value: boolean) {
|
|
|
889
971
|
|
|
890
972
|
function reset() {
|
|
891
973
|
step.value = "subjects";
|
|
974
|
+
countries.value = [];
|
|
892
975
|
reached.value = 0;
|
|
893
976
|
reviewPhase.value = 0;
|
|
894
977
|
query.value = "";
|
|
@@ -1158,6 +1241,47 @@ watch(
|
|
|
1158
1241
|
}
|
|
1159
1242
|
|
|
1160
1243
|
/* Blocs de sources : un carre par bloc, ses sources se deplient dessous. */
|
|
1244
|
+
.prj_gd_country_pick {
|
|
1245
|
+
display: flex;
|
|
1246
|
+
flex-direction: column;
|
|
1247
|
+
gap: 8px;
|
|
1248
|
+
margin-top: 8px;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
.prj_gd_countries {
|
|
1252
|
+
display: flex;
|
|
1253
|
+
flex-wrap: wrap;
|
|
1254
|
+
gap: 8px;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
.prj_gd_country {
|
|
1258
|
+
display: inline-flex;
|
|
1259
|
+
align-items: center;
|
|
1260
|
+
gap: 8px;
|
|
1261
|
+
padding: 6px 12px;
|
|
1262
|
+
border: 1px solid var(--border-default);
|
|
1263
|
+
border-radius: 999px;
|
|
1264
|
+
background: var(--bg-surface);
|
|
1265
|
+
color: var(--text-secondary);
|
|
1266
|
+
font: inherit;
|
|
1267
|
+
font-size: var(--font-12, 12px);
|
|
1268
|
+
font-weight: var(--weight-medium, 500);
|
|
1269
|
+
cursor: pointer;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
.prj_gd_country.is-on {
|
|
1273
|
+
border-color: var(--color-primary);
|
|
1274
|
+
background: var(--color-primary);
|
|
1275
|
+
color: var(--text-on-primary, #fff);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
.prj_gd_country_count {
|
|
1279
|
+
display: inline-flex;
|
|
1280
|
+
align-items: center;
|
|
1281
|
+
font-variant-numeric: tabular-nums;
|
|
1282
|
+
opacity: 0.85;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1161
1285
|
.prj_gd_blocks {
|
|
1162
1286
|
display: grid;
|
|
1163
1287
|
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
|
@@ -1173,6 +1297,17 @@ watch(
|
|
|
1173
1297
|
background: var(--bg-surface);
|
|
1174
1298
|
}
|
|
1175
1299
|
|
|
1300
|
+
.prj_gd_block.is-soon {
|
|
1301
|
+
border-style: dashed;
|
|
1302
|
+
background: var(--bg-surface-2);
|
|
1303
|
+
opacity: 0.6;
|
|
1304
|
+
cursor: default;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
.prj_gd_block.is-soon .prj_gd_block_main {
|
|
1308
|
+
cursor: default;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1176
1311
|
.prj_gd_block.is-on {
|
|
1177
1312
|
border-color: var(--color-primary);
|
|
1178
1313
|
box-shadow: 0 0 0 1px var(--color-primary);
|
|
@@ -1339,6 +1474,9 @@ watch(
|
|
|
1339
1474
|
}
|
|
1340
1475
|
|
|
1341
1476
|
.prj_gd_review_title {
|
|
1477
|
+
display: inline-flex;
|
|
1478
|
+
align-items: center;
|
|
1479
|
+
gap: 8px;
|
|
1342
1480
|
flex: 1;
|
|
1343
1481
|
font-size: var(--font-14, 14px);
|
|
1344
1482
|
font-weight: var(--weight-semibold, 600);
|
|
@@ -62,11 +62,11 @@ export const PROJECTS_UPSELL: Component | null = null;
|
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* La creation guidee du layer (components/project/Guided.vue), proposee a
|
|
65
|
-
* cote de la creation libre
|
|
66
|
-
*
|
|
67
|
-
* creation
|
|
65
|
+
* cote de la creation libre par « Nouveau projet », dans toutes les apps :
|
|
66
|
+
* les blocs de sources qu'elle offre. Les pays se choisissent dans la
|
|
67
|
+
* creation elle-meme. `null` : creation libre seulement.
|
|
68
68
|
*/
|
|
69
|
-
export const PROJECT_GUIDED_BLOCKS: GuidedBlockKey[] | null =
|
|
69
|
+
export const PROJECT_GUIDED_BLOCKS: GuidedBlockKey[] | null = ["regulatory", "drugs", "science"];
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Une creation guidee propre a l'app (v-model d'ouverture), pour les apps
|
|
@@ -50,6 +50,23 @@ type Text = { fr: string; en: string };
|
|
|
50
50
|
|
|
51
51
|
export type GuidedBlockKey = "drugs" | "regulatory" | "science";
|
|
52
52
|
|
|
53
|
+
/** Les pays que la creation guidee sait chercher (code ISO alpha-2, minuscules). */
|
|
54
|
+
export type GuidedCountry = "fr" | "it" | "de" | "es" | "au" | "nz";
|
|
55
|
+
|
|
56
|
+
export const GUIDED_COUNTRIES: Array<{ code: GuidedCountry; label: Text }> = [
|
|
57
|
+
{ code: "fr", label: { fr: "France", en: "France" } },
|
|
58
|
+
{ code: "it", label: { fr: "Italie", en: "Italy" } },
|
|
59
|
+
{ code: "de", label: { fr: "Allemagne", en: "Germany" } },
|
|
60
|
+
{ code: "es", label: { fr: "Espagne", en: "Spain" } },
|
|
61
|
+
{ code: "au", label: { fr: "Australie", en: "Australia" } },
|
|
62
|
+
{ code: "nz", label: { fr: "Nouvelle-Zélande", en: "New Zealand" } },
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Un bloc de sources, le meme quel que soit le pays : ses familles sont
|
|
67
|
+
* celles de tous les pays (les actes AIFA sont du reglementaire, les prix
|
|
68
|
+
* italiens du Drugs), et les pays choisis a l'etape des sujets les filtrent.
|
|
69
|
+
*/
|
|
53
70
|
export interface GuidedBlock {
|
|
54
71
|
key: GuidedBlockKey;
|
|
55
72
|
label: Text;
|
|
@@ -78,6 +95,11 @@ export const GUIDED_BLOCKS: GuidedBlock[] = [
|
|
|
78
95
|
"FrPatientContribution",
|
|
79
96
|
"FrPatientAssociation",
|
|
80
97
|
"FrNationalAssemblySession",
|
|
98
|
+
"ItApproval",
|
|
99
|
+
"DeGbaAssessment", "DeBfarmApproval",
|
|
100
|
+
"EsApproval",
|
|
101
|
+
"AuPbacOpinion",
|
|
102
|
+
"NzMedsafeProduct",
|
|
81
103
|
],
|
|
82
104
|
},
|
|
83
105
|
{
|
|
@@ -88,7 +110,14 @@ export const GUIDED_BLOCKS: GuidedBlock[] = [
|
|
|
88
110
|
en: "Retail and hospital sales, brand prices.",
|
|
89
111
|
},
|
|
90
112
|
icon: "Pill",
|
|
91
|
-
types: [
|
|
113
|
+
types: [
|
|
114
|
+
"FrMedicamBrand", "FrOutpatientBrand", "FrSusBrand", "FrRetrocessionBrand", "FrDrugPrice", "FrDrugPriceJo",
|
|
115
|
+
"ItDrugPrice", "ItDrugReimbursement",
|
|
116
|
+
"DeGkvMolecule",
|
|
117
|
+
"EsDrugPrice", "EsDrugReimbursement",
|
|
118
|
+
"AuPbsPrice", "AuPbsItem", "AuDrugReimbursement",
|
|
119
|
+
"NzDrugPrice", "NzRetailMolecule",
|
|
120
|
+
],
|
|
92
121
|
},
|
|
93
122
|
{
|
|
94
123
|
key: "science",
|
|
@@ -104,6 +133,11 @@ export const GUIDED_BLOCKS: GuidedBlock[] = [
|
|
|
104
133
|
},
|
|
105
134
|
];
|
|
106
135
|
|
|
136
|
+
/** Le pays des donnees d'une famille (celui de sa spec), la France par defaut. */
|
|
137
|
+
export function guidedFamilyCountry(type: string): GuidedCountry {
|
|
138
|
+
return (oipResourceSpec(type)?.kind.country as GuidedCountry | undefined) ?? "fr";
|
|
139
|
+
}
|
|
140
|
+
|
|
107
141
|
/** Le libelle d'une famille, tel que les projets l'affichent. */
|
|
108
142
|
export function guidedFamilyLabel(type: string, lang: GuidedLang) {
|
|
109
143
|
return oipResourceSpec(type)?.kind.label[lang] ?? type;
|
|
@@ -135,6 +169,14 @@ export const GUIDED_GROUPED_TYPES: Record<string, { fr: [string, string]; en: [s
|
|
|
135
169
|
FrMitm: { fr: ["spécialité", "spécialités"], en: ["product", "products"] },
|
|
136
170
|
FrHasPut: { fr: ["autorisation", "autorisations"], en: ["authorisation", "authorisations"] },
|
|
137
171
|
FrHasIndication: { fr: ["indication", "indications"], en: ["indication", "indications"] },
|
|
172
|
+
ItDrugPrice: { fr: ["présentation", "présentations"], en: ["presentation", "presentations"] },
|
|
173
|
+
EsDrugPrice: { fr: ["présentation", "présentations"], en: ["presentation", "presentations"] },
|
|
174
|
+
AuPbsPrice: { fr: ["présentation", "présentations"], en: ["presentation", "presentations"] },
|
|
175
|
+
NzDrugPrice: { fr: ["présentation", "présentations"], en: ["presentation", "presentations"] },
|
|
176
|
+
ItDrugReimbursement: { fr: ["présentation", "présentations"], en: ["presentation", "presentations"] },
|
|
177
|
+
ItApproval: { fr: ["acte", "actes"], en: ["act", "acts"] },
|
|
178
|
+
EsApproval: { fr: ["rapport", "rapports"], en: ["report", "reports"] },
|
|
179
|
+
AuPbacOpinion: { fr: ["avis", "avis"], en: ["opinion", "opinions"] },
|
|
138
180
|
};
|
|
139
181
|
const GROUPED_LIMIT = 500;
|
|
140
182
|
|
|
@@ -154,7 +196,10 @@ export async function collectGuided(
|
|
|
154
196
|
subjects: GuidedSubject[],
|
|
155
197
|
lang: GuidedLang,
|
|
156
198
|
onFamily: (type: string, state: GuidedFamilyState) => void,
|
|
199
|
+
/** Les pays choisis ; vide : tous. Une famille d'un autre pays n'est pas cherchee. */
|
|
200
|
+
countries: GuidedCountry[] = [],
|
|
157
201
|
) {
|
|
202
|
+
const wanted = (type: string) => !countries.length || countries.includes(guidedFamilyCountry(type));
|
|
158
203
|
const t = (fr: string, en: string) => (lang === "en" ? en : fr);
|
|
159
204
|
const diseases = subjects.filter((subject) => subject.focus === "disease");
|
|
160
205
|
const molecules = subjects.filter((subject) => subject.focus === "molecule");
|
|
@@ -162,6 +207,12 @@ export async function collectGuided(
|
|
|
162
207
|
|
|
163
208
|
/** Pose une famille en chargement, puis sa reponse (ou son echec, sans rien casser). */
|
|
164
209
|
const run = async (type: string, task: () => Promise<GuidedRow[]>) => {
|
|
210
|
+
if (!wanted(type)) {
|
|
211
|
+
// Les avis HAS restent cherches hors de la France : leurs marques sont
|
|
212
|
+
// la cle des familles des autres pays. Ils ne sont pas proposes.
|
|
213
|
+
if (type === "FrHasBrand") await task().catch(() => []);
|
|
214
|
+
return [];
|
|
215
|
+
}
|
|
165
216
|
onFamily(type, { loading: true, failed: false, rows: [] });
|
|
166
217
|
try {
|
|
167
218
|
const rows = merge((await task()).filter((row) => row.id && row.title), type in GUIDED_GROUPED_TYPES ? GROUPED_LIMIT : LIMIT);
|
|
@@ -611,7 +662,8 @@ export async function collectGuided(
|
|
|
611
662
|
return hits.map((hit): GuidedRow => ({
|
|
612
663
|
id: hit._id,
|
|
613
664
|
title: clean(hit._source?.agenda),
|
|
614
|
-
|
|
665
|
+
// La date de seance arrive parfois en millisecondes depuis 1970.
|
|
666
|
+
subtitle: /^\d{12,}$/.test(clean(hit._source?.session_date)) ? dayLabel(new Date(Number(hit._source.session_date)).toISOString()) : dayLabel(hit._source?.session_date),
|
|
615
667
|
kind: "direct",
|
|
616
668
|
evidence: [{ label: t("Compte rendu", "Transcript"), values: highlightsOf(hit) }],
|
|
617
669
|
source: hit._source ?? {},
|
|
@@ -971,7 +1023,122 @@ export async function collectGuided(
|
|
|
971
1023
|
});
|
|
972
1024
|
});
|
|
973
1025
|
|
|
1026
|
+
// --- Autres pays --------------------------------------------------------
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Comment chercher une famille d'un autre pays : le champ de la marque
|
|
1030
|
+
* (`keyword` exact, ou texte pour un nom de produit qui porte le dosage),
|
|
1031
|
+
* les champs ou se lit une molecule, ceux ou se lit une maladie, et un
|
|
1032
|
+
* filtre propre a l'index (le Price Tracker range tous les pays).
|
|
1033
|
+
*/
|
|
1034
|
+
interface ForeignSearch {
|
|
1035
|
+
brand?: { field: string; text?: boolean };
|
|
1036
|
+
molecule?: string[];
|
|
1037
|
+
disease?: string[];
|
|
1038
|
+
/** Le code CIM-10 d'une maladie, en prefixe (G-BA). */
|
|
1039
|
+
icd?: string;
|
|
1040
|
+
filter?: Record<string, unknown>[];
|
|
1041
|
+
}
|
|
1042
|
+
const priceTracker = (country: string): ForeignSearch => ({
|
|
1043
|
+
brand: { field: "brand" },
|
|
1044
|
+
molecule: ["molecule_en", "molecule_local"],
|
|
1045
|
+
filter: [{ term: { "country_code.keyword": country } }],
|
|
1046
|
+
});
|
|
1047
|
+
const FOREIGN: Record<string, ForeignSearch> = {
|
|
1048
|
+
ItApproval: { brand: { field: "brand" }, molecule: ["molecule", "atc5_code_label"], disease: ["indication", "indication_en"] },
|
|
1049
|
+
ItDrugPrice: priceTracker("it"),
|
|
1050
|
+
ItDrugReimbursement: { brand: { field: "brand" }, molecule: ["active_ingredient", "atc5_english_label", "atc5_italian_label", "atc5_french_label"] },
|
|
1051
|
+
DeGbaAssessment: { brand: { field: "brand_name" }, molecule: ["active_substance"], disease: ["indication_en", "indication_de", "patient_group_en"], icd: "icd10_gm" },
|
|
1052
|
+
DeBfarmApproval: { brand: { field: "product_name", text: true }, molecule: ["active_substance_names", "active_substance_en"], disease: ["indication_en", "indication_de"] },
|
|
1053
|
+
DeGkvMolecule: { molecule: ["atc5_label"] },
|
|
1054
|
+
EsApproval: { brand: { field: "brand" }, molecule: ["molecule"], disease: ["report_english_title", "report_spanish_title"] },
|
|
1055
|
+
EsDrugPrice: priceTracker("es"),
|
|
1056
|
+
EsDrugReimbursement: { molecule: ["local_name"] },
|
|
1057
|
+
AuPbacOpinion: { brand: { field: "brand" }, molecule: ["drug_label"], disease: ["indication"] },
|
|
1058
|
+
AuPbsPrice: priceTracker("au"),
|
|
1059
|
+
AuPbsItem: { brand: { field: "brands" }, molecule: ["generic_name"], disease: ["indications"] },
|
|
1060
|
+
AuDrugReimbursement: { brand: { field: "brands" }, molecule: ["molecule_local"] },
|
|
1061
|
+
NzMedsafeProduct: { brand: { field: "trade_name", text: true }, molecule: ["active_ingredients"], disease: ["indications"] },
|
|
1062
|
+
NzDrugPrice: priceTracker("nz"),
|
|
1063
|
+
NzRetailMolecule: { molecule: ["molecule_label", "label"] },
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* Les fiches d'une famille d'un autre pays : par les marques du projet
|
|
1068
|
+
* (choisies, ou deduites des avis HAS et des molecules), par les molecules
|
|
1069
|
+
* et par les maladies choisies. Clauses nommees : `brand` (directe si la
|
|
1070
|
+
* marque est un sujet, deduite sinon), `molecule` et `disease` (directes).
|
|
1071
|
+
*/
|
|
1072
|
+
async function foreignRows(type: string): Promise<GuidedRow[]> {
|
|
1073
|
+
const spec = oipResourceSpec(type);
|
|
1074
|
+
const how = FOREIGN[type];
|
|
1075
|
+
if (!spec || !how) return [];
|
|
1076
|
+
const brands = how.brand ? await brandsTask : [];
|
|
1077
|
+
const should: Record<string, unknown>[] = [];
|
|
1078
|
+
if (how.brand && brands.length) {
|
|
1079
|
+
const clauses = brands.map((brand) =>
|
|
1080
|
+
how.brand!.text
|
|
1081
|
+
? { match_phrase_prefix: { [how.brand!.field]: brand } }
|
|
1082
|
+
: { term: { [`${how.brand!.field}.keyword`]: { value: brand, case_insensitive: true } } },
|
|
1083
|
+
);
|
|
1084
|
+
should.push({ bool: { should: clauses, minimum_should_match: 1, _name: "brand" } });
|
|
1085
|
+
}
|
|
1086
|
+
if (how.molecule && molecules.length) {
|
|
1087
|
+
should.push({ bool: { should: molecules.map((molecule) => textMatch(molecule.label, how.molecule!)), minimum_should_match: 1, _name: "molecule" } });
|
|
1088
|
+
}
|
|
1089
|
+
if (how.disease && diseases.length) {
|
|
1090
|
+
should.push({
|
|
1091
|
+
bool: {
|
|
1092
|
+
should: diseases.flatMap((disease) => [
|
|
1093
|
+
textMatch(disease.label, how.disease!),
|
|
1094
|
+
...(how.icd && disease.code && disease.system === "icd10" ? [icdPrefix(`${how.icd}.keyword`, disease.code)] : []),
|
|
1095
|
+
]),
|
|
1096
|
+
minimum_should_match: 1,
|
|
1097
|
+
_name: "disease",
|
|
1098
|
+
},
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
if (!should.length) return [];
|
|
1102
|
+
const grouped = type in GUIDED_GROUPED_TYPES;
|
|
1103
|
+
const fields = [...new Set([...(spec.kind.source ?? []), ...(how.brand ? [how.brand.field] : []), ...(how.molecule ?? []), ...(how.disease ?? [])])];
|
|
1104
|
+
const hits = await search(type, {
|
|
1105
|
+
size: grouped ? GROUPED_LIMIT : LIMIT,
|
|
1106
|
+
_source: fields,
|
|
1107
|
+
query: { bool: { ...(how.filter ? { filter: how.filter } : {}), should, minimum_should_match: 1 } },
|
|
1108
|
+
highlight: highlightOf([...(how.molecule ?? []), ...(how.disease ?? [])]),
|
|
1109
|
+
});
|
|
1110
|
+
return hits.map((hit): GuidedRow => {
|
|
1111
|
+
const s = hit._source ?? {};
|
|
1112
|
+
const named: string[] = hit.matched_queries ?? [];
|
|
1113
|
+
// Un nom de produit (« Keytruda 25 mg/ml ») porte la marque sans lui etre egal.
|
|
1114
|
+
const names = list(s[how.brand?.field ?? ""]).map((value) => String(value).toUpperCase());
|
|
1115
|
+
const rowBrands = !how.brand
|
|
1116
|
+
? []
|
|
1117
|
+
: how.brand.text
|
|
1118
|
+
? brands.filter((brand) => names.some((name) => name.startsWith(brand)))
|
|
1119
|
+
: shared(names, brands);
|
|
1120
|
+
const direct = named.includes("molecule") || named.includes("disease") || rowBrands.some((brand) => brandSubjects.includes(brand));
|
|
1121
|
+
const brand = how.brand ? clean(list(s[how.brand.field])[0]).toUpperCase() : "";
|
|
1122
|
+
return {
|
|
1123
|
+
id: hit._id,
|
|
1124
|
+
title: spec.kind.title(s, lang) || hit._id,
|
|
1125
|
+
subtitle: spec.kind.subtitle?.(s, lang) ?? "",
|
|
1126
|
+
kind: direct ? "direct" : "deduced",
|
|
1127
|
+
evidence: [
|
|
1128
|
+
...(named.includes("brand") ? brandEvidence(rowBrands) : []),
|
|
1129
|
+
...(named.includes("molecule") || named.includes("disease")
|
|
1130
|
+
? [{ label: t("Le sujet dans la fiche", "The subject in the record"), values: highlightsOf(hit) }]
|
|
1131
|
+
: []),
|
|
1132
|
+
].filter((group) => group.values.length),
|
|
1133
|
+
source: s,
|
|
1134
|
+
...(grouped && brand ? { group: brand } : {}),
|
|
1135
|
+
...(named.includes("brand") && !direct ? viaOf(rowBrands) : {}),
|
|
1136
|
+
};
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
|
|
974
1140
|
await Promise.all([
|
|
1141
|
+
...Object.keys(FOREIGN).map((type) => run(type, () => foreignRows(type))),
|
|
975
1142
|
hasRows,
|
|
976
1143
|
...Object.entries(brandTasks).map(([type, task]) => run(type, task)),
|
|
977
1144
|
nctRows,
|