SPB Git

Repository Public

taxonomy.ts 12.7 KB 223 lines typescript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : Vrai-Prix8 * File             : src/lib/cost/taxonomy.ts9 * Module           : lib10 * Repository       : https://git.spboucher.ai/vrai-prix11 * Created          : 2026-09-0812 * Last Modified    : 2026-09-0813 *14 * Author           : Simon-Pierre Boucher15 * Position         : Professor of Finance16 * Institution      : Université du Québec en Outaouais (UQO)17 * Organization     : SP Boucher18 * Website          : https://spboucher.ai19 * Git              : https://git.spboucher.ai20 *21 * Preferred Contact: contact@spboucher.ai22 * Development      : dev@spboucher.ai23 * Support          : support@spboucher.ai24 * Security/Admin   : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License          : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142/**43 * Taxonomie de la méthode du coût : divisions MasterFormat, catégories UX,44 * qualités, conditions, matériaux normalisés, métiers, règles de dépréciation.45 * Module PUR (client + serveur).46 */47import type { Condition, Quality, UxCategory, BuildingType, IndirectParams, CostParams } from "./types";4849export const METHOD_VERSION = "1.0.0";5051/** Divisions CSI MasterFormat retenues. */52export const MASTERFORMAT: Record<string, { fr: string; en: string }> = {53  "01": { fr: "Exigences générales", en: "General Requirements" },54  "02": { fr: "Conditions existantes", en: "Existing Conditions" },55  "03": { fr: "Béton", en: "Concrete" },56  "04": { fr: "Maçonnerie", en: "Masonry" },57  "05": { fr: "Métaux", en: "Metals" },58  "06": { fr: "Bois, plastiques et composites", en: "Wood, Plastics and Composites" },59  "07": { fr: "Isolation et étanchéité", en: "Thermal and Moisture Protection" },60  "08": { fr: "Ouvertures", en: "Openings" },61  "09": { fr: "Finitions", en: "Finishes" },62  "10": { fr: "Ouvrages spéciaux", en: "Specialties" },63  "11": { fr: "Équipement", en: "Equipment" },64  "12": { fr: "Ameublement", en: "Furnishings" },65  "21": { fr: "Protection incendie", en: "Fire Suppression" },66  "22": { fr: "Plomberie", en: "Plumbing" },67  "23": { fr: "CVCA", en: "HVAC" },68  "26": { fr: "Électricité", en: "Electrical" },69  "31": { fr: "Terrassement", en: "Earthwork" },70  "32": { fr: "Aménagements extérieurs", en: "Exterior Improvements" },71  "33": { fr: "Services publics", en: "Utilities" },72};7374export const UX_CATEGORIES: { key: UxCategory; fr: string; en: string; order: number }[] = [75  { key: "site", fr: "Préparation du site", en: "Site preparation", order: 1 },76  { key: "excavation", fr: "Excavation", en: "Excavation", order: 2 },77  { key: "foundation", fr: "Fondations", en: "Foundations", order: 3 },78  { key: "structure", fr: "Structure", en: "Structure", order: 4 },79  { key: "roofing", fr: "Toiture", en: "Roofing", order: 5 },80  { key: "envelope", fr: "Enveloppe", en: "Envelope", order: 6 },81  { key: "openings", fr: "Portes et fenêtres", en: "Doors and windows", order: 7 },82  { key: "insulation", fr: "Isolation", en: "Insulation", order: 8 },83  { key: "finishes_ext", fr: "Revêtements", en: "Cladding", order: 9 },84  { key: "interior", fr: "Finition intérieure", en: "Interior finishes", order: 10 },85  { key: "kitchen", fr: "Cuisine", en: "Kitchen", order: 11 },86  { key: "bathroom", fr: "Salle de bain", en: "Bathroom", order: 12 },87  { key: "plumbing", fr: "Plomberie", en: "Plumbing", order: 13 },88  { key: "hvac", fr: "Chauffage / ventilation", en: "HVAC", order: 14 },89  { key: "electrical", fr: "Électricité", en: "Electrical", order: 15 },90  { key: "garage", fr: "Garage", en: "Garage", order: 16 },91  { key: "basement", fr: "Sous-sol", en: "Basement", order: 17 },92  { key: "exterior", fr: "Aménagement extérieur", en: "Exterior improvements", order: 18 },93];9495export const categoryLabel = (key: UxCategory, fr: boolean): string => {96  const c = UX_CATEGORIES.find((x) => x.key === key);97  return c ? (fr ? c.fr : c.en) : key;98};99100export const QUALITIES: { key: Quality; fr: string; en: string }[] = [101  { key: "economy", fr: "Économique", en: "Economy" },102  { key: "standard", fr: "Standard", en: "Standard" },103  { key: "superior", fr: "Supérieur", en: "Superior" },104  { key: "prestige", fr: "Prestige", en: "Prestige" },105];106107export const CONDITIONS: { key: Condition; fr: string; en: string; effectiveAgeRatio: number }[] = [108  { key: "poor", fr: "Mauvais", en: "Poor", effectiveAgeRatio: 0.85 },109  { key: "below_average", fr: "Sous la moyenne", en: "Below average", effectiveAgeRatio: 0.7 },110  { key: "average", fr: "Moyen", en: "Average", effectiveAgeRatio: 0.55 },111  { key: "good", fr: "Bon", en: "Good", effectiveAgeRatio: 0.35 },112  { key: "very_good", fr: "Très bon", en: "Very good", effectiveAgeRatio: 0.2 },113  { key: "excellent", fr: "Excellent", en: "Excellent", effectiveAgeRatio: 0.1 },114  { key: "renovated", fr: "Rénové", en: "Renovated", effectiveAgeRatio: 0.12 },115  { key: "new", fr: "Neuf", en: "New", effectiveAgeRatio: 0.0 },116];117118/**119 * Règles condition → âge effectif d'une composante (component_condition_rules,120 * §144). L'âge effectif = ratio × vie économique de la composante. Hypothèses121 * documentées, modifiables en base (table `component_condition_rules`).122 */123export const CONDITION_GROUPS: { key: string; fr: string; en: string; economicLife: number }[] = [124  { key: "structure", fr: "Structure et fondations", en: "Structure and foundations", economicLife: 75 },125  { key: "roof", fr: "Toiture", en: "Roof", economicLife: 22 },126  { key: "exterior", fr: "Enveloppe et revêtements", en: "Envelope and cladding", economicLife: 40 },127  { key: "windows", fr: "Portes et fenêtres", en: "Doors and windows", economicLife: 30 },128  { key: "interior", fr: "Finition intérieure", en: "Interior finishes", economicLife: 25 },129  { key: "kitchen", fr: "Cuisine", en: "Kitchen", economicLife: 20 },130  { key: "bathroom", fr: "Salles de bain", en: "Bathrooms", economicLife: 22 },131  { key: "mechanical", fr: "Mécanique (plomberie, CVCA)", en: "Mechanical (plumbing, HVAC)", economicLife: 22 },132  { key: "electrical", fr: "Électricité", en: "Electrical", economicLife: 35 },133  { key: "site", fr: "Site et extérieur", en: "Site and exterior", economicLife: 25 },134];135136export const BUILDING_TYPES: { key: BuildingType; fr: string; en: string; economicLife: number }[] = [137  { key: "detached", fr: "Maison unifamiliale détachée", en: "Detached single-family", economicLife: 60 },138  { key: "semi_detached", fr: "Jumelé", en: "Semi-detached", economicLife: 60 },139  { key: "row", fr: "Maison en rangée", en: "Row house", economicLife: 60 },140  { key: "plex", fr: "Plex (2-5 logements)", en: "Plex (2-5 units)", economicLife: 60 },141  { key: "condo", fr: "Condo (unité)", en: "Condo (unit)", economicLife: 60 },142  { key: "chalet", fr: "Chalet", en: "Cottage", economicLife: 50 },143  { key: "mobile", fr: "Maison mobile", en: "Mobile home", economicLife: 35 },144  { key: "other", fr: "Autre", en: "Other", economicLife: 55 },145];146147/** Métiers (codes internes) ↔ libellés APCHQ/CCQ. */148export const TRADES: { code: string; fr: string; en: string; apchq: string[] }[] = [149  { code: "charpentier", fr: "Charpentier-menuisier", en: "Carpenter", apchq: ["Charpentier-menuisier"] },150  { code: "briqueteur", fr: "Briqueteur-maçon", en: "Bricklayer-mason", apchq: ["Briqueteur-maçon"] },151  { code: "carreleur", fr: "Carreleur", en: "Tile setter", apchq: ["Carreleur"] },152  { code: "cimentier", fr: "Cimentier-applicateur", en: "Cement finisher", apchq: ["Cimentier-applicateur"] },153  { code: "coffreur", fr: "Coffreur à béton", en: "Concrete formworker", apchq: ["Coffreur à béton"] },154  { code: "couvreur", fr: "Couvreur", en: "Roofer", apchq: ["Couvreur"] },155  { code: "electricien", fr: "Électricien", en: "Electrician", apchq: ["Électricien", "Electricien"] },156  { code: "plombier", fr: "Tuyauteur (plombier)", en: "Pipefitter (plumber)", apchq: ["Tuyauteur", "Plombier"] },157  { code: "ferblantier", fr: "Ferblantier", en: "Sheet-metal worker", apchq: ["Ferblantier"] },158  { code: "frigoriste", fr: "Frigoriste", en: "Refrigeration mechanic", apchq: ["Frigoriste"] },159  { code: "peintre", fr: "Peintre", en: "Painter", apchq: ["Peintre"] },160  { code: "platrier", fr: "Plâtrier (tireur de joints)", en: "Plasterer (taper)", apchq: ["Plâtrier", "Platrier"] },161  { code: "poseur_systemes", fr: "Poseur de systèmes intérieurs", en: "Interior systems installer", apchq: ["Poseur de systèmes intérieurs", "Poseur de systemes interieurs"] },162  { code: "poseur_revetements", fr: "Poseur de revêtements souples", en: "Floor-covering installer", apchq: ["Poseur de revêtements souples", "Poseur de revetements souples"] },163  { code: "calorifugeur", fr: "Calorifugeur", en: "Insulator", apchq: ["Calorifugeur"] },164  { code: "ferrailleur", fr: "Ferrailleur", en: "Rebar worker", apchq: ["Ferrailleur"] },165  { code: "vitrier", fr: "Monteur-mécanicien (vitrier)", en: "Glazier", apchq: ["Monteur-mécanicien (vitrier)", "Vitrier"] },166  { code: "manoeuvre", fr: "Manœuvre", en: "Labourer", apchq: ["Manœuvre", "Manoeuvre"] },167  { code: "operateur", fr: "Opérateur de pelles mécaniques", en: "Excavator operator", apchq: ["Opérateur de pelles mécaniques", "Operateur de pelles mecaniques", "Opérateur de pelles"] },168  { code: "poseur_bardeaux", fr: "Poseur de bardeaux", en: "Shingle installer", apchq: ["Couvreur"] },169];170171export const tradeLabel = (code: string | null, fr: boolean): string => {172  const t = TRADES.find((x) => x.code === code);173  return t ? (fr ? t.fr : t.en) : (code ?? "—");174};175176/**177 * Paramètres par défaut — HYPOTHÈSES DOCUMENTÉES (aucun pourcentage n'est178 * universel) : visibles, modifiables et expliqués dans l'interface.179 */180export const DEFAULT_INDIRECT: IndirectParams = {181  plansPct: 3.0,182  permitsPct: 0.8,183  inspectionPct: 0.5,184  insurancePct: 1.5,185  mobilizationPct: 1.5,186  siteManagementPct: 3.0,187  financingPct: 2.0,188  adminPct: 1.0,189};190191export const DEFAULT_PARAMS: CostParams = {192  indirect: DEFAULT_INDIRECT,193  overheadPct: 7.0,194  profitPct: 8.0,195  contingencyPct: 3.0,196};197198export const INDIRECT_LABELS: Record<keyof IndirectParams, { fr: string; en: string; noteFr: string }> = {199  plansPct: { fr: "Plans et professionnels", en: "Plans and professionals", noteFr: "Architecte/technologue, ingénieur, arpenteur — hypothèse 3 % du coût direct." },200  permitsPct: { fr: "Permis", en: "Permits", noteFr: "Permis de construction municipal — hypothèse 0,8 %." },201  inspectionPct: { fr: "Inspection et essais", en: "Inspection and testing", noteFr: "Inspections, essais de sol/béton — hypothèse 0,5 %." },202  insurancePct: { fr: "Assurances chantier", en: "Builder's insurance", noteFr: "Assurance chantier et responsabilité — hypothèse 1,5 %." },203  mobilizationPct: { fr: "Mobilisation", en: "Mobilization", noteFr: "Roulotte, clôture, installations temporaires — hypothèse 1,5 %." },204  siteManagementPct: { fr: "Gestion de chantier", en: "Site management", noteFr: "Surintendant, coordination — hypothèse 3 %." },205  financingPct: { fr: "Financement", en: "Financing", noteFr: "Intérêts intercalaires pendant la construction — hypothèse 2 %." },206  adminPct: { fr: "Administration", en: "Administration", noteFr: "Frais administratifs du projet — hypothèse 1 %." },207};208209/** Matériaux normalisés (taxonomie canonique renvoyée par l'IA et l'UI). */210export const MATERIALS = [211  "quartz", "granite", "laminate", "butcher_block", "solid_surface", "marble",212  "hardwood", "engineered_wood", "vinyl_plank", "laminate_floor", "ceramic_tile", "porcelain_tile", "carpet", "concrete_floor",213  "brick", "stone", "vinyl_siding", "fiber_cement", "wood_siding", "stucco", "aluminum_siding", "steel_siding",214  "asphalt_shingle", "metal_roof", "elastomeric_membrane", "epdm", "cedar_shake",215  "pvc_window", "hybrid_window", "aluminum_window", "wood_window",216  "poured_concrete", "concrete_block", "stone_foundation",217  "melamine", "thermofoil", "painted_mdf", "wood_veneer", "solid_wood",218] as const;219export type Material = (typeof MATERIALS)[number];220221/** Économie de lecture des cuisines : pieds linéaires d'armoires typiques par qualité. */222export const KITCHEN_LINEAR_FT: Record<Quality, number> = { economy: 20, standard: 26, superior: 32, prestige: 40 };223
Files main
Menu

Theme