From a6514ad955c0359a84171d868d89c6903afa332e Mon Sep 17 00:00:00 2001 From: Steve Mosley Date: Thu, 12 Oct 2023 14:47:51 +1300 Subject: [PATCH 1/7] Adding in sample data scripts and way to run from gradle --- packages/Manager/build.gradle.kts | 41 +++++++++++++- .../Manager/sample-data/allocation_data.sql | 56 +++++++++++++++++++ .../Manager/sample-data/observation_data.sql | 17 ++++++ 3 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 packages/Manager/sample-data/allocation_data.sql create mode 100644 packages/Manager/sample-data/observation_data.sql diff --git a/packages/Manager/build.gradle.kts b/packages/Manager/build.gradle.kts index 37046c78..0fdb7797 100644 --- a/packages/Manager/build.gradle.kts +++ b/packages/Manager/build.gradle.kts @@ -1,5 +1,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jooq.meta.jaxb.ForcedType +import org.springframework.core.io.FileSystemResource +import org.springframework.jdbc.datasource.SingleConnectionDataSource +import org.springframework.jdbc.datasource.init.ScriptUtils plugins { id("org.springframework.boot") version "3.1.3" @@ -20,6 +23,14 @@ java.sourceCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +buildscript { + repositories { mavenCentral() } + dependencies { + "classpath"(group = "org.springframework", name = "spring-jdbc", version = "6.0.12") + "classpath"(group = "org.postgresql", name = "postgresql", version = "42.6.0") + } +} + ext["jooq.version"] = jooq.version.get() dependencies { @@ -78,13 +89,15 @@ configure { val dbConfig = mapOf( - "url" to + "devUrl" to + "jdbc:postgresql://${System.getenv("CONFIG_DATABASE_HOST") ?: "localhost"}:5432/eop_dev", + "testUrl" to "jdbc:postgresql://${System.getenv("CONFIG_DATABASE_HOST") ?: "localhost"}:5432/eop_test", "user" to "postgres", "password" to "password") flyway { - url = dbConfig["url"] + url = dbConfig["testUrl"] user = dbConfig["user"] password = dbConfig["password"] schemas = arrayOf("public") @@ -98,7 +111,7 @@ jooq { logging = org.jooq.meta.jaxb.Logging.WARN jdbc.apply { driver = "org.postgresql.Driver" - url = dbConfig["url"] + url = dbConfig["testUrl"] user = dbConfig["user"] password = dbConfig["password"] } @@ -166,3 +179,25 @@ testlogger { showSkippedStandardStreams = false showFailedStandardStreams = true } + +tasks.register("loadSampleData") { + dependsOn("flywayMigrate") + doLast { + println("Loading Sample Data") + SingleConnectionDataSource( + dbConfig["devUrl"]!!, dbConfig["user"]!!, dbConfig["password"]!!, true) + .let { + it.connection.use { connection -> + ScriptUtils.executeSqlScript( + connection, FileSystemResource("./sample-data/allocation_data.sql")) + ScriptUtils.executeSqlScript( + connection, FileSystemResource("./sample-data/observation_data.sql")) + } + } + } +} + +tasks.register("refreshSampleData") { + dependsOn("flywayMigrate") + doLast { println("refreshSampleData - TODO rebase observations data off current time.") } +} diff --git a/packages/Manager/sample-data/allocation_data.sql b/packages/Manager/sample-data/allocation_data.sql new file mode 100644 index 00000000..85033ef6 --- /dev/null +++ b/packages/Manager/sample-data/allocation_data.sql @@ -0,0 +1,56 @@ +TRUNCATE TABLE water_allocations RESTART IDENTITY CASCADE; + +INSERT INTO water_allocations (area_id, ingest_id, source_id, consent_id, status, is_metered, allocation, meters, effective_from, effective_to, created_at, updated_at) +VALUES ('BoothsSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-01"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Dry RiverGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-02"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Fernhill TiffenGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-03"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('HuangaruaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-04"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('HuangaruaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-05"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('HuttSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-06"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('KapitiCoastSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-07"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('KopuarangaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-08"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('LakeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-09"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('LakeWairarapaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-10"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Lower HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-11"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('LowerRuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-12"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('MangatarereGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-13"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('MangatarereSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-14"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('MartinboroughGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-15"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('OnokeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-16"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('OrongorongoSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-17"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('OtakiSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-18"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('OtukuraSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-19"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('PapawaiSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-20"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('ParkvaleSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-21"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('ParkvaleUnconfinedGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-22"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Parkvale_ConfinedGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-23"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('RaumatiGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-24"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('RuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-25"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('RuamahangaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-26"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Ruamahanga_LowerSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-27"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Ruamahanga_MiddleSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-28"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Ruamahanga_OtherGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-29"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Ruamahanga_UpperSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-30"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('TaratahiGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-31"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('TauherenikauGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-32"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('TauherenikauSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-33"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Te HoroGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-34"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Te Ore OreGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-35"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('TeAwaruaoPoriruaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-36"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Upper HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-37"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Upper RuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-38"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaikanaeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-39"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaikanaeSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-40"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaingawaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-41"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaingawaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-42"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WainuiomataSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-43"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaiohineSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-44"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaipouaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-45"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Wairarapa CoastSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-46"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WairarapaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-47"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaitohuGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-48"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WgnHarbour,HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-49"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WgnHarbour,HuttSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-50"}', '2000-01-01', '2099-01-01', NOW(), NOW()); + + + diff --git a/packages/Manager/sample-data/observation_data.sql b/packages/Manager/sample-data/observation_data.sql new file mode 100644 index 00000000..22c3714c --- /dev/null +++ b/packages/Manager/sample-data/observation_data.sql @@ -0,0 +1,17 @@ +TRUNCATE TABLE observation_sites RESTART IDENTITY CASCADE; + +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-1', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-2', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-3', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-4', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-5', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-6', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-7', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-8', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-9', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-10', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-11', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-12', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-13', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-14', null); +INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-15', null); From 61ff9581fb145ceb4c900ea30490cff5d8cad97f Mon Sep 17 00:00:00 2001 From: Steve Mosley Date: Thu, 12 Oct 2023 15:04:09 +1300 Subject: [PATCH 2/7] Update so source id is unique per row --- .../Manager/sample-data/allocation_data.sql | 103 +++++++++--------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/packages/Manager/sample-data/allocation_data.sql b/packages/Manager/sample-data/allocation_data.sql index 85033ef6..6e40393e 100644 --- a/packages/Manager/sample-data/allocation_data.sql +++ b/packages/Manager/sample-data/allocation_data.sql @@ -1,56 +1,53 @@ TRUNCATE TABLE water_allocations RESTART IDENTITY CASCADE; INSERT INTO water_allocations (area_id, ingest_id, source_id, consent_id, status, is_metered, allocation, meters, effective_from, effective_to, created_at, updated_at) -VALUES ('BoothsSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-01"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Dry RiverGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-02"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Fernhill TiffenGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-03"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('HuangaruaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-04"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('HuangaruaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-05"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('HuttSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-06"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('KapitiCoastSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-07"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('KopuarangaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-08"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('LakeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-09"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('LakeWairarapaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-10"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Lower HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-11"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('LowerRuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-12"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('MangatarereGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-13"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('MangatarereSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-14"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('MartinboroughGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-15"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('OnokeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-16"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('OrongorongoSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-17"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('OtakiSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-18"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('OtukuraSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-19"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('PapawaiSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-20"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('ParkvaleSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-21"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('ParkvaleUnconfinedGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-22"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Parkvale_ConfinedGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-23"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('RaumatiGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-24"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('RuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-25"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('RuamahangaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-26"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Ruamahanga_LowerSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-27"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Ruamahanga_MiddleSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-28"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Ruamahanga_OtherGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-29"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Ruamahanga_UpperSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-30"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('TaratahiGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-31"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('TauherenikauGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-32"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('TauherenikauSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-33"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Te HoroGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-34"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Te Ore OreGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-35"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('TeAwaruaoPoriruaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-36"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Upper HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-37"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Upper RuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-38"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WaikanaeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-39"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WaikanaeSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-40"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WaingawaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-41"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WaingawaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-42"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WainuiomataSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-43"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WaiohineSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-44"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WaipouaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-45"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('Wairarapa CoastSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-46"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WairarapaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-47"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WaitohuGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-48"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WgnHarbour,HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-49"}', '2000-01-01', '2099-01-01', NOW(), NOW()), - ('WgnHarbour,HuttSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-ID', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-50"}', '2000-01-01', '2099-01-01', NOW(), NOW()); - - - +VALUES ('BoothsSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-01', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-01"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Dry RiverGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-02', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-02"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Fernhill TiffenGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-03', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-03"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('HuangaruaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-04', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-04"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('HuangaruaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-05', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-05"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('HuttSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-06', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-06"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('KapitiCoastSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-07', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-07"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('KopuarangaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-08', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-08"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('LakeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-09', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-09"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('LakeWairarapaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-10', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-10"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Lower HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-11', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-11"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('LowerRuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-12', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-12"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('MangatarereGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-13', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-13"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('MangatarereSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-14', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-14"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('MartinboroughGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-15', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-15"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('OnokeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-16', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-16"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('OrongorongoSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-17', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-17"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('OtakiSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-18', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-18"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('OtukuraSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-19', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-19"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('PapawaiSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-20', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-20"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('ParkvaleSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-21', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-21"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('ParkvaleUnconfinedGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-22', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-22"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Parkvale_ConfinedGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-23', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-23"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('RaumatiGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-24', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-24"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('RuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-25', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-25"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('RuamahangaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-26', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-26"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Ruamahanga_LowerSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-27', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-27"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Ruamahanga_MiddleSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-28', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-28"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Ruamahanga_OtherGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-29', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-29"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Ruamahanga_UpperSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-30', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-30"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('TaratahiGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-31', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-31"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('TauherenikauGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-32', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-32"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('TauherenikauSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-33', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-33"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Te HoroGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-34', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-34"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Te Ore OreGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-35', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-35"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('TeAwaruaoPoriruaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-36', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-36"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Upper HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-37', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-37"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Upper RuamahangaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-38', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-38"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaikanaeGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-39', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-39"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaikanaeSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-40', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-40"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaingawaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-41', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-41"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaingawaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-42', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-42"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WainuiomataSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-43', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-43"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaiohineSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-44', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-44"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaipouaSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-45', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-45"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('Wairarapa CoastSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-46', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-46"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WairarapaGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-47', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-47"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WaitohuGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-48', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-48"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WgnHarbour,HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-49', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-49"}', '2000-01-01', '2099-01-01', NOW(), NOW()), + ('WgnHarbour,HuttSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-50', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-50"}', '2000-01-01', '2099-01-01', NOW(), NOW()); From 977742bc1ceda9cbdd102d9ecfb8ff116caf947c Mon Sep 17 00:00:00 2001 From: Steve Mosley Date: Thu, 12 Oct 2023 17:07:59 +1300 Subject: [PATCH 3/7] Update to insert observation data for 50 sites --- packages/Manager/build.gradle.kts | 12 +- .../Manager/sample-data/observation_data.sql | 26 +- .../sample-data/observation_data_function.sql | 741 ++++++++++++++++++ 3 files changed, 762 insertions(+), 17 deletions(-) create mode 100644 packages/Manager/sample-data/observation_data_function.sql diff --git a/packages/Manager/build.gradle.kts b/packages/Manager/build.gradle.kts index 0fdb7797..39cc28c6 100644 --- a/packages/Manager/build.gradle.kts +++ b/packages/Manager/build.gradle.kts @@ -1,8 +1,11 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jooq.meta.jaxb.ForcedType import org.springframework.core.io.FileSystemResource +import org.springframework.core.io.support.EncodedResource import org.springframework.jdbc.datasource.SingleConnectionDataSource import org.springframework.jdbc.datasource.init.ScriptUtils +import org.springframework.jdbc.datasource.init.ScriptUtils.* +import org.springframework.jdbc.datasource.init.ScriptUtils.EOF_STATEMENT_SEPARATOR as EOF_STATEMENT_SEPARATOR1 plugins { id("org.springframework.boot") version "3.1.3" @@ -188,9 +191,14 @@ tasks.register("loadSampleData") { dbConfig["devUrl"]!!, dbConfig["user"]!!, dbConfig["password"]!!, true) .let { it.connection.use { connection -> - ScriptUtils.executeSqlScript( + executeSqlScript( connection, FileSystemResource("./sample-data/allocation_data.sql")) - ScriptUtils.executeSqlScript( + + executeSqlScript( + connection, EncodedResource(FileSystemResource("./sample-data/observation_data_function.sql")), false, false, DEFAULT_COMMENT_PREFIX, EOF_STATEMENT_SEPARATOR1, + DEFAULT_BLOCK_COMMENT_START_DELIMITER, DEFAULT_BLOCK_COMMENT_END_DELIMITER + ) + executeSqlScript( connection, FileSystemResource("./sample-data/observation_data.sql")) } } diff --git a/packages/Manager/sample-data/observation_data.sql b/packages/Manager/sample-data/observation_data.sql index 22c3714c..5aad7d4e 100644 --- a/packages/Manager/sample-data/observation_data.sql +++ b/packages/Manager/sample-data/observation_data.sql @@ -1,17 +1,13 @@ +TRUNCATE TABLE observations RESTART IDENTITY CASCADE; +TRUNCATE TABLE observation_sites_measurements RESTART IDENTITY CASCADE; TRUNCATE TABLE observation_sites RESTART IDENTITY CASCADE; -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-1', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-2', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-3', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-4', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-5', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-6', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-7', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-8', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-9', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-10', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-11', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-12', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-13', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-14', null); -INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-15', null); +INSERT INTO observation_sites(council_id, name, location) +SELECT 9, CONCAT('TEST-METER-', LPAD(num::varchar, 2, '0')), null FROM (SELECT generate_series(0, 50) AS num) AS subquery; + +INSERT INTO observation_sites_measurements(site_id, measurement_name, first_observation_at, last_observation_at, observation_count) +SELECT id, 'Water Meter Reading', '2000-01-01', '2099-01-01', 0 +FROM observation_sites +WHERE council_id = 9; + +SELECT pg_temp.insert_observation_data(osm.id) FROM observation_sites_measurements osm; diff --git a/packages/Manager/sample-data/observation_data_function.sql b/packages/Manager/sample-data/observation_data_function.sql new file mode 100644 index 00000000..4e6319d0 --- /dev/null +++ b/packages/Manager/sample-data/observation_data_function.sql @@ -0,0 +1,741 @@ +-- This function has to exist in a seperate file because of how spring handles loading SQL files. +-- with different tooling this might not be needed. + +DROP FUNCTION IF EXISTS pg_temp.insert_observation_data(int); + +CREATE FUNCTION pg_temp.insert_observation_data(p_observation_measurement_id int) + RETURNS void AS $$ +BEGIN + INSERT INTO observations (observation_measurement_id, observed_at, amount) + VALUES (p_observation_measurement_id, '2022-01-01 00:00:00+00', 3437526), + (p_observation_measurement_id, '2022-01-01 23:50:00+00', 3437906), + (p_observation_measurement_id, '2022-01-02 00:00:00+00', 3437913), + (p_observation_measurement_id, '2022-01-02 23:50:00+00', 3438981), + (p_observation_measurement_id, '2022-01-03 00:00:00+00', 3438988), + (p_observation_measurement_id, '2022-01-03 23:50:00+00', 3440053), + (p_observation_measurement_id, '2022-01-04 00:00:00+00', 3440060), + (p_observation_measurement_id, '2022-01-04 23:50:00+00', 3441147), + (p_observation_measurement_id, '2022-01-05 00:00:00+00', 3441156), + (p_observation_measurement_id, '2022-01-05 23:50:00+00', 3442498), + (p_observation_measurement_id, '2022-01-06 00:00:00+00', 3442508), + (p_observation_measurement_id, '2022-01-06 23:50:00+00', 3443847), + (p_observation_measurement_id, '2022-01-07 00:00:00+00', 3443856), + (p_observation_measurement_id, '2022-01-07 23:50:00+00', 3445195), + (p_observation_measurement_id, '2022-01-08 00:00:00+00', 3445205), + (p_observation_measurement_id, '2022-01-08 23:50:00+00', 3446544), + (p_observation_measurement_id, '2022-01-09 00:00:00+00', 3446553), + (p_observation_measurement_id, '2022-01-09 23:50:00+00', 3447875), + (p_observation_measurement_id, '2022-01-10 00:00:00+00', 3447884), + (p_observation_measurement_id, '2022-01-10 23:50:00+00', 3449224), + (p_observation_measurement_id, '2022-01-11 00:00:00+00', 3449233), + (p_observation_measurement_id, '2022-01-11 23:50:00+00', 3450573), + (p_observation_measurement_id, '2022-01-12 00:00:00+00', 3450582), + (p_observation_measurement_id, '2022-01-12 23:50:00+00', 3451921), + (p_observation_measurement_id, '2022-01-13 00:00:00+00', 3451930), + (p_observation_measurement_id, '2022-01-13 23:50:00+00', 3453267), + (p_observation_measurement_id, '2022-01-14 00:00:00+00', 3453276), + (p_observation_measurement_id, '2022-01-14 23:50:00+00', 3454611), + (p_observation_measurement_id, '2022-01-15 00:00:00+00', 3454621), + (p_observation_measurement_id, '2022-01-15 23:50:00+00', 3455959), + (p_observation_measurement_id, '2022-01-16 00:00:00+00', 3455968), + (p_observation_measurement_id, '2022-01-16 23:50:00+00', 3457306), + (p_observation_measurement_id, '2022-01-17 00:00:00+00', 3457315), + (p_observation_measurement_id, '2022-01-17 23:50:00+00', 3458656), + (p_observation_measurement_id, '2022-01-18 00:00:00+00', 3458665), + (p_observation_measurement_id, '2022-01-18 23:50:00+00', 3460006), + (p_observation_measurement_id, '2022-01-19 00:00:00+00', 3460015), + (p_observation_measurement_id, '2022-01-19 23:50:00+00', 3461343), + (p_observation_measurement_id, '2022-01-20 00:00:00+00', 3461351), + (p_observation_measurement_id, '2022-01-20 23:50:00+00', 3462517), + (p_observation_measurement_id, '2022-01-21 00:00:00+00', 3462525), + (p_observation_measurement_id, '2022-01-21 23:50:00+00', 3463402), + (p_observation_measurement_id, '2022-01-22 00:00:00+00', 3463402), + (p_observation_measurement_id, '2022-01-22 23:50:00+00', 3463402), + (p_observation_measurement_id, '2022-01-23 00:00:00+00', 3463402), + (p_observation_measurement_id, '2022-01-23 23:50:00+00', 3463402), + (p_observation_measurement_id, '2022-01-24 00:00:00+00', 3463402), + (p_observation_measurement_id, '2022-01-24 23:50:00+00', 3463612), + (p_observation_measurement_id, '2022-01-25 00:00:00+00', 3463621), + (p_observation_measurement_id, '2022-01-25 23:50:00+00', 3464818), + (p_observation_measurement_id, '2022-01-26 00:00:00+00', 3464827), + (p_observation_measurement_id, '2022-01-26 23:50:00+00', 3466021), + (p_observation_measurement_id, '2022-01-27 00:00:00+00', 3466029), + (p_observation_measurement_id, '2022-01-27 23:50:00+00', 3467227), + (p_observation_measurement_id, '2022-01-28 00:00:00+00', 3467235), + (p_observation_measurement_id, '2022-01-28 23:50:00+00', 3468453), + (p_observation_measurement_id, '2022-01-29 00:00:00+00', 3468463), + (p_observation_measurement_id, '2022-01-29 23:50:00+00', 3469823), + (p_observation_measurement_id, '2022-01-30 00:00:00+00', 3469832), + (p_observation_measurement_id, '2022-01-30 23:50:00+00', 3471193), + (p_observation_measurement_id, '2022-01-31 00:00:00+00', 3471202), + (p_observation_measurement_id, '2022-01-31 23:50:00+00', 3472566), + (p_observation_measurement_id, '2022-02-01 00:00:00+00', 3472576), + (p_observation_measurement_id, '2022-02-01 23:50:00+00', 3473942), + (p_observation_measurement_id, '2022-02-02 00:00:00+00', 3473951), + (p_observation_measurement_id, '2022-02-02 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-03 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-03 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-04 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-04 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-05 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-05 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-06 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-06 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-07 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-07 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-08 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-08 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-09 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-09 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-10 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-10 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-11 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-11 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-12 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-12 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-13 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-13 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-14 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-14 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-15 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-15 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-16 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-16 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-17 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-17 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-18 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-18 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-19 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-19 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-20 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-20 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-21 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-21 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-22 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-22 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-23 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-23 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-24 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-24 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-25 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-25 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-26 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-26 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-27 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-27 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-02-28 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-02-28 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-03-01 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-03-01 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-03-02 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-03-02 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-03-03 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-03-03 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-03-04 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-03-04 23:50:00+00', 3475147), + (p_observation_measurement_id, '2022-03-05 00:00:00+00', 3475147), + (p_observation_measurement_id, '2022-03-05 23:50:00+00', 3475148), + (p_observation_measurement_id, '2022-03-06 00:00:00+00', 3475148), + (p_observation_measurement_id, '2022-03-06 23:50:00+00', 3475148), + (p_observation_measurement_id, '2022-03-07 00:00:00+00', 3475148), + (p_observation_measurement_id, '2022-03-07 23:50:00+00', 3475148), + (p_observation_measurement_id, '2022-03-08 00:00:00+00', 3475148), + (p_observation_measurement_id, '2022-03-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-03-31 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-03-31 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-04-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-04-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-05-31 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-05-31 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-06-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-06-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-07-31 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-07-31 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-08-31 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-08-31 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-09-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-09-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-10-31 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-10-31 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-11-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-11-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-01 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-01 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-02 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-02 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-03 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-03 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-04 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-04 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-05 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-05 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-06 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-06 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-07 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-07 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-08 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-08 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-09 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-09 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-10 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-10 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-11 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-11 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-12 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-12 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-13 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-13 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-14 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-14 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-15 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-15 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-16 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-16 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-17 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-17 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-18 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-18 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-19 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-19 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-20 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-20 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-21 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-21 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-22 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-22 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-23 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-23 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-24 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-24 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-25 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-25 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-26 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-26 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-27 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-27 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-28 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-28 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-29 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-29 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-30 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-30 23:50:00+00', 3475250), + (p_observation_measurement_id, '2022-12-31 00:00:00+00', 3475250), + (p_observation_measurement_id, '2022-12-31 23:50:00+00', 3475250); +END; +$$ LANGUAGE plpgsql; From 5376ec71cfe6b8243fbd66d1cdd6f75982577a56 Mon Sep 17 00:00:00 2001 From: Steve Mosley Date: Thu, 12 Oct 2023 17:30:37 +1300 Subject: [PATCH 4/7] Adding in a simple script to add time to the observed data --- packages/Manager/build.gradle.kts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/Manager/build.gradle.kts b/packages/Manager/build.gradle.kts index 39cc28c6..460b152b 100644 --- a/packages/Manager/build.gradle.kts +++ b/packages/Manager/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jooq.meta.jaxb.ForcedType import org.springframework.core.io.FileSystemResource import org.springframework.core.io.support.EncodedResource +import org.springframework.jdbc.core.JdbcTemplate import org.springframework.jdbc.datasource.SingleConnectionDataSource import org.springframework.jdbc.datasource.init.ScriptUtils import org.springframework.jdbc.datasource.init.ScriptUtils.* @@ -207,5 +208,14 @@ tasks.register("loadSampleData") { tasks.register("refreshSampleData") { dependsOn("flywayMigrate") - doLast { println("refreshSampleData - TODO rebase observations data off current time.") } + doLast { println("refreshSampleData.") + + SingleConnectionDataSource( + dbConfig["devUrl"]!!, dbConfig["user"]!!, dbConfig["password"]!!, true) + .let { + JdbcTemplate(it).let { + it.execute("UPDATE observations SET observed_at = observed_at + INTERVAL '1 YEAR';") + } + } + } } From 39c1ce5c143c0ab24f395c900f401c28edda4d92 Mon Sep 17 00:00:00 2001 From: Steve Mosley Date: Fri, 13 Oct 2023 11:23:04 +1300 Subject: [PATCH 5/7] Tweak how loading is done to avoid the function --- packages/Manager/build.gradle.kts | 5 - .../Manager/sample-data/observation_data.sql | 749 +++++++++++++++++- .../sample-data/observation_data_function.sql | 741 ----------------- 3 files changed, 747 insertions(+), 748 deletions(-) delete mode 100644 packages/Manager/sample-data/observation_data_function.sql diff --git a/packages/Manager/build.gradle.kts b/packages/Manager/build.gradle.kts index 460b152b..0c3f5ad3 100644 --- a/packages/Manager/build.gradle.kts +++ b/packages/Manager/build.gradle.kts @@ -194,11 +194,6 @@ tasks.register("loadSampleData") { it.connection.use { connection -> executeSqlScript( connection, FileSystemResource("./sample-data/allocation_data.sql")) - - executeSqlScript( - connection, EncodedResource(FileSystemResource("./sample-data/observation_data_function.sql")), false, false, DEFAULT_COMMENT_PREFIX, EOF_STATEMENT_SEPARATOR1, - DEFAULT_BLOCK_COMMENT_START_DELIMITER, DEFAULT_BLOCK_COMMENT_END_DELIMITER - ) executeSqlScript( connection, FileSystemResource("./sample-data/observation_data.sql")) } diff --git a/packages/Manager/sample-data/observation_data.sql b/packages/Manager/sample-data/observation_data.sql index 5aad7d4e..4703a431 100644 --- a/packages/Manager/sample-data/observation_data.sql +++ b/packages/Manager/sample-data/observation_data.sql @@ -3,11 +3,756 @@ TRUNCATE TABLE observation_sites_measurements RESTART IDENTITY CASCADE; TRUNCATE TABLE observation_sites RESTART IDENTITY CASCADE; INSERT INTO observation_sites(council_id, name, location) -SELECT 9, CONCAT('TEST-METER-', LPAD(num::varchar, 2, '0')), null FROM (SELECT generate_series(0, 50) AS num) AS subquery; +SELECT 9, CONCAT('TEST-METER-', LPAD(num::varchar, 2, '0')), null +FROM (SELECT generate_series(0, 50) AS num) AS subquery; INSERT INTO observation_sites_measurements(site_id, measurement_name, first_observation_at, last_observation_at, observation_count) SELECT id, 'Water Meter Reading', '2000-01-01', '2099-01-01', 0 FROM observation_sites WHERE council_id = 9; -SELECT pg_temp.insert_observation_data(osm.id) FROM observation_sites_measurements osm; +DROP TABLE IF EXISTS temp_observation_data; +CREATE TEMPORARY TABLE temp_observation_data +( + amount NUMERIC NOT NULL, + observed_at TIMESTAMPTZ NOT NULL +); + +INSERT INTO temp_observation_data (observed_at, amount) +VALUES ('2022-01-01 00:00:00+00', 3437526), + ('2022-01-01 23:50:00+00', 3437906), + ('2022-01-02 00:00:00+00', 3437913), + ('2022-01-02 23:50:00+00', 3438981), + ('2022-01-03 00:00:00+00', 3438988), + ('2022-01-03 23:50:00+00', 3440053), + ('2022-01-04 00:00:00+00', 3440060), + ('2022-01-04 23:50:00+00', 3441147), + ('2022-01-05 00:00:00+00', 3441156), + ('2022-01-05 23:50:00+00', 3442498), + ('2022-01-06 00:00:00+00', 3442508), + ('2022-01-06 23:50:00+00', 3443847), + ('2022-01-07 00:00:00+00', 3443856), + ('2022-01-07 23:50:00+00', 3445195), + ('2022-01-08 00:00:00+00', 3445205), + ('2022-01-08 23:50:00+00', 3446544), + ('2022-01-09 00:00:00+00', 3446553), + ('2022-01-09 23:50:00+00', 3447875), + ('2022-01-10 00:00:00+00', 3447884), + ('2022-01-10 23:50:00+00', 3449224), + ('2022-01-11 00:00:00+00', 3449233), + ('2022-01-11 23:50:00+00', 3450573), + ('2022-01-12 00:00:00+00', 3450582), + ('2022-01-12 23:50:00+00', 3451921), + ('2022-01-13 00:00:00+00', 3451930), + ('2022-01-13 23:50:00+00', 3453267), + ('2022-01-14 00:00:00+00', 3453276), + ('2022-01-14 23:50:00+00', 3454611), + ('2022-01-15 00:00:00+00', 3454621), + ('2022-01-15 23:50:00+00', 3455959), + ('2022-01-16 00:00:00+00', 3455968), + ('2022-01-16 23:50:00+00', 3457306), + ('2022-01-17 00:00:00+00', 3457315), + ('2022-01-17 23:50:00+00', 3458656), + ('2022-01-18 00:00:00+00', 3458665), + ('2022-01-18 23:50:00+00', 3460006), + ('2022-01-19 00:00:00+00', 3460015), + ('2022-01-19 23:50:00+00', 3461343), + ('2022-01-20 00:00:00+00', 3461351), + ('2022-01-20 23:50:00+00', 3462517), + ('2022-01-21 00:00:00+00', 3462525), + ('2022-01-21 23:50:00+00', 3463402), + ('2022-01-22 00:00:00+00', 3463402), + ('2022-01-22 23:50:00+00', 3463402), + ('2022-01-23 00:00:00+00', 3463402), + ('2022-01-23 23:50:00+00', 3463402), + ('2022-01-24 00:00:00+00', 3463402), + ('2022-01-24 23:50:00+00', 3463612), + ('2022-01-25 00:00:00+00', 3463621), + ('2022-01-25 23:50:00+00', 3464818), + ('2022-01-26 00:00:00+00', 3464827), + ('2022-01-26 23:50:00+00', 3466021), + ('2022-01-27 00:00:00+00', 3466029), + ('2022-01-27 23:50:00+00', 3467227), + ('2022-01-28 00:00:00+00', 3467235), + ('2022-01-28 23:50:00+00', 3468453), + ('2022-01-29 00:00:00+00', 3468463), + ('2022-01-29 23:50:00+00', 3469823), + ('2022-01-30 00:00:00+00', 3469832), + ('2022-01-30 23:50:00+00', 3471193), + ('2022-01-31 00:00:00+00', 3471202), + ('2022-01-31 23:50:00+00', 3472566), + ('2022-02-01 00:00:00+00', 3472576), + ('2022-02-01 23:50:00+00', 3473942), + ('2022-02-02 00:00:00+00', 3473951), + ('2022-02-02 23:50:00+00', 3475147), + ('2022-02-03 00:00:00+00', 3475147), + ('2022-02-03 23:50:00+00', 3475147), + ('2022-02-04 00:00:00+00', 3475147), + ('2022-02-04 23:50:00+00', 3475147), + ('2022-02-05 00:00:00+00', 3475147), + ('2022-02-05 23:50:00+00', 3475147), + ('2022-02-06 00:00:00+00', 3475147), + ('2022-02-06 23:50:00+00', 3475147), + ('2022-02-07 00:00:00+00', 3475147), + ('2022-02-07 23:50:00+00', 3475147), + ('2022-02-08 00:00:00+00', 3475147), + ('2022-02-08 23:50:00+00', 3475147), + ('2022-02-09 00:00:00+00', 3475147), + ('2022-02-09 23:50:00+00', 3475147), + ('2022-02-10 00:00:00+00', 3475147), + ('2022-02-10 23:50:00+00', 3475147), + ('2022-02-11 00:00:00+00', 3475147), + ('2022-02-11 23:50:00+00', 3475147), + ('2022-02-12 00:00:00+00', 3475147), + ('2022-02-12 23:50:00+00', 3475147), + ('2022-02-13 00:00:00+00', 3475147), + ('2022-02-13 23:50:00+00', 3475147), + ('2022-02-14 00:00:00+00', 3475147), + ('2022-02-14 23:50:00+00', 3475147), + ('2022-02-15 00:00:00+00', 3475147), + ('2022-02-15 23:50:00+00', 3475147), + ('2022-02-16 00:00:00+00', 3475147), + ('2022-02-16 23:50:00+00', 3475147), + ('2022-02-17 00:00:00+00', 3475147), + ('2022-02-17 23:50:00+00', 3475147), + ('2022-02-18 00:00:00+00', 3475147), + ('2022-02-18 23:50:00+00', 3475147), + ('2022-02-19 00:00:00+00', 3475147), + ('2022-02-19 23:50:00+00', 3475147), + ('2022-02-20 00:00:00+00', 3475147), + ('2022-02-20 23:50:00+00', 3475147), + ('2022-02-21 00:00:00+00', 3475147), + ('2022-02-21 23:50:00+00', 3475147), + ('2022-02-22 00:00:00+00', 3475147), + ('2022-02-22 23:50:00+00', 3475147), + ('2022-02-23 00:00:00+00', 3475147), + ('2022-02-23 23:50:00+00', 3475147), + ('2022-02-24 00:00:00+00', 3475147), + ('2022-02-24 23:50:00+00', 3475147), + ('2022-02-25 00:00:00+00', 3475147), + ('2022-02-25 23:50:00+00', 3475147), + ('2022-02-26 00:00:00+00', 3475147), + ('2022-02-26 23:50:00+00', 3475147), + ('2022-02-27 00:00:00+00', 3475147), + ('2022-02-27 23:50:00+00', 3475147), + ('2022-02-28 00:00:00+00', 3475147), + ('2022-02-28 23:50:00+00', 3475147), + ('2022-03-01 00:00:00+00', 3475147), + ('2022-03-01 23:50:00+00', 3475147), + ('2022-03-02 00:00:00+00', 3475147), + ('2022-03-02 23:50:00+00', 3475147), + ('2022-03-03 00:00:00+00', 3475147), + ('2022-03-03 23:50:00+00', 3475147), + ('2022-03-04 00:00:00+00', 3475147), + ('2022-03-04 23:50:00+00', 3475147), + ('2022-03-05 00:00:00+00', 3475147), + ('2022-03-05 23:50:00+00', 3475148), + ('2022-03-06 00:00:00+00', 3475148), + ('2022-03-06 23:50:00+00', 3475148), + ('2022-03-07 00:00:00+00', 3475148), + ('2022-03-07 23:50:00+00', 3475148), + ('2022-03-08 00:00:00+00', 3475148), + ('2022-03-08 23:50:00+00', 3475250), + ('2022-03-09 00:00:00+00', 3475250), + ('2022-03-09 23:50:00+00', 3475250), + ('2022-03-10 00:00:00+00', 3475250), + ('2022-03-10 23:50:00+00', 3475250), + ('2022-03-11 00:00:00+00', 3475250), + ('2022-03-11 23:50:00+00', 3475250), + ('2022-03-12 00:00:00+00', 3475250), + ('2022-03-12 23:50:00+00', 3475250), + ('2022-03-13 00:00:00+00', 3475250), + ('2022-03-13 23:50:00+00', 3475250), + ('2022-03-14 00:00:00+00', 3475250), + ('2022-03-14 23:50:00+00', 3475250), + ('2022-03-15 00:00:00+00', 3475250), + ('2022-03-15 23:50:00+00', 3475250), + ('2022-03-16 00:00:00+00', 3475250), + ('2022-03-16 23:50:00+00', 3475250), + ('2022-03-17 00:00:00+00', 3475250), + ('2022-03-17 23:50:00+00', 3475250), + ('2022-03-18 00:00:00+00', 3475250), + ('2022-03-18 23:50:00+00', 3475250), + ('2022-03-19 00:00:00+00', 3475250), + ('2022-03-19 23:50:00+00', 3475250), + ('2022-03-20 00:00:00+00', 3475250), + ('2022-03-20 23:50:00+00', 3475250), + ('2022-03-21 00:00:00+00', 3475250), + ('2022-03-21 23:50:00+00', 3475250), + ('2022-03-22 00:00:00+00', 3475250), + ('2022-03-22 23:50:00+00', 3475250), + ('2022-03-23 00:00:00+00', 3475250), + ('2022-03-23 23:50:00+00', 3475250), + ('2022-03-24 00:00:00+00', 3475250), + ('2022-03-24 23:50:00+00', 3475250), + ('2022-03-25 00:00:00+00', 3475250), + ('2022-03-25 23:50:00+00', 3475250), + ('2022-03-26 00:00:00+00', 3475250), + ('2022-03-26 23:50:00+00', 3475250), + ('2022-03-27 00:00:00+00', 3475250), + ('2022-03-27 23:50:00+00', 3475250), + ('2022-03-28 00:00:00+00', 3475250), + ('2022-03-28 23:50:00+00', 3475250), + ('2022-03-29 00:00:00+00', 3475250), + ('2022-03-29 23:50:00+00', 3475250), + ('2022-03-30 00:00:00+00', 3475250), + ('2022-03-30 23:50:00+00', 3475250), + ('2022-03-31 00:00:00+00', 3475250), + ('2022-03-31 23:50:00+00', 3475250), + ('2022-04-01 00:00:00+00', 3475250), + ('2022-04-01 23:50:00+00', 3475250), + ('2022-04-02 00:00:00+00', 3475250), + ('2022-04-02 23:50:00+00', 3475250), + ('2022-04-03 00:00:00+00', 3475250), + ('2022-04-03 23:50:00+00', 3475250), + ('2022-04-04 00:00:00+00', 3475250), + ('2022-04-04 23:50:00+00', 3475250), + ('2022-04-05 00:00:00+00', 3475250), + ('2022-04-05 23:50:00+00', 3475250), + ('2022-04-06 00:00:00+00', 3475250), + ('2022-04-06 23:50:00+00', 3475250), + ('2022-04-07 00:00:00+00', 3475250), + ('2022-04-07 23:50:00+00', 3475250), + ('2022-04-08 00:00:00+00', 3475250), + ('2022-04-08 23:50:00+00', 3475250), + ('2022-04-09 00:00:00+00', 3475250), + ('2022-04-09 23:50:00+00', 3475250), + ('2022-04-10 00:00:00+00', 3475250), + ('2022-04-10 23:50:00+00', 3475250), + ('2022-04-11 00:00:00+00', 3475250), + ('2022-04-11 23:50:00+00', 3475250), + ('2022-04-12 00:00:00+00', 3475250), + ('2022-04-12 23:50:00+00', 3475250), + ('2022-04-13 00:00:00+00', 3475250), + ('2022-04-13 23:50:00+00', 3475250), + ('2022-04-14 00:00:00+00', 3475250), + ('2022-04-14 23:50:00+00', 3475250), + ('2022-04-15 00:00:00+00', 3475250), + ('2022-04-15 23:50:00+00', 3475250), + ('2022-04-16 00:00:00+00', 3475250), + ('2022-04-16 23:50:00+00', 3475250), + ('2022-04-17 00:00:00+00', 3475250), + ('2022-04-17 23:50:00+00', 3475250), + ('2022-04-18 00:00:00+00', 3475250), + ('2022-04-18 23:50:00+00', 3475250), + ('2022-04-19 00:00:00+00', 3475250), + ('2022-04-19 23:50:00+00', 3475250), + ('2022-04-20 00:00:00+00', 3475250), + ('2022-04-20 23:50:00+00', 3475250), + ('2022-04-21 00:00:00+00', 3475250), + ('2022-04-21 23:50:00+00', 3475250), + ('2022-04-22 00:00:00+00', 3475250), + ('2022-04-22 23:50:00+00', 3475250), + ('2022-04-23 00:00:00+00', 3475250), + ('2022-04-23 23:50:00+00', 3475250), + ('2022-04-24 00:00:00+00', 3475250), + ('2022-04-24 23:50:00+00', 3475250), + ('2022-04-25 00:00:00+00', 3475250), + ('2022-04-25 23:50:00+00', 3475250), + ('2022-04-26 00:00:00+00', 3475250), + ('2022-04-26 23:50:00+00', 3475250), + ('2022-04-27 00:00:00+00', 3475250), + ('2022-04-27 23:50:00+00', 3475250), + ('2022-04-28 00:00:00+00', 3475250), + ('2022-04-28 23:50:00+00', 3475250), + ('2022-04-29 00:00:00+00', 3475250), + ('2022-04-29 23:50:00+00', 3475250), + ('2022-04-30 00:00:00+00', 3475250), + ('2022-04-30 23:50:00+00', 3475250), + ('2022-05-01 00:00:00+00', 3475250), + ('2022-05-01 23:50:00+00', 3475250), + ('2022-05-02 00:00:00+00', 3475250), + ('2022-05-02 23:50:00+00', 3475250), + ('2022-05-03 00:00:00+00', 3475250), + ('2022-05-03 23:50:00+00', 3475250), + ('2022-05-04 00:00:00+00', 3475250), + ('2022-05-04 23:50:00+00', 3475250), + ('2022-05-05 00:00:00+00', 3475250), + ('2022-05-05 23:50:00+00', 3475250), + ('2022-05-06 00:00:00+00', 3475250), + ('2022-05-06 23:50:00+00', 3475250), + ('2022-05-07 00:00:00+00', 3475250), + ('2022-05-07 23:50:00+00', 3475250), + ('2022-05-08 00:00:00+00', 3475250), + ('2022-05-08 23:50:00+00', 3475250), + ('2022-05-09 00:00:00+00', 3475250), + ('2022-05-09 23:50:00+00', 3475250), + ('2022-05-10 00:00:00+00', 3475250), + ('2022-05-10 23:50:00+00', 3475250), + ('2022-05-11 00:00:00+00', 3475250), + ('2022-05-11 23:50:00+00', 3475250), + ('2022-05-12 00:00:00+00', 3475250), + ('2022-05-12 23:50:00+00', 3475250), + ('2022-05-13 00:00:00+00', 3475250), + ('2022-05-13 23:50:00+00', 3475250), + ('2022-05-14 00:00:00+00', 3475250), + ('2022-05-14 23:50:00+00', 3475250), + ('2022-05-15 00:00:00+00', 3475250), + ('2022-05-15 23:50:00+00', 3475250), + ('2022-05-16 00:00:00+00', 3475250), + ('2022-05-16 23:50:00+00', 3475250), + ('2022-05-17 00:00:00+00', 3475250), + ('2022-05-17 23:50:00+00', 3475250), + ('2022-05-18 00:00:00+00', 3475250), + ('2022-05-18 23:50:00+00', 3475250), + ('2022-05-19 00:00:00+00', 3475250), + ('2022-05-19 23:50:00+00', 3475250), + ('2022-05-20 00:00:00+00', 3475250), + ('2022-05-20 23:50:00+00', 3475250), + ('2022-05-21 00:00:00+00', 3475250), + ('2022-05-21 23:50:00+00', 3475250), + ('2022-05-22 00:00:00+00', 3475250), + ('2022-05-22 23:50:00+00', 3475250), + ('2022-05-23 00:00:00+00', 3475250), + ('2022-05-23 23:50:00+00', 3475250), + ('2022-05-24 00:00:00+00', 3475250), + ('2022-05-24 23:50:00+00', 3475250), + ('2022-05-25 00:00:00+00', 3475250), + ('2022-05-25 23:50:00+00', 3475250), + ('2022-05-26 00:00:00+00', 3475250), + ('2022-05-26 23:50:00+00', 3475250), + ('2022-05-27 00:00:00+00', 3475250), + ('2022-05-27 23:50:00+00', 3475250), + ('2022-05-28 00:00:00+00', 3475250), + ('2022-05-28 23:50:00+00', 3475250), + ('2022-05-29 00:00:00+00', 3475250), + ('2022-05-29 23:50:00+00', 3475250), + ('2022-05-30 00:00:00+00', 3475250), + ('2022-05-30 23:50:00+00', 3475250), + ('2022-05-31 00:00:00+00', 3475250), + ('2022-05-31 23:50:00+00', 3475250), + ('2022-06-01 00:00:00+00', 3475250), + ('2022-06-01 23:50:00+00', 3475250), + ('2022-06-02 00:00:00+00', 3475250), + ('2022-06-02 23:50:00+00', 3475250), + ('2022-06-03 00:00:00+00', 3475250), + ('2022-06-03 23:50:00+00', 3475250), + ('2022-06-04 00:00:00+00', 3475250), + ('2022-06-04 23:50:00+00', 3475250), + ('2022-06-05 00:00:00+00', 3475250), + ('2022-06-05 23:50:00+00', 3475250), + ('2022-06-06 00:00:00+00', 3475250), + ('2022-06-06 23:50:00+00', 3475250), + ('2022-06-07 00:00:00+00', 3475250), + ('2022-06-07 23:50:00+00', 3475250), + ('2022-06-08 00:00:00+00', 3475250), + ('2022-06-08 23:50:00+00', 3475250), + ('2022-06-09 00:00:00+00', 3475250), + ('2022-06-09 23:50:00+00', 3475250), + ('2022-06-10 00:00:00+00', 3475250), + ('2022-06-10 23:50:00+00', 3475250), + ('2022-06-11 00:00:00+00', 3475250), + ('2022-06-11 23:50:00+00', 3475250), + ('2022-06-12 00:00:00+00', 3475250), + ('2022-06-12 23:50:00+00', 3475250), + ('2022-06-13 00:00:00+00', 3475250), + ('2022-06-13 23:50:00+00', 3475250), + ('2022-06-14 00:00:00+00', 3475250), + ('2022-06-14 23:50:00+00', 3475250), + ('2022-06-15 00:00:00+00', 3475250), + ('2022-06-15 23:50:00+00', 3475250), + ('2022-06-16 00:00:00+00', 3475250), + ('2022-06-16 23:50:00+00', 3475250), + ('2022-06-17 00:00:00+00', 3475250), + ('2022-06-17 23:50:00+00', 3475250), + ('2022-06-18 00:00:00+00', 3475250), + ('2022-06-18 23:50:00+00', 3475250), + ('2022-06-19 00:00:00+00', 3475250), + ('2022-06-19 23:50:00+00', 3475250), + ('2022-06-20 00:00:00+00', 3475250), + ('2022-06-20 23:50:00+00', 3475250), + ('2022-06-21 00:00:00+00', 3475250), + ('2022-06-21 23:50:00+00', 3475250), + ('2022-06-22 00:00:00+00', 3475250), + ('2022-06-22 23:50:00+00', 3475250), + ('2022-06-23 00:00:00+00', 3475250), + ('2022-06-23 23:50:00+00', 3475250), + ('2022-06-24 00:00:00+00', 3475250), + ('2022-06-24 23:50:00+00', 3475250), + ('2022-06-25 00:00:00+00', 3475250), + ('2022-06-25 23:50:00+00', 3475250), + ('2022-06-26 00:00:00+00', 3475250), + ('2022-06-26 23:50:00+00', 3475250), + ('2022-06-27 00:00:00+00', 3475250), + ('2022-06-27 23:50:00+00', 3475250), + ('2022-06-28 00:00:00+00', 3475250), + ('2022-06-28 23:50:00+00', 3475250), + ('2022-06-29 00:00:00+00', 3475250), + ('2022-06-29 23:50:00+00', 3475250), + ('2022-06-30 00:00:00+00', 3475250), + ('2022-06-30 23:50:00+00', 3475250), + ('2022-07-01 00:00:00+00', 3475250), + ('2022-07-01 23:50:00+00', 3475250), + ('2022-07-02 00:00:00+00', 3475250), + ('2022-07-02 23:50:00+00', 3475250), + ('2022-07-03 00:00:00+00', 3475250), + ('2022-07-03 23:50:00+00', 3475250), + ('2022-07-04 00:00:00+00', 3475250), + ('2022-07-04 23:50:00+00', 3475250), + ('2022-07-05 00:00:00+00', 3475250), + ('2022-07-05 23:50:00+00', 3475250), + ('2022-07-06 00:00:00+00', 3475250), + ('2022-07-06 23:50:00+00', 3475250), + ('2022-07-07 00:00:00+00', 3475250), + ('2022-07-07 23:50:00+00', 3475250), + ('2022-07-08 00:00:00+00', 3475250), + ('2022-07-08 23:50:00+00', 3475250), + ('2022-07-09 00:00:00+00', 3475250), + ('2022-07-09 23:50:00+00', 3475250), + ('2022-07-10 00:00:00+00', 3475250), + ('2022-07-10 23:50:00+00', 3475250), + ('2022-07-11 00:00:00+00', 3475250), + ('2022-07-11 23:50:00+00', 3475250), + ('2022-07-12 00:00:00+00', 3475250), + ('2022-07-12 23:50:00+00', 3475250), + ('2022-07-13 00:00:00+00', 3475250), + ('2022-07-13 23:50:00+00', 3475250), + ('2022-07-14 00:00:00+00', 3475250), + ('2022-07-14 23:50:00+00', 3475250), + ('2022-07-15 00:00:00+00', 3475250), + ('2022-07-15 23:50:00+00', 3475250), + ('2022-07-16 00:00:00+00', 3475250), + ('2022-07-16 23:50:00+00', 3475250), + ('2022-07-17 00:00:00+00', 3475250), + ('2022-07-17 23:50:00+00', 3475250), + ('2022-07-18 00:00:00+00', 3475250), + ('2022-07-18 23:50:00+00', 3475250), + ('2022-07-19 00:00:00+00', 3475250), + ('2022-07-19 23:50:00+00', 3475250), + ('2022-07-20 00:00:00+00', 3475250), + ('2022-07-20 23:50:00+00', 3475250), + ('2022-07-21 00:00:00+00', 3475250), + ('2022-07-21 23:50:00+00', 3475250), + ('2022-07-22 00:00:00+00', 3475250), + ('2022-07-22 23:50:00+00', 3475250), + ('2022-07-23 00:00:00+00', 3475250), + ('2022-07-23 23:50:00+00', 3475250), + ('2022-07-24 00:00:00+00', 3475250), + ('2022-07-24 23:50:00+00', 3475250), + ('2022-07-25 00:00:00+00', 3475250), + ('2022-07-25 23:50:00+00', 3475250), + ('2022-07-26 00:00:00+00', 3475250), + ('2022-07-26 23:50:00+00', 3475250), + ('2022-07-27 00:00:00+00', 3475250), + ('2022-07-27 23:50:00+00', 3475250), + ('2022-07-28 00:00:00+00', 3475250), + ('2022-07-28 23:50:00+00', 3475250), + ('2022-07-29 00:00:00+00', 3475250), + ('2022-07-29 23:50:00+00', 3475250), + ('2022-07-30 00:00:00+00', 3475250), + ('2022-07-30 23:50:00+00', 3475250), + ('2022-07-31 00:00:00+00', 3475250), + ('2022-07-31 23:50:00+00', 3475250), + ('2022-08-01 00:00:00+00', 3475250), + ('2022-08-01 23:50:00+00', 3475250), + ('2022-08-02 00:00:00+00', 3475250), + ('2022-08-02 23:50:00+00', 3475250), + ('2022-08-03 00:00:00+00', 3475250), + ('2022-08-03 23:50:00+00', 3475250), + ('2022-08-04 00:00:00+00', 3475250), + ('2022-08-04 23:50:00+00', 3475250), + ('2022-08-05 00:00:00+00', 3475250), + ('2022-08-05 23:50:00+00', 3475250), + ('2022-08-06 00:00:00+00', 3475250), + ('2022-08-06 23:50:00+00', 3475250), + ('2022-08-07 00:00:00+00', 3475250), + ('2022-08-07 23:50:00+00', 3475250), + ('2022-08-08 00:00:00+00', 3475250), + ('2022-08-08 23:50:00+00', 3475250), + ('2022-08-09 00:00:00+00', 3475250), + ('2022-08-09 23:50:00+00', 3475250), + ('2022-08-10 00:00:00+00', 3475250), + ('2022-08-10 23:50:00+00', 3475250), + ('2022-08-11 00:00:00+00', 3475250), + ('2022-08-11 23:50:00+00', 3475250), + ('2022-08-12 00:00:00+00', 3475250), + ('2022-08-12 23:50:00+00', 3475250), + ('2022-08-13 00:00:00+00', 3475250), + ('2022-08-13 23:50:00+00', 3475250), + ('2022-08-14 00:00:00+00', 3475250), + ('2022-08-14 23:50:00+00', 3475250), + ('2022-08-15 00:00:00+00', 3475250), + ('2022-08-15 23:50:00+00', 3475250), + ('2022-08-16 00:00:00+00', 3475250), + ('2022-08-16 23:50:00+00', 3475250), + ('2022-08-17 00:00:00+00', 3475250), + ('2022-08-17 23:50:00+00', 3475250), + ('2022-08-18 00:00:00+00', 3475250), + ('2022-08-18 23:50:00+00', 3475250), + ('2022-08-19 00:00:00+00', 3475250), + ('2022-08-19 23:50:00+00', 3475250), + ('2022-08-20 00:00:00+00', 3475250), + ('2022-08-20 23:50:00+00', 3475250), + ('2022-08-21 00:00:00+00', 3475250), + ('2022-08-21 23:50:00+00', 3475250), + ('2022-08-22 00:00:00+00', 3475250), + ('2022-08-22 23:50:00+00', 3475250), + ('2022-08-23 00:00:00+00', 3475250), + ('2022-08-23 23:50:00+00', 3475250), + ('2022-08-24 00:00:00+00', 3475250), + ('2022-08-24 23:50:00+00', 3475250), + ('2022-08-25 00:00:00+00', 3475250), + ('2022-08-25 23:50:00+00', 3475250), + ('2022-08-26 00:00:00+00', 3475250), + ('2022-08-26 23:50:00+00', 3475250), + ('2022-08-27 00:00:00+00', 3475250), + ('2022-08-27 23:50:00+00', 3475250), + ('2022-08-28 00:00:00+00', 3475250), + ('2022-08-28 23:50:00+00', 3475250), + ('2022-08-29 00:00:00+00', 3475250), + ('2022-08-29 23:50:00+00', 3475250), + ('2022-08-30 00:00:00+00', 3475250), + ('2022-08-30 23:50:00+00', 3475250), + ('2022-08-31 00:00:00+00', 3475250), + ('2022-08-31 23:50:00+00', 3475250), + ('2022-09-01 00:00:00+00', 3475250), + ('2022-09-01 23:50:00+00', 3475250), + ('2022-09-02 00:00:00+00', 3475250), + ('2022-09-02 23:50:00+00', 3475250), + ('2022-09-03 00:00:00+00', 3475250), + ('2022-09-03 23:50:00+00', 3475250), + ('2022-09-04 00:00:00+00', 3475250), + ('2022-09-04 23:50:00+00', 3475250), + ('2022-09-05 00:00:00+00', 3475250), + ('2022-09-05 23:50:00+00', 3475250), + ('2022-09-06 00:00:00+00', 3475250), + ('2022-09-06 23:50:00+00', 3475250), + ('2022-09-07 00:00:00+00', 3475250), + ('2022-09-07 23:50:00+00', 3475250), + ('2022-09-08 00:00:00+00', 3475250), + ('2022-09-08 23:50:00+00', 3475250), + ('2022-09-09 00:00:00+00', 3475250), + ('2022-09-09 23:50:00+00', 3475250), + ('2022-09-10 00:00:00+00', 3475250), + ('2022-09-10 23:50:00+00', 3475250), + ('2022-09-11 00:00:00+00', 3475250), + ('2022-09-11 23:50:00+00', 3475250), + ('2022-09-12 00:00:00+00', 3475250), + ('2022-09-12 23:50:00+00', 3475250), + ('2022-09-13 00:00:00+00', 3475250), + ('2022-09-13 23:50:00+00', 3475250), + ('2022-09-14 00:00:00+00', 3475250), + ('2022-09-14 23:50:00+00', 3475250), + ('2022-09-15 00:00:00+00', 3475250), + ('2022-09-15 23:50:00+00', 3475250), + ('2022-09-16 00:00:00+00', 3475250), + ('2022-09-16 23:50:00+00', 3475250), + ('2022-09-17 00:00:00+00', 3475250), + ('2022-09-17 23:50:00+00', 3475250), + ('2022-09-18 00:00:00+00', 3475250), + ('2022-09-18 23:50:00+00', 3475250), + ('2022-09-19 00:00:00+00', 3475250), + ('2022-09-19 23:50:00+00', 3475250), + ('2022-09-20 00:00:00+00', 3475250), + ('2022-09-20 23:50:00+00', 3475250), + ('2022-09-21 00:00:00+00', 3475250), + ('2022-09-21 23:50:00+00', 3475250), + ('2022-09-22 00:00:00+00', 3475250), + ('2022-09-22 23:50:00+00', 3475250), + ('2022-09-23 00:00:00+00', 3475250), + ('2022-09-23 23:50:00+00', 3475250), + ('2022-09-24 00:00:00+00', 3475250), + ('2022-09-24 23:50:00+00', 3475250), + ('2022-09-25 00:00:00+00', 3475250), + ('2022-09-25 23:50:00+00', 3475250), + ('2022-09-26 00:00:00+00', 3475250), + ('2022-09-26 23:50:00+00', 3475250), + ('2022-09-27 00:00:00+00', 3475250), + ('2022-09-27 23:50:00+00', 3475250), + ('2022-09-28 00:00:00+00', 3475250), + ('2022-09-28 23:50:00+00', 3475250), + ('2022-09-29 00:00:00+00', 3475250), + ('2022-09-29 23:50:00+00', 3475250), + ('2022-09-30 00:00:00+00', 3475250), + ('2022-09-30 23:50:00+00', 3475250), + ('2022-10-01 00:00:00+00', 3475250), + ('2022-10-01 23:50:00+00', 3475250), + ('2022-10-02 00:00:00+00', 3475250), + ('2022-10-02 23:50:00+00', 3475250), + ('2022-10-03 00:00:00+00', 3475250), + ('2022-10-03 23:50:00+00', 3475250), + ('2022-10-04 00:00:00+00', 3475250), + ('2022-10-04 23:50:00+00', 3475250), + ('2022-10-05 00:00:00+00', 3475250), + ('2022-10-05 23:50:00+00', 3475250), + ('2022-10-06 00:00:00+00', 3475250), + ('2022-10-06 23:50:00+00', 3475250), + ('2022-10-07 00:00:00+00', 3475250), + ('2022-10-07 23:50:00+00', 3475250), + ('2022-10-08 00:00:00+00', 3475250), + ('2022-10-08 23:50:00+00', 3475250), + ('2022-10-09 00:00:00+00', 3475250), + ('2022-10-09 23:50:00+00', 3475250), + ('2022-10-10 00:00:00+00', 3475250), + ('2022-10-10 23:50:00+00', 3475250), + ('2022-10-11 00:00:00+00', 3475250), + ('2022-10-11 23:50:00+00', 3475250), + ('2022-10-12 00:00:00+00', 3475250), + ('2022-10-12 23:50:00+00', 3475250), + ('2022-10-13 00:00:00+00', 3475250), + ('2022-10-13 23:50:00+00', 3475250), + ('2022-10-14 00:00:00+00', 3475250), + ('2022-10-14 23:50:00+00', 3475250), + ('2022-10-15 00:00:00+00', 3475250), + ('2022-10-15 23:50:00+00', 3475250), + ('2022-10-16 00:00:00+00', 3475250), + ('2022-10-16 23:50:00+00', 3475250), + ('2022-10-17 00:00:00+00', 3475250), + ('2022-10-17 23:50:00+00', 3475250), + ('2022-10-18 00:00:00+00', 3475250), + ('2022-10-18 23:50:00+00', 3475250), + ('2022-10-19 00:00:00+00', 3475250), + ('2022-10-19 23:50:00+00', 3475250), + ('2022-10-20 00:00:00+00', 3475250), + ('2022-10-20 23:50:00+00', 3475250), + ('2022-10-21 00:00:00+00', 3475250), + ('2022-10-21 23:50:00+00', 3475250), + ('2022-10-22 00:00:00+00', 3475250), + ('2022-10-22 23:50:00+00', 3475250), + ('2022-10-23 00:00:00+00', 3475250), + ('2022-10-23 23:50:00+00', 3475250), + ('2022-10-24 00:00:00+00', 3475250), + ('2022-10-24 23:50:00+00', 3475250), + ('2022-10-25 00:00:00+00', 3475250), + ('2022-10-25 23:50:00+00', 3475250), + ('2022-10-26 00:00:00+00', 3475250), + ('2022-10-26 23:50:00+00', 3475250), + ('2022-10-27 00:00:00+00', 3475250), + ('2022-10-27 23:50:00+00', 3475250), + ('2022-10-28 00:00:00+00', 3475250), + ('2022-10-28 23:50:00+00', 3475250), + ('2022-10-29 00:00:00+00', 3475250), + ('2022-10-29 23:50:00+00', 3475250), + ('2022-10-30 00:00:00+00', 3475250), + ('2022-10-30 23:50:00+00', 3475250), + ('2022-10-31 00:00:00+00', 3475250), + ('2022-10-31 23:50:00+00', 3475250), + ('2022-11-01 00:00:00+00', 3475250), + ('2022-11-01 23:50:00+00', 3475250), + ('2022-11-02 00:00:00+00', 3475250), + ('2022-11-02 23:50:00+00', 3475250), + ('2022-11-03 00:00:00+00', 3475250), + ('2022-11-03 23:50:00+00', 3475250), + ('2022-11-04 00:00:00+00', 3475250), + ('2022-11-04 23:50:00+00', 3475250), + ('2022-11-05 00:00:00+00', 3475250), + ('2022-11-05 23:50:00+00', 3475250), + ('2022-11-06 00:00:00+00', 3475250), + ('2022-11-06 23:50:00+00', 3475250), + ('2022-11-07 00:00:00+00', 3475250), + ('2022-11-07 23:50:00+00', 3475250), + ('2022-11-08 00:00:00+00', 3475250), + ('2022-11-08 23:50:00+00', 3475250), + ('2022-11-09 00:00:00+00', 3475250), + ('2022-11-09 23:50:00+00', 3475250), + ('2022-11-10 00:00:00+00', 3475250), + ('2022-11-10 23:50:00+00', 3475250), + ('2022-11-11 00:00:00+00', 3475250), + ('2022-11-11 23:50:00+00', 3475250), + ('2022-11-12 00:00:00+00', 3475250), + ('2022-11-12 23:50:00+00', 3475250), + ('2022-11-13 00:00:00+00', 3475250), + ('2022-11-13 23:50:00+00', 3475250), + ('2022-11-14 00:00:00+00', 3475250), + ('2022-11-14 23:50:00+00', 3475250), + ('2022-11-15 00:00:00+00', 3475250), + ('2022-11-15 23:50:00+00', 3475250), + ('2022-11-16 00:00:00+00', 3475250), + ('2022-11-16 23:50:00+00', 3475250), + ('2022-11-17 00:00:00+00', 3475250), + ('2022-11-17 23:50:00+00', 3475250), + ('2022-11-18 00:00:00+00', 3475250), + ('2022-11-18 23:50:00+00', 3475250), + ('2022-11-19 00:00:00+00', 3475250), + ('2022-11-19 23:50:00+00', 3475250), + ('2022-11-20 00:00:00+00', 3475250), + ('2022-11-20 23:50:00+00', 3475250), + ('2022-11-21 00:00:00+00', 3475250), + ('2022-11-21 23:50:00+00', 3475250), + ('2022-11-22 00:00:00+00', 3475250), + ('2022-11-22 23:50:00+00', 3475250), + ('2022-11-23 00:00:00+00', 3475250), + ('2022-11-23 23:50:00+00', 3475250), + ('2022-11-24 00:00:00+00', 3475250), + ('2022-11-24 23:50:00+00', 3475250), + ('2022-11-25 00:00:00+00', 3475250), + ('2022-11-25 23:50:00+00', 3475250), + ('2022-11-26 00:00:00+00', 3475250), + ('2022-11-26 23:50:00+00', 3475250), + ('2022-11-27 00:00:00+00', 3475250), + ('2022-11-27 23:50:00+00', 3475250), + ('2022-11-28 00:00:00+00', 3475250), + ('2022-11-28 23:50:00+00', 3475250), + ('2022-11-29 00:00:00+00', 3475250), + ('2022-11-29 23:50:00+00', 3475250), + ('2022-11-30 00:00:00+00', 3475250), + ('2022-11-30 23:50:00+00', 3475250), + ('2022-12-01 00:00:00+00', 3475250), + ('2022-12-01 23:50:00+00', 3475250), + ('2022-12-02 00:00:00+00', 3475250), + ('2022-12-02 23:50:00+00', 3475250), + ('2022-12-03 00:00:00+00', 3475250), + ('2022-12-03 23:50:00+00', 3475250), + ('2022-12-04 00:00:00+00', 3475250), + ('2022-12-04 23:50:00+00', 3475250), + ('2022-12-05 00:00:00+00', 3475250), + ('2022-12-05 23:50:00+00', 3475250), + ('2022-12-06 00:00:00+00', 3475250), + ('2022-12-06 23:50:00+00', 3475250), + ('2022-12-07 00:00:00+00', 3475250), + ('2022-12-07 23:50:00+00', 3475250), + ('2022-12-08 00:00:00+00', 3475250), + ('2022-12-08 23:50:00+00', 3475250), + ('2022-12-09 00:00:00+00', 3475250), + ('2022-12-09 23:50:00+00', 3475250), + ('2022-12-10 00:00:00+00', 3475250), + ('2022-12-10 23:50:00+00', 3475250), + ('2022-12-11 00:00:00+00', 3475250), + ('2022-12-11 23:50:00+00', 3475250), + ('2022-12-12 00:00:00+00', 3475250), + ('2022-12-12 23:50:00+00', 3475250), + ('2022-12-13 00:00:00+00', 3475250), + ('2022-12-13 23:50:00+00', 3475250), + ('2022-12-14 00:00:00+00', 3475250), + ('2022-12-14 23:50:00+00', 3475250), + ('2022-12-15 00:00:00+00', 3475250), + ('2022-12-15 23:50:00+00', 3475250), + ('2022-12-16 00:00:00+00', 3475250), + ('2022-12-16 23:50:00+00', 3475250), + ('2022-12-17 00:00:00+00', 3475250), + ('2022-12-17 23:50:00+00', 3475250), + ('2022-12-18 00:00:00+00', 3475250), + ('2022-12-18 23:50:00+00', 3475250), + ('2022-12-19 00:00:00+00', 3475250), + ('2022-12-19 23:50:00+00', 3475250), + ('2022-12-20 00:00:00+00', 3475250), + ('2022-12-20 23:50:00+00', 3475250), + ('2022-12-21 00:00:00+00', 3475250), + ('2022-12-21 23:50:00+00', 3475250), + ('2022-12-22 00:00:00+00', 3475250), + ('2022-12-22 23:50:00+00', 3475250), + ('2022-12-23 00:00:00+00', 3475250), + ('2022-12-23 23:50:00+00', 3475250), + ('2022-12-24 00:00:00+00', 3475250), + ('2022-12-24 23:50:00+00', 3475250), + ('2022-12-25 00:00:00+00', 3475250), + ('2022-12-25 23:50:00+00', 3475250), + ('2022-12-26 00:00:00+00', 3475250), + ('2022-12-26 23:50:00+00', 3475250), + ('2022-12-27 00:00:00+00', 3475250), + ('2022-12-27 23:50:00+00', 3475250), + ('2022-12-28 00:00:00+00', 3475250), + ('2022-12-28 23:50:00+00', 3475250), + ('2022-12-29 00:00:00+00', 3475250), + ('2022-12-29 23:50:00+00', 3475250), + ('2022-12-30 00:00:00+00', 3475250), + ('2022-12-30 23:50:00+00', 3475250), + ('2022-12-31 00:00:00+00', 3475250), + ('2022-12-31 23:50:00+00', 3475250); + + +INSERT INTO observations (observation_measurement_id, observed_at, amount) +SELECT osm.id, tmp.observed_at, tmp.amount +FROM temp_observation_data tmp, + observation_sites_measurements osm; + diff --git a/packages/Manager/sample-data/observation_data_function.sql b/packages/Manager/sample-data/observation_data_function.sql deleted file mode 100644 index 4e6319d0..00000000 --- a/packages/Manager/sample-data/observation_data_function.sql +++ /dev/null @@ -1,741 +0,0 @@ --- This function has to exist in a seperate file because of how spring handles loading SQL files. --- with different tooling this might not be needed. - -DROP FUNCTION IF EXISTS pg_temp.insert_observation_data(int); - -CREATE FUNCTION pg_temp.insert_observation_data(p_observation_measurement_id int) - RETURNS void AS $$ -BEGIN - INSERT INTO observations (observation_measurement_id, observed_at, amount) - VALUES (p_observation_measurement_id, '2022-01-01 00:00:00+00', 3437526), - (p_observation_measurement_id, '2022-01-01 23:50:00+00', 3437906), - (p_observation_measurement_id, '2022-01-02 00:00:00+00', 3437913), - (p_observation_measurement_id, '2022-01-02 23:50:00+00', 3438981), - (p_observation_measurement_id, '2022-01-03 00:00:00+00', 3438988), - (p_observation_measurement_id, '2022-01-03 23:50:00+00', 3440053), - (p_observation_measurement_id, '2022-01-04 00:00:00+00', 3440060), - (p_observation_measurement_id, '2022-01-04 23:50:00+00', 3441147), - (p_observation_measurement_id, '2022-01-05 00:00:00+00', 3441156), - (p_observation_measurement_id, '2022-01-05 23:50:00+00', 3442498), - (p_observation_measurement_id, '2022-01-06 00:00:00+00', 3442508), - (p_observation_measurement_id, '2022-01-06 23:50:00+00', 3443847), - (p_observation_measurement_id, '2022-01-07 00:00:00+00', 3443856), - (p_observation_measurement_id, '2022-01-07 23:50:00+00', 3445195), - (p_observation_measurement_id, '2022-01-08 00:00:00+00', 3445205), - (p_observation_measurement_id, '2022-01-08 23:50:00+00', 3446544), - (p_observation_measurement_id, '2022-01-09 00:00:00+00', 3446553), - (p_observation_measurement_id, '2022-01-09 23:50:00+00', 3447875), - (p_observation_measurement_id, '2022-01-10 00:00:00+00', 3447884), - (p_observation_measurement_id, '2022-01-10 23:50:00+00', 3449224), - (p_observation_measurement_id, '2022-01-11 00:00:00+00', 3449233), - (p_observation_measurement_id, '2022-01-11 23:50:00+00', 3450573), - (p_observation_measurement_id, '2022-01-12 00:00:00+00', 3450582), - (p_observation_measurement_id, '2022-01-12 23:50:00+00', 3451921), - (p_observation_measurement_id, '2022-01-13 00:00:00+00', 3451930), - (p_observation_measurement_id, '2022-01-13 23:50:00+00', 3453267), - (p_observation_measurement_id, '2022-01-14 00:00:00+00', 3453276), - (p_observation_measurement_id, '2022-01-14 23:50:00+00', 3454611), - (p_observation_measurement_id, '2022-01-15 00:00:00+00', 3454621), - (p_observation_measurement_id, '2022-01-15 23:50:00+00', 3455959), - (p_observation_measurement_id, '2022-01-16 00:00:00+00', 3455968), - (p_observation_measurement_id, '2022-01-16 23:50:00+00', 3457306), - (p_observation_measurement_id, '2022-01-17 00:00:00+00', 3457315), - (p_observation_measurement_id, '2022-01-17 23:50:00+00', 3458656), - (p_observation_measurement_id, '2022-01-18 00:00:00+00', 3458665), - (p_observation_measurement_id, '2022-01-18 23:50:00+00', 3460006), - (p_observation_measurement_id, '2022-01-19 00:00:00+00', 3460015), - (p_observation_measurement_id, '2022-01-19 23:50:00+00', 3461343), - (p_observation_measurement_id, '2022-01-20 00:00:00+00', 3461351), - (p_observation_measurement_id, '2022-01-20 23:50:00+00', 3462517), - (p_observation_measurement_id, '2022-01-21 00:00:00+00', 3462525), - (p_observation_measurement_id, '2022-01-21 23:50:00+00', 3463402), - (p_observation_measurement_id, '2022-01-22 00:00:00+00', 3463402), - (p_observation_measurement_id, '2022-01-22 23:50:00+00', 3463402), - (p_observation_measurement_id, '2022-01-23 00:00:00+00', 3463402), - (p_observation_measurement_id, '2022-01-23 23:50:00+00', 3463402), - (p_observation_measurement_id, '2022-01-24 00:00:00+00', 3463402), - (p_observation_measurement_id, '2022-01-24 23:50:00+00', 3463612), - (p_observation_measurement_id, '2022-01-25 00:00:00+00', 3463621), - (p_observation_measurement_id, '2022-01-25 23:50:00+00', 3464818), - (p_observation_measurement_id, '2022-01-26 00:00:00+00', 3464827), - (p_observation_measurement_id, '2022-01-26 23:50:00+00', 3466021), - (p_observation_measurement_id, '2022-01-27 00:00:00+00', 3466029), - (p_observation_measurement_id, '2022-01-27 23:50:00+00', 3467227), - (p_observation_measurement_id, '2022-01-28 00:00:00+00', 3467235), - (p_observation_measurement_id, '2022-01-28 23:50:00+00', 3468453), - (p_observation_measurement_id, '2022-01-29 00:00:00+00', 3468463), - (p_observation_measurement_id, '2022-01-29 23:50:00+00', 3469823), - (p_observation_measurement_id, '2022-01-30 00:00:00+00', 3469832), - (p_observation_measurement_id, '2022-01-30 23:50:00+00', 3471193), - (p_observation_measurement_id, '2022-01-31 00:00:00+00', 3471202), - (p_observation_measurement_id, '2022-01-31 23:50:00+00', 3472566), - (p_observation_measurement_id, '2022-02-01 00:00:00+00', 3472576), - (p_observation_measurement_id, '2022-02-01 23:50:00+00', 3473942), - (p_observation_measurement_id, '2022-02-02 00:00:00+00', 3473951), - (p_observation_measurement_id, '2022-02-02 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-03 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-03 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-04 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-04 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-05 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-05 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-06 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-06 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-07 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-07 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-08 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-08 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-09 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-09 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-10 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-10 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-11 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-11 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-12 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-12 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-13 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-13 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-14 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-14 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-15 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-15 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-16 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-16 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-17 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-17 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-18 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-18 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-19 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-19 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-20 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-20 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-21 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-21 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-22 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-22 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-23 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-23 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-24 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-24 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-25 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-25 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-26 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-26 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-27 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-27 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-02-28 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-02-28 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-03-01 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-03-01 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-03-02 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-03-02 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-03-03 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-03-03 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-03-04 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-03-04 23:50:00+00', 3475147), - (p_observation_measurement_id, '2022-03-05 00:00:00+00', 3475147), - (p_observation_measurement_id, '2022-03-05 23:50:00+00', 3475148), - (p_observation_measurement_id, '2022-03-06 00:00:00+00', 3475148), - (p_observation_measurement_id, '2022-03-06 23:50:00+00', 3475148), - (p_observation_measurement_id, '2022-03-07 00:00:00+00', 3475148), - (p_observation_measurement_id, '2022-03-07 23:50:00+00', 3475148), - (p_observation_measurement_id, '2022-03-08 00:00:00+00', 3475148), - (p_observation_measurement_id, '2022-03-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-03-31 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-03-31 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-04-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-04-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-05-31 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-05-31 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-06-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-06-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-07-31 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-07-31 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-08-31 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-08-31 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-09-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-09-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-10-31 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-10-31 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-11-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-11-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-01 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-01 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-02 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-02 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-03 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-03 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-04 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-04 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-05 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-05 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-06 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-06 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-07 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-07 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-08 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-08 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-09 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-09 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-10 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-10 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-11 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-11 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-12 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-12 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-13 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-13 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-14 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-14 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-15 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-15 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-16 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-16 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-17 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-17 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-18 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-18 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-19 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-19 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-20 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-20 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-21 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-21 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-22 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-22 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-23 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-23 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-24 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-24 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-25 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-25 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-26 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-26 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-27 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-27 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-28 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-28 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-29 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-29 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-30 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-30 23:50:00+00', 3475250), - (p_observation_measurement_id, '2022-12-31 00:00:00+00', 3475250), - (p_observation_measurement_id, '2022-12-31 23:50:00+00', 3475250); -END; -$$ LANGUAGE plpgsql; From be252ff268da6f5197a9acbff9e2e5fc8f140a08 Mon Sep 17 00:00:00 2001 From: Steve Mosley Date: Fri, 13 Oct 2023 12:36:20 +1300 Subject: [PATCH 6/7] Update the refresh to be relative to current date --- packages/Manager/build.gradle.kts | 8 +++++--- .../Manager/sample-data/update_observation_dates.sql | 10 ++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 packages/Manager/sample-data/update_observation_dates.sql diff --git a/packages/Manager/build.gradle.kts b/packages/Manager/build.gradle.kts index 0c3f5ad3..79e3e514 100644 --- a/packages/Manager/build.gradle.kts +++ b/packages/Manager/build.gradle.kts @@ -203,13 +203,15 @@ tasks.register("loadSampleData") { tasks.register("refreshSampleData") { dependsOn("flywayMigrate") - doLast { println("refreshSampleData.") + doLast { + println("Refresh Sample Data Dates") SingleConnectionDataSource( dbConfig["devUrl"]!!, dbConfig["user"]!!, dbConfig["password"]!!, true) .let { - JdbcTemplate(it).let { - it.execute("UPDATE observations SET observed_at = observed_at + INTERVAL '1 YEAR';") + it.connection.use { connection -> + executeSqlScript( + connection, FileSystemResource("./sample-data/update_observation_dates.sql")) } } } diff --git a/packages/Manager/sample-data/update_observation_dates.sql b/packages/Manager/sample-data/update_observation_dates.sql new file mode 100644 index 00000000..1b9ff289 --- /dev/null +++ b/packages/Manager/sample-data/update_observation_dates.sql @@ -0,0 +1,10 @@ +-- This script moves all the observed_at time stamps so that the latest one is 60 days in the future. + +-- If we just try to add say 30 days to the observed_at column we get primary key conflicts. +-- So we subtract 10 years first so that we can add days back without conflicts. +UPDATE observations +SET observed_at = observed_at - make_interval(years => 10); + +WITH days_to_add AS (SELECT make_interval(days => (SELECT (EXTRACT(DAY FROM NOW() - MAX(observed_at))::INT + 60))) FROM observations) +UPDATE observations +SET observed_at = observed_at + (SELECT * FROM days_to_add); From 15896288c8b8afe296eaa69d230517f9c27e2fcf Mon Sep 17 00:00:00 2001 From: Steve Mosley Date: Fri, 13 Oct 2023 14:06:24 +1300 Subject: [PATCH 7/7] Adding in transactions for the scripts --- packages/Manager/build.gradle.kts | 22 +++++++------------ .../Manager/sample-data/allocation_data.sql | 3 +++ .../Manager/sample-data/observation_data.sql | 3 +++ .../sample-data/update_observation_dates.sql | 5 +++++ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/packages/Manager/build.gradle.kts b/packages/Manager/build.gradle.kts index 79e3e514..c844b170 100644 --- a/packages/Manager/build.gradle.kts +++ b/packages/Manager/build.gradle.kts @@ -1,12 +1,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jooq.meta.jaxb.ForcedType import org.springframework.core.io.FileSystemResource -import org.springframework.core.io.support.EncodedResource -import org.springframework.jdbc.core.JdbcTemplate import org.springframework.jdbc.datasource.SingleConnectionDataSource -import org.springframework.jdbc.datasource.init.ScriptUtils import org.springframework.jdbc.datasource.init.ScriptUtils.* -import org.springframework.jdbc.datasource.init.ScriptUtils.EOF_STATEMENT_SEPARATOR as EOF_STATEMENT_SEPARATOR1 plugins { id("org.springframework.boot") version "3.1.3" @@ -192,10 +188,8 @@ tasks.register("loadSampleData") { dbConfig["devUrl"]!!, dbConfig["user"]!!, dbConfig["password"]!!, true) .let { it.connection.use { connection -> - executeSqlScript( - connection, FileSystemResource("./sample-data/allocation_data.sql")) - executeSqlScript( - connection, FileSystemResource("./sample-data/observation_data.sql")) + executeSqlScript(connection, FileSystemResource("./sample-data/allocation_data.sql")) + executeSqlScript(connection, FileSystemResource("./sample-data/observation_data.sql")) } } } @@ -207,12 +201,12 @@ tasks.register("refreshSampleData") { println("Refresh Sample Data Dates") SingleConnectionDataSource( - dbConfig["devUrl"]!!, dbConfig["user"]!!, dbConfig["password"]!!, true) - .let { - it.connection.use { connection -> - executeSqlScript( - connection, FileSystemResource("./sample-data/update_observation_dates.sql")) + dbConfig["devUrl"]!!, dbConfig["user"]!!, dbConfig["password"]!!, true) + .let { + it.connection.use { connection -> + executeSqlScript( + connection, FileSystemResource("./sample-data/update_observation_dates.sql")) + } } - } } } diff --git a/packages/Manager/sample-data/allocation_data.sql b/packages/Manager/sample-data/allocation_data.sql index 6e40393e..f44778a4 100644 --- a/packages/Manager/sample-data/allocation_data.sql +++ b/packages/Manager/sample-data/allocation_data.sql @@ -1,3 +1,4 @@ +BEGIN; TRUNCATE TABLE water_allocations RESTART IDENTITY CASCADE; INSERT INTO water_allocations (area_id, ingest_id, source_id, consent_id, status, is_metered, allocation, meters, effective_from, effective_to, created_at, updated_at) @@ -51,3 +52,5 @@ VALUES ('BoothsSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-01', 'SAMPLE-CONSENT-ID ('WaitohuGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-48', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-48"}', '2000-01-01', '2099-01-01', NOW(), NOW()), ('WgnHarbour,HuttGW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-49', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-49"}', '2000-01-01', '2099-01-01', NOW(), NOW()), ('WgnHarbour,HuttSW', 'SAMPLE-DATA-INGEST', 'SAMPLE-SOURCE-50', 'SAMPLE-CONSENT-ID', 'active', true, 10, '{"TEST-METER-50"}', '2000-01-01', '2099-01-01', NOW(), NOW()); + +COMMIT; diff --git a/packages/Manager/sample-data/observation_data.sql b/packages/Manager/sample-data/observation_data.sql index 4703a431..90de83b1 100644 --- a/packages/Manager/sample-data/observation_data.sql +++ b/packages/Manager/sample-data/observation_data.sql @@ -1,3 +1,5 @@ +BEGIN; + TRUNCATE TABLE observations RESTART IDENTITY CASCADE; TRUNCATE TABLE observation_sites_measurements RESTART IDENTITY CASCADE; TRUNCATE TABLE observation_sites RESTART IDENTITY CASCADE; @@ -756,3 +758,4 @@ SELECT osm.id, tmp.observed_at, tmp.amount FROM temp_observation_data tmp, observation_sites_measurements osm; +COMMIT; diff --git a/packages/Manager/sample-data/update_observation_dates.sql b/packages/Manager/sample-data/update_observation_dates.sql index 1b9ff289..06b42ca6 100644 --- a/packages/Manager/sample-data/update_observation_dates.sql +++ b/packages/Manager/sample-data/update_observation_dates.sql @@ -2,9 +2,14 @@ -- If we just try to add say 30 days to the observed_at column we get primary key conflicts. -- So we subtract 10 years first so that we can add days back without conflicts. + +BEGIN; + UPDATE observations SET observed_at = observed_at - make_interval(years => 10); WITH days_to_add AS (SELECT make_interval(days => (SELECT (EXTRACT(DAY FROM NOW() - MAX(observed_at))::INT + 60))) FROM observations) UPDATE observations SET observed_at = observed_at + (SELECT * FROM days_to_add); + +COMMIT;