Skip to content

Commit b2e6ea9

Browse files
chore: update dpe analysis pages
1 parent cc642db commit b2e6ea9

File tree

2 files changed

+95
-20
lines changed

2 files changed

+95
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Vous devez d'abord installer [NodeJS](https://nodejs.org/en) en version 20 ou su
7171
npm install @open3cl/engine
7272
```
7373

74-
### Démonstration
74+
## Démonstration
7575

7676
Il est possible d'analyser un dpe pour tester la lib Open3CL: [https://open3cl.github.io/engine](https://open3cl.github.io/engine/build/).
7777
Un dpe au format XML peut être chargé, il sera envoyé à la lib Open3CL. Un visuel permet de voir les informations

pages/open3CL/src/lib/components/DpeAnalysis.svelte

Lines changed: 94 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
1919
let filesInDropzone = $state(null);
2020
21-
let summaryDpeInfos = $state([]);
21+
let dpeInfos = $state([]);
2222
2323
/**
2424
* Ademe xml data (json format) input of the 3CL engine
@@ -99,57 +99,126 @@
9999
event.preventDefault();
100100
event.stopImmediatePropagation();
101101
setAnalyzedDpe({numero_dpe: undefined});
102-
summaryDpeInfos = [];
102+
dpeInfos = [];
103103
filesInDropzone = null
104104
}
105105
106106
const summarizeDpeInfos = () => {
107107
const dpe = getAnalyzedDpe();
108108
/** @type {string} **/
109109
const methodeApplication = enums['methode_application_dpe_log'][dpe.logement.caracteristique_generale.enum_methode_application_dpe_log_id];
110-
console.log(methodeApplication);
111-
summaryDpeInfos = [];
110+
const chauffageDpeInfos = [];
111+
const ecsDpeInfos = [];
112+
const ventilationDpeInfos = [];
113+
const generalInfos = [];
114+
const logementInfos = [];
115+
const meteoInfos = [];
116+
generalInfos.push({label: toDpeInfoLabel('Version dpe', dpe.administratif.enum_version_id), color: 'teal'});
112117
113118
if (methodeApplication.includes('immeuble')) {
114-
summaryDpeInfos.push({label: 'Dpe immeuble', color: 'lime'});
119+
generalInfos.push({label: 'Dpe immeuble', color: 'teal'});
115120
}
116121
117122
if (methodeApplication.includes('individuel')) {
118123
if (methodeApplication.includes('maison')) {
119-
summaryDpeInfos.push({label: 'Maison individuelle', color: 'teal'});
124+
generalInfos.push({label: 'Maison individuelle', color: 'teal'});
120125
}
121126
if (methodeApplication.includes('appartement')) {
122-
summaryDpeInfos.push({label: 'Appartement individuel', color: 'teal'});
127+
generalInfos.push({label: 'Appartement individuel', color: 'teal'});
123128
}
124129
}
125130
131+
if (dpe.logement.caracteristique_generale.annee_construction) {
132+
logementInfos.push({label: toDpeInfoLabel('Année de construction', dpe.logement.caracteristique_generale.annee_construction ), color: 'amber'});
133+
}
134+
135+
logementInfos.push({label: toDpeInfoLabel('Période de construction', enums['periode_construction'][dpe.logement.caracteristique_generale.enum_periode_construction_id]), color: 'amber'});
136+
if (dpe.logement.caracteristique_generale.surface_habitable_logement) {
137+
logementInfos.push({label: toDpeInfoLabel('Surface logement', dpe.logement.caracteristique_generale.surface_habitable_logement, ''), color: 'amber'});
138+
}
139+
if (dpe.logement.caracteristique_generale.surface_habitable_immeuble) {
140+
logementInfos.push({label: toDpeInfoLabel('Surface immeuble', dpe.logement.caracteristique_generale.surface_habitable_immeuble, ''), color: 'amber'});
141+
}
142+
if (dpe.logement.caracteristique_generale.nombre_appartement) {
143+
logementInfos.push({label: toDpeInfoLabel('Nombre d\'appartements', dpe.logement.caracteristique_generale.nombre_appartement), color: 'amber'});
144+
}
145+
logementInfos.push({label: toDpeInfoLabel('Hauteur ss plafond', dpe.logement.caracteristique_generale.hsp, 'm'), color: 'amber'});
146+
147+
meteoInfos.push({label: toDpeInfoLabel('Zone climatique', enums['zone_climatique'][dpe.logement.meteo.enum_zone_climatique_id]), color: 'emerald'});
148+
meteoInfos.push({label: toDpeInfoLabel('Altitude', enums['classe_altitude'][dpe.logement.meteo.enum_classe_altitude_id]), color: 'emerald'});
149+
126150
if (methodeApplication.includes('chauffage')) {
127151
if (methodeApplication.includes('chauffage mixte')) {
128-
summaryDpeInfos.push({label: 'Chauffage mixte', color: 'indigo'});
152+
chauffageDpeInfos.push({label: 'Chauffage mixte', color: 'indigo'});
129153
}
130154
if (methodeApplication.includes('chauffage collectif')) {
131-
summaryDpeInfos.push({label: 'Chauffage collectif', color: 'indigo'});
155+
chauffageDpeInfos.push({label: 'Chauffage collectif', color: 'indigo'});
132156
}
133157
if (methodeApplication.includes('chauffage individuel')) {
134-
summaryDpeInfos.push({label: 'Chauffage individuel', color: 'indigo'});
158+
chauffageDpeInfos.push({label: 'Chauffage individuel', color: 'indigo'});
135159
}
136160
}
137-
summaryDpeInfos.push({label: `${dpe.logement.installation_chauffage_collection.installation_chauffage.length} installation(s) chauffage`, color: 'indigo'});
161+
chauffageDpeInfos.push({label: `${dpe.logement.installation_chauffage_collection?.installation_chauffage?.length || 0} installation(s) chauffage`, color: 'indigo'});
162+
const chauffagesGenDescriptions = dpe.logement
163+
.installation_chauffage_collection?.installation_chauffage?.flatMap(inst => inst.generateur_chauffage_collection
164+
.generateur_chauffage.map(gen => `générateur: ${enums['type_generateur_ch'][gen.donnee_entree.enum_type_generateur_ch_id]} (id: ${gen.donnee_entree.enum_type_generateur_ch_id})`));
165+
166+
const chauffagesEmetteurDescriptions = dpe.logement
167+
.installation_chauffage_collection?.installation_chauffage?.flatMap(inst => inst.emetteur_chauffage_collection
168+
.emetteur_chauffage.map(emetteur => `émetteur: ${enums['equipement_intermittence'][emetteur.donnee_entree.enum_equipement_intermittence_id]} (id: ${emetteur.donnee_entree.enum_equipement_intermittence_id})`));
169+
170+
chauffagesGenDescriptions.forEach(chauffagesGenDescription => {
171+
chauffageDpeInfos.push({label: chauffagesGenDescription, color: 'indigo'});
172+
});
173+
174+
chauffagesEmetteurDescriptions.forEach(chauffagesEmetteurDescription => {
175+
chauffageDpeInfos.push({label: chauffagesEmetteurDescription, color: 'indigo'});
176+
});
138177
139178
if (methodeApplication.includes('ecs')) {
140179
if (methodeApplication.includes('ecs mixte')) {
141-
summaryDpeInfos.push({label: 'Ecs mixte', color: 'fuchsia'});
180+
ecsDpeInfos.push({label: 'Ecs mixte', color: 'fuchsia'});
142181
}
143182
if (methodeApplication.includes('ecs collectif')) {
144-
summaryDpeInfos.push({label: 'Ecs collectif', color: 'fuchsia'});
183+
ecsDpeInfos.push({label: 'Ecs collectif', color: 'fuchsia'});
145184
}
146185
if (methodeApplication.includes('ecs individuel')) {
147-
summaryDpeInfos.push({label: 'Ecs individuel', color: 'fuchsia'});
186+
ecsDpeInfos.push({label: 'Ecs individuel', color: 'fuchsia'});
148187
}
149188
}
150-
summaryDpeInfos.push({label: `${dpe.logement.installation_ecs_collection.installation_ecs.length} installation(s) ecs`, color: 'fuchsia'});
189+
ecsDpeInfos.push({label: `${dpe.logement.installation_ecs_collection?.installation_ecs.length || 0} installation(s) ecs`, color: 'fuchsia'});
190+
191+
const ecsGenDescriptions = dpe.logement
192+
.installation_ecs_collection?.installation_ecs?.flatMap(inst => inst.generateur_ecs_collection
193+
.generateur_ecs.map(gen => `générateur: ${enums['type_generateur_ecs'][gen.donnee_entree.enum_type_generateur_ecs_id]} (id: ${gen.donnee_entree.enum_type_generateur_ecs_id})`));
194+
195+
ecsGenDescriptions.forEach(ecsGenDescription => {
196+
ecsDpeInfos.push({label: ecsGenDescription, color: 'fuchsia'});
197+
});
198+
199+
ventilationDpeInfos.push({label: `${dpe.logement.ventilation_collection?.ventilation.length || 0} installation(s) ventilation`, color: 'sky'});
200+
201+
const ventilationDescriptions = dpe.logement
202+
.ventilation_collection?.ventilation?.map(ventilation => `${enums['type_ventilation'][ventilation.donnee_entree.enum_type_ventilation_id]} (id: ${ventilation.donnee_entree.enum_type_ventilation_id})`);
203+
ventilationDescriptions.forEach(ventilationDescription => {
204+
ventilationDpeInfos.push({label: ventilationDescription, color: 'sky'});
205+
});
151206
152-
summaryDpeInfos.push({label: `${dpe.logement.ventilation_collection.ventilation.length} installation(s) ventilation`, color: 'sky'});
207+
dpeInfos.push(generalInfos);
208+
dpeInfos.push(logementInfos);
209+
dpeInfos.push(meteoInfos);
210+
dpeInfos.push(chauffageDpeInfos);
211+
dpeInfos.push(ecsDpeInfos);
212+
dpeInfos.push(ventilationDpeInfos);
213+
}
214+
215+
/**
216+
* @param label {string}
217+
* @param value {any}
218+
* @param suffix {string?}
219+
*/
220+
function toDpeInfoLabel(label, value, suffix = '') {
221+
return `${label} :&nbsp;<span class="font-bold underline">${value} ${suffix}</span>`;
153222
}
154223
155224
</script>
@@ -185,9 +254,15 @@
185254
<p class="text-xs text-gray-500 dark:text-gray-400">Format XML uniquement</p>
186255
</Dropzone>
187256
{:else}
188-
<div class="flex gap-3">
189-
{#each summaryDpeInfos as info}
190-
<Badge large color="{info.color}">{info.label}</Badge>
257+
<div class="flex gap-3 justify-start">
258+
{#each dpeInfos as info}
259+
<div>
260+
{#each info as dpeInfo}
261+
<div class="pt-1">
262+
<Badge large color="{dpeInfo.color}">{@html dpeInfo.label}</Badge>
263+
</div>
264+
{/each}
265+
</div>
191266
{/each}
192267
</div>
193268

0 commit comments

Comments
 (0)