@tekkare/romulus 0.1.296 → 0.1.298
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/dist/runtime/components/FilterBar.vue +1 -1
- package/layer/app/components/oip-new-zealand/MedsafeProduct.vue +209 -0
- package/layer/app/components/oip-new-zealand/NewZealandPrice.vue +288 -0
- package/layer/app/components/oip-new-zealand/RetailMolecule.vue +213 -0
- package/layer/app/composables/useOipResourceViews.ts +3 -0
- package/layer/app/oip-new-zealand/kinds.ts +5 -5
- package/layer/app/utils/oipResources.ts +13 -4
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -340,5 +340,5 @@ onBeforeUnmount(() => {
|
|
|
340
340
|
</template>
|
|
341
341
|
|
|
342
342
|
<style scoped>
|
|
343
|
-
.rm-fbar{margin-inline:calc((min(var(--oip-content-max, 100%), 100%) - var(--oip-main-w, 100%))/2);position:sticky;width:var(--oip-main-w,100%);z-index:91;--rm-fbar-field-h:32px;backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);display:flex;flex-direction:column;font-family:var(--font-sans)}.rm-fbar__views{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__views:empty{display:none}.rm-fbar__band{display:flex;justify-content:center;padding-inline:32px}.rm-fbar__rail-row,.rm-fbar__row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__row{align-items:flex-start;display:flex;gap:var(--space-12);padding-block:8px}.rm-fbar--open .rm-fbar__band:not(:has(~.rm-fbar__band--rail)){border-bottom:1px solid var(--border-default)}.rm-fbar__toggle :deep(p),.rm-fbar__toggle :deep(span){font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-fbar__toggle{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);color:var(--text-primary);cursor:pointer;display:flex;flex:0 0 auto;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);gap:var(--space-6);height:var(--rm-fbar-field-h);justify-content:center;padding:0 14px}.rm-fbar__toggle:hover{background:var(--bg-surface-3)}.rm-fbar__toggle.is-active,.rm-fbar__toggle.is-active:hover{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.rm-fbar__toggle.is-active .rm-fbar__badge{background:var(--color-text-inverse);color:var(--color-primary)}.rm-fbar__badge{align-items:center;background:var(--color-primary);border-radius:16px;color:var(--color-text-inverse);display:inline-flex;font-size:var(--font-11);font-weight:var(--weight-bold);justify-content:center;min-width:18px;padding:0 5px}.rm-fbar__view{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__advanced{align-items:center;background:none;border:none;border-left:1px solid var(--border-default);color:var(--color-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);font-weight:var(--weight-medium);height:var(--rm-fbar-field-h);padding:0 0 0 var(--space-12);position:absolute;right:14px;text-decoration-line:underline;top:0;white-space:nowrap;z-index:2}.rm-fbar__advanced.is-active,.rm-fbar__advanced:hover{color:var(--color-primary-hover,var(--color-primary));text-decoration-thickness:2px}.rm-fbar__rail-row{display:flex;padding-bottom:var(--space-8)}.rm-fbar--open .rm-fbar__band--rail{border-bottom:1px solid var(--border-default)}.rm-fbar__rail{align-items:center;display:flex;flex:0 1 auto;min-width:0;overflow-x:auto;scrollbar-width:thin}.rm-fbar__rail:empty{display:none}.rm-fbar__search{align-items:center;display:flex;flex:1 1 auto;gap:var(--space-8);min-width:0;position:relative}.rm-fbar__search:empty{display:none}.rm-fbar__search :deep(.rm-search-tags__field){border-radius:var(--radius-pill);box-sizing:border-box;height:var(--rm-fbar-field-h);padding-block:0;padding-right:calc(var(--rm-fbar-advanced-w, 0px) + 14px + var(--space-12))}.rm-fbar__search :deep(.rm-search-tags__field.is-open),.rm-fbar__search :deep(.rm-search-tags__field.is-panel){border-radius:var(--radius-pill)}.rm-fbar__search :deep(.rm-search-tags__list),.rm-fbar__search :deep(.rm-search-tags__panel){border-radius:var(--radius-2xl);border-top:1px solid var(--border-default);box-shadow:var(--shadow-lg);margin-top:var(--space-6);padding:var(--space-6)}.rm-fbar__search :deep(.rm-search-tags__option){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.search-bar-wrapper){flex:1 1 auto;min-width:0}.rm-fbar__search :deep(.search-bar){background:var(--bg-surface);box-sizing:border-box;display:flex;height:var(--rm-fbar-field-h);width:100%}.rm-fbar__search :deep(.filters_input_search){border-radius:var(--radius-pill);box-sizing:border-box;height:auto;min-height:var(--rm-fbar-field-h);padding-right:calc(var(--rm-fbar-advanced-w, 0px) + var(--space-12));width:100%}.rm-fbar__search :deep(.research_tags:not(:has(*))){display:none}.rm-fbar__search :deep(.select_shortcut){box-sizing:border-box;font-size:var(--font-11);height:24px;padding-block:0}.rm-fbar__search :deep(.select_shortcut:hover){background:var(--bg-surface-3)!important;border-color:var(--border-default)!important;color:inherit!important}.rm-fbar__search :deep(.select_shortcut:hover svg){color:inherit!important}.rm-fbar__search :deep(.remove_search_section){border-left:none;border-radius:0 var(--radius-pill) var(--radius-pill) 0}.rm-fbar__search :deep(.remove_search_section:hover){background:transparent!important}.rm-fbar__search :deep(.remove_search_section:hover svg){color:var(--text-primary)!important}.rm-fbar__search :deep(.filters_input_search.no_bottom){border-bottom:1.5px solid var(--color-primary)!important;border-radius:var(--radius-pill)}.rm-fbar__search :deep(.search_suggestions){border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);left:0;padding:var(--space-6);right:0;top:calc(100% + 6px);width:auto}.rm-fbar__search :deep(.sugg_container>*){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.sugg_container>.selected){background:color-mix(in srgb,var(--color-primary) 6%,transparent)!important}.rm-fbar__panel{--rm-filter-col:224px;--rm-fbar-panel-field-h:40px;align-items:end;
|
|
343
|
+
.rm-fbar{margin-inline:calc((min(var(--oip-content-max, 100%), 100%) - var(--oip-main-w, 100%))/2);position:sticky;width:var(--oip-main-w,100%);z-index:91;--rm-fbar-field-h:32px;backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);display:flex;flex-direction:column;font-family:var(--font-sans)}.rm-fbar__views{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__views:empty{display:none}.rm-fbar__band{display:flex;justify-content:center;padding-inline:32px}.rm-fbar__rail-row,.rm-fbar__row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__row{align-items:flex-start;display:flex;gap:var(--space-12);padding-block:8px}.rm-fbar--open .rm-fbar__band:not(:has(~.rm-fbar__band--rail)){border-bottom:1px solid var(--border-default)}.rm-fbar__toggle :deep(p),.rm-fbar__toggle :deep(span){font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-fbar__toggle{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);color:var(--text-primary);cursor:pointer;display:flex;flex:0 0 auto;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);gap:var(--space-6);height:var(--rm-fbar-field-h);justify-content:center;padding:0 14px}.rm-fbar__toggle:hover{background:var(--bg-surface-3)}.rm-fbar__toggle.is-active,.rm-fbar__toggle.is-active:hover{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.rm-fbar__toggle.is-active .rm-fbar__badge{background:var(--color-text-inverse);color:var(--color-primary)}.rm-fbar__badge{align-items:center;background:var(--color-primary);border-radius:16px;color:var(--color-text-inverse);display:inline-flex;font-size:var(--font-11);font-weight:var(--weight-bold);justify-content:center;min-width:18px;padding:0 5px}.rm-fbar__view{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__advanced{align-items:center;background:none;border:none;border-left:1px solid var(--border-default);color:var(--color-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);font-weight:var(--weight-medium);height:var(--rm-fbar-field-h);padding:0 0 0 var(--space-12);position:absolute;right:14px;text-decoration-line:underline;top:0;white-space:nowrap;z-index:2}.rm-fbar__advanced.is-active,.rm-fbar__advanced:hover{color:var(--color-primary-hover,var(--color-primary));text-decoration-thickness:2px}.rm-fbar__rail-row{display:flex;padding-bottom:var(--space-8)}.rm-fbar--open .rm-fbar__band--rail{border-bottom:1px solid var(--border-default)}.rm-fbar__rail{align-items:center;display:flex;flex:0 1 auto;min-width:0;overflow-x:auto;scrollbar-width:thin}.rm-fbar__rail:empty{display:none}.rm-fbar__search{align-items:center;display:flex;flex:1 1 auto;gap:var(--space-8);min-width:0;position:relative}.rm-fbar__search:empty{display:none}.rm-fbar__search :deep(.rm-search-tags__field){border-radius:var(--radius-pill);box-sizing:border-box;height:var(--rm-fbar-field-h);padding-block:0;padding-right:calc(var(--rm-fbar-advanced-w, 0px) + 14px + var(--space-12))}.rm-fbar__search :deep(.rm-search-tags__field.is-open),.rm-fbar__search :deep(.rm-search-tags__field.is-panel){border-radius:var(--radius-pill)}.rm-fbar__search :deep(.rm-search-tags__list),.rm-fbar__search :deep(.rm-search-tags__panel){border-radius:var(--radius-2xl);border-top:1px solid var(--border-default);box-shadow:var(--shadow-lg);margin-top:var(--space-6);padding:var(--space-6)}.rm-fbar__search :deep(.rm-search-tags__option){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.search-bar-wrapper){flex:1 1 auto;min-width:0}.rm-fbar__search :deep(.search-bar){background:var(--bg-surface);box-sizing:border-box;display:flex;height:var(--rm-fbar-field-h);width:100%}.rm-fbar__search :deep(.filters_input_search){border-radius:var(--radius-pill);box-sizing:border-box;height:auto;min-height:var(--rm-fbar-field-h);padding-right:calc(var(--rm-fbar-advanced-w, 0px) + var(--space-12));width:100%}.rm-fbar__search :deep(.research_tags:not(:has(*))){display:none}.rm-fbar__search :deep(.select_shortcut){box-sizing:border-box;font-size:var(--font-11);height:24px;padding-block:0}.rm-fbar__search :deep(.select_shortcut:hover){background:var(--bg-surface-3)!important;border-color:var(--border-default)!important;color:inherit!important}.rm-fbar__search :deep(.select_shortcut:hover svg){color:inherit!important}.rm-fbar__search :deep(.remove_search_section){border-left:none;border-radius:0 var(--radius-pill) var(--radius-pill) 0}.rm-fbar__search :deep(.remove_search_section:hover){background:transparent!important}.rm-fbar__search :deep(.remove_search_section:hover svg){color:var(--text-primary)!important}.rm-fbar__search :deep(.filters_input_search.no_bottom){border-bottom:1.5px solid var(--color-primary)!important;border-radius:var(--radius-pill)}.rm-fbar__search :deep(.search_suggestions){border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);left:0;padding:var(--space-6);right:0;top:calc(100% + 6px);width:auto}.rm-fbar__search :deep(.sugg_container>*){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.sugg_container>.selected){background:color-mix(in srgb,var(--color-primary) 6%,transparent)!important}.rm-fbar__panel{--rm-filter-col:224px;--rm-fbar-panel-field-h:40px;align-items:end;display:grid;gap:var(--space-8);grid-template-columns:repeat(auto-fit,minmax(0,var(--rm-filter-col)));justify-content:start;padding-block:16px 20px;padding-inline:max(32px,(100% - var(--oip-content-max,100%))/2)}.rm-fbar__panel--wide{align-items:stretch;display:flex;flex-direction:column;gap:var(--space-12)}.rm-fbar__filters{display:contents}.rm-fbar__filters :deep(.filter-chip),.rm-fbar__filters :deep(.filter-complex__trigger),.rm-fbar__filters :deep(.rm-csel__field),.rm-fbar__filters :deep(.rm-dsel__field),.rm-fbar__filters :deep(.rm-msel__field),.rm-fbar__filters :deep(.rm-number__box){border-radius:var(--radius-lg);height:var(--rm-fbar-panel-field-h);width:100%}.rm-fbar__filters :deep(.rm-csel),.rm-fbar__filters :deep(.rm-dsel),.rm-fbar__filters :deep(.rm-msel){align-items:stretch;width:100%}.rm-fbar__panel-head{align-items:baseline;display:flex;gap:var(--space-16);grid-column:1/-1;width:100%}.rm-fbar__customize{grid-column:1/-1}.rm-fbar__panel :deep(.filters_row_break){grid-column:1/-1}.rm-fbar__panel-title{font-family:var(--font-serif);font-size:var(--font-18);font-weight:700;margin:0}.rm-fbar__action{background:none;border:none;cursor:pointer;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);padding:0;text-decoration-line:underline}.rm-fbar__action--save{color:var(--color-primary)}.rm-fbar__action--clear{color:var(--color-danger)}.rm-fbar__action--clear:hover{opacity:.8;text-decoration-thickness:2px}.rm-fbar__action-sep{align-self:center;background:var(--border-default);height:14px;width:1px}
|
|
344
344
|
</style>
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Fiche d'un produit du registre Medsafe (New Zealand One, type
|
|
3
|
+
NzMedsafeProduct), par son `_id` (product_id) : statut, classification,
|
|
4
|
+
substances, laboratoire, forme, indications, documents, puis l'historique
|
|
5
|
+
des demandes (la plus recente d'abord).
|
|
6
|
+
|
|
7
|
+
Montee par le tiroir des projets ; le lien vers l'app passe par le slot
|
|
8
|
+
`title-link`.
|
|
9
|
+
-->
|
|
10
|
+
<template>
|
|
11
|
+
<div class="oip-nz">
|
|
12
|
+
<RmPageHeader :eyebrow="en ? 'Medsafe, New Zealand' : 'Medsafe, Nouvelle-Zélande'">
|
|
13
|
+
<template #title>
|
|
14
|
+
<span class="oip-nz__title">{{ doc?.trade_name || id }}</span>
|
|
15
|
+
<slot name="title-link" />
|
|
16
|
+
</template>
|
|
17
|
+
</RmPageHeader>
|
|
18
|
+
|
|
19
|
+
<div class="oip-nz__body">
|
|
20
|
+
<RmLoadingState v-if="loading" spinner />
|
|
21
|
+
<RmEmptyState v-else-if="!doc" icon="Prohibit" :title="en ? 'Product not found' : 'Produit introuvable'" />
|
|
22
|
+
<template v-else>
|
|
23
|
+
<div class="oip-nz__tags">
|
|
24
|
+
<RmTag v-if="doc.regulatory_status" :variant="statusVariant">{{ doc.regulatory_status }}</RmTag>
|
|
25
|
+
<RmTag v-if="doc.classification" variant="violet">{{ doc.classification }}</RmTag>
|
|
26
|
+
<RmTag variant="gray">Medsafe {{ id }}</RmTag>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<RmCard padding="md">
|
|
30
|
+
<p v-if="doc.product_label" class="oip-nz__lead">{{ doc.product_label }}</p>
|
|
31
|
+
<dl class="oip-nz__rows">
|
|
32
|
+
<template v-for="row in rows" :key="row.label">
|
|
33
|
+
<dt>{{ row.label }}</dt>
|
|
34
|
+
<dd>{{ row.value }}</dd>
|
|
35
|
+
</template>
|
|
36
|
+
</dl>
|
|
37
|
+
<div v-if="links.length" class="oip-nz__links">
|
|
38
|
+
<a v-for="link in links" :key="link.href" :href="link.href" target="_blank" rel="noopener" class="oip-nz__link">
|
|
39
|
+
{{ link.label }}
|
|
40
|
+
</a>
|
|
41
|
+
</div>
|
|
42
|
+
</RmCard>
|
|
43
|
+
|
|
44
|
+
<RmCard v-if="doc.indications" padding="md">
|
|
45
|
+
<h3 class="oip-nz__card-title">Indications</h3>
|
|
46
|
+
<RmClampText :text="doc.indications" :lines="6" :lang="lang" />
|
|
47
|
+
</RmCard>
|
|
48
|
+
|
|
49
|
+
<RmCard padding="md">
|
|
50
|
+
<h3 class="oip-nz__card-title">{{ en ? "Application history" : "Historique des demandes" }} ({{ applications.length }})</h3>
|
|
51
|
+
<RmTable
|
|
52
|
+
:columns="columns"
|
|
53
|
+
:rows="applications"
|
|
54
|
+
compact
|
|
55
|
+
flat
|
|
56
|
+
:page-size="15"
|
|
57
|
+
max-height="none"
|
|
58
|
+
:empty-text="en ? 'No application' : 'Aucune demande'"
|
|
59
|
+
/>
|
|
60
|
+
</RmCard>
|
|
61
|
+
</template>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script setup lang="ts">
|
|
67
|
+
import { oipEsGet } from "../../composables/useOipResources";
|
|
68
|
+
import { NEW_ZEALAND_INDEX } from "../../oip-new-zealand/kinds";
|
|
69
|
+
|
|
70
|
+
const props = withDefaults(
|
|
71
|
+
defineProps<{
|
|
72
|
+
/** Le `resourceId` : product_id du produit Medsafe. */
|
|
73
|
+
id: string;
|
|
74
|
+
type?: string;
|
|
75
|
+
lang?: "fr" | "en";
|
|
76
|
+
highlight?: string[];
|
|
77
|
+
}>(),
|
|
78
|
+
{ type: "NzMedsafeProduct", lang: "fr", highlight: () => [] },
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const en = computed(() => props.lang === "en");
|
|
82
|
+
const loading = ref(true);
|
|
83
|
+
const doc = ref<Record<string, any> | null>(null);
|
|
84
|
+
|
|
85
|
+
const asList = (value: unknown): string[] =>
|
|
86
|
+
(Array.isArray(value) ? value : value ? [value] : []).map(String).filter(Boolean);
|
|
87
|
+
const date = (value: unknown) => {
|
|
88
|
+
const parsed = new Date(String(value ?? ""));
|
|
89
|
+
return Number.isNaN(parsed.getTime())
|
|
90
|
+
? ""
|
|
91
|
+
: parsed.toLocaleDateString(en.value ? "en-NZ" : "fr-FR", { day: "numeric", month: "short", year: "numeric" });
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** Autorise, refuse ou retire, autre (meme lecture que la liste Drug approvals de l'app). */
|
|
95
|
+
const statusVariant = computed(() => {
|
|
96
|
+
if (doc.value?.is_approved) return "green";
|
|
97
|
+
return ["Revoked", "Consent refused", "Consent suspended", "Never approved"].includes(doc.value?.regulatory_status)
|
|
98
|
+
? "rose"
|
|
99
|
+
: "gray";
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const rows = computed(() => {
|
|
103
|
+
const d = doc.value ?? {};
|
|
104
|
+
const ingredients = asList(d.active_ingredients_strength).length ? asList(d.active_ingredients_strength) : asList(d.active_ingredients);
|
|
105
|
+
return [
|
|
106
|
+
{ label: en.value ? "Active ingredients" : "Substances", value: ingredients.join(", ") },
|
|
107
|
+
{ label: en.value ? "Sponsor" : "Laboratoire", value: d.sponsor_name },
|
|
108
|
+
{ label: en.value ? "Dose form" : "Forme", value: [d.dose_form, d.strength || d.identifier].filter(Boolean).join(" · ") },
|
|
109
|
+
{ label: en.value ? "Approval date" : "Date d'autorisation", value: date(d.approval_date) },
|
|
110
|
+
{ label: en.value ? "Notification date" : "Date de notification", value: date(d.notification_date) },
|
|
111
|
+
].filter((row) => row.value);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const links = computed(() => {
|
|
115
|
+
const d = doc.value ?? {};
|
|
116
|
+
return [
|
|
117
|
+
{ label: en.value ? "Medsafe page" : "Page Medsafe", href: d.product_url },
|
|
118
|
+
{ label: en.value ? "Data sheet" : "Fiche technique", href: d.datasheet_url },
|
|
119
|
+
{ label: en.value ? "Consumer information" : "Information du consommateur", href: d.cmi_url },
|
|
120
|
+
].filter((link) => typeof link.href === "string" && link.href.startsWith("http"));
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const columns = computed(() => [
|
|
124
|
+
{ key: "date", label: en.value ? "Application date" : "Date de demande" },
|
|
125
|
+
{ key: "type", label: "Type", minWidth: "160px" },
|
|
126
|
+
{ key: "change", label: en.value ? "Change" : "Modification", minWidth: "220px" },
|
|
127
|
+
{ key: "status", label: en.value ? "Status" : "Statut" },
|
|
128
|
+
]);
|
|
129
|
+
|
|
130
|
+
const applications = computed(() =>
|
|
131
|
+
[...(doc.value?.applications ?? [])]
|
|
132
|
+
.sort((a: any, b: any) => String(b.application_date ?? "").localeCompare(String(a.application_date ?? "")))
|
|
133
|
+
.map((a: any) => ({
|
|
134
|
+
date: date(a.application_date) || "-",
|
|
135
|
+
type: a.application_type || "-",
|
|
136
|
+
change: a.change_description || "-",
|
|
137
|
+
status: a.application_status || "-",
|
|
138
|
+
})),
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
async function read() {
|
|
142
|
+
loading.value = true;
|
|
143
|
+
const hit = await oipEsGet<any>("drugs", NEW_ZEALAND_INDEX.medsafe, props.id).catch(() => null);
|
|
144
|
+
doc.value = hit?._source ?? null;
|
|
145
|
+
loading.value = false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
watch(() => props.id, read, { immediate: true });
|
|
149
|
+
</script>
|
|
150
|
+
|
|
151
|
+
<style scoped>
|
|
152
|
+
.oip-nz__title {
|
|
153
|
+
margin-right: var(--space-8);
|
|
154
|
+
}
|
|
155
|
+
.oip-nz__body {
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
gap: var(--space-16);
|
|
159
|
+
padding: var(--space-16) 0;
|
|
160
|
+
}
|
|
161
|
+
.oip-nz__tags {
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-wrap: wrap;
|
|
164
|
+
gap: var(--space-6);
|
|
165
|
+
}
|
|
166
|
+
.oip-nz__lead {
|
|
167
|
+
margin: 0 0 var(--space-12);
|
|
168
|
+
color: var(--text-primary);
|
|
169
|
+
font-size: var(--font-14);
|
|
170
|
+
}
|
|
171
|
+
.oip-nz__card-title {
|
|
172
|
+
margin: 0 0 var(--space-12);
|
|
173
|
+
font-size: var(--font-14);
|
|
174
|
+
font-weight: var(--weight-bold);
|
|
175
|
+
}
|
|
176
|
+
.oip-nz__rows {
|
|
177
|
+
display: grid;
|
|
178
|
+
grid-template-columns: 180px minmax(0, 1fr);
|
|
179
|
+
gap: var(--space-6) var(--space-12);
|
|
180
|
+
margin: 0;
|
|
181
|
+
}
|
|
182
|
+
.oip-nz__rows dt {
|
|
183
|
+
color: var(--text-muted);
|
|
184
|
+
font-size: var(--font-12);
|
|
185
|
+
font-weight: var(--weight-semibold);
|
|
186
|
+
text-transform: uppercase;
|
|
187
|
+
letter-spacing: 0.04em;
|
|
188
|
+
}
|
|
189
|
+
.oip-nz__rows dd {
|
|
190
|
+
margin: 0;
|
|
191
|
+
color: var(--text-primary);
|
|
192
|
+
font-size: var(--font-14);
|
|
193
|
+
}
|
|
194
|
+
.oip-nz__links {
|
|
195
|
+
display: flex;
|
|
196
|
+
flex-wrap: wrap;
|
|
197
|
+
gap: var(--space-12);
|
|
198
|
+
margin-top: var(--space-12);
|
|
199
|
+
}
|
|
200
|
+
.oip-nz__link {
|
|
201
|
+
color: var(--color-primary);
|
|
202
|
+
font-size: var(--font-13, 13px);
|
|
203
|
+
font-weight: var(--weight-semibold);
|
|
204
|
+
text-decoration: none;
|
|
205
|
+
}
|
|
206
|
+
.oip-nz__link:hover {
|
|
207
|
+
text-decoration: underline;
|
|
208
|
+
}
|
|
209
|
+
</style>
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Fiche d'une boite du Price Tracker neo-zelandais (New Zealand One, type
|
|
3
|
+
NzDrugPrice), par son `_id` (nz_<code>_1 en officine, _2 a l'hopital) :
|
|
4
|
+
identite, prix en vigueur (ex-usine, subvention Pharmac), courbe en
|
|
5
|
+
escalier, puis les seuls vrais changements de prix.
|
|
6
|
+
|
|
7
|
+
Montee par le tiroir des projets ; le lien vers l'app passe par le slot
|
|
8
|
+
`title-link`.
|
|
9
|
+
-->
|
|
10
|
+
<template>
|
|
11
|
+
<div class="oip-nz">
|
|
12
|
+
<RmPageHeader :eyebrow="en ? 'Price, New Zealand' : 'Prix, Nouvelle-Zélande'">
|
|
13
|
+
<template #title>
|
|
14
|
+
<span class="oip-nz__title">{{ doc?.label_local || id }}</span>
|
|
15
|
+
<slot name="title-link" />
|
|
16
|
+
</template>
|
|
17
|
+
</RmPageHeader>
|
|
18
|
+
|
|
19
|
+
<div class="oip-nz__body">
|
|
20
|
+
<RmLoadingState v-if="loading" spinner />
|
|
21
|
+
<RmEmptyState v-else-if="!doc" icon="Prohibit" :title="en ? 'Price not found' : 'Prix introuvable'" />
|
|
22
|
+
<template v-else>
|
|
23
|
+
<div class="oip-nz__tags">
|
|
24
|
+
<RmTag v-if="doc.brand" variant="indigo">{{ doc.brand }}</RmTag>
|
|
25
|
+
<RmTag v-if="doc.price_category" :variant="doc.price_category === 'Hospital' ? 'blue' : 'orange'">
|
|
26
|
+
{{ categoryLabel(doc.price_category) }}
|
|
27
|
+
</RmTag>
|
|
28
|
+
<RmTag v-if="doc.local_drug_id" variant="gray">Pharmac {{ doc.local_drug_id }}</RmTag>
|
|
29
|
+
<RmTag v-if="productType" variant="green">{{ productType }}</RmTag>
|
|
30
|
+
<RmTag v-if="doc.treatment_class" variant="violet">{{ doc.treatment_class }}</RmTag>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<RmCard padding="md">
|
|
34
|
+
<h3 class="oip-nz__card-title">{{ en ? "Current price" : "Prix en vigueur" }}</h3>
|
|
35
|
+
<div v-if="current.length" class="oip-nz__figures">
|
|
36
|
+
<div v-for="price in current" :key="price.type" class="oip-nz__figure">
|
|
37
|
+
<span class="oip-nz__figure-label">{{ price.type }}</span>
|
|
38
|
+
<span class="oip-nz__figure-value">{{ price.value }}</span>
|
|
39
|
+
<span class="oip-nz__figure-note">{{ price.note }}</span>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<p v-else class="oip-nz__note">{{ en ? "No price recorded." : "Aucun prix enregistré." }}</p>
|
|
43
|
+
<dl class="oip-nz__rows">
|
|
44
|
+
<template v-for="row in rows" :key="row.label">
|
|
45
|
+
<dt>{{ row.label }}</dt>
|
|
46
|
+
<dd>{{ row.value }}</dd>
|
|
47
|
+
</template>
|
|
48
|
+
</dl>
|
|
49
|
+
<p class="oip-nz__note">{{ en ? "NZD per pack, excluding GST." : "NZD par boîte, hors GST." }}</p>
|
|
50
|
+
</RmCard>
|
|
51
|
+
|
|
52
|
+
<RmCard v-if="dates.length > 1" padding="md">
|
|
53
|
+
<h3 class="oip-nz__card-title">{{ en ? "Price history" : "Historique des prix" }}</h3>
|
|
54
|
+
<RmLineChart
|
|
55
|
+
:categories="dates"
|
|
56
|
+
:series="series"
|
|
57
|
+
step
|
|
58
|
+
:value-formatter="(v: number) => nzd(v)"
|
|
59
|
+
height="compact"
|
|
60
|
+
:description="en ? 'Price history' : 'Historique des prix'"
|
|
61
|
+
/>
|
|
62
|
+
</RmCard>
|
|
63
|
+
|
|
64
|
+
<RmCard padding="md">
|
|
65
|
+
<h3 class="oip-nz__card-title">{{ en ? "Price changes" : "Changements de prix" }} ({{ changes.length }})</h3>
|
|
66
|
+
<RmTable
|
|
67
|
+
:columns="changeColumns"
|
|
68
|
+
:rows="changes"
|
|
69
|
+
compact
|
|
70
|
+
flat
|
|
71
|
+
:page-size="20"
|
|
72
|
+
max-height="none"
|
|
73
|
+
:empty-text="en ? 'No price change in the history' : 'Aucun changement de prix dans l\'historique'"
|
|
74
|
+
/>
|
|
75
|
+
</RmCard>
|
|
76
|
+
</template>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup lang="ts">
|
|
82
|
+
import { oipEsGet } from "../../composables/useOipResources";
|
|
83
|
+
import { NEW_ZEALAND_INDEX } from "../../oip-new-zealand/kinds";
|
|
84
|
+
|
|
85
|
+
const props = withDefaults(
|
|
86
|
+
defineProps<{
|
|
87
|
+
/** Le `resourceId` : `_id` de la boite (nz_<code>_<n>). */
|
|
88
|
+
id: string;
|
|
89
|
+
type?: string;
|
|
90
|
+
lang?: "fr" | "en";
|
|
91
|
+
highlight?: string[];
|
|
92
|
+
}>(),
|
|
93
|
+
{ type: "NzDrugPrice", lang: "fr", highlight: () => [] },
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const en = computed(() => props.lang === "en");
|
|
97
|
+
const loading = ref(true);
|
|
98
|
+
const doc = ref<Record<string, any> | null>(null);
|
|
99
|
+
|
|
100
|
+
/** Pharmac publie le prix ex-usine (les deux listes) et la subvention (officine). */
|
|
101
|
+
const PRICE_TYPES: Record<number, { fr: string; en: string }> = {
|
|
102
|
+
1: { fr: "Prix ex-usine", en: "Ex-factory" },
|
|
103
|
+
12: { fr: "Remboursement (subvention Pharmac)", en: "Reimbursement (Pharmac subsidy)" },
|
|
104
|
+
};
|
|
105
|
+
const typeName = (id: number) => {
|
|
106
|
+
const type = PRICE_TYPES[id];
|
|
107
|
+
return type ? (en.value ? type.en : type.fr) : String(id);
|
|
108
|
+
};
|
|
109
|
+
const PRODUCT_TYPES: Record<number, { fr: string; en: string }> = {
|
|
110
|
+
10: { fr: "Générique", en: "Generic" },
|
|
111
|
+
2: { fr: "Biologique", en: "Biologic" },
|
|
112
|
+
20: { fr: "Biosimilaire", en: "Biosimilar" },
|
|
113
|
+
};
|
|
114
|
+
const productType = computed(() => {
|
|
115
|
+
const type = PRODUCT_TYPES[Number(doc.value?.status_generic)];
|
|
116
|
+
return type ? (en.value ? type.en : type.fr) : null;
|
|
117
|
+
});
|
|
118
|
+
const categoryLabel = (category: string) =>
|
|
119
|
+
category === "Retail"
|
|
120
|
+
? en.value
|
|
121
|
+
? "Community (Retail)"
|
|
122
|
+
: "Officine (Community Schedule)"
|
|
123
|
+
: category === "Hospital"
|
|
124
|
+
? en.value
|
|
125
|
+
? "Hospital"
|
|
126
|
+
: "Hôpital (Hospital Medicines List)"
|
|
127
|
+
: category;
|
|
128
|
+
|
|
129
|
+
const date = (value: unknown) => {
|
|
130
|
+
const parsed = new Date(String(value ?? ""));
|
|
131
|
+
return Number.isNaN(parsed.getTime())
|
|
132
|
+
? "-"
|
|
133
|
+
: parsed.toLocaleDateString(en.value ? "en-NZ" : "fr-FR", { day: "numeric", month: "short", year: "numeric" });
|
|
134
|
+
};
|
|
135
|
+
const nzd = (value: unknown) => {
|
|
136
|
+
const n = Number(value);
|
|
137
|
+
return Number.isFinite(n)
|
|
138
|
+
? `${n.toLocaleString(en.value ? "en-NZ" : "fr-FR", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} NZ$`
|
|
139
|
+
: "-";
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** Les entrees d'un type, de la plus recente a la plus ancienne. */
|
|
143
|
+
const historyOf = (typeId: number) =>
|
|
144
|
+
[...(doc.value?.price_history ?? [])]
|
|
145
|
+
.filter((entry: any) => Number(entry.price_type_id) === typeId && Number.isFinite(Number(entry.new_price)))
|
|
146
|
+
.sort((a: any, b: any) => String(b.application_date ?? "").localeCompare(String(a.application_date ?? "")));
|
|
147
|
+
|
|
148
|
+
const types = computed(() => [1, 12].filter((typeId) => historyOf(typeId).length > 0));
|
|
149
|
+
|
|
150
|
+
const isChange = (entry: any) =>
|
|
151
|
+
entry.last_price != null && entry.new_price != null && Number(entry.last_price) !== Number(entry.new_price);
|
|
152
|
+
|
|
153
|
+
const current = computed(() =>
|
|
154
|
+
types.value.map((typeId) => {
|
|
155
|
+
const history = historyOf(typeId);
|
|
156
|
+
const change = history.find(isChange);
|
|
157
|
+
return {
|
|
158
|
+
type: typeName(typeId),
|
|
159
|
+
value: nzd(history[0]?.new_price),
|
|
160
|
+
note: change
|
|
161
|
+
? `${en.value ? "since" : "depuis le"} ${date(change.application_date)} (${en.value ? "before" : "avant"} ${nzd(change.last_price)})`
|
|
162
|
+
: en.value
|
|
163
|
+
? "unchanged in the history"
|
|
164
|
+
: "inchangé dans l'historique",
|
|
165
|
+
};
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const dates = computed(() =>
|
|
170
|
+
[...new Set(types.value.flatMap((typeId) => historyOf(typeId).map((entry: any) => String(entry.application_date))))].sort(),
|
|
171
|
+
);
|
|
172
|
+
const series = computed(() =>
|
|
173
|
+
types.value.map((typeId) => {
|
|
174
|
+
const byDate = new Map(historyOf(typeId).map((entry: any) => [String(entry.application_date), Number(entry.new_price)]));
|
|
175
|
+
return { name: typeName(typeId), data: dates.value.map((d) => byDate.get(d) ?? null) };
|
|
176
|
+
}),
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const changeColumns = computed(() => [
|
|
180
|
+
{ key: "date", label: en.value ? "Application date" : "Date d'application" },
|
|
181
|
+
{ key: "type", label: en.value ? "Price type" : "Type de prix" },
|
|
182
|
+
{ key: "before", label: en.value ? "Previous price" : "Prix précédent", numeric: true },
|
|
183
|
+
{ key: "price", label: en.value ? "New price" : "Nouveau prix", numeric: true },
|
|
184
|
+
{ key: "evol", label: en.value ? "Change" : "Variation", numeric: true },
|
|
185
|
+
]);
|
|
186
|
+
|
|
187
|
+
const changes = computed(() =>
|
|
188
|
+
types.value
|
|
189
|
+
.flatMap((typeId) =>
|
|
190
|
+
historyOf(typeId)
|
|
191
|
+
.filter(isChange)
|
|
192
|
+
.map((entry: any) => {
|
|
193
|
+
const from = Number(entry.last_price);
|
|
194
|
+
const to = Number(entry.new_price);
|
|
195
|
+
return {
|
|
196
|
+
sort: String(entry.application_date ?? ""),
|
|
197
|
+
date: date(entry.application_date),
|
|
198
|
+
type: typeName(typeId),
|
|
199
|
+
before: nzd(from),
|
|
200
|
+
price: nzd(to),
|
|
201
|
+
evol: from ? `${to > from ? "+" : ""}${(((to - from) / from) * 100).toFixed(1)} %` : "-",
|
|
202
|
+
};
|
|
203
|
+
}),
|
|
204
|
+
)
|
|
205
|
+
.sort((a, b) => b.sort.localeCompare(a.sort)),
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
const rows = computed(() => {
|
|
209
|
+
const d = doc.value ?? {};
|
|
210
|
+
return [
|
|
211
|
+
{ label: en.value ? "Molecule" : "Molécule", value: d.molecule_en || d.molecule_local },
|
|
212
|
+
{ label: "ATC", value: [d.atc_who, d.atc4_en].filter(Boolean).join(" · ") },
|
|
213
|
+
{ label: en.value ? "Last price change" : "Dernier changement de prix", value: d.last_price_update ? date(d.last_price_update) : "" },
|
|
214
|
+
].filter((row) => row.value);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
async function read() {
|
|
218
|
+
loading.value = true;
|
|
219
|
+
const hit = await oipEsGet<any>("drugs", NEW_ZEALAND_INDEX.prices, props.id).catch(() => null);
|
|
220
|
+
doc.value = hit?._source ?? null;
|
|
221
|
+
loading.value = false;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
watch(() => props.id, read, { immediate: true });
|
|
225
|
+
</script>
|
|
226
|
+
|
|
227
|
+
<style scoped>
|
|
228
|
+
.oip-nz__title {
|
|
229
|
+
margin-right: var(--space-8);
|
|
230
|
+
}
|
|
231
|
+
.oip-nz__body {
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
gap: var(--space-16);
|
|
235
|
+
padding: var(--space-16) 0;
|
|
236
|
+
}
|
|
237
|
+
.oip-nz__tags {
|
|
238
|
+
display: flex;
|
|
239
|
+
flex-wrap: wrap;
|
|
240
|
+
gap: var(--space-6);
|
|
241
|
+
}
|
|
242
|
+
.oip-nz__card-title {
|
|
243
|
+
margin: 0 0 var(--space-12);
|
|
244
|
+
font-size: var(--font-14);
|
|
245
|
+
font-weight: var(--weight-bold);
|
|
246
|
+
}
|
|
247
|
+
.oip-nz__figures {
|
|
248
|
+
display: grid;
|
|
249
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
250
|
+
gap: var(--space-12);
|
|
251
|
+
margin-bottom: var(--space-12);
|
|
252
|
+
}
|
|
253
|
+
.oip-nz__figure {
|
|
254
|
+
display: flex;
|
|
255
|
+
flex-direction: column;
|
|
256
|
+
gap: 2px;
|
|
257
|
+
}
|
|
258
|
+
.oip-nz__figure-label,
|
|
259
|
+
.oip-nz__rows dt {
|
|
260
|
+
color: var(--text-muted);
|
|
261
|
+
font-size: var(--font-12);
|
|
262
|
+
font-weight: var(--weight-semibold);
|
|
263
|
+
text-transform: uppercase;
|
|
264
|
+
letter-spacing: 0.04em;
|
|
265
|
+
}
|
|
266
|
+
.oip-nz__figure-value {
|
|
267
|
+
font-size: var(--font-20);
|
|
268
|
+
font-weight: var(--weight-bold);
|
|
269
|
+
color: var(--text-primary);
|
|
270
|
+
}
|
|
271
|
+
.oip-nz__figure-note,
|
|
272
|
+
.oip-nz__note {
|
|
273
|
+
color: var(--text-muted);
|
|
274
|
+
font-size: var(--font-12);
|
|
275
|
+
margin: 0;
|
|
276
|
+
}
|
|
277
|
+
.oip-nz__rows {
|
|
278
|
+
display: grid;
|
|
279
|
+
grid-template-columns: 180px minmax(0, 1fr);
|
|
280
|
+
gap: var(--space-6) var(--space-12);
|
|
281
|
+
margin: 0 0 var(--space-8);
|
|
282
|
+
}
|
|
283
|
+
.oip-nz__rows dd {
|
|
284
|
+
margin: 0;
|
|
285
|
+
color: var(--text-primary);
|
|
286
|
+
font-size: var(--font-14);
|
|
287
|
+
}
|
|
288
|
+
</style>
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Fiche d'une molecule du marche de ville neo-zelandais (New Zealand One, type
|
|
3
|
+
NzRetailMolecule), par son `_id` (code de la Pharmaceutical Collection) :
|
|
4
|
+
groupes therapeutiques, chiffres nationaux de la derniere annee, puis
|
|
5
|
+
l'evolution nationale des delivrances et des patients.
|
|
6
|
+
|
|
7
|
+
Montee par le tiroir des projets ; le lien vers l'app passe par le slot
|
|
8
|
+
`title-link`.
|
|
9
|
+
-->
|
|
10
|
+
<template>
|
|
11
|
+
<div class="oip-nz">
|
|
12
|
+
<RmPageHeader :eyebrow="en ? 'Retail market, New Zealand' : 'Marché de ville, Nouvelle-Zélande'">
|
|
13
|
+
<template #title>
|
|
14
|
+
<span class="oip-nz__title">{{ doc?.label || id }}</span>
|
|
15
|
+
<slot name="title-link" />
|
|
16
|
+
</template>
|
|
17
|
+
</RmPageHeader>
|
|
18
|
+
|
|
19
|
+
<div class="oip-nz__body">
|
|
20
|
+
<RmLoadingState v-if="loading" spinner />
|
|
21
|
+
<RmEmptyState v-else-if="!doc" icon="Prohibit" :title="en ? 'Molecule not found' : 'Molécule introuvable'" />
|
|
22
|
+
<template v-else>
|
|
23
|
+
<div class="oip-nz__tags">
|
|
24
|
+
<RmTag v-if="doc.tg2_label" variant="indigo">TG2 · {{ doc.tg2_label }}</RmTag>
|
|
25
|
+
<RmTag v-if="doc.tg3_label" variant="blue">TG3 · {{ doc.tg3_label }}</RmTag>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<RmCard v-if="last" padding="md">
|
|
29
|
+
<h3 class="oip-nz__card-title">{{ en ? `New Zealand, ${last}` : `Nouvelle-Zélande, ${last}` }}</h3>
|
|
30
|
+
<div class="oip-nz__figures">
|
|
31
|
+
<div v-for="figure in figures" :key="figure.label" class="oip-nz__figure">
|
|
32
|
+
<span class="oip-nz__figure-label">{{ figure.label }}</span>
|
|
33
|
+
<span class="oip-nz__figure-value">{{ figure.value }}</span>
|
|
34
|
+
<span class="oip-nz__figure-note">{{ figure.note }}</span>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</RmCard>
|
|
38
|
+
|
|
39
|
+
<RmCard v-if="periods.length > 1" padding="md">
|
|
40
|
+
<h3 class="oip-nz__card-title">{{ en ? "Number dispensed, national evolution" : "Nombre de délivrances, évolution nationale" }}</h3>
|
|
41
|
+
<RmLineChart
|
|
42
|
+
:categories="periods"
|
|
43
|
+
:series="series"
|
|
44
|
+
:value-formatter="(v: number) => format(v)"
|
|
45
|
+
height="compact"
|
|
46
|
+
:description="en ? 'Number dispensed by year' : 'Délivrances par année'"
|
|
47
|
+
/>
|
|
48
|
+
<RmTable :columns="columns" :rows="table" compact flat max-height="none" :empty-text="en ? 'No data' : 'Aucune donnée'" />
|
|
49
|
+
</RmCard>
|
|
50
|
+
</template>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup lang="ts">
|
|
56
|
+
import { oipEsGet } from "../../composables/useOipResources";
|
|
57
|
+
import { NEW_ZEALAND_INDEX } from "../../oip-new-zealand/kinds";
|
|
58
|
+
|
|
59
|
+
const props = withDefaults(
|
|
60
|
+
defineProps<{
|
|
61
|
+
/** Le `resourceId` : code de la molecule (Pharmaceutical Collection). */
|
|
62
|
+
id: string;
|
|
63
|
+
type?: string;
|
|
64
|
+
lang?: "fr" | "en";
|
|
65
|
+
highlight?: string[];
|
|
66
|
+
}>(),
|
|
67
|
+
{ type: "NzRetailMolecule", lang: "fr", highlight: () => [] },
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const en = computed(() => props.lang === "en");
|
|
71
|
+
const loading = ref(true);
|
|
72
|
+
const doc = ref<Record<string, any> | null>(null);
|
|
73
|
+
|
|
74
|
+
type DataType = "Prescriptions" | "Dispensings";
|
|
75
|
+
const TYPES: DataType[] = ["Dispensings", "Prescriptions"];
|
|
76
|
+
const typeLabel = (type: DataType) => (type === "Dispensings" ? (en.value ? "Dispensings" : "Délivrances") : "Prescriptions");
|
|
77
|
+
|
|
78
|
+
/** Comptes de l'index en chaines, `<6` quand ils sont masques. */
|
|
79
|
+
const num = (value: unknown) => {
|
|
80
|
+
if (value === null || value === undefined || value === "" || value === "<6") return null;
|
|
81
|
+
const n = Number(value);
|
|
82
|
+
return Number.isNaN(n) ? null : n;
|
|
83
|
+
};
|
|
84
|
+
const format = (value: number | null | undefined) =>
|
|
85
|
+
value === null || value === undefined ? "-" : value.toLocaleString(en.value ? "en-NZ" : "fr-FR", { maximumFractionDigits: 0 });
|
|
86
|
+
|
|
87
|
+
/** La ligne nationale (`Total`) d'une annee et d'un type. */
|
|
88
|
+
const national = (period: number, type: DataType) =>
|
|
89
|
+
(doc.value?.region_level ?? []).find(
|
|
90
|
+
(row: any) => row.region === "Total" && row.type === type && Number(row.period) === period,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const periods = computed(() =>
|
|
94
|
+
[...new Set((doc.value?.region_level ?? []).filter((row: any) => row.region === "Total").map((row: any) => Number(row.period)))].sort(
|
|
95
|
+
(a: any, b: any) => a - b,
|
|
96
|
+
) as number[],
|
|
97
|
+
);
|
|
98
|
+
const last = computed(() => periods.value.at(-1) ?? null);
|
|
99
|
+
|
|
100
|
+
const growth = (current: number | null, previous: number | null) =>
|
|
101
|
+
current === null || !previous ? "" : `${current > previous ? "+" : ""}${(((current - previous) / previous) * 100).toFixed(1)} %`;
|
|
102
|
+
|
|
103
|
+
const figures = computed(() => {
|
|
104
|
+
const year = last.value;
|
|
105
|
+
if (year === null) return [];
|
|
106
|
+
return TYPES.flatMap((type) => {
|
|
107
|
+
const now = national(year, type);
|
|
108
|
+
const before = national(year - 1, type);
|
|
109
|
+
const dispensed = num(now?.number_dispensed);
|
|
110
|
+
const patients = num(now?.patient_count);
|
|
111
|
+
const vs = (value: number | null, previous: number | null) => {
|
|
112
|
+
const g = growth(value, previous);
|
|
113
|
+
return g ? `${g} vs ${year - 1}` : "";
|
|
114
|
+
};
|
|
115
|
+
return [
|
|
116
|
+
{
|
|
117
|
+
label: `${typeLabel(type)}, ${en.value ? "number dispensed" : "délivrances"}`,
|
|
118
|
+
value: format(dispensed),
|
|
119
|
+
note: vs(dispensed, num(before?.number_dispensed)),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
label: `${typeLabel(type)}, ${en.value ? "patients" : "patients"}`,
|
|
123
|
+
value: format(patients),
|
|
124
|
+
note: vs(patients, num(before?.patient_count)),
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const series = computed(() =>
|
|
131
|
+
TYPES.map((type) => ({
|
|
132
|
+
name: typeLabel(type),
|
|
133
|
+
data: periods.value.map((period) => num(national(period, type)?.number_dispensed)),
|
|
134
|
+
})),
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const columns = computed(() => [
|
|
138
|
+
{ key: "period", label: en.value ? "Year" : "Année", rowHeader: true },
|
|
139
|
+
...TYPES.flatMap((type) => [
|
|
140
|
+
{ key: `${type}-n`, label: `${typeLabel(type)}, ${en.value ? "dispensed" : "délivrances"}`, numeric: true },
|
|
141
|
+
{ key: `${type}-p`, label: `${typeLabel(type)}, patients`, numeric: true },
|
|
142
|
+
]),
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
const table = computed(() =>
|
|
146
|
+
[...periods.value].reverse().map((period) => {
|
|
147
|
+
const out: Record<string, string> = { period: String(period) };
|
|
148
|
+
for (const type of TYPES) {
|
|
149
|
+
const row = national(period, type);
|
|
150
|
+
out[`${type}-n`] = format(num(row?.number_dispensed));
|
|
151
|
+
out[`${type}-p`] = format(num(row?.patient_count));
|
|
152
|
+
}
|
|
153
|
+
return out;
|
|
154
|
+
}),
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
async function read() {
|
|
158
|
+
loading.value = true;
|
|
159
|
+
const hit = await oipEsGet<any>("drugs", NEW_ZEALAND_INDEX.retail, props.id).catch(() => null);
|
|
160
|
+
doc.value = hit?._source ?? null;
|
|
161
|
+
loading.value = false;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
watch(() => props.id, read, { immediate: true });
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<style scoped>
|
|
168
|
+
.oip-nz__title {
|
|
169
|
+
margin-right: var(--space-8);
|
|
170
|
+
}
|
|
171
|
+
.oip-nz__body {
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
gap: var(--space-16);
|
|
175
|
+
padding: var(--space-16) 0;
|
|
176
|
+
}
|
|
177
|
+
.oip-nz__tags {
|
|
178
|
+
display: flex;
|
|
179
|
+
flex-wrap: wrap;
|
|
180
|
+
gap: var(--space-6);
|
|
181
|
+
}
|
|
182
|
+
.oip-nz__card-title {
|
|
183
|
+
margin: 0 0 var(--space-12);
|
|
184
|
+
font-size: var(--font-14);
|
|
185
|
+
font-weight: var(--weight-bold);
|
|
186
|
+
}
|
|
187
|
+
.oip-nz__figures {
|
|
188
|
+
display: grid;
|
|
189
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
190
|
+
gap: var(--space-12);
|
|
191
|
+
}
|
|
192
|
+
.oip-nz__figure {
|
|
193
|
+
display: flex;
|
|
194
|
+
flex-direction: column;
|
|
195
|
+
gap: 2px;
|
|
196
|
+
}
|
|
197
|
+
.oip-nz__figure-label {
|
|
198
|
+
color: var(--text-muted);
|
|
199
|
+
font-size: var(--font-12);
|
|
200
|
+
font-weight: var(--weight-semibold);
|
|
201
|
+
text-transform: uppercase;
|
|
202
|
+
letter-spacing: 0.04em;
|
|
203
|
+
}
|
|
204
|
+
.oip-nz__figure-value {
|
|
205
|
+
font-size: var(--font-20);
|
|
206
|
+
font-weight: var(--weight-bold);
|
|
207
|
+
color: var(--text-primary);
|
|
208
|
+
}
|
|
209
|
+
.oip-nz__figure-note {
|
|
210
|
+
color: var(--text-muted);
|
|
211
|
+
font-size: var(--font-12);
|
|
212
|
+
}
|
|
213
|
+
</style>
|
|
@@ -112,6 +112,9 @@ const VIEW_LOADERS: Record<string, () => Promise<any>> = {
|
|
|
112
112
|
"australia-price": () => import("../components/oip-australia/AustraliaPrice.vue"),
|
|
113
113
|
"australia-item": () => import("../components/oip-australia/PbsItem.vue"),
|
|
114
114
|
"australia-reimbursement": () => import("../components/oip-australia/Reimbursement.vue"),
|
|
115
|
+
"new-zealand-medsafe": () => import("../components/oip-new-zealand/MedsafeProduct.vue"),
|
|
116
|
+
"new-zealand-price": () => import("../components/oip-new-zealand/NewZealandPrice.vue"),
|
|
117
|
+
"new-zealand-retail-molecule": () => import("../components/oip-new-zealand/RetailMolecule.vue"),
|
|
115
118
|
};
|
|
116
119
|
|
|
117
120
|
const cache = new Map<string, Component>();
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Les familles que New Zealand One range dans un projet, decrites pour tout le
|
|
3
3
|
* portail : produits du registre Medsafe (Drug approvals), prix des boites de
|
|
4
4
|
* la Pharmaceutical Schedule de Pharmac (Price Tracker) et molecules du marche
|
|
5
|
-
* de ville (Pharmaceutical Collection).
|
|
6
|
-
* du projet mene a la page
|
|
5
|
+
* de ville (Pharmaceutical Collection). Le tiroir d'un projet les montre par
|
|
6
|
+
* leurs vues (components/oip-new-zealand) ; la ligne du projet mene a la page
|
|
7
|
+
* de l'app.
|
|
7
8
|
*
|
|
8
9
|
* Index lus sur le cluster `drugs` (meme domaine que fr_drugs_app, cle
|
|
9
10
|
* principale ; cf. runtimeConfig.oipEs.drugs).
|
|
@@ -17,9 +18,8 @@ const NEW_ZEALAND = { fr: "Nouvelle-Zélande", en: "New Zealand" };
|
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Les index des fiches de New Zealand One, par leur id Directus
|
|
20
|
-
* (collection ElasticIndices) : le proxy
|
|
21
|
-
*
|
|
22
|
-
* Nouvelle-Zelande que dans son index staging aujourd'hui).
|
|
21
|
+
* (collection ElasticIndices) : le proxy en tire le nom physique, l'index
|
|
22
|
+
* staging en preproduction.
|
|
23
23
|
*/
|
|
24
24
|
export const NEW_ZEALAND_INDEX = {
|
|
25
25
|
/** Registre Medsafe (ope__nz__medsafe_drug_approval__tekkare), `_id` = product_id. */
|
|
@@ -222,10 +222,11 @@ function australiaSpec(kind: RmProjectKind, view: string): OipResourceSpec {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
|
-
* Une fiche de New Zealand One, lue sur le cluster `drugs
|
|
226
|
-
*
|
|
225
|
+
* Une fiche de New Zealand One, lue sur le cluster `drugs` et montree d'un
|
|
226
|
+
* seul tenant (components/oip-new-zealand) ; la ligne du projet mene a la page
|
|
227
|
+
* de l'app qui la montre.
|
|
227
228
|
*/
|
|
228
|
-
function newZealandSpec(kind: RmProjectKind): OipResourceSpec {
|
|
229
|
+
function newZealandSpec(kind: RmProjectKind, view: string): OipResourceSpec {
|
|
229
230
|
return {
|
|
230
231
|
type: kind.type,
|
|
231
232
|
app: "new_zealand_one_app",
|
|
@@ -234,10 +235,18 @@ function newZealandSpec(kind: RmProjectKind): OipResourceSpec {
|
|
|
234
235
|
routeId: (id) => id,
|
|
235
236
|
base: () => "",
|
|
236
237
|
tabs: [],
|
|
238
|
+
view,
|
|
237
239
|
detailPath: (id, _tab, doc) => kind.path?.(doc ?? {}, id) ?? "",
|
|
238
240
|
};
|
|
239
241
|
}
|
|
240
242
|
|
|
243
|
+
/** La fiche de chaque famille de New Zealand One (cf. useOipResourceViews). */
|
|
244
|
+
const NEW_ZEALAND_VIEWS: Record<string, string> = {
|
|
245
|
+
NzMedsafeProduct: "new-zealand-medsafe",
|
|
246
|
+
NzDrugPrice: "new-zealand-price",
|
|
247
|
+
NzRetailMolecule: "new-zealand-retail-molecule",
|
|
248
|
+
};
|
|
249
|
+
|
|
241
250
|
/** La fiche de chaque famille d'Australia One (cf. useOipResourceViews). */
|
|
242
251
|
const AUSTRALIA_VIEWS: Record<string, string> = {
|
|
243
252
|
AuPbacOpinion: "australia-pbac",
|
|
@@ -493,7 +502,7 @@ export const OIP_RESOURCE_SPECS: OipResourceSpec[] = [
|
|
|
493
502
|
...GERMANY_PROJECT_KINDS.map((kind) => germanySpec(kind, GERMANY_VIEWS[kind.type]!)),
|
|
494
503
|
...ITALY_PROJECT_KINDS.map((kind) => italySpec(kind, ITALY_VIEWS[kind.type]!)),
|
|
495
504
|
...AUSTRALIA_PROJECT_KINDS.map((kind) => australiaSpec(kind, AUSTRALIA_VIEWS[kind.type]!)),
|
|
496
|
-
...NEW_ZEALAND_PROJECT_KINDS.map(newZealandSpec),
|
|
505
|
+
...NEW_ZEALAND_PROJECT_KINDS.map((kind) => newZealandSpec(kind, NEW_ZEALAND_VIEWS[kind.type]!)),
|
|
497
506
|
];
|
|
498
507
|
|
|
499
508
|
export function oipResourceSpec(type: string): OipResourceSpec | undefined {
|