Skip to content

Commit f7290d9

Browse files
author
Jérôme GAVIGNET
committed
feat: Add preprocessing for epaisseur_structure on mur
1 parent ccd81e5 commit f7290d9

34 files changed

+3454
-558
lines changed

index.d.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
declare namespace DpeValidator {
2-
class DpeValidator {
3-
validate(dpe: FullDpe): ValidationError[];
4-
}
1+
import { Dpe } from './src/dpe/domain/models/dpe.model';
52

6-
class DpeComparator {
7-
compare(firstDpe: FullDpe, secondDpe: FullDpe): ValidationError[];
3+
declare namespace DpePreProcessor {
4+
class DpePreProcessor {
5+
preprocess(dpe: Dpe): void;
86
}
97
}
108

11-
export = DpeValidator;
9+
export = DpePreProcessor;

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { DpePreProcessor } from './src/index.js';
2+
3+
export { DpePreProcessor };

src/core/utils.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Retrieve a number describing a thickness from the description
3+
* @param description string in which to get the number
4+
* @returns {number} if found, 0 otherwise
5+
*/
6+
export function getThicknessFromDescription(description) {
7+
if (!description) {
8+
return 0;
9+
}
10+
11+
const matching = description.match(/(\d+) cm/);
12+
return matching && matching.length > 1 ? Number.parseFloat(matching[1]) : 0;
13+
}

src/core/utils.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { getThicknessFromDescription } from './utils.js';
2+
import { describe, expect, it } from 'vitest';
3+
4+
describe('Utils unit tests', () => {
5+
it.each([
6+
[0, null],
7+
[0, undefined],
8+
[0, ''],
9+
[0, 'Mur en blocs de béton creux'],
10+
[0, "Mur en blocs de béton creux d'épaisseur xxx cm non isolé"],
11+
[4, "Mur en blocs de béton creux d'épaisseur 4 cm non isolé"],
12+
[25, "Mur en blocs de béton creux d'''épaisseur ≥ 25 cm non isolé"]
13+
])('should get thickness %s from description %s', (thickness, description) => {
14+
expect(getThicknessFromDescription(description)).toBe(thickness);
15+
});
16+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export interface BaieEts {
2+
donnee_entree?: BaieEtsDE;
3+
}
4+
5+
export interface BaieEtsDE {
6+
description?: string;
7+
reference?: string;
8+
enum_orientation_id?: number;
9+
enum_inclinaison_vitrage_id?: number; // ENUM inclinaison_vitrage
10+
surface_totale_baie?: number;
11+
nb_baie?: number;
12+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
export interface BaieVitree {
2+
donnee_entree?: BaieVitreeDE;
3+
donnee_intermediaire?: BaieVitreeDI;
4+
baie_vitree_double_fenetre?: BaieVitreeDoubleFenetre;
5+
}
6+
7+
export interface BaieVitreeDE {
8+
description?: string;
9+
reference?: string;
10+
reference_paroi?: string;
11+
reference_lnc?: string;
12+
tv_coef_reduction_deperdition_id?: string; // TV
13+
surface_aiu?: number;
14+
surface_aue?: number;
15+
enum_cfg_isolation_lnc_id?: string; // ENUM cfg_isolation_lnc
16+
enum_type_adjacence_id?: string; // ENUM type_adjacence
17+
surface_totale_baie?: number;
18+
nb_baie?: number;
19+
tv_ug_id?: string; // TV
20+
enum_type_vitrage_id?: string; // ENUM type_vitrage
21+
enum_inclinaison_vitrage_id?: string; // ENUM inclinaison_vitrage
22+
enum_type_gaz_lame_id?: string; // ENUM type_gaz_lame
23+
epaisseur_lame?: number;
24+
vitrage_vir?: boolean;
25+
enum_methode_saisie_perf_vitrage_id?: string; // ENUM methode_saisie_perf_vitrage
26+
ug_saisi?: number;
27+
tv_uw_id?: string;
28+
enum_type_materiaux_menuiserie_id?: string; // ENUM type_materiaux_menuiserie
29+
enum_type_baie_id?: string; // ENUM type_baie
30+
uw_saisi?: number;
31+
double_fenetre?: boolean;
32+
uw_1?: number;
33+
sw_1?: number;
34+
uw_2?: number;
35+
sw_2?: number;
36+
tv_deltar_id?: string;
37+
tv_ujn_id?: string;
38+
enum_type_fermeture_id?: string;
39+
presence_protection_solaire_hors_fermeture?: boolean;
40+
ujn_saisi?: number;
41+
presence_retour_isolation?: boolean;
42+
presence_joint?: boolean;
43+
largeur_dormant?: number;
44+
tv_sw_id?: string;
45+
sw_saisi?: number;
46+
enum_type_pose_id?: string; // ENUM type_pose
47+
enum_orientation_id?: string;
48+
tv_coef_masque_proche_id?: string;
49+
tv_coef_masque_lointain_homogene_id?: string;
50+
masque_lointain_non_homogene_collection: {
51+
masque_lointain_non_homogene: {
52+
tv_coef_masque_lointain_non_homogene_id?: string; // TV
53+
};
54+
}[];
55+
}
56+
57+
export interface BaieVitreeDI {
58+
b: number;
59+
ug?: number;
60+
uw: number;
61+
ujn?: number;
62+
u_menuiserie: number;
63+
sw: number;
64+
fe1: number;
65+
fe2: number;
66+
}
67+
68+
export interface BaieVitreeDoubleFenetre {
69+
donnee_entree?: BaieVitreeDoubleFenetreDE;
70+
donnee_intermediaire?: BaieVitreeDoubleFenetreDI;
71+
}
72+
73+
export interface BaieVitreeDoubleFenetreDE {
74+
tv_ug_id?: string;
75+
enum_type_vitrage_id: string;
76+
enum_inclinaison_vitrage_id: string;
77+
enum_type_gaz_lame_id?: string;
78+
epaisseur_lame?: number;
79+
vitrage_vir?: boolean;
80+
enum_methode_saisie_perf_vitrage_id: string;
81+
ug_saisi?: number;
82+
tv_uw_id?: string;
83+
enum_type_materiaux_menuiserie_id: string;
84+
enum_type_baie_id: string;
85+
uw_saisi?: number;
86+
tv_sw_id?: string;
87+
sw_saisi?: number;
88+
enum_type_pose_id: string;
89+
}
90+
91+
export interface BaieVitreeDoubleFenetreDI {
92+
ug?: number;
93+
uw: number;
94+
sw: number;
95+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export interface Climatisation {
2+
donnee_entree?: ClimatisationDE;
3+
donnee_intermediaire?: ClimatisationDI;
4+
}
5+
6+
export interface ClimatisationDE {
7+
description?: string;
8+
reference: string;
9+
tv_seer_id?: number;
10+
nombre_logement_echantillon?: number;
11+
enum_methode_calcul_conso_id: number;
12+
enum_periode_installation_fr_id: number;
13+
cle_repartition_clim?: number;
14+
enum_type_generateur_fr_id: number;
15+
enum_type_energie_id?: number;
16+
enum_methode_saisie_carac_sys_id: number;
17+
ref_produit_fr?: string;
18+
}
19+
20+
export interface ClimatisationDI {
21+
eer: number;
22+
besoin_fr: number;
23+
conso_fr: number;
24+
conso_fr_depensier: number;
25+
}

src/dpe/domain/models/dpe.model.ts

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
import { Mur } from './mur.model';
2+
import { Porte } from './porte.model';
3+
import { PlancherBas } from './plancher-bas.model';
4+
import { PlancherHaut } from './plancher-haut.model';
5+
import { BaieVitree } from './baie-vitree.model';
6+
import { Ets } from './ets.model';
7+
import { PontThermique } from './pont-thermique.model';
8+
import { Ventilation } from './ventilation.model';
9+
import { Climatisation } from './climatisation.model';
10+
import { ProductionElecEnr } from './production-elec-enr.model';
11+
import { InstallationEcs } from './installation-ecs.model';
12+
import { InstallationChauffage } from './installation-chauffage.model';
13+
import { Sortie } from './sortie.model';
14+
15+
/**
16+
* @see https://gitlab.com/observatoire-dpe/observatoire-dpe/-/blob/master/modele_donnee/DPE_complet.xsd?ref_type=heads
17+
*/
18+
export interface Dpe {
19+
hashkey: string;
20+
id: string;
21+
version: string;
22+
numero_dpe: string;
23+
statut: string;
24+
administratif: Administratif;
25+
dpe_immeuble?: DpeImmeuble;
26+
logement?: Logement;
27+
tertiaire?: Tertiaire;
28+
logement_neuf?: LogementNeuf;
29+
descriptif_enr_collection: any; // Pas traité pour l'instant
30+
descriptif_simplifie_collection: any; // Pas traité pour l'instant
31+
fiche_technique_collection: any; // Pas traité pour l'instant
32+
justificatif_collection: any; // Pas traité pour l'instant
33+
descriptif_geste_entretien_collection: any; // Pas traité pour l'instant
34+
descriptif_travaux: any; // Pas traité pour l'instant
35+
}
36+
37+
export interface Administratif {
38+
dpe_a_remplacer?: string;
39+
reference_interne_projet?: string;
40+
motif_remplacement?: string;
41+
dpe_immeuble_associe?: string;
42+
enum_version_id: string;
43+
date_visite_diagnostiqueur: string;
44+
nom_proprietaire?: string;
45+
siren_proprietaire?: string;
46+
nom_proprietaire_installation_commune?: string;
47+
date_etablissement_dpe: string;
48+
enum_modele_dpe_id: string;
49+
diagnostiqueur: Diagnostiqueur;
50+
geolocalisation: Geolocalisation;
51+
consentement_proprietaire?: boolean;
52+
information_consentement_proprietaire?: InformationConsentementProprietaire;
53+
}
54+
55+
export interface Diagnostiqueur {
56+
usr_logiciel_id: string;
57+
version_logiciel: string;
58+
version_moteur_calcul?: string;
59+
nom_diagnostiqueur: string;
60+
prenom_diagnostiqueur: string;
61+
mail_diagnostiqueur: string;
62+
telephone_diagnostiqueur: string;
63+
adresse_diagnostiqueur: string;
64+
entreprise_diagnostiqueur: string;
65+
numero_certification_diagnostiqueur: string;
66+
organisme_certificateur: string;
67+
}
68+
69+
export interface DpeImmeuble {
70+
logement_visite_collection: LogementVisite[];
71+
}
72+
73+
export interface LogementVisite {
74+
description: string;
75+
enum_position_etage_logement_id: string;
76+
enum_typologie_logement_id: string;
77+
surface_habitable_logement: number;
78+
}
79+
80+
export interface Geolocalisation {
81+
invar_logement?: string;
82+
numero_fiscal_local?: string;
83+
id_batiment_rnb?: string;
84+
rpls_log_id?: string;
85+
rpls_org_id?: string;
86+
idpar?: string;
87+
immatriculation_copropriete?: string;
88+
adresses?: {
89+
adresse_bien: Adresse;
90+
adresse_proprietaire: Adresse;
91+
adresse_proprietaire_installation_commune: Adresse;
92+
};
93+
}
94+
95+
export interface Adresse {
96+
adresse_brut: string;
97+
code_postal_brut: string;
98+
nom_commune_brut: string;
99+
label_brut: string;
100+
label_brut_avec_complement: string;
101+
enum_statut_geocodage_ban_id: string;
102+
ban_date_appel: string;
103+
ban_id?: string;
104+
ban_id_ban_adresse?: string;
105+
ban_label?: string;
106+
ban_housenumber?: string;
107+
ban_street?: string;
108+
ban_citycode?: string;
109+
ban_postcode?: string;
110+
ban_city?: string;
111+
ban_type?: string;
112+
ban_score?: string;
113+
ban_x?: string;
114+
compl_nom_residence?: string;
115+
compl_ref_batiment?: string;
116+
compl_etage_appartement?: string;
117+
compl_ref_cage_escalier?: string;
118+
compl_ref_logement?: string;
119+
}
120+
121+
export interface InformationConsentementProprietaire {
122+
nom_proprietaire: string;
123+
personne_morale: boolean;
124+
siren_proprietaire?: string;
125+
telephone?: string;
126+
mail?: string;
127+
label_adresse: string;
128+
label_adresse_avec_complement: string;
129+
}
130+
131+
export interface CaracteristiqueGenerale {
132+
annee_construction?: number;
133+
enum_periode_construction_id: number;
134+
enum_methode_application_dpe_log_id: number;
135+
enum_calcul_echantillonnage_id?: number;
136+
surface_habitable_logement?: number;
137+
nombre_niveau_immeuble?: number;
138+
nombre_niveau_logement?: number;
139+
hsp: number;
140+
surface_habitable_immeuble?: number;
141+
surface_tertiaire_immeuble?: number;
142+
nombre_appartement?: number;
143+
appartement_non_visite: boolean;
144+
}
145+
146+
export interface Meteo {
147+
enum_zone_climatique_id?: number;
148+
altitude: number;
149+
enum_classe_altitude_id: number;
150+
batiment_materiaux_anciens: boolean;
151+
}
152+
153+
export interface Logement {
154+
caracteristique_generale: CaracteristiqueGenerale;
155+
meteo: Meteo;
156+
enveloppe: Enveloppe;
157+
ventilation_collection: { ventilation: Ventilation[] };
158+
climatisation_collection: { climatisation: Climatisation[] };
159+
production_elec_enr?: ProductionElecEnr;
160+
installation_ecs_collection: { installation_ecs: InstallationEcs[] };
161+
installation_chauffage_collection: { installation_chauffage: InstallationChauffage[] };
162+
sortie: Sortie;
163+
}
164+
165+
export interface Tertiaire extends Logement {}
166+
167+
export interface LogementNeuf extends Logement {}
168+
169+
export interface Enveloppe {
170+
inertie: {
171+
inertie_plancher_bas_lourd: boolean;
172+
inertie_plancher_haut_lourd: boolean;
173+
inertie_paroi_verticale_lourd: boolean;
174+
enum_classe_inertie_id: number;
175+
};
176+
mur_collection: { mur: Mur[] };
177+
plancher_bas_collection: { plancher_bas: PlancherBas[] };
178+
plancher_haut_collection: { plancher_haut: PlancherHaut[] };
179+
baie_vitree_collection: { baie_vitree: BaieVitree[] };
180+
porte_collection: { porte: Porte[] };
181+
ets_collection: { ets: Ets };
182+
pont_thermique_collection: { pont_thermique: PontThermique[] };
183+
}

src/dpe/domain/models/ets.model.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { BaieEts } from './baie-ets.model';
2+
3+
export interface Ets {
4+
donnee_entree?: EtsDE;
5+
donnee_intermediaire?: EtsDI;
6+
baie_ets_collection?: { baie_ets: BaieEts[] };
7+
}
8+
9+
export interface EtsDE {
10+
description?: string;
11+
reference: string;
12+
tv_coef_reduction_deperdition_id?: number; // TV
13+
enum_cfg_isolation_lnc_id?: number; // ENUM cfg_isolation_lnc
14+
tv_coef_transparence_ets_id: number; // TV
15+
}
16+
17+
export interface EtsDI {
18+
coef_transparence_ets: number;
19+
bver: number;
20+
}

0 commit comments

Comments
 (0)