[2026-08-11 06:42:05] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj, ROUND(SUM(em.no2_kg)::numeric, 4) AS no2_kg, ROUND(SUM(ext.c6h6_kg)::numeric, 4) AS c6h6_kg, ROUND(SUM(ext.butadiene_kg)::numeric, 4) AS butadiene_kg, ROUND(SUM(ext.bap_kg)::numeric, 4) AS bap_kg, ROUND(SUM(ext.bbf_kg)::numeric, 4) AS bbf_kg, ROUND(SUM(ext.bkf_kg)::numeric, 4) AS bkf_kg, ROUND(SUM(ext.indpy_kg)::numeric, 4) AS indpy_kg, ROUND(SUM(ext.pcddf_kg)::numeric, 4) AS pcddf_kg from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" left join \"observatoire\".\"agg_epci_extended\" as \"ext\" on \"ext\".\"year_id\" = \"em\".\"year_id\" and \"ext\".\"geo_id\" = \"em\".\"geo_id\" and \"ext\".\"activity_id\" = \"em\".\"activity_id\" and \"ext\".\"fuel_id\" = \"em\".\"fuel_id\" and \"ext\".\"usage_id\" = \"em\".\"usage_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-2074645457) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 06:42:05] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj, ROUND(SUM(em.no2_kg)::numeric, 4) AS no2_kg, ROUND(SUM(ext.c6h6_kg)::numeric, 4) AS c6h6_kg, ROUND(SUM(ext.butadiene_kg)::numeric, 4) AS butadiene_kg, ROUND(SUM(ext.bap_kg)::numeric, 4) AS bap_kg, ROUND(SUM(ext.bbf_kg)::numeric, 4) AS bbf_kg, ROUND(SUM(ext.bkf_kg)::numeric, 4) AS bkf_kg, ROUND(SUM(ext.indpy_kg)::numeric, 4) AS indpy_kg, ROUND(SUM(ext.pcddf_kg)::numeric, 4) AS pcddf_kg from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" left join \"observatoire\".\"agg_epci_extended\" as \"ext\" on \"ext\".\"year_id\" = \"em\".\"year_id\" and \"ext\".\"geo_id\" = \"em\".\"geo_id\" and \"ext\".\"activity_id\" = \"em\".\"activity_id\" and \"ext\".\"fuel_id\" = \"em\".\"fuel_id\" and \"ext\".\"usage_id\" = \"em\".\"usage_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-2074645457) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 06:42:16] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj, ROUND(SUM(em.no2_kg)::numeric, 4) AS no2_kg, ROUND(SUM(ext.c6h6_kg)::numeric, 4) AS c6h6_kg, ROUND(SUM(ext.butadiene_kg)::numeric, 4) AS butadiene_kg, ROUND(SUM(ext.bap_kg)::numeric, 4) AS bap_kg, ROUND(SUM(ext.bbf_kg)::numeric, 4) AS bbf_kg, ROUND(SUM(ext.bkf_kg)::numeric, 4) AS bkf_kg, ROUND(SUM(ext.indpy_kg)::numeric, 4) AS indpy_kg, ROUND(SUM(ext.pcddf_kg)::numeric, 4) AS pcddf_kg from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" left join \"observatoire\".\"agg_epci_extended\" as \"ext\" on \"ext\".\"year_id\" = \"em\".\"year_id\" and \"ext\".\"geo_id\" = \"em\".\"geo_id\" and \"ext\".\"activity_id\" = \"em\".\"activity_id\" and \"ext\".\"fuel_id\" = \"em\".\"fuel_id\" and \"ext\".\"usage_id\" = \"em\".\"usage_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-2074645457) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 06:42:27] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":"epci","years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t_parent.name, '(non rattaché)') AS territoire_parent, COALESCE(t.name, '(non rattaché)') AS territoire, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317, 1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_parent\" on \"dtm_parent\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_parent\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t_parent\" on \"t_parent\".\"id\" = \"dtm_parent\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire_parent\", \"territoire\", \"v\".\"name\""} 
[2026-08-11 06:42:27] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":"epci","years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t_parent.name, '(non rattaché)') AS territoire_parent, COALESCE(t.name, '(non rattaché)') AS territoire, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317, 1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_parent\" on \"dtm_parent\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_parent\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t_parent\" on \"t_parent\".\"id\" = \"dtm_parent\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire_parent\", \"territoire\", \"v\".\"name\""} 
[2026-08-11 06:42:47] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":"epci","years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t_parent.name, '(non rattaché)') AS territoire_parent, COALESCE(t.name, '(non rattaché)') AS territoire, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317, 1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_parent\" on \"dtm_parent\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_parent\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t_parent\" on \"t_parent\".\"id\" = \"dtm_parent\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire_parent\", \"territoire\", \"v\".\"name\""} 
[2026-08-11 06:44:09] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":"epci","years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t_parent.name, '(non rattaché)') AS territoire_parent, COALESCE(t.name, '(non rattaché)') AS territoire, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317, 1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_parent\" on \"dtm_parent\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_parent\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t_parent\" on \"t_parent\".\"id\" = \"dtm_parent\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire_parent\", \"territoire\", \"v\".\"name\""} 
[2026-08-11 06:47:47] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf, ROUND(SUM(sq.co2_bio_kg_utcatf)::numeric, 4) AS co2_bio_kg_utcatf, ROUND(SUM(sq.ch4_kg_utcatf)::numeric, 4) AS ch4_kg_utcatf, ROUND(SUM(sq.n2o_kg_utcatf)::numeric, 4) AS n2o_kg_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-2074645457)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-2074645457) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" group by \"sq\".\"year_id\", \"territoire\""} 
[2026-08-11 06:47:47] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf, ROUND(SUM(sq.co2_bio_kg_utcatf)::numeric, 4) AS co2_bio_kg_utcatf, ROUND(SUM(sq.ch4_kg_utcatf)::numeric, 4) AS ch4_kg_utcatf, ROUND(SUM(sq.n2o_kg_utcatf)::numeric, 4) AS n2o_kg_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-2074645457)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-2074645457) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" group by \"sq\".\"year_id\", \"territoire\""} 
[2026-08-11 06:47:50] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf, ROUND(SUM(sq.co2_bio_kg_utcatf)::numeric, 4) AS co2_bio_kg_utcatf, ROUND(SUM(sq.ch4_kg_utcatf)::numeric, 4) AS ch4_kg_utcatf, ROUND(SUM(sq.n2o_kg_utcatf)::numeric, 4) AS n2o_kg_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-2074645457)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-2074645457) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" group by \"sq\".\"year_id\", \"territoire\""} 
[2026-08-11 06:49:37] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":"epci","years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t_parent.name, '(non rattaché)') AS territoire_parent, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317, 1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_parent\" on \"dtm_parent\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_parent\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t_parent\" on \"t_parent\".\"id\" = \"dtm_parent\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire_parent\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 06:49:37] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":"epci","years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t_parent.name, '(non rattaché)') AS territoire_parent, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317, 1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_parent\" on \"dtm_parent\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_parent\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t_parent\" on \"t_parent\".\"id\" = \"dtm_parent\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire_parent\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 06:49:43] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":"epci","years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t_parent.name, '(non rattaché)') AS territoire_parent, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317, 1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_parent\" on \"dtm_parent\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_parent\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t_parent\" on \"t_parent\".\"id\" = \"dtm_parent\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire_parent\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 07:09:47] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":"epci","years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t_parent.name, '(non rattaché)') AS territoire_parent, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317, 1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_parent\" on \"dtm_parent\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_parent\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t_parent\" on \"t_parent\".\"id\" = \"dtm_parent\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire_parent\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 07:10:55] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-1725457796)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-1725457796) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (732180862, 1824193386) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1844241335, -929314708) and \"fp\".\"vecteur_id\" in (3, 2, 1) and \"fp\".\"filiere_id\" not in (-1193645855, -1543929019, -2102167500, -1589048475, 1413501954, -1316980943, 801089390, 193523191, 1500531356, 967948000, 1033820579, -1392130500, 1716416743, -1109286771, 1942610929, 2138005553, 1680724918, -1240650519, 1218982353, 2023042180, 829965003, -243069253) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 07:10:56] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-1725457796)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-1725457796) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (732180862, 1824193386) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1844241335, -929314708) and \"fp\".\"vecteur_id\" in (3, 2, 1) and \"fp\".\"filiere_id\" not in (-1193645855, -1543929019, -2102167500, -1589048475, 1413501954, -1316980943, 801089390, 193523191, 1500531356, 967948000, 1033820579, -1392130500, 1716416743, -1109286771, 1942610929, 2138005553, 1680724918, -1240650519, 1218982353, 2023042180, 829965003, -243069253) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 07:11:26] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf, ROUND(SUM(sq.co2_bio_kg_utcatf)::numeric, 4) AS co2_bio_kg_utcatf, ROUND(SUM(sq.ch4_kg_utcatf)::numeric, 4) AS ch4_kg_utcatf, ROUND(SUM(sq.n2o_kg_utcatf)::numeric, 4) AS n2o_kg_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-2074645457)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-2074645457) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 07:11:26] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf, ROUND(SUM(sq.co2_bio_kg_utcatf)::numeric, 4) AS co2_bio_kg_utcatf, ROUND(SUM(sq.ch4_kg_utcatf)::numeric, 4) AS ch4_kg_utcatf, ROUND(SUM(sq.n2o_kg_utcatf)::numeric, 4) AS n2o_kg_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-2074645457)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-2074645457) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 07:11:40] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf, ROUND(SUM(sq.co2_bio_kg_utcatf)::numeric, 4) AS co2_bio_kg_utcatf, ROUND(SUM(sq.ch4_kg_utcatf)::numeric, 4) AS ch4_kg_utcatf, ROUND(SUM(sq.n2o_kg_utcatf)::numeric, 4) AS n2o_kg_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-2074645457)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-2074645457) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 07:13:58] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-1725457796)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-1725457796) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (732180862, 1824193386) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1844241335, -929314708) and \"fp\".\"vecteur_id\" in (3, 2, 1) and \"fp\".\"filiere_id\" not in (-1193645855, -1543929019, -2102167500, -1589048475, 1413501954, -1316980943, 801089390, 193523191, 1500531356, 967948000, 1033820579, -1392130500, 1716416743, -1109286771, 1942610929, 2138005553, 1680724918, -1240650519, 1218982353, 2023042180, 829965003, -243069253) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 07:13:58] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-1725457796)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-1725457796) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (732180862, 1824193386) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1844241335, -929314708) and \"fp\".\"vecteur_id\" in (3, 2, 1) and \"fp\".\"filiere_id\" not in (-1193645855, -1543929019, -2102167500, -1589048475, 1413501954, -1316980943, 801089390, 193523191, 1500531356, 967948000, 1033820579, -1392130500, 1716416743, -1109286771, 1942610929, 2138005553, 1680724918, -1240650519, 1218982353, 2023042180, 829965003, -243069253) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 07:32:32] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1906986335, 1241913931, 985002177, -800058609, -1217983427, 119677758, -1660766647, 1959490234) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 911083398, 53616376, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 1735525248, 254468532, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, 1409930224, -1982109166, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1166060768, 2113546912, -1100601087, -1270919973, 1741715211, -604604043, -65650287, -1323823743, -1771225083, -497458774, 556015237, 1890006254, -475198975, -717879577, 1306594475, 1087885866, -1618922050, -893165577, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 1329377505, 76265396, 503239948, -2004721785, -1859723360, -731418973, 1648387281, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, -1605866945, 1659802002, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, -797747832, 1307996793, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 1444864905, 660808751, 82030098, 937605621, -1352377836, 1763501654, -407252425, 350725182, -1405923019, 1824837113, 682492730, -1560607589, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -1887790066, -567757160, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, 859934642, -1736763325, 760580929, 138601578, 1658855321, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -1259394394, -2104684761, 1942080707, -913831972, 350561514, 1633334487, 1206983340, -843932025, -1017289816, -337017078, 41079158, 454621909, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -1608512036, -2009648112, 489987876, 1663410790, 301093584, -820564035, 1066750091, -2048915241, 2110173394, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, 21511964, -964500217, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, -1487774563, 1519990054, 153764150, 1371033649, 776279000, -1951358321, 692870153, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -388600018, -667330531, -1327037360, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, 971161973, -1432964826, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, 425592013, -1609021450, 1142721112, 1125960239, 342687363, -715496447, -22267807, -466654990, 2004972987, 373557710, -583628804, -538767368, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 1319740754, 530155604, -1878882180, -578878727, 46178169, 1173150921, 595454509, 707403387, 2093595260, 1933574569, -178885722, 1689971204, 2099170107, -893109849, -23642967, -394754806, 373550100, -1052690536, -1337323363, 1447225472, 1276215965, 33249239, -639410621, 730336352, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -799071091, -450105656, -1118403434, -2125877781, -432827018, -1464392700, -1334310062, -1652853783, 1371610371, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -1496086086, -390568655, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -1345162752, -35558533, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 579293477, 1024219564, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 1949554747, 692025924, 216692383, -1071587566, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2117292693, -2024511393, -183910117, -1210454800, 933754793, 1924478818, -1929400904, 1584015331, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, -1028097404, 1386497909, -1390684557, -1273156420, 2139709518, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -337441085, -97814566, 675577244, 1367391544, 1049700765, 1379603351, 847335499, -14567500, -118886754, 1563060129, 1574055369, -1287483713, -1513139721, -1144038162, -1389614002, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, -271055130, 375123593, -1781860008, 1096813866, 1849745898, -2140441286, -1605275342, 1007707851, 739923250, -467115791, -704377305, 1079222860, 242615640, -1837178453, 318613241, -197558611, -2019686765, 347811431, 1553348267, -980556544, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, -73273843, 1359890860, 1077172953, 1392617912, -1659840926, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -955858860, -1869570613, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1743133853, 1843164580, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -302632139, -648559285, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -908948374, -1814854069, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, -1717498989, 1989286800, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, -23479538, 224035916, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, -443199195, 1678295557, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, 971904816, -1460631101, -1915212800, -1519785494, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, -1744193508, 68476456, -980025384, -306861080, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -38219474, -1727327625, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 540645732, 803377337, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -746688917, -807863775, 1656148124, 302308805, -1201074141, 922162158, 2079850451, 2011035759, 1040750617, 1436256879, 344405547, 1207010603, 1340950393, -2062377130, 1972919535, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:32:32] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1906986335, 1241913931, 985002177, -800058609, -1217983427, 119677758, -1660766647, 1959490234) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 911083398, 53616376, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 1735525248, 254468532, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, 1409930224, -1982109166, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1166060768, 2113546912, -1100601087, -1270919973, 1741715211, -604604043, -65650287, -1323823743, -1771225083, -497458774, 556015237, 1890006254, -475198975, -717879577, 1306594475, 1087885866, -1618922050, -893165577, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 1329377505, 76265396, 503239948, -2004721785, -1859723360, -731418973, 1648387281, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, -1605866945, 1659802002, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, -797747832, 1307996793, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 1444864905, 660808751, 82030098, 937605621, -1352377836, 1763501654, -407252425, 350725182, -1405923019, 1824837113, 682492730, -1560607589, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -1887790066, -567757160, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, 859934642, -1736763325, 760580929, 138601578, 1658855321, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -1259394394, -2104684761, 1942080707, -913831972, 350561514, 1633334487, 1206983340, -843932025, -1017289816, -337017078, 41079158, 454621909, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -1608512036, -2009648112, 489987876, 1663410790, 301093584, -820564035, 1066750091, -2048915241, 2110173394, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, 21511964, -964500217, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, -1487774563, 1519990054, 153764150, 1371033649, 776279000, -1951358321, 692870153, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -388600018, -667330531, -1327037360, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, 971161973, -1432964826, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, 425592013, -1609021450, 1142721112, 1125960239, 342687363, -715496447, -22267807, -466654990, 2004972987, 373557710, -583628804, -538767368, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 1319740754, 530155604, -1878882180, -578878727, 46178169, 1173150921, 595454509, 707403387, 2093595260, 1933574569, -178885722, 1689971204, 2099170107, -893109849, -23642967, -394754806, 373550100, -1052690536, -1337323363, 1447225472, 1276215965, 33249239, -639410621, 730336352, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -799071091, -450105656, -1118403434, -2125877781, -432827018, -1464392700, -1334310062, -1652853783, 1371610371, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -1496086086, -390568655, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -1345162752, -35558533, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 579293477, 1024219564, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 1949554747, 692025924, 216692383, -1071587566, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2117292693, -2024511393, -183910117, -1210454800, 933754793, 1924478818, -1929400904, 1584015331, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, -1028097404, 1386497909, -1390684557, -1273156420, 2139709518, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -337441085, -97814566, 675577244, 1367391544, 1049700765, 1379603351, 847335499, -14567500, -118886754, 1563060129, 1574055369, -1287483713, -1513139721, -1144038162, -1389614002, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, -271055130, 375123593, -1781860008, 1096813866, 1849745898, -2140441286, -1605275342, 1007707851, 739923250, -467115791, -704377305, 1079222860, 242615640, -1837178453, 318613241, -197558611, -2019686765, 347811431, 1553348267, -980556544, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, -73273843, 1359890860, 1077172953, 1392617912, -1659840926, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -955858860, -1869570613, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1743133853, 1843164580, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -302632139, -648559285, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -908948374, -1814854069, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, -1717498989, 1989286800, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, -23479538, 224035916, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, -443199195, 1678295557, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, 971904816, -1460631101, -1915212800, -1519785494, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, -1744193508, 68476456, -980025384, -306861080, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -38219474, -1727327625, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 540645732, 803377337, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -746688917, -807863775, 1656148124, 302308805, -1201074141, 922162158, 2079850451, 2011035759, 1040750617, 1436256879, 344405547, 1207010603, 1340950393, -2062377130, 1972919535, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:32:38] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1906986335, 1241913931, 985002177, -800058609, -1217983427, 119677758, -1660766647, 1959490234) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 911083398, 53616376, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 1735525248, 254468532, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, 1409930224, -1982109166, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1166060768, 2113546912, -1100601087, -1270919973, 1741715211, -604604043, -65650287, -1323823743, -1771225083, -497458774, 556015237, 1890006254, -475198975, -717879577, 1306594475, 1087885866, -1618922050, -893165577, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 1329377505, 76265396, 503239948, -2004721785, -1859723360, -731418973, 1648387281, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, -1605866945, 1659802002, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, -797747832, 1307996793, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 1444864905, 660808751, 82030098, 937605621, -1352377836, 1763501654, -407252425, 350725182, -1405923019, 1824837113, 682492730, -1560607589, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -1887790066, -567757160, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, 859934642, -1736763325, 760580929, 138601578, 1658855321, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -1259394394, -2104684761, 1942080707, -913831972, 350561514, 1633334487, 1206983340, -843932025, -1017289816, -337017078, 41079158, 454621909, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -1608512036, -2009648112, 489987876, 1663410790, 301093584, -820564035, 1066750091, -2048915241, 2110173394, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, 21511964, -964500217, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, -1487774563, 1519990054, 153764150, 1371033649, 776279000, -1951358321, 692870153, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -388600018, -667330531, -1327037360, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, 971161973, -1432964826, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, 425592013, -1609021450, 1142721112, 1125960239, 342687363, -715496447, -22267807, -466654990, 2004972987, 373557710, -583628804, -538767368, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 1319740754, 530155604, -1878882180, -578878727, 46178169, 1173150921, 595454509, 707403387, 2093595260, 1933574569, -178885722, 1689971204, 2099170107, -893109849, -23642967, -394754806, 373550100, -1052690536, -1337323363, 1447225472, 1276215965, 33249239, -639410621, 730336352, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -799071091, -450105656, -1118403434, -2125877781, -432827018, -1464392700, -1334310062, -1652853783, 1371610371, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -1496086086, -390568655, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -1345162752, -35558533, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 579293477, 1024219564, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 1949554747, 692025924, 216692383, -1071587566, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2117292693, -2024511393, -183910117, -1210454800, 933754793, 1924478818, -1929400904, 1584015331, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, -1028097404, 1386497909, -1390684557, -1273156420, 2139709518, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -337441085, -97814566, 675577244, 1367391544, 1049700765, 1379603351, 847335499, -14567500, -118886754, 1563060129, 1574055369, -1287483713, -1513139721, -1144038162, -1389614002, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, -271055130, 375123593, -1781860008, 1096813866, 1849745898, -2140441286, -1605275342, 1007707851, 739923250, -467115791, -704377305, 1079222860, 242615640, -1837178453, 318613241, -197558611, -2019686765, 347811431, 1553348267, -980556544, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, -73273843, 1359890860, 1077172953, 1392617912, -1659840926, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -955858860, -1869570613, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1743133853, 1843164580, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -302632139, -648559285, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -908948374, -1814854069, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, -1717498989, 1989286800, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, -23479538, 224035916, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, -443199195, 1678295557, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, 971904816, -1460631101, -1915212800, -1519785494, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, -1744193508, 68476456, -980025384, -306861080, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -38219474, -1727327625, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 540645732, 803377337, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -746688917, -807863775, 1656148124, 302308805, -1201074141, 922162158, 2079850451, 2011035759, 1040750617, 1436256879, 344405547, 1207010603, 1340950393, -2062377130, 1972919535, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:33:09] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1906986335, 1241913931, 985002177, -800058609, -1217983427, 119677758, -1660766647, 1959490234) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 911083398, 53616376, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 1735525248, 254468532, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, 1409930224, -1982109166, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1166060768, 2113546912, -1100601087, -1270919973, 1741715211, -604604043, -65650287, -1323823743, -1771225083, -497458774, 556015237, 1890006254, -475198975, -717879577, 1306594475, 1087885866, -1618922050, -893165577, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 1329377505, 76265396, 503239948, -2004721785, -1859723360, -731418973, 1648387281, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, -1605866945, 1659802002, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, -797747832, 1307996793, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 1444864905, 660808751, 82030098, 937605621, -1352377836, 1763501654, -407252425, 350725182, -1405923019, 1824837113, 682492730, -1560607589, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -1887790066, -567757160, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, 859934642, -1736763325, 760580929, 138601578, 1658855321, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -1259394394, -2104684761, 1942080707, -913831972, 350561514, 1633334487, 1206983340, -843932025, -1017289816, -337017078, 41079158, 454621909, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -1608512036, -2009648112, 489987876, 1663410790, 301093584, -820564035, 1066750091, -2048915241, 2110173394, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, 21511964, -964500217, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, -1487774563, 1519990054, 153764150, 1371033649, 776279000, -1951358321, 692870153, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -388600018, -667330531, -1327037360, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, 971161973, -1432964826, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, 425592013, -1609021450, 1142721112, 1125960239, 342687363, -715496447, -22267807, -466654990, 2004972987, 373557710, -583628804, -538767368, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 1319740754, 530155604, -1878882180, -578878727, 46178169, 1173150921, 595454509, 707403387, 2093595260, 1933574569, -178885722, 1689971204, 2099170107, -893109849, -23642967, -394754806, 373550100, -1052690536, -1337323363, 1447225472, 1276215965, 33249239, -639410621, 730336352, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -799071091, -450105656, -1118403434, -2125877781, -432827018, -1464392700, -1334310062, -1652853783, 1371610371, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -1496086086, -390568655, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -1345162752, -35558533, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 579293477, 1024219564, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 1949554747, 692025924, 216692383, -1071587566, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2117292693, -2024511393, -183910117, -1210454800, 933754793, 1924478818, -1929400904, 1584015331, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, -1028097404, 1386497909, -1390684557, -1273156420, 2139709518, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -337441085, -97814566, 675577244, 1367391544, 1049700765, 1379603351, 847335499, -14567500, -118886754, 1563060129, 1574055369, -1287483713, -1513139721, -1144038162, -1389614002, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, -271055130, 375123593, -1781860008, 1096813866, 1849745898, -2140441286, -1605275342, 1007707851, 739923250, -467115791, -704377305, 1079222860, 242615640, -1837178453, 318613241, -197558611, -2019686765, 347811431, 1553348267, -980556544, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, -73273843, 1359890860, 1077172953, 1392617912, -1659840926, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -955858860, -1869570613, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1743133853, 1843164580, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -302632139, -648559285, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -908948374, -1814854069, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, -1717498989, 1989286800, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, -23479538, 224035916, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, -443199195, 1678295557, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, 971904816, -1460631101, -1915212800, -1519785494, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, -1744193508, 68476456, -980025384, -306861080, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -38219474, -1727327625, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 540645732, 803377337, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -746688917, -807863775, 1656148124, 302308805, -1201074141, 922162158, 2079850451, 2011035759, 1040750617, 1436256879, 344405547, 1207010603, 1340950393, -2062377130, 1972919535, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:33:37] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1906986335, 1241913931, 985002177, -800058609, -1217983427, 119677758, -1660766647, 1959490234) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 911083398, 53616376, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 1735525248, 254468532, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, 1409930224, -1982109166, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1166060768, 2113546912, -1100601087, -1270919973, 1741715211, -604604043, -65650287, -1323823743, -1771225083, -497458774, 556015237, 1890006254, -475198975, -717879577, 1306594475, 1087885866, -1618922050, -893165577, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 1329377505, 76265396, 503239948, -2004721785, -1859723360, -731418973, 1648387281, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, -1605866945, 1659802002, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, -797747832, 1307996793, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 1444864905, 660808751, 82030098, 937605621, -1352377836, 1763501654, -407252425, 350725182, -1405923019, 1824837113, 682492730, -1560607589, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -1887790066, -567757160, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, 859934642, -1736763325, 760580929, 138601578, 1658855321, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -1259394394, -2104684761, 1942080707, -913831972, 350561514, 1633334487, 1206983340, -843932025, -1017289816, -337017078, 41079158, 454621909, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -1608512036, -2009648112, 489987876, 1663410790, 301093584, -820564035, 1066750091, -2048915241, 2110173394, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, 21511964, -964500217, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, -1487774563, 1519990054, 153764150, 1371033649, 776279000, -1951358321, 692870153, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -388600018, -667330531, -1327037360, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, 971161973, -1432964826, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, 425592013, -1609021450, 1142721112, 1125960239, 342687363, -715496447, -22267807, -466654990, 2004972987, 373557710, -583628804, -538767368, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 1319740754, 530155604, -1878882180, -578878727, 46178169, 1173150921, 595454509, 707403387, 2093595260, 1933574569, -178885722, 1689971204, 2099170107, -893109849, -23642967, -394754806, 373550100, -1052690536, -1337323363, 1447225472, 1276215965, 33249239, -639410621, 730336352, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -799071091, -450105656, -1118403434, -2125877781, -432827018, -1464392700, -1334310062, -1652853783, 1371610371, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -1496086086, -390568655, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -1345162752, -35558533, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 579293477, 1024219564, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 1949554747, 692025924, 216692383, -1071587566, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2117292693, -2024511393, -183910117, -1210454800, 933754793, 1924478818, -1929400904, 1584015331, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, -1028097404, 1386497909, -1390684557, -1273156420, 2139709518, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -337441085, -97814566, 675577244, 1367391544, 1049700765, 1379603351, 847335499, -14567500, -118886754, 1563060129, 1574055369, -1287483713, -1513139721, -1144038162, -1389614002, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, -271055130, 375123593, -1781860008, 1096813866, 1849745898, -2140441286, -1605275342, 1007707851, 739923250, -467115791, -704377305, 1079222860, 242615640, -1837178453, 318613241, -197558611, -2019686765, 347811431, 1553348267, -980556544, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, -73273843, 1359890860, 1077172953, 1392617912, -1659840926, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -955858860, -1869570613, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1743133853, 1843164580, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -302632139, -648559285, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -908948374, -1814854069, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, -1717498989, 1989286800, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, -23479538, 224035916, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, -443199195, 1678295557, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, 971904816, -1460631101, -1915212800, -1519785494, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, -1744193508, 68476456, -980025384, -306861080, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -38219474, -1727327625, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 540645732, 803377337, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -746688917, -807863775, 1656148124, 302308805, -1201074141, 922162158, 2079850451, 2011035759, 1040750617, 1436256879, 344405547, 1207010603, 1340950393, -2062377130, 1972919535, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:34:10] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:34:10] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:34:17] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:34:36] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:45:20] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2020],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2020) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:45:20] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2020],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2020) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 07:45:35] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2020],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" where \"em\".\"year_id\" in (2020) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\""} 
[2026-08-11 07:45:35] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2020],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" where \"em\".\"year_id\" in (2020) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\""} 
[2026-08-11 07:45:45] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2020],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" where \"em\".\"year_id\" in (2020) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\""} 
[2026-08-11 07:47:39] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"pnr","display_level":null,"years":[2020,2021,2022,2024,2023],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-330926110)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2020, 2021, 2022, 2024, 2023) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-330926110) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 07:47:39] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"pnr","display_level":null,"years":[2020,2021,2022,2024,2023],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-330926110)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2020, 2021, 2022, 2024, 2023) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-330926110) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 07:51:34] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'snap' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (1942963054, 506491597, -1315688156, -1017289816, -1438657658, -1519785494, -1390883660, 1108698765, 826582647, 53616376, -1932993837, -1461717196, 747547873, 1435696692, 1659802002, -1605866945, 1711779466, 1367391544, -1371339394, 68476456, -1389614002, -1832238632, 1974281097, -1743267982, -1337323363, -1758060949, 1695347196, 1687613177, -1071587566, 1849745898, 803377337, 730336352, 1989286800, 1967813158, 242615640, 145755964, -837308181, 1429295941, 1362332800, -1210454800, 1034344725, -1436585389, 589008399, -1201074141, 922162158, 1974523832, 153764150, -450105656, 692870153, 1040750617, -432827018, -889255393, 1898736760, -1736763325, 1658855321, 1678295557, -1327037360, 76265396, 503239948, 919914692, 736532642, 2078237231, -869291431, -92274995, 2139709518, 1942080707, 1222056809, 515802054) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 07:51:34] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'snap' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (1942963054, 506491597, -1315688156, -1017289816, -1438657658, -1519785494, -1390883660, 1108698765, 826582647, 53616376, -1932993837, -1461717196, 747547873, 1435696692, 1659802002, -1605866945, 1711779466, 1367391544, -1371339394, 68476456, -1389614002, -1832238632, 1974281097, -1743267982, -1337323363, -1758060949, 1695347196, 1687613177, -1071587566, 1849745898, 803377337, 730336352, 1989286800, 1967813158, 242615640, 145755964, -837308181, 1429295941, 1362332800, -1210454800, 1034344725, -1436585389, 589008399, -1201074141, 922162158, 1974523832, 153764150, -450105656, 692870153, 1040750617, -432827018, -889255393, 1898736760, -1736763325, 1658855321, 1678295557, -1327037360, 76265396, 503239948, 919914692, 736532642, 2078237231, -869291431, -92274995, 2139709518, 1942080707, 1222056809, 515802054) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 07:51:47] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'spcaet' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (1942963054, 506491597, -1315688156, -1017289816, -1438657658, -1519785494, -1390883660, 1108698765, 826582647, 53616376, -1932993837, -1461717196, 747547873, 1435696692, 1659802002, -1605866945, 1711779466, 1367391544, -1371339394, 68476456, -1389614002, -1832238632, 1974281097, -1743267982, -1337323363, -1758060949, 1695347196, 1687613177, -1071587566, 1849745898, 803377337, 730336352, 1989286800, 1967813158, 242615640, 145755964, -837308181, 1429295941, 1362332800, -1210454800, 1034344725, -1436585389, 589008399, -1201074141, 922162158, 1974523832, 153764150, -450105656, 692870153, 1040750617, -432827018, -889255393, 1898736760, -1736763325, 1658855321, 1678295557, -1327037360, 76265396, 503239948, 919914692, 736532642, 2078237231, -869291431, -92274995, 2139709518, 1942080707, 1222056809, 515802054) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 07:51:47] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'spcaet' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (1942963054, 506491597, -1315688156, -1017289816, -1438657658, -1519785494, -1390883660, 1108698765, 826582647, 53616376, -1932993837, -1461717196, 747547873, 1435696692, 1659802002, -1605866945, 1711779466, 1367391544, -1371339394, 68476456, -1389614002, -1832238632, 1974281097, -1743267982, -1337323363, -1758060949, 1695347196, 1687613177, -1071587566, 1849745898, 803377337, 730336352, 1989286800, 1967813158, 242615640, 145755964, -837308181, 1429295941, 1362332800, -1210454800, 1034344725, -1436585389, 589008399, -1201074141, 922162158, 1974523832, 153764150, -450105656, 692870153, 1040750617, -432827018, -889255393, 1898736760, -1736763325, 1658855321, 1678295557, -1327037360, 76265396, 503239948, 919914692, 736532642, 2078237231, -869291431, -92274995, 2139709518, 1942080707, 1222056809, 515802054) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 08:08:06] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"reg","display_level":null,"years":[2017],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (936037254)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (936037254) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" group by \"sq\".\"year_id\", \"territoire\""} 
[2026-08-11 08:08:06] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"reg","display_level":null,"years":[2017],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (936037254)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (936037254) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" group by \"sq\".\"year_id\", \"territoire\""} 
[2026-08-11 08:08:07] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"reg","display_level":null,"years":[2017],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (936037254)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (936037254) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" group by \"sq\".\"year_id\", \"territoire\""} 
[2026-08-11 08:16:53] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (203685376) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 08:16:53] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (203685376) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 08:46:13] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-1725457796)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-1725457796) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-996979377, 774281089, 1200710728, 1340024063, 1453260670) and \"fp\".\"vecteur_id\" in (3, 2, 1) and \"fp\".\"filiere_id\" not in (-1193645855, -1543929019, -2102167500, -1589048475, 1413501954, -1316980943, 801089390, 193523191, 1500531356, 967948000, 1033820579, -1392130500, 1716416743, -1109286771, 1942610929, 2138005553, 1680724918, -1240650519, 1218982353, 2023042180, 829965003, -243069253) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 08:46:13] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-1725457796)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-1725457796) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-996979377, 774281089, 1200710728, 1340024063, 1453260670) and \"fp\".\"vecteur_id\" in (3, 2, 1) and \"fp\".\"filiere_id\" not in (-1193645855, -1543929019, -2102167500, -1589048475, 1413501954, -1316980943, 801089390, 193523191, 1500531356, 967948000, 1033820579, -1392130500, 1716416743, -1109286771, 1942610929, 2138005553, 1680724918, -1240650519, 1218982353, 2023042180, 829965003, -243069253) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 09:03:10] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_reg","filter_level":"reg","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(em.prg_2021_teqco2)::numeric, 4) AS prg_2021_teqco2 from \"observatoire\".\"agg_reg\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1241913931, 985002177, 1959490234) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (936037254) and \"em\".\"activity_id\" in (1411111401, -1496086086, -390568655, 1664202072, -2065015321, -273047452, -1189987097, -366685926, -2129813176, 494216435, -393206791, 2001630306, 562718587, -858228785, 942233085, -1824930634, 1824025864, -35558533, 254468532, 751538419, 1660135024, 1713162907, -1294709678, -761498023, 97436677, -124660711, 722905366, 579293477, -93516697, 1140113838, -1419278172, 1409930224, -1982109166, -2034818798, 2117082238, -919487101, 1822307428, -770400240, -1939219148, 155019705, 1687214361, -543242059, 1395794963, 64335092, 1949554747, 692025924, 1184608045, -482664252, 26668268, -2024511393, -2117292693, -289004236, 933754793, 2113546912, 1924478818, -1270919973, 1584015331, -1865280307, -65650287, -1323823743, -125964541, 556015237, -497458774, 1890006254, -717879577, 1640238785, -1829002824, 1087885866, 2108532170, 1044726750, -1618922050, -893165577, 865842982, 1765509547, 1923261691, -2044885611, -2004721785, -731418973, 1648387281, -1632648707, 571578548, -1028097404, -1390684557, 1372013544, 539391017, -2017652732, -1408995398, 632880332, 333711349, 680092381, 1772504308, -966063115, 28083642, 1477165581, 1900723648, 1253744553, 203783501, -198132915, 1273925006, 719954458, 1236677003, 689872, 1075533786, -337441085, -97814566, -2000350303, 675577244, 1855887801, 1049700765, 1379603351, 1307996793, -797747832, 847335499, -14567500, -574407755, -1287483713, -1513139721, 775868583, -606258386, 1312649538, 1855178673, 660808751, 1444864905, -2044004547, -1581253380, 937605621, 682492730, -1560607589, -68842748, 2005250983, -271055130, 375123593, 1243082219, 1096813866, -1605275342, 1140080948, -467115791, -704377305, 1079222860, 1663741761, -1837178453, -1887790066, -567757160, 347811431, 1553348267, -980556544, 494206472, 1258750298, -1623725498, -889282158, 1299296056, 2079193929, 423665295, 1285586024, -1749430722, 1359890860, 1077172953, -717359299, -98448292, 1392617912, -1659840926, 392392088, -2017022783, 760580929, 1184793512, 1153344103, -1869570613, 340061913, 618379975, 1280935296, 1011823494, -1951484904, -469721241, 1842692073, -939991847, 1418466514, 1620817717, 350561514, 1633334487, 1206983340, -337017078, 41079158, 454621909, 1901794668, 1743133853, 1843164580, -1732290900, 1353783048, -858994155, 1054770029, 1528030456, -648559285, -302632139, -1430328674, 223376167, 730376509, 504001257, -1990228258, 548540297, -435776990, 1651542945, -2102767552, -933330074, -1614026445, -446796902, -1546313589, 1104829866, 600270447, -763786315, -323474854, 906942419, 283393782, -734407698, -1703285931, -1788065014, 960709480, -1608512036, -2009648112, 489987876, -908948374, -1814854069, 1663410790, 301093584, 1066750091, 859987309, -1219234331, 1099679168, 220080184, -57766241, 1855856603, -676428704, -1255434042, 21511964, -964500217, 1388087176, -1337246483, -1063238036, 1458785475, -570672305, -1332638305, 1287376035, 1913359952, 224035916, -23479538, -2145734036, 429059437, -566762324, -376271361, -347269928, 2047409618, 1519990054, -1487774563, 679566165, 276545043, 288394184, -1286440751, 905336003, -1528757905, -2020552257, -667330531, 1428443613, 50809254, -1935636633, 2101386234, -708582396, -1316167746, 2001828071, 717533312, -919698739, -1871954656, -1859668546, 438839785, -1151541471, 988479706, 1838130794, -1888967964, -1802228876, -1296777115, -35163706, 1201309406, -1531584106, -178006637, 425592013, -1609021450, -1132107069, -373631934, -22267807, -466654990, 2004972987, 373557710, -583628804, -538767368, 1231105243, 1201351105, 1035684050, -980025384, -306861080, 1319740754, 530155604, -1878882180, -578878727, -2072230927, 595454509, 707403387, 1933574569, -178885722, -1736978617, 1689971204, 2099170107, -23642967, -1156123924, -1727327625, -2063183380, 1276215965, 1684813422, 932667705, -1240017080, 2034593037, 1381736146, 1911698987, -833249209, 1611256781, -1200401518, -518501295, 1572749265, 1656148124, -1459018491, -883327242, 1252179801, 2079850451, 1436256879, 1371610371, -1652853783, 1340950393, 2106513667, -2062377130, 1972919535, -975191328, -1981687934, 1764341119, -457559919, -1414713643, 931702417, -1087220802, 35115389, -1650124362, 575519546, 500851691) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:03:11] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_reg","filter_level":"reg","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(em.prg_2021_teqco2)::numeric, 4) AS prg_2021_teqco2 from \"observatoire\".\"agg_reg\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1241913931, 985002177, 1959490234) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (936037254) and \"em\".\"activity_id\" in (1411111401, -1496086086, -390568655, 1664202072, -2065015321, -273047452, -1189987097, -366685926, -2129813176, 494216435, -393206791, 2001630306, 562718587, -858228785, 942233085, -1824930634, 1824025864, -35558533, 254468532, 751538419, 1660135024, 1713162907, -1294709678, -761498023, 97436677, -124660711, 722905366, 579293477, -93516697, 1140113838, -1419278172, 1409930224, -1982109166, -2034818798, 2117082238, -919487101, 1822307428, -770400240, -1939219148, 155019705, 1687214361, -543242059, 1395794963, 64335092, 1949554747, 692025924, 1184608045, -482664252, 26668268, -2024511393, -2117292693, -289004236, 933754793, 2113546912, 1924478818, -1270919973, 1584015331, -1865280307, -65650287, -1323823743, -125964541, 556015237, -497458774, 1890006254, -717879577, 1640238785, -1829002824, 1087885866, 2108532170, 1044726750, -1618922050, -893165577, 865842982, 1765509547, 1923261691, -2044885611, -2004721785, -731418973, 1648387281, -1632648707, 571578548, -1028097404, -1390684557, 1372013544, 539391017, -2017652732, -1408995398, 632880332, 333711349, 680092381, 1772504308, -966063115, 28083642, 1477165581, 1900723648, 1253744553, 203783501, -198132915, 1273925006, 719954458, 1236677003, 689872, 1075533786, -337441085, -97814566, -2000350303, 675577244, 1855887801, 1049700765, 1379603351, 1307996793, -797747832, 847335499, -14567500, -574407755, -1287483713, -1513139721, 775868583, -606258386, 1312649538, 1855178673, 660808751, 1444864905, -2044004547, -1581253380, 937605621, 682492730, -1560607589, -68842748, 2005250983, -271055130, 375123593, 1243082219, 1096813866, -1605275342, 1140080948, -467115791, -704377305, 1079222860, 1663741761, -1837178453, -1887790066, -567757160, 347811431, 1553348267, -980556544, 494206472, 1258750298, -1623725498, -889282158, 1299296056, 2079193929, 423665295, 1285586024, -1749430722, 1359890860, 1077172953, -717359299, -98448292, 1392617912, -1659840926, 392392088, -2017022783, 760580929, 1184793512, 1153344103, -1869570613, 340061913, 618379975, 1280935296, 1011823494, -1951484904, -469721241, 1842692073, -939991847, 1418466514, 1620817717, 350561514, 1633334487, 1206983340, -337017078, 41079158, 454621909, 1901794668, 1743133853, 1843164580, -1732290900, 1353783048, -858994155, 1054770029, 1528030456, -648559285, -302632139, -1430328674, 223376167, 730376509, 504001257, -1990228258, 548540297, -435776990, 1651542945, -2102767552, -933330074, -1614026445, -446796902, -1546313589, 1104829866, 600270447, -763786315, -323474854, 906942419, 283393782, -734407698, -1703285931, -1788065014, 960709480, -1608512036, -2009648112, 489987876, -908948374, -1814854069, 1663410790, 301093584, 1066750091, 859987309, -1219234331, 1099679168, 220080184, -57766241, 1855856603, -676428704, -1255434042, 21511964, -964500217, 1388087176, -1337246483, -1063238036, 1458785475, -570672305, -1332638305, 1287376035, 1913359952, 224035916, -23479538, -2145734036, 429059437, -566762324, -376271361, -347269928, 2047409618, 1519990054, -1487774563, 679566165, 276545043, 288394184, -1286440751, 905336003, -1528757905, -2020552257, -667330531, 1428443613, 50809254, -1935636633, 2101386234, -708582396, -1316167746, 2001828071, 717533312, -919698739, -1871954656, -1859668546, 438839785, -1151541471, 988479706, 1838130794, -1888967964, -1802228876, -1296777115, -35163706, 1201309406, -1531584106, -178006637, 425592013, -1609021450, -1132107069, -373631934, -22267807, -466654990, 2004972987, 373557710, -583628804, -538767368, 1231105243, 1201351105, 1035684050, -980025384, -306861080, 1319740754, 530155604, -1878882180, -578878727, -2072230927, 595454509, 707403387, 1933574569, -178885722, -1736978617, 1689971204, 2099170107, -23642967, -1156123924, -1727327625, -2063183380, 1276215965, 1684813422, 932667705, -1240017080, 2034593037, 1381736146, 1911698987, -833249209, 1611256781, -1200401518, -518501295, 1572749265, 1656148124, -1459018491, -883327242, 1252179801, 2079850451, 1436256879, 1371610371, -1652853783, 1340950393, 2106513667, -2062377130, 1972919535, -975191328, -1981687934, 1764341119, -457559919, -1414713643, 931702417, -1087220802, 35115389, -1650124362, 575519546, 500851691) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:03:43] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_reg","filter_level":"reg","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(em.prg_2021_teqco2)::numeric, 4) AS prg_2021_teqco2 from \"observatoire\".\"agg_reg\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1241913931, 985002177, 119677758) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (936037254) and \"em\".\"activity_id\" in (1411111401, -390568655, 1664202072, -273047452, -1189987097, -366685926, -2129813176, 494216435, -393206791, 2001630306, 562718587, -858228785, 942233085, -1824930634, 1824025864, -35558533, 254468532, 751538419, 1660135024, 1713162907, -1294709678, 97436677, -124660711, 722905366, 579293477, 1024219564, -93516697, 1140113838, -1419278172, 1409930224, -1982109166, -2034818798, 2117082238, -919487101, 1822307428, -770400240, -1939219148, 155019705, 1687214361, -543242059, 1395794963, 64335092, 692025924, 1184608045, -482664252, 26668268, -2024511393, -2117292693, -183910117, -289004236, 933754793, -1100601087, 2113546912, 1924478818, -1270919973, 1584015331, -1865280307, -65650287, -1323823743, -125964541, 556015237, -497458774, 1890006254, -717879577, 1640238785, -1829002824, 1087885866, 2108532170, 1044726750, -1618922050, -893165577, 1765509547, 1923261691, -2044885611, -2004721785, -731418973, 1648387281, 1386497909, 571578548, -1028097404, -1390684557, 1372013544, 539391017, -2129230707, -2017652732, -1408995398, 632880332, 333711349, 680092381, 1772504308, -966063115, 28083642, 1477165581, 1900723648, 1253744553, 203783501, -198132915, 1273925006, 719954458, 1236677003, 689872, 1075533786, -337441085, -97814566, -2000350303, 675577244, 1855887801, 1049700765, 1379603351, 1307996793, 847335499, -14567500, -574407755, -1287483713, -1513139721, 775868583, 1312649538, 1855178673, 660808751, 1444864905, -2044004547, -1581253380, 937605621, 682492730, -1560607589, -68842748, 2005250983, -271055130, 375123593, 1243082219, 1096813866, 1007707851, -1605275342, 1140080948, -467115791, -704377305, 1079222860, 1663741761, -1837178453, -1887790066, -567757160, 347811431, 1553348267, -980556544, 494206472, 1258750298, -1623725498, -889282158, 1299296056, 2079193929, 423665295, 1285586024, -1749430722, 1359890860, 1077172953, -717359299, -98448292, 1392617912, -1659840926, -1081530607, 392392088, -2017022783, 760580929, 1184793512, 1153344103, -1869570613, 340061913, 618379975, 1280935296, 1011823494, -1951484904, -469721241, 1842692073, -939991847, 1418466514, 1620817717, 350561514, 1206983340, -337017078, 41079158, 454621909, 1901794668, 1743133853, 1843164580, -1732290900, 1353783048, -858994155, 1054770029, 1528030456, -648559285, -1430328674, 223376167, 730376509, 504001257, -1990228258, -435776990, 1651542945, -2102767552, -933330074, -1614026445, -446796902, -1546313589, 1104829866, 600270447, -763786315, -323474854, 906942419, 283393782, -734407698, -1703285931, -1788065014, 960709480, -1608512036, -2009648112, 489987876, -908948374, -1814854069, 1663410790, 301093584, 1066750091, 859987309, -1219234331, 1099679168, 220080184, -57766241, 1855856603, -676428704, -1255434042, 21511964, -964500217, 1388087176, -1337246483, -1063238036, 1458785475, -570672305, -1332638305, 1287376035, 1913359952, 224035916, -23479538, -2145734036, 429059437, -566762324, -376271361, -347269928, 2047409618, 1519990054, 679566165, 288394184, -1286440751, 905336003, -1528757905, -2020552257, -667330531, 1428443613, 50809254, -1935636633, 2101386234, -708582396, -1316167746, 2001828071, 717533312, -919698739, -1859668546, -1151541471, 988479706, 1838130794, -1888967964, -1802228876, -1296777115, -35163706, 1201309406, -1531584106, -178006637, 425592013, -1609021450, -1132107069, -373631934, -22267807, -466654990, 373557710, -583628804, -538767368, 1231105243, -148499659, 1201351105, 1035684050, -980025384, -306861080, 1319740754, 530155604, -1878882180, -578878727, -2072230927, 595454509, 707403387, 1933574569, -178885722, -1736978617, 1689971204, 2099170107, -23642967, -1156123924, -1727327625, -2063183380, 1276215965, 1684813422, 932667705, -1240017080, 2034593037, 1381736146, 1911698987, -1200401518, -518501295, 1572749265, 1656148124, -1459018491, -883327242, 1252179801, 2079850451, -1118403434, 1436256879, 1371610371, -1652853783, 1340950393, 2106513667, -2062377130, 1972919535, -975191328, -1981687934, 1764341119, -457559919, -1414713643, 931702417, -1087220802, -1650124362, 575519546, 500851691) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:03:43] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_reg","filter_level":"reg","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(em.prg_2021_teqco2)::numeric, 4) AS prg_2021_teqco2 from \"observatoire\".\"agg_reg\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (1241913931, 985002177, 119677758) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (936037254) and \"em\".\"activity_id\" in (1411111401, -390568655, 1664202072, -273047452, -1189987097, -366685926, -2129813176, 494216435, -393206791, 2001630306, 562718587, -858228785, 942233085, -1824930634, 1824025864, -35558533, 254468532, 751538419, 1660135024, 1713162907, -1294709678, 97436677, -124660711, 722905366, 579293477, 1024219564, -93516697, 1140113838, -1419278172, 1409930224, -1982109166, -2034818798, 2117082238, -919487101, 1822307428, -770400240, -1939219148, 155019705, 1687214361, -543242059, 1395794963, 64335092, 692025924, 1184608045, -482664252, 26668268, -2024511393, -2117292693, -183910117, -289004236, 933754793, -1100601087, 2113546912, 1924478818, -1270919973, 1584015331, -1865280307, -65650287, -1323823743, -125964541, 556015237, -497458774, 1890006254, -717879577, 1640238785, -1829002824, 1087885866, 2108532170, 1044726750, -1618922050, -893165577, 1765509547, 1923261691, -2044885611, -2004721785, -731418973, 1648387281, 1386497909, 571578548, -1028097404, -1390684557, 1372013544, 539391017, -2129230707, -2017652732, -1408995398, 632880332, 333711349, 680092381, 1772504308, -966063115, 28083642, 1477165581, 1900723648, 1253744553, 203783501, -198132915, 1273925006, 719954458, 1236677003, 689872, 1075533786, -337441085, -97814566, -2000350303, 675577244, 1855887801, 1049700765, 1379603351, 1307996793, 847335499, -14567500, -574407755, -1287483713, -1513139721, 775868583, 1312649538, 1855178673, 660808751, 1444864905, -2044004547, -1581253380, 937605621, 682492730, -1560607589, -68842748, 2005250983, -271055130, 375123593, 1243082219, 1096813866, 1007707851, -1605275342, 1140080948, -467115791, -704377305, 1079222860, 1663741761, -1837178453, -1887790066, -567757160, 347811431, 1553348267, -980556544, 494206472, 1258750298, -1623725498, -889282158, 1299296056, 2079193929, 423665295, 1285586024, -1749430722, 1359890860, 1077172953, -717359299, -98448292, 1392617912, -1659840926, -1081530607, 392392088, -2017022783, 760580929, 1184793512, 1153344103, -1869570613, 340061913, 618379975, 1280935296, 1011823494, -1951484904, -469721241, 1842692073, -939991847, 1418466514, 1620817717, 350561514, 1206983340, -337017078, 41079158, 454621909, 1901794668, 1743133853, 1843164580, -1732290900, 1353783048, -858994155, 1054770029, 1528030456, -648559285, -1430328674, 223376167, 730376509, 504001257, -1990228258, -435776990, 1651542945, -2102767552, -933330074, -1614026445, -446796902, -1546313589, 1104829866, 600270447, -763786315, -323474854, 906942419, 283393782, -734407698, -1703285931, -1788065014, 960709480, -1608512036, -2009648112, 489987876, -908948374, -1814854069, 1663410790, 301093584, 1066750091, 859987309, -1219234331, 1099679168, 220080184, -57766241, 1855856603, -676428704, -1255434042, 21511964, -964500217, 1388087176, -1337246483, -1063238036, 1458785475, -570672305, -1332638305, 1287376035, 1913359952, 224035916, -23479538, -2145734036, 429059437, -566762324, -376271361, -347269928, 2047409618, 1519990054, 679566165, 288394184, -1286440751, 905336003, -1528757905, -2020552257, -667330531, 1428443613, 50809254, -1935636633, 2101386234, -708582396, -1316167746, 2001828071, 717533312, -919698739, -1859668546, -1151541471, 988479706, 1838130794, -1888967964, -1802228876, -1296777115, -35163706, 1201309406, -1531584106, -178006637, 425592013, -1609021450, -1132107069, -373631934, -22267807, -466654990, 373557710, -583628804, -538767368, 1231105243, -148499659, 1201351105, 1035684050, -980025384, -306861080, 1319740754, 530155604, -1878882180, -578878727, -2072230927, 595454509, 707403387, 1933574569, -178885722, -1736978617, 1689971204, 2099170107, -23642967, -1156123924, -1727327625, -2063183380, 1276215965, 1684813422, 932667705, -1240017080, 2034593037, 1381736146, 1911698987, -1200401518, -518501295, 1572749265, 1656148124, -1459018491, -883327242, 1252179801, 2079850451, -1118403434, 1436256879, 1371610371, -1652853783, 1340950393, 2106513667, -2062377130, 1972919535, -975191328, -1981687934, 1764341119, -457559919, -1414713643, 931702417, -1087220802, -1650124362, 575519546, 500851691) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:04:29] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024,2010],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" where \"em\".\"year_id\" in (2024, 2010) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\""} 
[2026-08-11 09:04:29] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024,2010],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" where \"em\".\"year_id\" in (2024, 2010) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\""} 
[2026-08-11 09:04:42] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024,2010,2023,2022,2021,2020],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" where \"em\".\"year_id\" in (2024, 2010, 2023, 2022, 2021, 2020) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\""} 
[2026-08-11 09:04:42] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2024,2010,2023,2022,2021,2020],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" where \"em\".\"year_id\" in (2024, 2010, 2023, 2022, 2021, 2020) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\""} 
[2026-08-11 09:08:51] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-1725457796)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-1725457796) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1433878201, -844504743) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1773246028, -996979377, 774281089, 874142471, 1200710728, 1340024063, 1453260670) and \"fp\".\"vecteur_id\" in (3, 2, 1) and \"fp\".\"filiere_id\" not in (-1193645855, -1543929019, -2102167500, -1589048475, 1413501954, -1316980943, 801089390, 193523191, 1500531356, 967948000, 1033820579, -1392130500, 1716416743, -1109286771, 1942610929, 2138005553, 1680724918, -1240650519, 1218982353, 2023042180, 829965003, -243069253) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 09:08:51] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-1725457796)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-1725457796) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1433878201, -844504743) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1773246028, -996979377, 774281089, 874142471, 1200710728, 1340024063, 1453260670) and \"fp\".\"vecteur_id\" in (3, 2, 1) and \"fp\".\"filiere_id\" not in (-1193645855, -1543929019, -2102167500, -1589048475, 1413501954, -1316980943, 801089390, 193523191, 1500531356, 967948000, 1033820579, -1392130500, 1716416743, -1109286771, 1942610929, 2138005553, 1680724918, -1240650519, 1218982353, 2023042180, 829965003, -243069253) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 09:19:48] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2012],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2012) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:19:48] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_pnr","filter_level":"pnr","display_level":null,"years":[2012],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj from \"observatoire\".\"agg_pnr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2012) and \"em\".\"geo_id\" in (-330926110) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:35:27] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, u.name AS usage, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_usages\" as \"u\" on \"u\".\"id\" = \"em\".\"usage_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"usage_id\" in (100, 111, 112, 120, 130, 200, 300, 400, 450, 480, 490, 500, 600, 700, 800, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 961, 962, 971, 972, 980, 999, 1001) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"u\".\"name\""} 
[2026-08-11 09:35:27] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, u.name AS usage, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_usages\" as \"u\" on \"u\".\"id\" = \"em\".\"usage_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"usage_id\" in (100, 111, 112, 120, 130, 200, 300, 400, 450, 480, 490, 500, 600, 700, 800, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 961, 962, 971, 972, 980, 999, 1001) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"u\".\"name\""} 
[2026-08-11 09:35:44] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'snap' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 09:35:44] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'snap' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 09:36:01] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"em\".\"fuel_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (1855338849, 203685376, -1068765758, -248609480, 454816236, -762418863, -635957407, 1344636899, 1567694641, 78930848, 606829677, 1685905379, 221388039, 512871173, 521156911, -507988172, 1506772054, -1454921658, 1898049943, -1668675215, 580937015, -664757232, 1710276699, 915693911, -1809684072, 609723321, -1909685346, -1660819109, -83169964, 1330229813, 1084264565, 1992193200, 16034538, 842100943, -1994671959, -1174609830, 1078099193, 1625357355, 1875270378, -604367190, -1598383649, -1415973785, -1272684724, 556720288, 237320038, 1801451108, -1951840467, 13585771, -2111800721, -1358379524, 1285184399, 1488087421, -1115210332, 480850863, 1914704207, -485896727, -1912882661, 618715071, -874737624, 566015977, -821358327, 612491118, 2074953191, -1294566295, 23822128, -1163760912, -784501144, 1587660764, -791711088, -267083638, -1049358887, 767873144, 783920659, -68749161, 1194464230, -1673725551, -1592428522, -1920227806, 193009920, 48365780, -59538796, 347520938, -2085768558, -683447095, 759960937, 1177006962, 1625866553, 1484267897, -1104883769, -796112667, 281177182, -202464622, 2066942576, -704599906, 1544538872, -830241899, -531598568, -1616434285, -1594592327, 1495275359, 1908804281, 1884553775, 1611197846, -1759484656, 1615206468, -2102937339, 2035346998, 208303479, -2117240436, -52796417, -601886031, -1782263122, 634974096, -1906149501, 1554441156, -1105469274, -825344667, 625058658, 1385935766, 745451612) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 09:36:01] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"em\".\"fuel_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (1855338849, 203685376, -1068765758, -248609480, 454816236, -762418863, -635957407, 1344636899, 1567694641, 78930848, 606829677, 1685905379, 221388039, 512871173, 521156911, -507988172, 1506772054, -1454921658, 1898049943, -1668675215, 580937015, -664757232, 1710276699, 915693911, -1809684072, 609723321, -1909685346, -1660819109, -83169964, 1330229813, 1084264565, 1992193200, 16034538, 842100943, -1994671959, -1174609830, 1078099193, 1625357355, 1875270378, -604367190, -1598383649, -1415973785, -1272684724, 556720288, 237320038, 1801451108, -1951840467, 13585771, -2111800721, -1358379524, 1285184399, 1488087421, -1115210332, 480850863, 1914704207, -485896727, -1912882661, 618715071, -874737624, 566015977, -821358327, 612491118, 2074953191, -1294566295, 23822128, -1163760912, -784501144, 1587660764, -791711088, -267083638, -1049358887, 767873144, 783920659, -68749161, 1194464230, -1673725551, -1592428522, -1920227806, 193009920, 48365780, -59538796, 347520938, -2085768558, -683447095, 759960937, 1177006962, 1625866553, 1484267897, -1104883769, -796112667, 281177182, -202464622, 2066942576, -704599906, 1544538872, -830241899, -531598568, -1616434285, -1594592327, 1495275359, 1908804281, 1884553775, 1611197846, -1759484656, 1615206468, -2102937339, 2035346998, 208303479, -2117240436, -52796417, -601886031, -1782263122, 634974096, -1906149501, 1554441156, -1105469274, -825344667, 625058658, 1385935766, 745451612) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 09:53:35] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_scot","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_scot\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (268434814) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:53:35] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_scot","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_scot\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (268434814) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:53:43] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"em\".\"fuel_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-843932025, -1915212800, -1645230407, -697951920, 118055960, 2128833364, -567369811, 310956635, -1918263047, -1246034248, -1144004711, 1839125859, -1345162752, 1735525248, -1978708979, 1574055369, 1663401832, -1987478087, -1171478393, 1770243570, -818258464, 1763501654, -893109849, 85619372, 350725182, -182420025, -1279064480, 775840687, -38219474, 1303189715, 1996142013, -183191368, -1110362267, 1734631443, -1781860008, -2140441286, 921165895, -966852427, 1784442077, 2101539831, 2106414096, -197558611, -2019686765, -1912564262, -694125069, -1166060768, -1929400904, 1741715211, -73273843, -604604043, 1371033649, 776279000, -1951358321, -475198975, 859934642, -1334310062, 344405547, -388600018, -955858860, 409891242, 1207010603, -1320908412, 1978588983, -263558204, 725270159, -1689620327, -394200259, 254882134, -1432964826, 971161973, -1573937312, 1983248498, -620524373, -1259394394, -1715977758, -115032065, 1173327443, -1710809284, -913831972) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (1855338849, 203685376, -1068765758, -248609480, 454816236, -762418863, -635957407, 1344636899, 1567694641, 78930848, 606829677, 1685905379, 221388039, 512871173, 521156911, -507988172, 1506772054, -1454921658, 1898049943, -1668675215, 580937015, -664757232, 1710276699, 915693911, -1809684072, 609723321, -1909685346, -1660819109, -83169964, 1330229813, 1084264565, 1992193200, 16034538, 842100943, -1994671959, -1174609830, 1078099193, 1625357355, 1875270378, -604367190, -1598383649, -1415973785, -1272684724, 556720288, 237320038, 1801451108, -1951840467, 13585771, -2111800721, -1358379524, 1285184399, 1488087421, -1115210332, 480850863, 1914704207, -485896727, -1912882661, 618715071, -874737624, 566015977, -821358327, 612491118, 2074953191, -1294566295, 23822128, -1163760912, -784501144, 1587660764, -791711088, -267083638, -1049358887, 767873144, 783920659, -68749161, 1194464230, -1673725551, -1592428522, -1920227806, 193009920, 48365780, -59538796, 347520938, -2085768558, -683447095, 759960937, 1177006962, 1625866553, 1484267897, -1104883769, -796112667, 281177182, -202464622, 2066942576, -704599906, 1544538872, -830241899, -531598568, -1616434285, -1594592327, 1495275359, 1908804281, 1884553775, 1611197846, -1759484656, 1615206468, -2102937339, 2035346998, 208303479, -2117240436, -52796417, -601886031, -1782263122, 634974096, -1906149501, 1554441156, -1105469274, -825344667, 625058658, 1385935766, 745451612) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 09:53:43] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"em\".\"fuel_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-843932025, -1915212800, -1645230407, -697951920, 118055960, 2128833364, -567369811, 310956635, -1918263047, -1246034248, -1144004711, 1839125859, -1345162752, 1735525248, -1978708979, 1574055369, 1663401832, -1987478087, -1171478393, 1770243570, -818258464, 1763501654, -893109849, 85619372, 350725182, -182420025, -1279064480, 775840687, -38219474, 1303189715, 1996142013, -183191368, -1110362267, 1734631443, -1781860008, -2140441286, 921165895, -966852427, 1784442077, 2101539831, 2106414096, -197558611, -2019686765, -1912564262, -694125069, -1166060768, -1929400904, 1741715211, -73273843, -604604043, 1371033649, 776279000, -1951358321, -475198975, 859934642, -1334310062, 344405547, -388600018, -955858860, 409891242, 1207010603, -1320908412, 1978588983, -263558204, 725270159, -1689620327, -394200259, 254882134, -1432964826, 971161973, -1573937312, 1983248498, -620524373, -1259394394, -1715977758, -115032065, 1173327443, -1710809284, -913831972) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (1855338849, 203685376, -1068765758, -248609480, 454816236, -762418863, -635957407, 1344636899, 1567694641, 78930848, 606829677, 1685905379, 221388039, 512871173, 521156911, -507988172, 1506772054, -1454921658, 1898049943, -1668675215, 580937015, -664757232, 1710276699, 915693911, -1809684072, 609723321, -1909685346, -1660819109, -83169964, 1330229813, 1084264565, 1992193200, 16034538, 842100943, -1994671959, -1174609830, 1078099193, 1625357355, 1875270378, -604367190, -1598383649, -1415973785, -1272684724, 556720288, 237320038, 1801451108, -1951840467, 13585771, -2111800721, -1358379524, 1285184399, 1488087421, -1115210332, 480850863, 1914704207, -485896727, -1912882661, 618715071, -874737624, 566015977, -821358327, 612491118, 2074953191, -1294566295, 23822128, -1163760912, -784501144, 1587660764, -791711088, -267083638, -1049358887, 767873144, 783920659, -68749161, 1194464230, -1673725551, -1592428522, -1920227806, 193009920, 48365780, -59538796, 347520938, -2085768558, -683447095, 759960937, 1177006962, 1625866553, 1484267897, -1104883769, -796112667, 281177182, -202464622, 2066942576, -704599906, 1544538872, -830241899, -531598568, -1616434285, -1594592327, 1495275359, 1908804281, 1884553775, 1611197846, -1759484656, 1615206468, -2102937339, 2035346998, 208303479, -2117240436, -52796417, -601886031, -1782263122, 634974096, -1906149501, 1554441156, -1105469274, -825344667, 625058658, 1385935766, 745451612) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 09:53:52] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_scot","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_scot\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (268434814) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 09:53:55] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, u.name AS usage, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_usages\" as \"u\" on \"u\".\"id\" = \"em\".\"usage_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-843932025, -1915212800, -1645230407, -697951920, 118055960, 2128833364, -567369811, 310956635, -1918263047, -1246034248, -1144004711, 1839125859, -1345162752, 1735525248, -1978708979, 1574055369, 1663401832, -1987478087, -1171478393, 1770243570, -818258464, 1763501654, -893109849, 85619372, 350725182, -182420025, -1279064480, 775840687, -38219474, 1303189715, 1996142013, -183191368, -1110362267, 1734631443, -1781860008, -2140441286, 921165895, -966852427, 1784442077, 2101539831, 2106414096, -197558611, -2019686765, -1912564262, -694125069, -1166060768, -1929400904, 1741715211, -73273843, -604604043, 1371033649, 776279000, -1951358321, -475198975, 859934642, -1334310062, 344405547, -388600018, -955858860, 409891242, 1207010603, -1320908412, 1978588983, -263558204, 725270159, -1689620327, -394200259, 254882134, -1432964826, 971161973, -1573937312, 1983248498, -620524373, -1259394394, -1715977758, -115032065, 1173327443, -1710809284, -913831972) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"usage_id\" in (100, 111, 112, 120, 130, 200, 300, 400, 450, 480, 490, 500, 600, 700, 800, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 961, 962, 971, 972, 980, 999, 1001) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"u\".\"name\""} 
[2026-08-11 09:53:55] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, u.name AS usage, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_usages\" as \"u\" on \"u\".\"id\" = \"em\".\"usage_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-843932025, -1915212800, -1645230407, -697951920, 118055960, 2128833364, -567369811, 310956635, -1918263047, -1246034248, -1144004711, 1839125859, -1345162752, 1735525248, -1978708979, 1574055369, 1663401832, -1987478087, -1171478393, 1770243570, -818258464, 1763501654, -893109849, 85619372, 350725182, -182420025, -1279064480, 775840687, -38219474, 1303189715, 1996142013, -183191368, -1110362267, 1734631443, -1781860008, -2140441286, 921165895, -966852427, 1784442077, 2101539831, 2106414096, -197558611, -2019686765, -1912564262, -694125069, -1166060768, -1929400904, 1741715211, -73273843, -604604043, 1371033649, 776279000, -1951358321, -475198975, 859934642, -1334310062, 344405547, -388600018, -955858860, 409891242, 1207010603, -1320908412, 1978588983, -263558204, 725270159, -1689620327, -394200259, 254882134, -1432964826, 971161973, -1573937312, 1983248498, -620524373, -1259394394, -1715977758, -115032065, 1173327443, -1710809284, -913831972) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"usage_id\" in (100, 111, 112, 120, 130, 200, 300, 400, 450, 480, 490, 500, 600, 700, 800, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 961, 962, 971, 972, 980, 999, 1001) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"u\".\"name\""} 
[2026-08-11 09:54:27] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_scot","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_scot\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (268434814) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 09:54:27] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_scot","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_scot\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (268434814) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 09:54:29] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_scot","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_scot\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (268434814) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 09:57:40] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, u.name AS usage, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_usages\" as \"u\" on \"u\".\"id\" = \"em\".\"usage_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-843932025, -1915212800, -1645230407, -697951920, 118055960, 2128833364, -567369811, 310956635, -1918263047, -1246034248, -1144004711, 1839125859, -1345162752, 1735525248, -1978708979, 1574055369, 1663401832, -1987478087, -1171478393, 1770243570, -818258464, 1763501654, -893109849, 85619372, 350725182, -182420025, -1279064480, 775840687, -38219474, 1303189715, 1996142013, -183191368, -1110362267, 1734631443, -1781860008, -2140441286, 921165895, -966852427, 1784442077, 2101539831, 2106414096, -197558611, -2019686765, -1912564262, -694125069, -1166060768, -1929400904, 1741715211, -73273843, -604604043, 1371033649, 776279000, -1951358321, -475198975, 859934642, -1334310062, 344405547, -388600018, -955858860, 409891242, 1207010603, -1320908412, 1978588983, -263558204, 725270159, -1689620327, -394200259, 254882134, -1432964826, 971161973, -1573937312, 1983248498, -620524373, -1259394394, -1715977758, -115032065, 1173327443, -1710809284, -913831972) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"usage_id\" in (100, 111, 112, 120, 130, 200, 300, 400, 450, 480, 490, 500, 600, 700, 800, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 961, 962, 971, 972, 980, 999, 1001) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"u\".\"name\""} 
[2026-08-11 09:57:59] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'snap' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-843932025, -1915212800, -1645230407, -697951920, 118055960, 2128833364, -567369811, 310956635, -1918263047, -1246034248, -1144004711, 1839125859, -1345162752, 1735525248, -1978708979, 1574055369, 1663401832, -1987478087, -1171478393, 1770243570, -818258464, 1763501654, -893109849, 85619372, 350725182, -182420025, -1279064480, 775840687, -38219474, 1303189715, 1996142013, -183191368, -1110362267, 1734631443, -1781860008, -2140441286, 921165895, -966852427, 1784442077, 2101539831, 2106414096, -197558611, -2019686765, -1912564262, -694125069, -1166060768, -1929400904, 1741715211, -73273843, -604604043, 1371033649, 776279000, -1951358321, -475198975, 859934642, -1334310062, 344405547, -388600018, -955858860, 409891242, 1207010603, -1320908412, 1978588983, -263558204, 725270159, -1689620327, -394200259, 254882134, -1432964826, 971161973, -1573937312, 1983248498, -620524373, -1259394394, -1715977758, -115032065, 1173327443, -1710809284, -913831972) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 09:57:59] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'snap' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-843932025, -1915212800, -1645230407, -697951920, 118055960, 2128833364, -567369811, 310956635, -1918263047, -1246034248, -1144004711, 1839125859, -1345162752, 1735525248, -1978708979, 1574055369, 1663401832, -1987478087, -1171478393, 1770243570, -818258464, 1763501654, -893109849, 85619372, 350725182, -182420025, -1279064480, 775840687, -38219474, 1303189715, 1996142013, -183191368, -1110362267, 1734631443, -1781860008, -2140441286, 921165895, -966852427, 1784442077, 2101539831, 2106414096, -197558611, -2019686765, -1912564262, -694125069, -1166060768, -1929400904, 1741715211, -73273843, -604604043, 1371033649, 776279000, -1951358321, -475198975, 859934642, -1334310062, 344405547, -388600018, -955858860, 409891242, 1207010603, -1320908412, 1978588983, -263558204, 725270159, -1689620327, -394200259, 254882134, -1432964826, 971161973, -1573937312, 1983248498, -620524373, -1259394394, -1715977758, -115032065, 1173327443, -1710809284, -913831972) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 09:58:09] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite_parent, COALESCE(a_display.name, '(non rattaché)') AS activite, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a_display\" on \"dtm_a_display\".\"activity_id\" = \"em\".\"activity_id\" inner join \"observatoire\".\"dim_activities\" as \"a_display\" on \"a_display\".\"id\" = \"dtm_a_display\".\"parent_id\" and \"a_display\".\"type_id\" = 'snap' where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-843932025, -1915212800, -1645230407, -697951920, 118055960, 2128833364, -567369811, 310956635, -1918263047, -1246034248, -1144004711, 1839125859, -1345162752, 1735525248, -1978708979, 1574055369, 1663401832, -1987478087, -1171478393, 1770243570, -818258464, 1763501654, -893109849, 85619372, 350725182, -182420025, -1279064480, 775840687, -38219474, 1303189715, 1996142013, -183191368, -1110362267, 1734631443, -1781860008, -2140441286, 921165895, -966852427, 1784442077, 2101539831, 2106414096, -197558611, -2019686765, -1912564262, -694125069, -1166060768, -1929400904, 1741715211, -73273843, -604604043, 1371033649, 776279000, -1951358321, -475198975, 859934642, -1334310062, 344405547, -388600018, -955858860, 409891242, 1207010603, -1320908412, 1978588983, -263558204, 725270159, -1689620327, -394200259, 254882134, -1432964826, 971161973, -1573937312, 1983248498, -620524373, -1259394394, -1715977758, -115032065, 1173327443, -1710809284, -913831972) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite_parent\", \"activite\""} 
[2026-08-11 11:47:21] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2019],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2019) and \"em\".\"geo_id\" in (-2074645457) and \"em\".\"activity_id\" in (1942963054, 506491597, -1315688156, -1017289816, -1438657658, -1519785494, -1390883660, 1108698765, 826582647, 53616376, -1932993837, -1461717196, 747547873, 1435696692, 1659802002, -1605866945, 1711779466, 1367391544, -1371339394, 68476456, -1389614002, -1832238632, 1974281097, -1743267982, -1337323363, -1758060949, 1695347196, 1687613177, -1071587566, 1849745898, 803377337, 730336352, 1989286800, 1967813158, 242615640, 145755964, -837308181, 1429295941, 1362332800, -1210454800, 1034344725, -1436585389, 589008399, -1201074141, 922162158, 1974523832, 153764150, -450105656, 692870153, 1040750617, -432827018, -889255393, 1898736760, -1736763325, 1658855321, 1678295557, -1327037360, 76265396, 503239948, 919914692, 736532642, 2078237231, -869291431, -92274995, 2139709518, 1942080707, 1222056809, 515802054) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 11:47:21] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2019],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2019) and \"em\".\"geo_id\" in (-2074645457) and \"em\".\"activity_id\" in (1942963054, 506491597, -1315688156, -1017289816, -1438657658, -1519785494, -1390883660, 1108698765, 826582647, 53616376, -1932993837, -1461717196, 747547873, 1435696692, 1659802002, -1605866945, 1711779466, 1367391544, -1371339394, 68476456, -1389614002, -1832238632, 1974281097, -1743267982, -1337323363, -1758060949, 1695347196, 1687613177, -1071587566, 1849745898, 803377337, 730336352, 1989286800, 1967813158, 242615640, 145755964, -837308181, 1429295941, 1362332800, -1210454800, 1034344725, -1436585389, 589008399, -1201074141, 922162158, 1974523832, 153764150, -450105656, 692870153, 1040750617, -432827018, -889255393, 1898736760, -1736763325, 1658855321, 1678295557, -1327037360, 76265396, 503239948, 919914692, 736532642, 2078237231, -869291431, -92274995, 2139709518, 1942080707, 1222056809, 515802054) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 11:49:22] local.DEBUG: EstimationN1QueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_estimation_n_1","filter_level":"epci","display_level":null,"years":[2025],"sql":"select fe1.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(fe1.nox_kg_n1)::numeric, 4) AS nox_kg_n1, ROUND(SUM(fe1.pm10_kg_n1)::numeric, 4) AS pm10_kg_n1, ROUND(SUM(fe1.pm2_5_kg_n1)::numeric, 4) AS pm2_5_kg_n1 from \"observatoire\".\"fact_estimation_n_1\" as \"fe1\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"fe1\".\"geo_id\" inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"fe1\".\"activity_pcaet_id\" where \"fe1\".\"year_id\" in (2025) and \"fe1\".\"geo_id\" in (-2074645457) and \"fe1\".\"activity_pcaet_id\" in (14022040) and \"fe1\".\"activity_secten_id\" not in (633536125, 1705364151) group by \"fe1\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 11:49:22] local.DEBUG: EstimationN1QueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_estimation_n_1","filter_level":"epci","display_level":null,"years":[2025],"sql":"select fe1.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(fe1.nox_kg_n1)::numeric, 4) AS nox_kg_n1, ROUND(SUM(fe1.pm10_kg_n1)::numeric, 4) AS pm10_kg_n1, ROUND(SUM(fe1.pm2_5_kg_n1)::numeric, 4) AS pm2_5_kg_n1 from \"observatoire\".\"fact_estimation_n_1\" as \"fe1\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"fe1\".\"geo_id\" inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"fe1\".\"activity_pcaet_id\" where \"fe1\".\"year_id\" in (2025) and \"fe1\".\"geo_id\" in (-2074645457) and \"fe1\".\"activity_pcaet_id\" in (14022040) and \"fe1\".\"activity_secten_id\" not in (633536125, 1705364151) group by \"fe1\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 14:38:45] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 14:38:45] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) group by \"em\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 14:39:13] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 14:39:13] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 14:39:15] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 14:44:17] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"em\".\"fuel_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (1855338849, 203685376, -1068765758, -248609480, 454816236, -762418863, -635957407, 1344636899, 1567694641, 78930848, 606829677, 1685905379, 221388039, 512871173, 521156911, -507988172, 1506772054, -1454921658, 1898049943, -1668675215, 580937015, -664757232, 1710276699, 915693911, -1809684072, 609723321, -1909685346, -1660819109, -83169964, 1330229813, 1084264565, 1992193200, 16034538, 842100943, -1994671959, -1174609830, 1078099193, 1625357355, 1875270378, -604367190, -1598383649, -1415973785, -1272684724, 556720288, 237320038, 1801451108, -1951840467, 13585771, -2111800721, -1358379524, 1285184399, 1488087421, -1115210332, 480850863, 1914704207, -485896727, -1912882661, 618715071, -874737624, 566015977, -821358327, 612491118, 2074953191, -1294566295, 23822128, -1163760912, -784501144, 1587660764, -791711088, -267083638, -1049358887, 767873144, 783920659, -68749161, 1194464230, -1673725551, -1592428522, -1920227806, 193009920, 48365780, -59538796, 347520938, -2085768558, -683447095, 759960937, 1177006962, 1625866553, 1484267897, -1104883769, -796112667, 281177182, -202464622, 2066942576, -704599906, 1544538872, -830241899, -531598568, -1616434285, -1594592327, 1495275359, 1908804281, 1884553775, 1611197846, -1759484656, 1615206468, -2102937339, 2035346998, 208303479, -2117240436, -52796417, -601886031, -1782263122, 634974096, -1906149501, 1554441156, -1105469274, -825344667, 625058658, 1385935766, 745451612) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 14:44:17] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"em\".\"fuel_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (1855338849, 203685376, -1068765758, -248609480, 454816236, -762418863, -635957407, 1344636899, 1567694641, 78930848, 606829677, 1685905379, 221388039, 512871173, 521156911, -507988172, 1506772054, -1454921658, 1898049943, -1668675215, 580937015, -664757232, 1710276699, 915693911, -1809684072, 609723321, -1909685346, -1660819109, -83169964, 1330229813, 1084264565, 1992193200, 16034538, 842100943, -1994671959, -1174609830, 1078099193, 1625357355, 1875270378, -604367190, -1598383649, -1415973785, -1272684724, 556720288, 237320038, 1801451108, -1951840467, 13585771, -2111800721, -1358379524, 1285184399, 1488087421, -1115210332, 480850863, 1914704207, -485896727, -1912882661, 618715071, -874737624, 566015977, -821358327, 612491118, 2074953191, -1294566295, 23822128, -1163760912, -784501144, 1587660764, -791711088, -267083638, -1049358887, 767873144, 783920659, -68749161, 1194464230, -1673725551, -1592428522, -1920227806, 193009920, 48365780, -59538796, 347520938, -2085768558, -683447095, 759960937, 1177006962, 1625866553, 1484267897, -1104883769, -796112667, 281177182, -202464622, 2066942576, -704599906, 1544538872, -830241899, -531598568, -1616434285, -1594592327, 1495275359, 1908804281, 1884553775, 1611197846, -1759484656, 1615206468, -2102937339, 2035346998, 208303479, -2117240436, -52796417, -601886031, -1782263122, 634974096, -1906149501, 1554441156, -1105469274, -825344667, 625058658, 1385935766, 745451612) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 14:44:29] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_petr","filter_level":"petr","display_level":null,"years":[2024],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg from \"observatoire\".\"agg_petr\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-273970232) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"em\".\"fuel_id\" where \"em\".\"year_id\" in (2024) and \"em\".\"geo_id\" in (-1339322508) and \"em\".\"activity_id\" in (-1193483522, -50696485, -1460631101, -1807500046, 971904816, -1846591393, 1352484195, 1578846294, 21937287, 911083398, -244693147, -316787613, -1591836854, 342687363, -715496447, 1649769611, 317524838, 122587945, -668408596, 1915345643, -1859749546, -1744193508, 595015853, 1563060129, 747285232, 1713779118, 1757275487, -1523665978, -356747582, 46178169, 1173150921, -1805861555, -1352377836, -407252425, 2024238092, -1405923019, 1572698384, -436117987, -820564035, 1682085334, -762279866, 2110173394, -2048915241, -609915394, 33249239, -884896557, -1231239857, 1016574566, -639410621, 739923250, 540645732, -1717498989, -142018260, -301100043, -632337157, 1570062812, 942433737, -1074151148, -1839258623, -1409046242, 342527500, -248116745, -853873446, -1771225083, -799071091, 2011035759, -2125877781, -1313144583, 138601578, -1768991392, 1227983953, -794523335, -1363934197, -921669000, -809881216, -1138006003, -924061465, -973132685, -1556578693, 2134862632, -2104684761, -1273156420, -161206170) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (1855338849, 203685376, -1068765758, -248609480, 454816236, -762418863, -635957407, 1344636899, 1567694641, 78930848, 606829677, 1685905379, 221388039, 512871173, 521156911, -507988172, 1506772054, -1454921658, 1898049943, -1668675215, 580937015, -664757232, 1710276699, 915693911, -1809684072, 609723321, -1909685346, -1660819109, -83169964, 1330229813, 1084264565, 1992193200, 16034538, 842100943, -1994671959, -1174609830, 1078099193, 1625357355, 1875270378, -604367190, -1598383649, -1415973785, -1272684724, 556720288, 237320038, 1801451108, -1951840467, 13585771, -2111800721, -1358379524, 1285184399, 1488087421, -1115210332, 480850863, 1914704207, -485896727, -1912882661, 618715071, -874737624, 566015977, -821358327, 612491118, 2074953191, -1294566295, 23822128, -1163760912, -784501144, 1587660764, -791711088, -267083638, -1049358887, 767873144, 783920659, -68749161, 1194464230, -1673725551, -1592428522, -1920227806, 193009920, 48365780, -59538796, 347520938, -2085768558, -683447095, 759960937, 1177006962, 1625866553, 1484267897, -1104883769, -796112667, 281177182, -202464622, 2066942576, -704599906, 1544538872, -830241899, -531598568, -1616434285, -1594592327, 1495275359, 1908804281, 1884553775, 1611197846, -1759484656, 1615206468, -2102937339, 2035346998, 208303479, -2117240436, -52796417, -601886031, -1782263122, 634974096, -1906149501, 1554441156, -1105469274, -825344667, 625058658, 1385935766, 745451612) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:12:06] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:12:06] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:12:17] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:13:44] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:13:45] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:13:51] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"scot","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (268434814)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (268434814) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:14:38] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[268434814],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (268434814) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:14:41] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[268434814],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (268434814) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:26:54] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[268434814],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (268434814) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (268434814) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:27:39] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) and \"em\".\"geo_id\" in (1304264383) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:27:39] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) and \"em\".\"geo_id\" in (1304264383) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:27:44] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) and \"em\".\"geo_id\" in (1304264383) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:28:10] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) and \"em\".\"geo_id\" in (1304264383) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:28:49] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:28:49] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:28:53] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:29:19] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:29:19] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:29:22] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:29:57] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[1304264383],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:29:57] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[1304264383],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:29:59] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[1304264383],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:30:52] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-943236317) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:30:52] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-943236317) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:30:53] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (-943236317) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:31:27] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:31:27] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:31:31] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:32:02] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:32:02] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:32:03] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:32:26] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[-943236317],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:32:26] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[-943236317],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:32:28] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[-943236317],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (-943236317) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:32:57] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 15:32:57] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 15:32:59] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (-943236317)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (-943236317) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 15:33:33] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (1304264383) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:33:33] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (1304264383) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:33:34] local.DEBUG: EmissionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"agg","source_table":"observatoire.agg_epci","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select em.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, COALESCE(f.name, '(non rattaché)') AS combustible, ROUND((SUM(em.conso_ener_finale_clim_normal_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_normal_gj, ROUND(SUM(em.co2_bio_kg)::numeric, 4) AS co2_bio_kg, ROUND(SUM(em.co2_ind_kg)::numeric, 4) AS co2_ind_kg, ROUND(SUM(em.tsp_kg)::numeric, 4) AS tsp_kg, ROUND(SUM(em.pm10_kg)::numeric, 4) AS pm10_kg, ROUND(SUM(em.pm2_5_kg)::numeric, 4) AS pm2_5_kg, ROUND(SUM(em.pm1_kg)::numeric, 4) AS pm1_kg, ROUND(SUM(em.bc_kg)::numeric, 4) AS bc_kg, ROUND(SUM(em.so2_kg)::numeric, 4) AS so2_kg, ROUND(SUM(em.nox_kg)::numeric, 4) AS nox_kg, ROUND(SUM(em.nh3_kg)::numeric, 4) AS nh3_kg, ROUND(SUM(em.co_kg)::numeric, 4) AS co_kg, ROUND(SUM(em.covnm_kg)::numeric, 4) AS covnm_kg, ROUND(SUM(em.co2_kg_pcaet)::numeric, 4) AS co2_kg_pcaet, ROUND(SUM(em.ch4_kg_pcaet)::numeric, 4) AS ch4_kg_pcaet, ROUND(SUM(em.n2o_kg_pcaet)::numeric, 4) AS n2o_kg_pcaet, ROUND(SUM(em.prg_2013_teqco2_pcaet)::numeric, 4) AS prg_2013_teqco2_pcaet, ROUND(SUM(em.prg_2021_teqco2_pcaet)::numeric, 4) AS prg_2021_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2013_teqco2_pcaet)::numeric, 4) AS prg_fluores_2013_teqco2_pcaet, ROUND(SUM(em.prg_fluores_2021_teqco2_pcaet)::numeric, 4) AS prg_fluores_2021_teqco2_pcaet, ROUND((SUM(em.conso_ener_finale_clim_reel_gj)/3.6)::numeric, 2) AS conso_ener_finale_clim_reel_gj from \"observatoire\".\"agg_epci\" as \"em\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"em\".\"geo_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"em\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-622080275, 208862058, 74904297, 1926750763, 1705942411, -273970232, -1732845089, 14022040) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" inner join \"observatoire\".\"dim_fuel_memberships\" as \"dtm_f\" on \"dtm_f\".\"fuel_id\" = \"em\".\"fuel_id\" and \"dtm_f\".\"parent_id\" in (-920315543, 588797234, -1751782324, 2053746054, 1806425435, 324701552, 1761117992, 1747110739, -1099704847) inner join \"observatoire\".\"dim_fuels\" as \"f\" on \"f\".\"id\" = \"dtm_f\".\"parent_id\" where \"em\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) and \"em\".\"geo_id\" in (1304264383) and \"em\".\"activity_id\" in (-2065015321, 1664202072, -1468143007, 1108698765, -697951920, 53616376, 911083398, -2129813176, -1918263047, -393206791, 562718587, 439277546, -858228785, 1839125859, 1824025864, 254468532, 1735525248, 240491429, 751538419, 1662919374, 1660135024, -2109039919, 97436677, -124660711, -1987478087, 722905366, -93516697, -818258464, -1982109166, 1409930224, -2034818798, 1822307428, -1758060949, 155019705, 1869212529, -609915394, 1481894613, 1395794963, 1695347196, 64335092, 921165895, -142018260, -482664252, 26668268, 942433737, 2101539831, -556896478, -289004236, 1180149453, -1100601087, 2113546912, -1166060768, -1270919973, 1741715211, -604604043, -1323823743, -65650287, -1771225083, 556015237, -497458774, 1890006254, -717879577, -475198975, 1306594475, 1087885866, -893165577, -1618922050, 409891242, -2075398489, 865842982, 1765509547, -1487210095, 76265396, 503239948, 1329377505, -2004721785, -1859723360, 1648387281, -731418973, -924061465, -519499276, -1689620327, 571578548, 1372013544, -2017652732, 506491597, 333711349, -1807500046, 680092381, 28083642, 879051533, -1167947622, 1900723648, -198132915, -567369811, 1273925006, 719954458, 1659802002, -1605866945, 1251539306, -1246034248, -2000350303, 122587945, 1855887801, 1307996793, -797747832, 1915345643, -719653191, -574407755, 747285232, 1757275487, 1312649538, 660808751, 1444864905, 82030098, 937605621, -1352377836, -407252425, 1763501654, -1405923019, 350725182, 1824837113, -1560607589, 682492730, 1303189715, 1734631443, 1243082219, 1140080948, -966852427, -632337157, 1663741761, -567757160, -1887790066, -837308181, -1623725498, -1436585389, -248116745, 2079193929, 1285586024, -1749430722, -717359299, -98448292, -853873446, -762838756, 1974523832, -1736763325, 859934642, 760580929, 1658855321, 138601578, 1153344103, 1280935296, -1951484904, 725270159, -1104146686, -225028528, -469721241, -1445420861, -2104684761, -1259394394, 1942080707, -913831972, 350561514, 1206983340, 1633334487, -1017289816, -843932025, -337017078, 454621909, 41079158, -1846591393, 804338617, 1352484195, 1426270099, -1732290900, 1353783048, -1078990055, -307626332, 2128833364, 1054770029, -740347188, -1430328674, 730376509, 504001257, -1859749546, -435776990, -2102767552, -933330074, 112476696, -446796902, -1546313589, 1663401832, 1104829866, -323474854, 906942419, -2009648112, -1608512036, 489987876, 301093584, 1663410790, -820564035, 1066750091, 2110173394, -2048915241, 859987309, 1134610842, -1219234331, 1099679168, 1855856603, -964500217, 21511964, 1388087176, 1967813158, -1063238036, -570672305, 2106414096, 1913359952, -2145734036, 342527500, 429059437, -295738415, -376271361, 827134186, 2047409618, 1519990054, -1487774563, 153764150, 1371033649, 776279000, 692870153, -1951358321, -889255393, 905336003, -1528757905, -1313144583, -189572407, 1219243506, -1959662381, -667330531, -1327037360, -388600018, -1768991392, 631501363, 1428443613, -794523335, -921669000, 50809254, -1151061648, -263558204, -1316167746, 254882134, -1432964826, 971161973, -869291431, -92274995, 2001828071, 717533312, -919698739, -115032065, -1710809284, 1440646841, 438839785, 1838130794, -1438657658, -2100037337, -1645230407, -35163706, -244693147, 747547873, -178006637, -316787613, -1609021450, 425592013, 1142721112, 1125960239, 342687363, -715496447, -466654990, -22267807, 2004972987, 373557710, -538767368, -583628804, 1231105243, -148499659, -1978708979, 1035684050, 595015853, 1713779118, 530155604, 1319740754, -1878882180, -578878727, 46178169, 1173150921, 707403387, 595454509, 2093595260, -178885722, 1933574569, 1689971204, 2099170107, -23642967, -893109849, -394754806, -1052690536, 373550100, -1337323363, 1447225472, 1276215965, 33249239, 730336352, -639410621, 932667705, -1839258623, 1911698987, -37699356, -982013561, -1459018491, -883327242, 1252179801, -450105656, -799071091, -1118403434, -432827018, -2125877781, -1464392700, -1334310062, 1371610371, -1652853783, 2106513667, -1320908412, -1981687934, 1764341119, -457559919, -1414713643, -394200259, -1573937312, -1087220802, 1173327443, 1942963054, -1193483522, 575519546, 1411111401, -50696485, -390568655, -1496086086, -273047452, 1578846294, -1189987097, -366685926, -390542442, 310956635, 494216435, -1591836854, -1958561345, 2001630306, -1144004711, 942233085, -1824930634, -35558533, -1345162752, 1713162907, -600367835, -1294709678, -356747582, -761498023, -1171478393, -487172781, -1805861555, 1024219564, 579293477, 1140113838, -1419278172, 2024238092, -182420025, -1904591798, 2117082238, 1974281097, -1743267982, -919487101, -770400240, -1939219148, 1687214361, -543242059, 1687613177, 692025924, 1949554747, -1071587566, 216692383, -1231239857, -301100043, 1184608045, 1570062812, 1744165561, -2024511393, -2117292693, -183910117, -1210454800, 933754793, 1924478818, 1584015331, -1929400904, -1865280307, 589008399, -125964541, 1640238785, -1829002824, 1898736760, 2108532170, 1044726750, 1923261691, 1227983953, -1363934197, 384410393, -2044885611, 919914692, 736532642, -1239747894, -1632648707, 2134862632, 1386497909, -1028097404, -1390684557, 2139709518, -1273156420, 1222056809, 539391017, 515802054, -2129230707, -1408995398, 632880332, 1772504308, -966063115, -1799725714, 21937287, 1477165581, 1253744553, 203783501, 1236677003, 689872, 1075533786, 1649769611, -97814566, -337441085, 675577244, 1367391544, 1379603351, 1049700765, 847335499, -14567500, -118886754, 1563060129, -1287483713, 1574055369, -1513139721, -1389614002, -1144038162, 775868583, -606258386, -1987052516, 1855178673, -2044004547, -1581253380, 1201608055, 85619372, -68842748, -1279064480, 2005250983, -307341145, 1996142013, 375123593, -271055130, -1781860008, 1096813866, 1849745898, 1007707851, -1605275342, -2140441286, 739923250, -704377305, -467115791, 1079222860, 242615640, -1837178453, 318613241, 347811431, -197558611, -2019686765, -980556544, 1553348267, 494206472, 1112036812, 1258750298, -842445917, 1544265955, -1912564262, -620488471, -889282158, 1299296056, 423665295, 1359890860, 1077172953, -73273843, -1659840926, 1392617912, -1081530607, 1303291967, 392392088, -2017022783, 1184793512, -1869570613, -955858860, 340061913, 618379975, 1011823494, -809881216, 1816787957, 1978588983, -1138006003, 2078237231, 1842692073, -620524373, -1715977758, -939991847, 1418466514, 1620817717, 1901794668, -1390883660, 1843164580, 1743133853, 578558002, -1932993837, -858994155, -1461717196, 1528030456, 1435696692, -648559285, -302632139, -1607714348, 223376167, 1711779466, 317524838, -1082127435, -1990228258, -668408596, 548540297, 1651542945, -1614026445, -1832238632, -1037581785, -1523665978, 600270447, -574372648, -763786315, 283393782, 1770243570, -734407698, -1703285931, -327559973, -1788065014, 960709480, -1814854069, -908948374, -436117987, 1682085334, -762279866, -183191368, 220080184, -57766241, -676428704, 1598532481, -1255434042, 1989286800, -1717498989, 1784442077, -1337246483, 1458785475, -1332638305, 145755964, -1074151148, 1287376035, 1362332800, 224035916, -23479538, -1409046242, -694125069, -566762324, -630866531, -347269928, 679566165, 276545043, 366390502, 288394184, -1914964681, -1286440751, -2020552257, 1678295557, -443199195, -1935636633, 2101386234, 818513443, -708582396, 1983248498, -1871954656, -161206170, -1859668546, -1151541471, 988479706, -1460631101, 971904816, -1519785494, -1915212800, -1888967964, -1802228876, -1296777115, 1201309406, -1531584106, 826582647, 118055960, -1132107069, -373631934, -1371339394, -1940516137, 1127749479, 1201351105, 68476456, -1744193508, -306861080, -980025384, -2072230927, -1736978617, 1572698384, 1177367976, -1156123924, 775840687, -1727327625, -38219474, -2063183380, -1110362267, 1684813422, -884896557, 1016574566, 803377337, 540645732, -1240017080, -1178332843, 2034593037, 1429295941, 1034344725, 1381736146, -62446596, -833249209, 1611256781, -1200401518, -518501295, 1572749265, -807863775, -746688917, 1656148124, -1201074141, 922162158, 302308805, 2079850451, 1040750617, 2011035759, 1436256879, 344405547, 1340950393, 1207010603, 1972919535, -2062377130, -975191328, -973132685, -1556578693, 931702417, -1990261158, 35115389, -1650124362, 500851691, -1315688156) and \"em\".\"activity_id\" not in (-1961301967, 1409433884, -480772070, 253605083, -1464052776, -290906344, -1845071579, 1744461479, -1645028903, -990500766, 454426900, 1145100677, -1320427570, 1885478838, 1588799712, 1741583917) and \"em\".\"fuel_id\" in (193009920, 759960937, 2035346998, -830241899, -1759484656, 23822128, -1163760912, -1660819109, 2066942576, 1898049943, 1484267897, -1358379524, -248609480, 347520938, 1385935766, -1049358887, 1587660764, -784501144, -2085768558, -1454921658, -762418863, -83169964, -704599906, 2074953191, -796112667, -1598383649, -2102937339, -683447095, 203685376, 1344636899, -1105469274, -1909685346, 1084264565, 1554441156, 281177182, -1906149501, 1615206468, -1616434285, 1194464230, -485896727, 1078099193, 1884553775, 1992193200, 1908804281, 842100943, 237320038, 1506772054, 78930848, -821358327, 1625357355, 16034538, 1801451108, -791711088, -601886031, -1592428522, 454816236, 48365780, 625058658, -1104883769, 1567694641, 1625866553, -1415973785, 512871173, -604367190, 13585771, 1914704207, 915693911, -2117240436, -68749161, -52796417, -1294566295, 783920659, 634974096, 556720288, -825344667, 208303479, -1668675215, -1994671959, 1875270378, 1488087421, 745451612, -1951840467, 606829677, -267083638, -664757232, -1068765758, 1611197846, -1673725551, -874737624, 1495275359, 1710276699, -1920227806, -202464622, 480850863, -1782263122, -1594592327, 566015977, -1912882661, 1855338849, -635957407, 1685905379, 618715071, -59538796, 1285184399, -507988172, 767873144, -1115210332, 1177006962, 609723321, 1544538872, 612491118, -2111800721, -1272684724, 521156911, -531598568, 580937015, 221388039, -1174609830, 1330229813, -1809684072) group by \"em\".\"year_id\", \"territoire\", \"activite\", \"combustible\""} 
[2026-08-11 15:34:05] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:34:05] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:34:07] local.DEBUG: ProductionQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_production","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select fp.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(fi.name, '(non rattaché)') AS filiere, v.name AS vecteur, ROUND(SUM(fp.prod_gwh)::numeric, 4) AS prod_gwh, ROUND(SUM(fp.prod_ktep)::numeric, 4) AS prod_ktep from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_production\" as \"fp\" on \"fp\".\"geo_id\" = \"communes\".\"territory_id\" and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"fp\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_filiere_memberships\" as \"dtm_fi\" on \"dtm_fi\".\"filiere_id\" = \"fp\".\"filiere_id\" and \"dtm_fi\".\"parent_id\" in (1298174201, -1583223985, 1270032335, -124248494, -1331514417, 1406800387, 1960668945, -1083934513, 1796054431, 462532502, -1497747537, 732180862, 1824193386, -1433878201, -844504743, 2065315848, -1014473487, -913750026, -1538118520, 897912354, -1843540233, 825071141, -1279318139, -543810268, -2097517554, -24603521, 403082322, -2094806066, 2023378393) inner join \"observatoire\".\"dim_filieres\" as \"fi\" on \"fi\".\"id\" = \"dtm_fi\".\"parent_id\" inner join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"fp\".\"vecteur_id\" where \"fp\".\"filiere_id\" in (-1316980943, -1589048475, 829965003, -1960216134, 801089390, 774281089, 1942610929, -929314708, 1506126584, 1413501954, -1193645855, 1033820579, -2102167500, -1312393098, 1498175839, 1716416743, -1936754040, 1371856852, 1963506075, -1839941303, 1961061561, -1004992653, 144162739, -243069253, -1982952820, -1958549795, 753002958, 1218982353, 193523191, 1680724918, -1109286771, -1165502792, 2023042180, 1500531356, 1723321957, 1340024063, -996979377, 1764268061, 1453260670, -1520867241, 2138005553, -498981429, -1392130500, 513682483, 1852304876, 967948000, -318804108, -1844241335, -1543929019, -1993658124, -1773246028, -1240650519, 1489167039, -992312423, 1200710728, 874142471) and \"fp\".\"vecteur_id\" in (3, 2, 1) group by \"fp\".\"year_id\", \"territoire\", \"filiere\", \"v\".\"name\""} 
[2026-08-11 15:34:32] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 15:34:32] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 15:34:33] local.DEBUG: SequestrationQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_sequestration","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select sq.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, COALESCE(a.name, '(non rattaché)') AS activite, ROUND(SUM(sq.prg_2013_teqco2_utcatf)::numeric, 4) AS prg_2013_teqco2_utcatf, ROUND(SUM(sq.prg_2021_teqco2_utcatf)::numeric, 4) AS prg_2021_teqco2_utcatf from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_sequestration\" as \"sq\" on \"sq\".\"geo_id\" = \"communes\".\"territory_id\" and \"sq\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"sq\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" inner join \"observatoire\".\"dim_activity_memberships\" as \"dtm_a\" on \"dtm_a\".\"activity_id\" = \"sq\".\"activity_id\" and \"dtm_a\".\"parent_id\" in (-2002853943, -1567040972, -1625133383) inner join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dtm_a\".\"parent_id\" where \"sq\".\"activity_id\" in (-2035023658, -1732453896, -1411397843, -1110135120, -505144512, 129249553, 256809383, 672883871, 795905378, 857918114, 1145580068) group by \"sq\".\"year_id\", \"territoire\", \"activite\""} 
[2026-08-11 15:34:51] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:34:51] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:34:54] local.DEBUG: EnrQueryBuilder {"context":"App\\Services\\Inventaire\\{closure}","mode":"fact","source_table":"observatoire.fact_enr","filter_level":"epci","display_level":null,"years":[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2012,2010,2005,1990],"sql":"select enr.year_id, COALESCE(t.name, '(non rattaché)') AS territoire, ROUND(((SUM(enr.numerateur_ktep) / NULLIF(SUM(enr.denominateur_ktep), 0)) * 100)::numeric, 2) AS ratio_enr from (select DISTINCT territory_id from \"observatoire\".\"dim_territory_memberships\" where \"parent_id\" in (1304264383)) as communes inner join \"observatoire\".\"fact_enr\" as \"enr\" on \"enr\".\"geo_id\" = \"communes\".\"territory_id\" and \"enr\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2012, 2010, 2005, 1990) left join \"observatoire\".\"dim_territory_memberships\" as \"dtm_d\" on \"dtm_d\".\"territory_id\" = \"enr\".\"geo_id\" and \"dtm_d\".\"parent_id\" in (1304264383) left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"dtm_d\".\"parent_id\" where (enr.confid_epci IS NULL OR enr.confid_epci = 0) group by \"enr\".\"year_id\", \"territoire\""} 
[2026-08-11 15:35:11] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[1304264383],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
[2026-08-11 15:35:13] local.DEBUG: FactureEnergetiqueQuery {"years":[2024,2023,2022,2021,2020,2019,2018,2017],"filter_geo_ids":[1304264383],"top_n":5,"sql":"select \"result\".\"territoire_id\", COALESCE(t.name, '(non rattaché)') AS territoire, \"result\".\"year_id\", \"result\".\"id_type_comptable\", \"result\".\"rang\", \"result\".\"montant_euros\", \"result\".\"contribution\", CASE WHEN result.id_type_comptable = 1 THEN 'Dépenses' WHEN result.id_type_comptable = 2 THEN 'Recettes' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' END AS type_comptable, CASE WHEN result.rang = 0 AND result.id_type_comptable = 1 THEN 'Dépense totale' WHEN result.rang = 0 AND result.id_type_comptable = 2 THEN 'Recette totale' WHEN result.id_type_comptable = 3 THEN 'Facture nette globale' WHEN result.id_type_comptable = 4 THEN 'Facture nette globale/hab' WHEN result.id_type_comptable = 1 THEN COALESCE(a.name, '') || ' - ' || COALESCE(fc.name, '') WHEN result.id_type_comptable = 2 THEN COALESCE(fdi.name, '') || ' - ' || COALESCE(v.name, '') END AS poste from ((select territoire_id, year_id, 1 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 1 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 2 AS id_type_comptable, poste_energetique_id, rang, montant_euros, contribution from (select a.territoire_id, a.year_id, a.poste_energetique_id, RANK() OVER (PARTITION BY a.territoire_id, a.year_id ORDER BY a.montant_euros DESC) AS rang, a.montant_euros, ROUND((a.montant_euros / t.montant_euros * 100)::numeric, 2) AS contribution from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"a\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"t\" on \"t\".\"territoire_id\" = \"a\".\"territoire_id\" and \"t\".\"year_id\" = \"a\".\"year_id\") as \"ranked\" where \"rang\" <= 5) union all (select territoire_id, year_id, 2 AS id_type_comptable, NULL::integer AS poste_energetique_id, 0::bigint AS rang, montant_euros, 100::numeric AS contribution from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"agg\") union all (select territoire_id, year_id, 3 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ABS(montant_euros) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\") union all (select fg.territoire_id, fg.year_id, 4 AS id_type_comptable, NULL::integer AS poste_energetique_id, NULL::bigint AS rang, ROUND((ABS(fg.montant_euros) / pa.population)::numeric, 2) AS montant_euros, NULL::numeric AS contribution from (select \"dt\".\"territoire_id\", \"dt\".\"year_id\", (rt.montant_euros - dt.montant_euros) as montant_euros from (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_depense_conso_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 1 and \"dpe\".\"activity_id\" = \"f\".\"activity_id\" and \"dpe\".\"fuel_cat_id\" = \"f\".\"fuel_cat_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"dt\" inner join (select \"territoire_id\", \"year_id\", SUM(montant_euros) as montant_euros from (select \"dtm\".\"parent_id\" as \"territoire_id\", \"f\".\"year_id\", \"dpe\".\"id\" as \"poste_energetique_id\", SUM(f.montant_euros) as montant_euros from \"observatoire\".\"fact_recette_prod_energetique\" as \"f\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"f\".\"geo_id\" inner join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id_type_comptable\" = 2 and \"dpe\".\"filiere_detail_interne_id\" = \"f\".\"filiere_detail_interne_id\" and \"dpe\".\"vecteur_id\" = \"f\".\"vecteur_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"f\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"f\".\"year_id\", \"dpe\".\"id\") as \"agg\" group by \"territoire_id\", \"year_id\") as \"rt\" on \"rt\".\"territoire_id\" = \"dt\".\"territoire_id\" and \"rt\".\"year_id\" = \"dt\".\"year_id\") as \"fg\" inner join (select \"dtm\".\"parent_id\" as \"territoire_id\", \"fp\".\"year_id\", SUM(fp.population) as population from \"observatoire\".\"fact_population\" as \"fp\" inner join \"observatoire\".\"dim_territory_memberships\" as \"dtm\" on \"dtm\".\"territory_id\" = \"fp\".\"geo_id\" where \"dtm\".\"parent_id\" in (1304264383) and \"fp\".\"year_id\" in (2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017) group by \"dtm\".\"parent_id\", \"fp\".\"year_id\") as \"pa\" on \"pa\".\"territoire_id\" = \"fg\".\"territoire_id\" and \"pa\".\"year_id\" = \"fg\".\"year_id\")) as \"result\" left join \"observatoire\".\"dim_territories\" as \"t\" on \"t\".\"id\" = \"result\".\"territoire_id\" left join \"observatoire\".\"dim_postes_energetique\" as \"dpe\" on \"dpe\".\"id\" = \"result\".\"poste_energetique_id\" left join \"observatoire\".\"dim_activities\" as \"a\" on \"a\".\"id\" = \"dpe\".\"activity_id\" left join \"observatoire\".\"dim_fuels\" as \"fc\" on \"fc\".\"id\" = \"dpe\".\"fuel_cat_id\" left join \"observatoire\".\"dim_filieres\" as \"fdi\" on \"fdi\".\"id\" = \"dpe\".\"filiere_detail_interne_id\" left join \"observatoire\".\"dim_vecteurs\" as \"v\" on \"v\".\"id\" = \"dpe\".\"vecteur_id\""} 
