From 9cda4eb8214ef371822792ff1a41282055ddcbb0 Mon Sep 17 00:00:00 2001 From: philippe Date: Sat, 1 Feb 2025 16:26:51 +0100 Subject: [PATCH] pdc -> statique --- src/prefect/indicators/infrastructure/i1.py | 11 ++++++----- src/prefect/indicators/infrastructure/i7.py | 7 ++++--- src/prefect/indicators/infrastructure/t1.py | 16 +++++++++------- src/prefect/indicators/usage/u10.py | 7 ++++--- src/prefect/indicators/usage/u11.py | 8 ++++---- src/prefect/indicators/usage/u12.py | 7 ++++--- src/prefect/indicators/usage/u13.py | 7 ++++--- src/prefect/indicators/usage/u5.py | 7 ++++--- src/prefect/indicators/usage/u6.py | 10 ++++++---- src/prefect/indicators/usage/u9.py | 10 ++++++---- .../infrastructure/{_test_i1.py => test_i1.py} | 0 .../infrastructure/{_test_i4.py => test_i4.py} | 0 .../infrastructure/{_test_i7.py => test_i7.py} | 0 .../infrastructure/{_test_t1.py => test_t1.py} | 0 .../{_test_utils.py => test_utils.py} | 0 .../tests/usage/{_test_c1.py => test_c1.py} | 0 .../tests/usage/{_test_u10.py => test_u10.py} | 0 .../tests/usage/{_test_u11.py => test_u11.py} | 0 .../tests/usage/{_test_u12.py => test_u12.py} | 0 .../tests/usage/{_test_u13.py => test_u13.py} | 0 .../tests/usage/{_test_u5.py => test_u5.py} | 0 .../tests/usage/{_test_u6.py => test_u6.py} | 0 .../tests/usage/{_test_u9.py => test_u9.py} | 0 23 files changed, 51 insertions(+), 39 deletions(-) rename src/prefect/tests/infrastructure/{_test_i1.py => test_i1.py} (100%) rename src/prefect/tests/infrastructure/{_test_i4.py => test_i4.py} (100%) rename src/prefect/tests/infrastructure/{_test_i7.py => test_i7.py} (100%) rename src/prefect/tests/infrastructure/{_test_t1.py => test_t1.py} (100%) rename src/prefect/tests/infrastructure/{_test_utils.py => test_utils.py} (100%) rename src/prefect/tests/usage/{_test_c1.py => test_c1.py} (100%) rename src/prefect/tests/usage/{_test_u10.py => test_u10.py} (100%) rename src/prefect/tests/usage/{_test_u11.py => test_u11.py} (100%) rename src/prefect/tests/usage/{_test_u12.py => test_u12.py} (100%) rename src/prefect/tests/usage/{_test_u13.py => test_u13.py} (100%) rename src/prefect/tests/usage/{_test_u5.py => test_u5.py} (100%) rename src/prefect/tests/usage/{_test_u6.py => test_u6.py} (100%) rename src/prefect/tests/usage/{_test_u9.py => test_u9.py} (100%) diff --git a/src/prefect/indicators/infrastructure/i1.py b/src/prefect/indicators/infrastructure/i1.py index 1117283f..13060e42 100644 --- a/src/prefect/indicators/infrastructure/i1.py +++ b/src/prefect/indicators/infrastructure/i1.py @@ -26,13 +26,14 @@ NUM_POCS_FOR_LEVEL_QUERY_TEMPLATE = """ SELECT - COUNT(DISTINCT PointDeCharge.id_pdc_itinerance) AS value, + COUNT(DISTINCT id_pdc_itinerance) AS value, $level_id AS level_id FROM - PointDeCharge - INNER JOIN Station ON PointDeCharge.station_id = Station.id - INNER JOIN Localisation ON Station.localisation_id = Localisation.id - INNER JOIN City ON Localisation.code_insee_commune = City.code + Statique + --PointDeCharge + --INNER JOIN Station ON PointDeCharge.station_id = Station.id + --INNER JOIN Localisation ON Station.localisation_id = Localisation.id + INNER JOIN City ON code_insee_commune = City.code $join_extras WHERE $level_id IN ($indexes) GROUP BY $level_id diff --git a/src/prefect/indicators/infrastructure/i7.py b/src/prefect/indicators/infrastructure/i7.py index be682815..15719cf8 100644 --- a/src/prefect/indicators/infrastructure/i7.py +++ b/src/prefect/indicators/infrastructure/i7.py @@ -29,9 +29,10 @@ sum(puissance_nominale) AS value, $level_id AS level_id FROM - pointdecharge - INNER JOIN station ON station.id = station_id - INNER JOIN localisation ON localisation_id = localisation.id + statique + --pointdecharge + --INNER JOIN station ON station.id = station_id + --INNER JOIN localisation ON localisation_id = localisation.id INNER JOIN city on city.code = code_insee_commune $join_extras WHERE $level_id IN ($indexes) diff --git a/src/prefect/indicators/infrastructure/t1.py b/src/prefect/indicators/infrastructure/t1.py index e469f7bc..00bcc679 100644 --- a/src/prefect/indicators/infrastructure/t1.py +++ b/src/prefect/indicators/infrastructure/t1.py @@ -28,14 +28,15 @@ WITH $power_range SELECT - COUNT(DISTINCT PointDeCharge.id_pdc_itinerance) AS value, + COUNT(DISTINCT id_pdc_itinerance) AS value, category, $level_id AS level_id FROM - PointDeCharge - INNER JOIN Station ON PointDeCharge.station_id = Station.id - INNER JOIN Localisation ON Station.localisation_id = Localisation.id - INNER JOIN City ON Localisation.code_insee_commune = City.code + Statique + --PointDeCharge + --INNER JOIN Station ON PointDeCharge.station_id = Station.id + --INNER JOIN Localisation ON Station.localisation_id = Localisation.id + INNER JOIN City ON code_insee_commune = City.code LEFT JOIN puissance ON puissance_nominale::numeric <@ category $join_extras WHERE @@ -50,10 +51,11 @@ WITH $power_range SELECT - COUNT(DISTINCT PointDeCharge.id_pdc_itinerance) AS value, + COUNT(DISTINCT id_pdc_itinerance) AS value, category FROM - PointDeCharge + Statique + --PointDeCharge LEFT JOIN puissance ON puissance_nominale::numeric <@ category GROUP BY category diff --git a/src/prefect/indicators/usage/u10.py b/src/prefect/indicators/usage/u10.py index f9707e12..6d78de82 100644 --- a/src/prefect/indicators/usage/u10.py +++ b/src/prefect/indicators/usage/u10.py @@ -30,9 +30,10 @@ $level_id AS level_id FROM SESSION - INNER JOIN PointDeCharge ON point_de_charge_id = PointDeCharge.id - LEFT JOIN station ON station_id = station.id - LEFT JOIN localisation ON localisation_id = localisation.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON point_de_charge_id = PointDeCharge.id + --LEFT JOIN station ON station_id = station.id + --LEFT JOIN localisation ON localisation_id = localisation.id LEFT JOIN city ON city.code = code_insee_commune $join_extras WHERE diff --git a/src/prefect/indicators/usage/u11.py b/src/prefect/indicators/usage/u11.py index 3217b27a..a1cf003f 100644 --- a/src/prefect/indicators/usage/u11.py +++ b/src/prefect/indicators/usage/u11.py @@ -30,9 +30,10 @@ $level_id AS level_id FROM SESSION - INNER JOIN PointDeCharge ON point_de_charge_id = PointDeCharge.id - LEFT JOIN Station ON station_id = Station.id - LEFT JOIN Localisation ON localisation_id = Localisation.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON point_de_charge_id = PointDeCharge.id + --LEFT JOIN Station ON station_id = Station.id + --LEFT JOIN Localisation ON localisation_id = Localisation.id LEFT JOIN City ON City.code = code_insee_commune $join_extras WHERE @@ -54,7 +55,6 @@ AND Session.end - Session.start > '3 minutes'::interval """ - @task(task_run_name="values-for-target-{level:02d}") def get_values_for_targets( connection: Connection, diff --git a/src/prefect/indicators/usage/u12.py b/src/prefect/indicators/usage/u12.py index a2b1fb37..b68a0634 100644 --- a/src/prefect/indicators/usage/u12.py +++ b/src/prefect/indicators/usage/u12.py @@ -44,9 +44,10 @@ $level_id AS level_id FROM statusf - INNER JOIN PointDeCharge ON statusf.point_de_charge_id = PointDeCharge.id - LEFT JOIN Station ON station_id = Station.id - LEFT JOIN Localisation ON localisation_id = Localisation.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON statusf.point_de_charge_id = PointDeCharge.id + --LEFT JOIN Station ON station_id = Station.id + --LEFT JOIN Localisation ON localisation_id = Localisation.id LEFT JOIN City ON City.code = code_insee_commune LEFT JOIN puissance ON puissance_nominale::numeric <@ category $join_extras diff --git a/src/prefect/indicators/usage/u13.py b/src/prefect/indicators/usage/u13.py index f2134258..4a8f280a 100644 --- a/src/prefect/indicators/usage/u13.py +++ b/src/prefect/indicators/usage/u13.py @@ -42,9 +42,10 @@ $level_id AS level_id FROM statusf - INNER JOIN PointDeCharge ON statusf.point_de_charge_id = PointDeCharge.id - LEFT JOIN Station ON station_id = Station.id - LEFT JOIN Localisation ON localisation_id = Localisation.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON statusf.point_de_charge_id = PointDeCharge.id + --LEFT JOIN Station ON station_id = Station.id + --LEFT JOIN Localisation ON localisation_id = Localisation.id LEFT JOIN City ON City.code = code_insee_commune $join_extras WHERE diff --git a/src/prefect/indicators/usage/u5.py b/src/prefect/indicators/usage/u5.py index 471ed35c..0b933b54 100644 --- a/src/prefect/indicators/usage/u5.py +++ b/src/prefect/indicators/usage/u5.py @@ -31,9 +31,10 @@ $level_id AS level_id FROM Session - INNER JOIN PointDeCharge ON point_de_charge_id = PointDeCharge.id - LEFT JOIN Station ON station_id = Station.id - LEFT JOIN Localisation ON localisation_id = Localisation.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON point_de_charge_id = PointDeCharge.id + --LEFT JOIN Station ON station_id = Station.id + --LEFT JOIN Localisation ON localisation_id = Localisation.id LEFT JOIN City ON City.code = code_insee_commune $join_extras WHERE diff --git a/src/prefect/indicators/usage/u6.py b/src/prefect/indicators/usage/u6.py index 8895d8b5..fb01efed 100644 --- a/src/prefect/indicators/usage/u6.py +++ b/src/prefect/indicators/usage/u6.py @@ -45,9 +45,10 @@ $level_id AS level_id FROM sessionf - INNER JOIN PointDeCharge ON sessionf.point_de_charge_id = PointDeCharge.id - LEFT JOIN Station ON station_id = Station.id - LEFT JOIN Localisation ON localisation_id = Localisation.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON sessionf.point_de_charge_id = PointDeCharge.id + --LEFT JOIN Station ON station_id = Station.id + --LEFT JOIN Localisation ON localisation_id = Localisation.id LEFT JOIN City ON City.code = code_insee_commune LEFT JOIN puissance ON puissance_nominale::numeric <@ category $join_extras @@ -77,7 +78,8 @@ category FROM sessionf - INNER JOIN PointDeCharge ON sessionf.point_de_charge_id = PointDeCharge.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON sessionf.point_de_charge_id = PointDeCharge.id LEFT JOIN puissance ON puissance_nominale::numeric <@ category GROUP BY category diff --git a/src/prefect/indicators/usage/u9.py b/src/prefect/indicators/usage/u9.py index e4d8b584..bb087a8e 100644 --- a/src/prefect/indicators/usage/u9.py +++ b/src/prefect/indicators/usage/u9.py @@ -45,9 +45,10 @@ $level_id AS level_id FROM sessionf - INNER JOIN PointDeCharge ON sessionf.point_de_charge_id = PointDeCharge.id - LEFT JOIN Station ON station_id = Station.id - LEFT JOIN Localisation ON localisation_id = Localisation.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON sessionf.point_de_charge_id = PointDeCharge.id + --LEFT JOIN Station ON station_id = Station.id + --LEFT JOIN Localisation ON localisation_id = Localisation.id LEFT JOIN City ON City.code = code_insee_commune LEFT JOIN puissance ON puissance_nominale::numeric <@ category $join_extras @@ -77,7 +78,8 @@ category FROM sessionf - INNER JOIN PointDeCharge ON sessionf.point_de_charge_id = PointDeCharge.id + INNER JOIN statique ON point_de_charge_id = pdc_id + --INNER JOIN PointDeCharge ON sessionf.point_de_charge_id = PointDeCharge.id LEFT JOIN puissance ON puissance_nominale::numeric <@ category GROUP BY category diff --git a/src/prefect/tests/infrastructure/_test_i1.py b/src/prefect/tests/infrastructure/test_i1.py similarity index 100% rename from src/prefect/tests/infrastructure/_test_i1.py rename to src/prefect/tests/infrastructure/test_i1.py diff --git a/src/prefect/tests/infrastructure/_test_i4.py b/src/prefect/tests/infrastructure/test_i4.py similarity index 100% rename from src/prefect/tests/infrastructure/_test_i4.py rename to src/prefect/tests/infrastructure/test_i4.py diff --git a/src/prefect/tests/infrastructure/_test_i7.py b/src/prefect/tests/infrastructure/test_i7.py similarity index 100% rename from src/prefect/tests/infrastructure/_test_i7.py rename to src/prefect/tests/infrastructure/test_i7.py diff --git a/src/prefect/tests/infrastructure/_test_t1.py b/src/prefect/tests/infrastructure/test_t1.py similarity index 100% rename from src/prefect/tests/infrastructure/_test_t1.py rename to src/prefect/tests/infrastructure/test_t1.py diff --git a/src/prefect/tests/infrastructure/_test_utils.py b/src/prefect/tests/infrastructure/test_utils.py similarity index 100% rename from src/prefect/tests/infrastructure/_test_utils.py rename to src/prefect/tests/infrastructure/test_utils.py diff --git a/src/prefect/tests/usage/_test_c1.py b/src/prefect/tests/usage/test_c1.py similarity index 100% rename from src/prefect/tests/usage/_test_c1.py rename to src/prefect/tests/usage/test_c1.py diff --git a/src/prefect/tests/usage/_test_u10.py b/src/prefect/tests/usage/test_u10.py similarity index 100% rename from src/prefect/tests/usage/_test_u10.py rename to src/prefect/tests/usage/test_u10.py diff --git a/src/prefect/tests/usage/_test_u11.py b/src/prefect/tests/usage/test_u11.py similarity index 100% rename from src/prefect/tests/usage/_test_u11.py rename to src/prefect/tests/usage/test_u11.py diff --git a/src/prefect/tests/usage/_test_u12.py b/src/prefect/tests/usage/test_u12.py similarity index 100% rename from src/prefect/tests/usage/_test_u12.py rename to src/prefect/tests/usage/test_u12.py diff --git a/src/prefect/tests/usage/_test_u13.py b/src/prefect/tests/usage/test_u13.py similarity index 100% rename from src/prefect/tests/usage/_test_u13.py rename to src/prefect/tests/usage/test_u13.py diff --git a/src/prefect/tests/usage/_test_u5.py b/src/prefect/tests/usage/test_u5.py similarity index 100% rename from src/prefect/tests/usage/_test_u5.py rename to src/prefect/tests/usage/test_u5.py diff --git a/src/prefect/tests/usage/_test_u6.py b/src/prefect/tests/usage/test_u6.py similarity index 100% rename from src/prefect/tests/usage/_test_u6.py rename to src/prefect/tests/usage/test_u6.py diff --git a/src/prefect/tests/usage/_test_u9.py b/src/prefect/tests/usage/test_u9.py similarity index 100% rename from src/prefect/tests/usage/_test_u9.py rename to src/prefect/tests/usage/test_u9.py