From cce52c369ba2f4f47eeb620eea8c44d1849ffba2 Mon Sep 17 00:00:00 2001 From: mfonsecaOEF Date: Wed, 8 May 2024 08:52:35 -0300 Subject: [PATCH 001/128] feat:allowing_other_languagues --- .../datasource_seeder/datasource_seeder.yaml | 1855 +++++++++++++++++ .../import_datasource_seeder.sql | 2 +- .../77d1cb7b24df_allowing_other_languages.py | 44 + 3 files changed, 1900 insertions(+), 1 deletion(-) create mode 100644 global-api/importer/datasource_seeder/datasource_seeder.yaml create mode 100644 global-api/migrations/versions/77d1cb7b24df_allowing_other_languages.py diff --git a/global-api/importer/datasource_seeder/datasource_seeder.yaml b/global-api/importer/datasource_seeder/datasource_seeder.yaml new file mode 100644 index 000000000..b2f893d97 --- /dev/null +++ b/global-api/importer/datasource_seeder/datasource_seeder.yaml @@ -0,0 +1,1855 @@ +- + datasource_id: 143F3378-17E7-4732-BF17-4253160A7CFE + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Manufacturing Industries and Construction Direct Emitters reported in the Greenhouse Gas Reporting Program (GHGRP) + es: Industrias Manufactureras y de Construcción consideradas como Emisores Directos reportados en el Programa de Reporte de Gases de Efecto Invernadero (GHGRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que compila información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.3.1 + scope: 1 +- + datasource_id: 06BB5C1D-E554-40D7-B619-DA768A5FD607 + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Power Plant Auxiliary Operations as Direct Emitters reported in the Greenhouse Gas Reporting Program (GHGRP) + es: Operaciones Auxiliares de Centrales Eléctricas como Emisores Directos reportados en el Programa de Reporte de Gases de Efecto Invernadero (GHGRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.4.1 + scope: 1 +- + datasource_id: C309DE81-6D75-4782-98B0-A9229D43F042 + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Solid Waste emissions by landfills as Direct Emitters reported in the Greenhouse Gas Reporting Program (GHGRP) + es: Emissiones provenientes de basura sólida dispuesta en rellenos sanitarios reportados como Emisores Directos en el Programa de Reporte de Gases de Efecto Invernadero (GHGRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: III.1.1 + scope: 1 +- + datasource_id: 8F3E7542-3C50-4E33-B2F7-57F326CBF9A6 + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Energy generation emissions by Power Plants reported as Direct Emitters in the Greenhouse Gas Reporting Program (GHGRP) + es: Emisiones provenientes de la generación de energía en plantas eléctricas reportadas como Emisores Directos en el Programa de Reporte de Gases de Efecto Invernadero (GHGRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.4.4 + scope: 1 +- + datasource_id: C57F697D-2659-450E-BAF6-6F142D18A9AF + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Emissions from large-scale industry processes in facilities reported as Direct Emitters in the Greenhouse Gas Reporting Program (GHGRP) + es: Emisiones provenientes de procesos industriales a gran escala en fábricas reportadas como Emisores Derectos en el Programa de Reporte de Gases de Efecto Invernadero (GHGRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: IV.1 + scope: 1 +- + datasource_id: 930F05CF-1796-4E25-B391-686BEA746A88 + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Emissions from incineration and open burning of solid waste in treatment plants reported as Direct Emitters in the Greenhouse Gas Reporting Program (GHGRP) + es: Emisiones provenientes la incineración y quema al aire libre de residuos sólidos en plantas de tratamiento reportadas como Emisores Directos en el Program de Reporte de Gases de Efecto Invernadero (GHGRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: III.3.1 + scope: 1 +- + datasource_id: 0D7F6F31-D483-4170-B36C-C9CFC0434A09 + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Fugitive emissions from natural gas systems reported as Direct Emitters in the Greenhouse Gas Reporting Program (GHGRP) + ES: Emisiones fugitivas de los sistemas de gas natural reportadas como Emisores Directos en el Programa de Reporte de Gases de Efecto Invernadero (GHGRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.8.1 + scope: 1 +- + datasource_id: 4E235B19-E4FD-4E64-A674-9ED9D9CBA9AA + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Fugitive emissions from mining, processing, storage, and transportation of coal reported as Direct Emitters in the Greenhouse Gas Reporting Program (GHGRP) + es: Emisiones fugitivas provenientes de la minería, procesamiento, almacenamiento y transporte de carbón reportadas como Emisores Directos en el Programa de Reporte de Gases de Efecto Invernadero (GHGRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.7.1 + scope: 1 +- + datasource_id: B7BCFC69-3E7F-4B5B-A7BE-B8C945BE073F + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Emissions from Wastewater Treatment Plants reported as Direct Emitters in the Greenhouse Gas Reporting Program (GHGRP) + es: Emisiones provenientes de plantas de tratamiento de aguas residuales reportadas como Emisores Directos en el Programa de Reporte de Gases de Efecto Invernadero (GHRP) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: III.4.1 + scope: 1 +- + datasource_id: D213BD2F-0164-4411-84BC-1339A9D7EB94 + publisher_id: EPA + datasource_name: Environmental Protection Agency + dataset_name: + en: Non-specifed sources reported as Direct Emitters in the Greenhouse Gas Reporting Program (GHGPR) + es: Fuentes no específicas reportadas como Emisores Directos reportados en el Programa de Informes de Gases de Efecto Invernadero (GHGPR) + dataset_description: + en: The GHGRP, administered by the EPA, is a vital resource that compiles detailed information on GHG emissions from large-scale facilities across the U.S. This program mandates that major emitters report comprehensive annual data concerning their GHG emissions derived from various industrial activities. + es: El GHGRP, administrado por la EPA, es un recurso vital que complia información detallada de las emisiones de GEI provenientes de fábricas de gran escala en Estados Unidos. Este programa exige que los principales emisores informen datos anuales completos sobre sus emisiones de GEI derivadas de diversas actividades industriales. + source_type: third_party + access_type: public + dataset_url: https://www.epa.gov/ + geographical_location: US + start_year: 2019 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: high + notes: Initial import + units: kg + methodology_description: + en: Direct-emitting facilities report emissions from combustion or process sources, such as fuel combustion and chemical transformations, using methods like continuous emission monitoring systems (CEMS) or default emission factors. + es: Las fábricas con emisiones directas informan sus emisiones provenientes de fuentes de combustión o de procesos, como la quema de combustibles y las transformaciones químicas, utilizando métodos como sistemas de monitoreo continuo de emisiones (CEMS) y/o aplicando factores de emisión predeterminados. + methodology_url: https://www.epa.gov/ghgreporting/learn-about-greenhouse-gas-reporting-program-ghgrp + transformation_description: + en: We follow the EPA categorization. EPA categorizes facilities into nine industry groups, and they report direct emissions from 23 facility-level processes. Facilities often engage in multiple emission-generating processes. If a facility reports emissions from a single activity, those emissions are placed in that industry group. If reporting includes stationary combustion, the stationary combustion emissions are added to the process emissions, and the emissions are reported into that process. In cases of multiple activities with stationary combustion, the highest-emission activity determines the industry group, the stationary combustion emissions are added to the highest-emission activity and the other emissions are classified separately in their corresponding process. Than, facility emissions were adjusted to fit the GPC format. + es: Seguimos la categorización de la EPA. La EPA clasifica las instalaciones en nueve grupos industriales y reporta emisiones directas de 23 procesos a nivel de fábrica. Las fábricas a menudo realizan múltiples procesos generadores de emisiones. Si una instalación informa emisiones de una sola actividad, esas emisiones se reportan en ese grupo industrial. Si los informes incluyen la combustión estacionaria, las emisiones de la combustión estacionaria se agregan a las emisiones del proceso y las emisiones se reportan en ese grupo industrial. En los casos de múltiples actividades con combustión estacionaria, la actividad con mayor emisión determina el principal proceso industrial, además las emisiones de combustión estacionaria se suman a la actividad con mayor emisión y las demás emisiones se clasifican por separado en su correspondiente proceso. Por último, las emisiones de las fábricas se ajustaron para adaptarse al formato GPC. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/ghgrp_epa/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.6.1 + scope: 1 +- + datasource_id: 124A1F4B-13FD-439B-9175-A8C40CC36E79 + publisher_id: IEA + datasource_name: International Energy Agency + dataset_name: + en: Electricity and heat production emissions reported by the International Energy Agency + es: Emisiones provenientes de producción de electricidad y calor reportadas por la Agencia Internacional de Energía + dataset_description: + en: Electricity and heat production data contains the sum of emissions from electricity production, combined heat and power plants and heat plants. Emissions from own on-site use of fuel are included. + es: Los datos de producción de electricidad y calor contienen la suma de las emisiones de la producción de electricidad, las centrales eléctricas y de calor combinadas y las centrales térmicas. Se incluyen las emisiones derivadas del uso propio de combustible en el sitio. + source_type: third_party + access_type: public + dataset_url: https://www.iea.org/statistics/co2emissions/ + geographical_location: EARTH + start_year: 2020 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: country + language: en + accessibility: + data_quality: high + notes: Initial import + units: tonnes + methodology_description: + en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. + es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. + methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf + transformation_description: + en: A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Electricity and heat production" as "I.4.4" + es: Se realizó una reasignación de las categorías propuestas por la IEA para considerar algunos de los subsectores del GPC. Para este caso, la reasignación fue "Producción de electricidad y calor" como "I.4.4" + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.4.4 + scope: 1 +- + datasource_id: 1087D232-BC25-498B-BE38-92DC330F0B15 + publisher_id: IEA + datasource_name: International Energy Agency + dataset_name: + en: Emissions from fuel consumption by Off-Road transportation reported by the International Energy Agency + es: Emisiones provenientes del consumo de combustible por transporte fuera de carreteras reportado por la Agencia Internacional de Energía + dataset_description: + en: Includes all transport emissions not specified in another sector. In the calculations, non-CO2 greenhouse gases are excluded. + es: Incluye todas las emisiones del transporte no especificadas en otro sector. En los cálculos se excluyen los gases de efecto invernadero distintos del CO2. + source_type: third_party + access_type: public + dataset_url: https://www.iea.org/statistics/co2emissions/ + geographical_location: EARTH + start_year: 2020 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: country + language: en + accessibility: + data_quality: high + notes: Initial import + units: tonnes + methodology_description: + en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. + es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. + methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf + transformation_description: + en: A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Other Transport" as "I.5.1" + es: Se realizó una reasignación de las categorías propuestas por la IEA para considerar algunos de los subsectores del GPC. Para este caso la reasignación fue "Otro Transporte" como "I.5.1" + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: II.5.1 + scope: 1 +- + datasource_id: D00A84CE-858E-462C-90D3-61D7BC728E30 + publisher_id: IEA + datasource_name: International Energy Agency + dataset_name: + en: Emissions from fuel consumption by On-Road transportation reported by the International Energy Agency + es: Emisiones provenientes del consumo de combustible por transporte en carreteras reportado por la Agencia Internacional de Energía + dataset_description: + en: It contains the emissions arising from fuel use in road vehicles, including the use of agricultural vehicles on highways. This corresponds to the IPCC Source/Sink Category 1 A 3 b. Excludes emissions from military consumption as well as motor gasoline used in stationary engines and diesel oil for use in tractors that are not for highway use. + es: Contiene las emisiones derivadas del uso de combustibles en vehículos de carretera, incluido el uso de vehículos agrícolas en autopistas. Esto corresponde a la categoría de fuente/sumidero del IPCC 1 A 3 b. Excluye las emisiones provenientes del consumo militar, así como la gasolina de motor utilizada en motores estacionarios y el gasóleo para uso en tractores que no son para uso en carreteras. + source_type: third_party + access_type: public + dataset_url: https://www.iea.org/statistics/co2emissions/ + geographical_location: EARTH + start_year: 2020 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: country + language: en + accessibility: + data_quality: high + notes: Initial import + units: tonnes + methodology_description: + en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. + es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. + methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf + transformation_description: + en: A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Road Transport" as "II.1.1" + es: Se realizó una reasignación de las categorías propuestas por la IEA para considerar algunos de los subsectores del GPC. Para este caso la reasignación fue "Transporte por Carretera" como "II.1.1" + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: II.1.1 + scope: 1 +- + datasource_id: AD25F669-FC74-46D3-9E6E-EF92CD0079A5 + publisher_id: IEA + datasource_name: International Energy Agency + dataset_name: + en: Other energy industry own use emissions from fuel consumption reported by the International Energy Agency + es: Otras emisiones de uso propio de la industria energética provenientes del consumo de combustible reportadas por la Agencia Internacional de Energía + dataset_description: + en: Emissions from own on-site use of fuel in energy facilities or power plants + es: Emisiones por uso propio in situ de combustible en instalaciones energéticas o centrales eléctricas + source_type: third_party + access_type: public + dataset_url: https://www.iea.org/statistics/co2emissions/ + geographical_location: EARTH + start_year: 2020 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: country + language: en + accessibility: + data_quality: high + notes: Initial import + units: tonnes + methodology_description: + en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. + es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. + methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf + transformation_description: + en: A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Other Energy Industry Own Use" as "I.4.1" + es: Se realizó una reasignación de las categorías propuestas por la IEA para considerar algunos de los subsectores del GPC. Para este caso, la reasignación fue "Otro uso propio de la industria energética" como "I.4.1" + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.4.1 + scope: 1 +- + datasource_id: A284E16D-F04E-46C9-A977-8BDDD396F1FB + publisher_id: IEA + datasource_name: International Energy Agency + dataset_name: Residential grid energy consumption reported by the International Energy Agency + en: + es: + dataset_description: Residential contains all emissions from fuel combustion in households. This corresponds to IPCC Source/Sink Category 1 A 4 b. + en: + es: + source_type: third_party + access_type: public + dataset_url: https://www.iea.org/statistics/co2emissions/ + geographical_location: EARTH + start_year: 2020 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: country + language: en + accessibility: + data_quality: high + notes: Initial import + units: tonnes + methodology_description: + en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. + es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. + methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf + transformation_description: 'A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Residential" as ''I.1.1''' + en: + es: + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.1.1 + scope: 1 +- + datasource_id: CAD04116-1B60-4290-A158-85F4B2BCED28 + publisher_id: IEA + datasource_name: International Energy Agency + dataset_name: Manufacturing industries and construction grid energy consumption reported by the International Energy Agency + en: + es: + dataset_description: Manufacturing and construction industries contribute to emissions through fuel combustion, classified under IPCC Source/Sink Category 1 A 2. The 2006 GLs include emissions from industry autoproducers generating electricity and/or heat in this category. IEA data lacks the specific end-use breakdown, resulting in unallocated autoproducers. + en: + es: + source_type: third_party + access_type: public + dataset_url: https://www.iea.org/statistics/co2emissions/ + geographical_location: EARTH + start_year: 2020 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: country + language: en + accessibility: + data_quality: high + notes: Initial import + units: tonnes + methodology_description: + en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. + es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. + methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf + transformation_description: 'A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Manufactoring Industries and Construction" as ''I.3.1''' + en: + es: + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.3.1 + scope: 1 +- + datasource_id: F70577EF-3E87-4750-BB48-DF48899B040E + publisher_id: IEA + datasource_name: International Energy Agency + dataset_name: + en: Emission from commercial buildings for fuel consumprion reported by the International Energy Agency + es: Emisiones de edificios comerciales por consumo de combustible reportadas por la Agencia Internacional de Energía + dataset_description: + en: It encompasses emissions from all applicable activities as categorized by the International Standard Industrial Classification of All Economic Activities, Revision 4 (ISIC Rev. 4). This classification system, maintained by the United Nations, enables precise monitoring and analysis of GHG emissions and energy consumption across various sectors. + es: Abarca las emisiones de todas las actividades aplicables según las clasificadas por la Clasificación Industrial Internacional Uniforme de Todas las Actividades Económicas, Revisión 4 (CIIU Rev. 4). Este sistema de clasificación, mantenido por las Naciones Unidas, permite un seguimiento y análisis preciso de las emisiones de GEI y el consumo de energía en varios sectores. + source_type: third_party + access_type: public + dataset_url: https://www.iea.org/statistics/co2emissions/ + geographical_location: EARTH + start_year: 2020 + end_year: 2022 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: country + language: en + accessibility: + data_quality: high + notes: Initial import + units: tonnes + methodology_description: + en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. + es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. + methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf + transformation_description: + en: A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Commercial and Public Services" as "I.2.1" + es: Se realizó una reasignación de las categorías propuestas por la IEA para considerar algunos de los subsectores del GPC. Para este caso la reasignación fue “Servicios Públicos y Comerciales” según "I.2.1" + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.2.1 + scope: 1 +- + datasource_id: 497e10f2-c3f3-3b1a-ba35-707edff58858 + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: Road transportation estimated emissions + es: Emisiones estimadas de transporte en carretera + dataset_description: + en: It includes GHG emission estimation from on-road transportation, integrating data on road segments, vehicle distribution, and fuel types for environmental impact assessments + es: Incluye la estimación de emisiones de GEI del transporte por carretera, integrando datos sobre segmentos de carreteras, distribución de vehículos y tipos de combustible para evaluaciones de impacto ambiental + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2021 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The on-road transportation emissions methodology involves classifying road segments, considering factors like road type from OpenStreetMap data. Vehicle distribution by type and fuel efficiency is determined using registration data, kilometers traveled, and US FHWA estimates. Fuel types and efficiencies are analyzed based on gasoline, diesel, and alternative fuels, using U.S. EPA emissions factors. Machine learning models assist in estimating traffic volume per road segment, contributing to emissions calculations. + es: La metodología de emisiones del transporte en carretera implica clasificar los segmentos de carreteras, considerando factores como el tipo de carretera a partir de los datos de OpenStreetMap. La distribución de vehículos por tipo y eficiencia de combustible se determina utilizando datos de registro, kilómetros recorridos y estimaciones de la FHWA de U.S. Los tipos de combustible y las eficiencias se analizan en función de la gasolina, el diésel y los combustibles alternativos, utilizando factores de emisiones de la EPA de U.S. Los modelos de aprendizaje automático ayudan a estimar el volumen de tráfico por segmento de carretera, lo que contribuye a los cálculos de emisiones. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Transportation/Transportation%20Sector-%20Road%20transportation%20(asset)%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: II.1.1 + scope: 1 +- + datasource_id: c7c660e4-56ca-3c42-96d4-6525d2a8f6cc + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: Oil and gas refining estimated Emissions + es: Emisiones estimadas de refinación de petróleo y gas + dataset_description: + en: It contains point source GHG estimates using the OCI+ tool, incorporating models like OPGEE for upstream activities and PRELIM for refining. + es: Contiene estimaciones de GEI de fuentes puntuales utilizando la herramienta OCI+, incorporando modelos como OPGEE para actividades upstream y PRELIM para refinación. + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2015 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: Point source GHG estimates are calculated using the OCI+ tool, which incorporates specialized models such as the Oil Production Greenhouse Gas Emissions Estimator (OPGEE) for upstream oil and gas activities, and PRELIM for refining processes. Key inputs like crude assays and refinery configurations are used to estimate emissions intensities, with throughput and capacity factored in to derive emissions estimates. For US refineries, increased data availability allows for more detailed categorization. + es: Las estimaciones de GEI de fuentes puntuales se calculan utilizando la herramienta OCI+, que incorpora modelos especializados como el Estimador de emisiones de gases de efecto invernadero de producción de petróleo (OPGEE) para actividades upstream de petróleo y gas, y PRELIM para procesos de refinación. Se utilizan insumos clave, como ensayos de crudo y configuraciones de refinería, para estimar la intensidad de las emisiones, y se tienen en cuenta el rendimiento y la capacidad para derivar estimaciones de emisiones. Para las refinerías estadounidenses, la mayor disponibilidad de datos permite una categorización más detallada. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Fossil%20fuel%20operations/Fossil%20Fuel%20Operations%20sector-%20Oil%20and%20Gas%20Production%20and%20Transport%20Oil%2C%20and%20Gas%20Refining%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.4.1 + scope: 1 +- + datasource_id: 7feeb3b0-a896-3481-8c05-8d31464dcede + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: Oil and gas production and transport estimated emissions + es: Emisiones estimadas de producción y transporte de petróleo y gas + dataset_description: + en: Oil and Gas Production and Transport Estimated Emissions - Point source GHG estimates using OCI+ tool, covering upstream to downstream operations, incorporating over 100 emission sources and integrating ground truthing and VIIRS remote sensing data for precision. + es: Estimaciones de GEI de fuentes puntuales utilizando la herramienta OCI+, que cubre operaciones upstream a downstream, incorporando más de 100 fuentes de emisión e integrando información sobre el terreno y datos de teledetección VIIRS para mayor precisión. + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2015 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The methodology involves using the OCI+ tool, which consists of three models, OPGEE for upstream operations, PRELIM for midstream refining, and OPEM for downstream consumption. OPGEE focuses on all stages of producing and transporting crude hydrocarbons and gas to end-use points. It accounts for over 100 emission sources, including flaring, venting, fugitive losses, and more. Key inputs such as field characteristics, production volumes, and transport methods are considered, integrating ground truthing and remote sensing data like VIIRS for accurate estimations. + es: La metodología implica el uso de la herramienta OCI+, que consta de tres modelos; OPGEE para operaciones upstream, PRELIM para refinación midstream y OPEM para consumo downstream. OPGEE se centra en todas las etapas de producción y transporte de hidrocarburos crudos y gas a los puntos de uso final. Representa más de 100 fuentes de emisión, incluidas la quema, la ventilación, las pérdidas fugitivas y más. Se consideran insumos clave como las características del campo, los volúmenes de producción y los métodos de transporte, integrando datos de verificación en el terreno y de sensores remotos como VIIRS para obtener estimaciones precisas. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Fossil%20fuel%20operations/Fossil%20Fuel%20Operations%20sector-%20Oil%20and%20Gas%20Production%20and%20Transport%20Oil%2C%20and%20Gas%20Refining%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.8.1 + scope: 1 +- + datasource_id: d58b08f3-efdb-3f2d-9320-cea8c763d05a + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: Coal mining estimated emissions + es: Emisiones estimadas de la minería del carbón + dataset_description: + en: Emissions from mining and quarrying are estimated on a statistical basis by taking national and facility level production figures and applying specific emission factors. + es: Se estiman las emisiones de la extracción de minas y canteras sobre una base estadística tomando las cifras de producción a nivel nacional y de instalación y aplicando factores de emisión específicos. + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2021 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The methodology involves utilizing data from the Global Coal Mine Tracker, which includes production and capacity data for coal mines globally. Methane emissions are estimated based on methane gas content and capacity factors obtained from literature. The methane gas content is converted to emissions using a conversion factor provided by the EPA. The emissions factor is calculated based on the methane gas content and an average emission factor coefficient. The emissions are then estimated for each mine using the emissions factor and activity data. + es: La metodología implica la utilización de datos del Global Coal Mine Tracker, que incluye datos de producción y capacidad de las minas de carbón a nivel mundial. Las emisiones de metano se estiman con base en el contenido de gas metano y los factores de capacidad obtenidos de la literatura. El contenido de gas metano se convierte en emisiones utilizando un factor de conversión proporcionado por la EPA. El factor de emisión se calcula en base al contenido de gas metano y un coeficiente promedio del factor de emisión. Luego se estiman las emisiones para cada mina utilizando el factor de emisiones y los datos de actividad. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Fossil%20fuel%20operations/Fossil%20Fuel%20Operations%20sector-%20Coal%20mining%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.7.1 + scope: 1 +- + datasource_id: 4fa3124f-cb69-300d-964f-57d63b04d46e + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: International aviation estimated emissions + es: Emisiones estimadas de la aviación internacional + dataset_description: + en: Point source estimates of GHG emissions from international aviation, employing the ICAO Tier 3a methodology, Version 11 of the ICAO Carbon Emissions Calculator, and OAG Historical Flight Status Data to calculate emissions based on fuel consumption, including CO2, CH4, and N2O, and attributing them to countries and airports. + es: Estimaciones de fuentes puntuales de emisiones de GEI de la aviación internacional, empleando la metodología Tier 3a de la OACI, la versión 11 de la Calculadora de emisiones de carbono de la OACI y los datos históricos del estado de los vuelos de la OAG para calcular las emisiones en función del consumo de combustible, incluidos CO2, CH4 y N2O, y atribuirlas. a países y aeropuertos. + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2015 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The ICAO methodology is applied, employing a Tier 3a approach defined by the IPCC. They use Version 11 of the ICAO Carbon Emissions Calculator Methodology along with OAG Historical Flight Status Data. The methodology estimates emissions based on fuel consumption, including CO2, CH4, and N2O. Flight data, aircraft types, and fuel consumption factors are used to estimate fuel burned for each trip. Emissions are attributed either fully to a country for domestic flights or divided equally between countries for international flights. Finally, emissions data is aggregated by country and airport for reporting. + es: Se aplica la metodología de la OACI, empleando un enfoque Tier 3a definido por el IPCC. Utilizan la versión 11 de la metodología de calculadora de emisiones de carbono de la OACI junto con los datos históricos del estado de los vuelos de la OAG. La metodología estima las emisiones en función del consumo de combustible, incluidos CO2, CH4 y N2O. Los datos de vuelo, los tipos de aeronaves y los factores de consumo de combustible se utilizan para estimar el combustible quemado en cada viaje. Las emisiones se atribuyen íntegramente a un país para vuelos nacionales o se dividen en partes iguales entre países para vuelos internacionales. Finalmente, los datos de emisiones se agregan por país y aeropuerto para su presentación en informes. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Transportation/Transportation%20sector-%20Domestic%20and%20International%20Aviation%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: II.4.3 + scope: 3 +- + datasource_id: d8bf703a-0b3f-305d-b2a0-6d1c9419044e + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: Domestic aviation estimated emissions + es: Emisiones estimadas de la aviación nacional + dataset_description: + en: Point source estimates of GHG emissions from domestic aviation, utilizing ICAO's Tier 3a approach, Carbon Emissions Calculator Methodology, and OAG Historical Flight Status Data from January 2015 to June 2023, attributing emissions fully to the country of origin based on detailed aircraft movement data and fuel consumption factors for accurate estimations. + es: Estimaciones de fuentes puntuales de emisiones de GEI de la aviación nacional, utilizando el enfoque de Nivel 3a de la OACI, la metodología de calculadora de emisiones de carbono y los datos históricos del estado de los vuelos de la OAG desde enero de 2015 hasta junio de 2023, atribuyendo las emisiones completamente al país de origen con base en datos detallados de movimiento de aeronaves y combustible. factores de consumo para estimaciones precisas. + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2015 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: To calculate domestic aviation emissions, Climate TRACE uses ICAO''s Tier 3a approach, considering detailed aircraft movement data. They employ ICAO's Carbon Emissions Calculator Methodology and OAG Historical Flight Status Data from January 2015 to June 2023. This methodology estimates emissions based on fuel consumption, including CO2, CH4, and N2O. They calculate emissions for each flight between origin and destination pairs, excluding specific aircraft types, adjusting for factors like stacking and weather. Fuel consumption is estimated using ICAO's data, and emissions are attributed fully to the country of origin. + es: Para calcular las emisiones de la aviación nacional, Climate TRACE utiliza el enfoque Tier 3a de la OACI, considerando datos detallados del movimiento de las aeronaves. Emplean la metodología de calculadora de emisiones de carbono de la OACI y los datos históricos del estado de los vuelos de la OAG desde enero de 2015 hasta junio de 2023. Esta metodología estima las emisiones en función del consumo de combustible, incluidos CO2, CH4 y N2O. Calculan las emisiones para cada vuelo entre pares de origen y destino, excluyendo tipos de aeronaves específicos, ajustando factores como el apilamiento y el clima. El consumo de combustible se estima utilizando los datos de la OACI y las emisiones se atribuyen totalmente al país de origen. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Transportation/Transportation%20sector-%20Domestic%20and%20International%20Aviation%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: II.4.3 + scope: 3 +- + datasource_id: 3b4cf72b-3bf0-32e3-af14-9dc0a05874d5 + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: Solid waste disposal estimated emissions + es: Emisiones estimadas de eliminación de residuos sólidos + dataset_description: + en: Point source estimates of GHG emissions from solid waste disposal, employing a Bayesian statistical approach, considering waste site capacities, income groups, and regions for robust methane emission predictions. + es: Estimaciones de fuentes puntuales de emisiones de GEI provenientes de la eliminación de desechos sólidos, empleando un enfoque estadístico bayesiano, considerando las capacidades de los sitios de desechos, los grupos de ingresos y las regiones para obtener predicciones sólidas de emisiones de metano. + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2021 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: This methodology adopts a Bayesian statistical approach using PyMC3 in Python, starting with hierarchical regression structures to predict methane emissions based on waste site capacities. Parameters are initialized using priors from prior predictive simulations and validated through model cross-validation. The model regresses mean site emissions against observed capacities, with coefficients adjusted for different income groups or regions. Posterior predictions are generated by sampling from parameter distributions, with a "saturation effect" implemented to cap emissions at realistic levels. This two-stage process first predicts waste capacities and then emissions, enabling robust and variable-sensitive modeling of methane emissions from solid waste sites. + es: Esta metodología adopta un enfoque estadístico bayesiano utilizando PyMC3 en Python, comenzando con estructuras de regresión jerárquica para predecir las emisiones de metano en función de las capacidades de los sitios de desechos. Los parámetros se inicializan utilizando datos previos de simulaciones predictivas anteriores y se validan mediante validación cruzada del modelo. El modelo compara las emisiones medias del sitio con las capacidades observadas, con coeficientes ajustados para diferentes grupos de ingresos o regiones. Las predicciones posteriores se generan mediante muestreo de distribuciones de parámetros, con un "efecto de saturación" implementado para limitar las emisiones a niveles realistas. Este proceso de dos etapas predice primero las capacidades de los desechos y luego las emisiones, lo que permite un modelado sólido y sensible a las variables de las emisiones de metano de los sitios de desechos sólidos. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Waste/Waste%20Sector-%20Solid%20Waste%20Disposal%20(asset)%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: III.1.1 + scope: 1 +- + datasource_id: e6d533a4-0020-30bc-bbac-90627e499663 + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: Manure management estimated emissions + es: Emisiones estimadas de gestión de estiércol + dataset_description: + en: Point source estimates of GHG emissions from beef and dairy feedlots, employing IPCC equations, default regional emission factors, and Climate Trace's approach incorporating temperature data, facility-level population counts, and regional manure management variations. + es: Estimaciones de fuentes puntuales de emisiones de GEI de corrales de engorde de carne y lácteos, empleando ecuaciones del IPCC, factores de emisión regionales predeterminados y el enfoque de Climate Trace que incorpora datos de temperatura, recuentos de población a nivel de instalaciones y variaciones regionales en el manejo del estiércol. + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2020 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The manure management calculation process involves the estimation of methane and nitrous oxide emissions from beef and dairy feedlots using IPCC equations and default regional emission factors. Climate Trace's approach incorporates temperature data, ground-truthed facility-level population counts, and regional variations in manure management practices to develop emission estimates. These estimates are presented for different regions, highlighting the significant contributions of beef and dairy feedlots to greenhouse gas emissions. + es: El proceso de cálculo del manejo del estiércol implica la estimación de las emisiones de metano y óxido nitroso de los corrales de engorde de carne y lácteos utilizando ecuaciones del IPCC y factores de emisión regionales predeterminados. El enfoque de Climate Trace incorpora datos de temperatura, recuentos de población a nivel de instalaciones verificados en el terreno y variaciones regionales en las prácticas de gestión del estiércol para desarrollar estimaciones de emisiones. Estas estimaciones se presentan para diferentes regiones, destacando las importantes contribuciones de los corrales de engorde de carne y lácteos a las emisiones de gases de efecto invernadero. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Agriculture/Agriculture%20sector-%20Enteric%20fermentation%20and%20Manure%20management%20(asset)%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: V.1 + scope: 1 +- + datasource_id: 3b18e434-cd0e-3686-9537-6ae38ccb5c0c + publisher_id: ClimateTRACE + datasource_name: ClimateTRACE + dataset_name: + en: Enteric fermentation estimated emissions + es: Emisiones estimadas de fermentación entérica + dataset_description: + en: Point source estimates of GHG emissions from beef and dairy feedlots, utilizing advanced spatial data processing techniques and machine learning algorithms to predict methane and nitrous oxide emissions, considering factors such as cattle populations, feedlot area size, and regional variations in manure management practices, with accuracy validated through statistical measures. + es: Estimaciones de fuentes puntuales de emisiones de GEI de corrales de engorda para carne y lácteos, utilizando técnicas avanzadas de procesamiento de datos espaciales y algoritmos de aprendizaje automático para predecir las emisiones de metano y óxido nitroso, considerando factores como las poblaciones de ganado, el tamaño del área de los corrales de engorda y las variaciones regionales en las prácticas de manejo del estiércol, con Precisión validada mediante medidas estadísticas. + source_type: third_party + access_type: globalapi + dataset_url: https://climatetrace.org/ + geographical_location: EARTH + start_year: 2020 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: point source + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The enteric fermentation calculation process involves the utilization of advanced spatial data processing techniques and machine learning algorithms to estimate methane and nitrous oxide emissions from beef and dairy feedlots. This method, developed by Climate Trace, involves spatially joining data, adding ancillary information, and performing data cleaning to create training datasets for model development. The models developed utilize linear regression to predict cattle populations at individual facilities, with separate models for beef and dairy feedlots, while also considering factors such as feedlot area size and regional variations in manure management practices. The accuracy of the models is evaluated through various statistical measures, and emission estimates are provided for different regions. + es: El proceso de cálculo de la fermentación entérica implica la utilización de técnicas avanzadas de procesamiento de datos espaciales y algoritmos de aprendizaje automático para estimar las emisiones de metano y óxido nitroso de los corrales de engorda de carne y lácteos. Este método, desarrollado por Climate Trace, implica unir datos espacialmente, agregar información auxiliar y realizar una limpieza de datos para crear conjuntos de datos de entrenamiento para el desarrollo de modelos. Los modelos desarrollados utilizan regresión lineal para predecir las poblaciones de ganado en instalaciones individuales, con modelos separados para lotes de engorde de carne y lácteos, al mismo tiempo que consideran factores como el tamaño del área del lote de engorde y las variaciones regionales en las prácticas de manejo del estiércol. La precisión de los modelos se evalúa mediante varias medidas estadísticas y se proporcionan estimaciones de emisiones para diferentes regiones. + methodology_url: https://github.com/climatetracecoalition/methodology-documents/blob/main/Agriculture/Agriculture%20sector-%20Enteric%20fermentation%20and%20Manure%20management%20(asset)%20Methodology.pdf + transformation_description: + en: Latitude and longitude information are utilized to apply a reverse geocode methodology, assigning the corresponding city locode to each emission point. Once identified, all data points within the city boundary are aggregated to calculate the total emissions for the sector. + es: La información de latitud y longitud se utiliza para aplicar una metodología de geocodificación inversa, asignando el código de ciudad correspondiente a cada punto de emisión. Una vez identificados, todos los puntos de datos dentro de los límites de la ciudad se agregan para calcular las emisiones totales del sector. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/climatetrace/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: V.1 + scope: 1 +- + datasource_id: 3bfaac71-953d-354b-8e0c-dc3bb8ec34c3 + publisher_id: EDGAR + datasource_name: Emissions Database for Global Atmospheric Research + dataset_name: + en: Estimated emissions from manufacturing industries and construction + es: Emisiones estimadas de las industrias manufactureras y de la construcción + dataset_description: + en: Grid cell estimates of GHG emissions (CO2, CH4, N2O) from manufacturing combustion, derived from EDGARv7.0 annual gridmaps (1970-2022) expressed in ton substance per 0.1-degree x 0.1-degree per year and sector specification using IPCC 1996 and 2006 codes + es: Estimaciones de celdas de cuadrícula de emisiones de GEI (CO2, CH4, N2O) provenientes de la combustión industrial, derivadas de mapas de cuadrícula anuales EDGARv7.0 (1970-2022) expresados en toneladas de sustancia por 0,1 grados x 0,1 grados por año y especificaciones del sector utilizando IPCC 1996 y código 2006 + source_type: third_party + access_type: globalapi + dataset_url: https://joint-research-centre.ec.europa.eu/index_en + geographical_location: EARTH + start_year: 2021 + end_year: 2021 + latest_accounting_year: 2021 + frequency_of_update: annual + spatial_resolution: 0.1 degree + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The emission calculation method utilizes a standardized approach across all countries, employing technology-based emission factors to estimate annual emissions for each compound and sector. This involves multiplying country-specific activity data with the mix of technologies and their associated abatement measures, considering both emission factors and reductions due to installed abatement measures. Spatial allocation of emissions is achieved through a grid system, utilizing geographical databases and spatial proxy datasets to distribute emissions across a country's area based on relevant spatial factors such as population density and land use. + es: El método de cálculo de emisiones utiliza un enfoque estandarizado en todos los países, empleando factores de emisión basados en tecnología para estimar las emisiones anuales de cada compuesto y sector. Esto implica multiplicar los datos de actividad específicos de cada país con la combinación de tecnologías y sus medidas de mitigación asociadas, considerando tanto los factores de emisión como las reducciones debidas a las medidas de mitigación instaladas. La asignación espacial de las emisiones se logra a través de un sistema de cuadrícula, que utiliza bases de datos geográficas y conjuntos de datos proxy espaciales para distribuir las emisiones en el área de un país en función de factores espaciales relevantes, como la densidad de población y el uso de la tierra. + methodology_url: https://edgar.jrc.ec.europa.eu/dataset_ghg70#intro + transformation_description: + en: Utilizing the central latitude and longitude coordinates of the grid, the assignment of the corresponding city locode is performed. Following identification, the aggregation of all the grid cells within the city boundary ensues to derive the total sector emissions. In instances where the grid extends beyond the city limits, the proportional fraction is calculated, and that specific emission fraction is assigned to the respective city. + es: Utilizando las coordenadas centrales de latitud y longitud de la cuadrícula, se realiza la asignación del código local de la ciudad correspondiente. Después de la identificación, se agregan todas las celdas de la cuadrícula dentro de los límites de la ciudad para derivar las emisiones totales del sector. En los casos en que la red se extiende más allá de los límites de la ciudad, se calcula la fracción proporcional y esa fracción de emisión específica se asigna a la ciudad respectiva. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/edgar/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.3.1 + scope: 1 +- + datasource_id: 9e7138c0-510a-3f17-9464-c245842d9862 + publisher_id: EDGAR + datasource_name: Emissions Database for Global Atmospheric Research + dataset_name: + en: Estimated emissions from on-road transportation (No Resuspension) + es: Emisiones estimadas del transporte por carretera (sin resuspensión) + dataset_description: + en: Grid cell estimates of GHG emissions from road transportation, employing a standardized method utilizing technology-based emission factors and spatial allocation through a grid system, considering country-specific activity data and relevant spatial factors. + es: Estimaciones de celdas de cuadrícula de las emisiones de GEI del transporte por carretera, empleando un método estandarizado que utiliza factores de emisión basados en tecnología y asignación espacial a través de un sistema de cuadrícula, considerando datos de actividad específicos de cada país y factores espaciales relevantes. + source_type: third_party + access_type: globalapi + dataset_url: https://joint-research-centre.ec.europa.eu/index_en + geographical_location: EARTH + start_year: 2021 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: 0.1 degree + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The emission calculation method utilizes a standardized approach across all countries, employing technology-based emission factors to estimate annual emissions for each compound and sector. This involves multiplying country-specific activity data with the mix of technologies and their associated abatement measures, considering both emission factors and reductions due to installed abatement measures. Spatial allocation of emissions is achieved through a grid system, utilizing geographical databases and spatial proxy datasets to distribute emissions across a country's area based on relevant spatial factors such as population density and land use. + es: El método de cálculo de emisiones utiliza un enfoque estandarizado en todos los países, empleando factores de emisión basados en tecnología para estimar las emisiones anuales de cada compuesto y sector. Esto implica multiplicar los datos de actividad específicos de cada país con la combinación de tecnologías y sus medidas de mitigación asociadas, considerando tanto los factores de emisión como las reducciones debidas a las medidas de mitigación instaladas. La asignación espacial de las emisiones se logra a través de un sistema de cuadrícula, que utiliza bases de datos geográficas y conjuntos de datos proxy espaciales para distribuir las emisiones en el área de un país en función de factores espaciales relevantes, como la densidad de población y el uso de la tierra. + methodology_url: https://edgar.jrc.ec.europa.eu/dataset_ghg70#intro + transformation_description: + en: Utilizing the central latitude and longitude coordinates of the grid, the assignment of the corresponding city locode is performed. Following identification, the aggregation of all the grid cells within the city boundary ensues to derive the total sector emissions. In instances where the grid extends beyond the city limits, the proportional fraction is calculated, and that specific emission fraction is assigned to the respective city. + es: Utilizando las coordenadas centrales de latitud y longitud de la cuadrícula, se realiza la asignación del código local de la ciudad correspondiente. Después de la identificación, se agregan todas las celdas de la cuadrícula dentro de los límites de la ciudad para derivar las emisiones totales del sector. En los casos en que la red se extiende más allá de los límites de la ciudad, se calcula la fracción proporcional y esa fracción de emisión específica se asigna a la ciudad respectiva. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/edgar/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: II.1.1 + scope: 1 +- + datasource_id: 66403f84-41cf-4c24-8dd8-ae980e8ad687 + publisher_id: DEIE Mendoza + datasource_name: Dirección de Estadísticas e Investigaciones Económicas Gobierno Mendoza + dataset_name: + en: Residential buildings electricity consumption in Mendoza cities + es: Consumo de energía eléctrica por edificios residenciales en ciudades de Mendoza + dataset_description: + en: Electric energy users by tariff category, according to year reported in the Directorate of Statistics and Economic Research based on data provided by EPRE (Provincial Electrical Regulatory Entity) + es: Usuarios de energía eléctrica por categoría tarifaria, según año reportado en la Dirección de Estadística e Investigaciones Económicas con base en datos proporcionados por el EPRE (Ente Regulador Eléctrico Provincial) + source_type: third_party + access_type: public + dataset_url: https://deie.mendoza.gov.ar/#!/ + geographical_location: AR + start_year: 2013 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The Directorate of Statistics and Economic Research is a public technical organization that coordinates the statistical activities carried out in the territory of the province of Mendoza. One of its objectives is to collect and systematize relevant economic data of the territory. + es: La Dirección de Estadística e Investigaciones Económicas es un organismo técnico público que coordina las actividades estadísticas que se realizan en el territorio de la provincia de Mendoza. Uno de sus objetivos es recopilar y sistematizar datos económicos relevantes del territorio. + methodology_url: https://deie.mendoza.gov.ar/#!/ + transformation_description: + en: Emissions data calculated using the grid energy consumption methodology according to the type of user, manual assignment of the corresponding GPC subsector was carried out and IPCC 2006 emission factors for Argentina were applied. + es: Datos de emisiones calculados mediante la metodología de consumo de energía de red según el tipo de usuario, se realizó la asignación manual del subsector del GPC correspondiente y se aplicaron factores de emisión del IPCC 2006 para Argentina. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/deie_mendoza/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.1.2 + scope: 2 +- + datasource_id: ef052fea-4b6c-4421-8911-c31e01f0cc89 + publisher_id: DEIE Mendoza + datasource_name: Direccion de Estadisticas e Investigaciones Economicas Gobierno Mendoza + dataset_name: + en: Commercial buildings electricity consumption in Mendoza cities + es: Consumo de energía eléctrica por edificios comerciales en ciudades de Mendoza +dataset_description: + en: Electric energy users by tariff category, according to year reported in the Directorate of Statistics and Economic Research based on data provided by EPRE (Provincial Electrical Regulatory Entity) + es: Usuarios de energía eléctrica por categoría tarifaria, según año reportado en la Dirección de Estadística e Investigaciones Económicas con base en datos proporcionados por el EPRE (Ente Regulador Eléctrico Provincial) + source_type: third_party + access_type: public + dataset_url: https://deie.mendoza.gov.ar/#!/ + geographical_location: AR + start_year: 2013 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The Directorate of Statistics and Economic Research is a public technical organization that coordinates the statistical activities carried out in the territory of the province of Mendoza. One of its objectives is to collect and systematize relevant economic data of the territory. + es: La Dirección de Estadística e Investigaciones Económicas es un organismo técnico público que coordina las actividades estadísticas que se realizan en el territorio de la provincia de Mendoza. Uno de sus objetivos es recopilar y sistematizar datos económicos relevantes del territorio. + methodology_url: https://deie.mendoza.gov.ar/#!/ + transformation_description: + en: Emissions data calculated using the grid energy consumption methodology according to the type of user, manual assignment of the corresponding GPC subsector was carried out and IPCC 2006 emission factors for Argentina were applied. + es: Datos de emisiones calculados mediante la metodología de consumo de energía de red según el tipo de usuario, se realizó la asignación manual del subsector del GPC correspondiente y se aplicaron factores de emisión del IPCC 2006 para Argentina. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/deie_mendoza/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.2.2 + scope: 2 +- + datasource_id: 56eab4cc-b26e-44a6-b9ac-65815736b6f0 + publisher_id: DEIE Mendoza + datasource_name: Direccion de Estadisticas e Investigaciones Economicas Gobierno Mendoza + dataset_name: + en: Agriculture activities electricity consumption in Mendoza cities + es: Consumo de energía eléctrica por actividades agrícolas en ciudades de Mendoza + dataset_description: + en: Electric energy users by tariff category, according to year reported in the Directorate of Statistics and Economic Research based on data provided by EPRE (Provincial Electrical Regulatory Entity) + es: Usuarios de energía eléctrica por categoría tarifaria, según año reportado en la Dirección de Estadística e Investigaciones Económicas con base en datos proporcionados por el EPRE (Ente Regulador Eléctrico Provincial) + source_type: third_party + access_type: public + dataset_url: https://deie.mendoza.gov.ar/#!/ + geographical_location: AR + start_year: 2013 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The Directorate of Statistics and Economic Research is a public technical organization that coordinates the statistical activities carried out in the territory of the province of Mendoza. One of its objectives is to collect and systematize relevant economic data of the territory. + es: La Dirección de Estadística e Investigaciones Económicas es un organismo técnico público que coordina las actividades estadísticas que se realizan en el territorio de la provincia de Mendoza. Uno de sus objetivos es recopilar y sistematizar datos económicos relevantes del territorio. + methodology_url: https://deie.mendoza.gov.ar/#!/ + transformation_description: + en: Emissions data calculated using the grid energy consumption methodology according to the type of user, manual assignment of the corresponding GPC subsector was carried out and IPCC 2006 emission factors for Argentina were applied. + es: Datos de emisiones calculados mediante la metodología de consumo de energía de red según el tipo de usuario, se realizó la asignación manual del subsector del GPC correspondiente y se aplicaron factores de emisión del IPCC 2006 para Argentina. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/deie_mendoza/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.5.2 + scope: 2 +- + datasource_id: ba4e85e8-8292-4a5d-93a7-2cec57e7dee7 + publisher_id: DEIE Mendoza + datasource_name: Direccion de Estadisticas e Investigaciones Economicas Gobierno Mendoza + dataset_name: + en: Manufactoring industries and construction electricity consumption in Mendoza cities + es: Consumo de energía eléctrica por industrias manufactureras y de construcción en ciudades de Mendoza + dataset_description: + en: Electric energy users by tariff category, according to year reported in the Directorate of Statistics and Economic Research based on data provided by EPRE (Provincial Electrical Regulatory Entity) + es: Usuarios de energía eléctrica por categoría tarifaria, según año reportado en la Dirección de Estadística e Investigaciones Económicas con base en datos proporcionados por el EPRE (Ente Regulador Eléctrico Provincial) + source_type: third_party + access_type: public + dataset_url: https://deie.mendoza.gov.ar/#!/ + geographical_location: AR + start_year: 2013 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The Directorate of Statistics and Economic Research is a public technical organization that coordinates the statistical activities carried out in the territory of the province of Mendoza. One of its objectives is to collect and systematize relevant economic data of the territory. + es: La Dirección de Estadística e Investigaciones Económicas es un organismo técnico público que coordina las actividades estadísticas que se realizan en el territorio de la provincia de Mendoza. Uno de sus objetivos es recopilar y sistematizar datos económicos relevantes del territorio. + methodology_url: https://deie.mendoza.gov.ar/#!/ + transformation_description: + en: Emissions data calculated using the grid energy consumption methodology according to the type of user, manual assignment of the corresponding GPC subsector was carried out and IPCC 2006 emission factors for Argentina were applied. + es: Datos de emisiones calculados mediante la metodología de consumo de energía de red según el tipo de usuario, se realizó la asignación manual del subsector del GPC correspondiente y se aplicaron factores de emisión del IPCC 2006 para Argentina. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/deie_mendoza/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.3.2 + scope: 2 +- + datasource_id: ff4c21b4-574b-4f4d-bd19-7d3f9dda9093 + publisher_id: DEIE Mendoza + datasource_name: Direccion de Estadisticas e Investigaciones Economicas Gobierno Mendoza + dataset_name: + en: Natural gas consumption by residential buildings in Mendoza cities + es: Consumo de gas natural por edificios comerciales en las ciudades en Mendoza + dataset_description: + en: Gas distributed by type of user, according to year reported in the Directorate of Statistics and Economic Research based on data provided by EPRE (Provincial Electrical Regulatory Entity) + es: Gas distribuido por tipo de usuario, según año reportado en la Dirección de Estadística e Investigaciones Económicas con base en datos proporcionados por EPRE (Ente Regulador Eléctrico Provincial) + source_type: third_party + access_type: public + dataset_url: https://deie.mendoza.gov.ar/#!/ + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The Directorate of Statistics and Economic Research is a public technical organization that coordinates the statistical activities carried out in the territory of the province of Mendoza. One of its objectives is to collect and systematize relevant economic data of the territory. + es: La Dirección de Estadística e Investigaciones Económicas es un organismo técnico público que coordina las actividades estadísticas que se realizan en el territorio de la provincia de Mendoza. Uno de sus objetivos es recopilar y sistematizar datos económicos relevantes del territorio. + methodology_url: https://deie.mendoza.gov.ar/#!/ + transformation_description: + en: Emissions data calculated for natural gas consumption using the fuel sales methodology for residential buildings proposed by GPC. Besides, GPC subsector was assign and emission factors by IPCC 2006 for Argentina were applied. + es: Datos de emisiones calculados para el consumo de gas natural utilizando la metodología de venta de combustible para edificios residenciales propuesta por GPC. Además, se asignó el subsector GPC y se aplicaron los factores de emisión del IPCC 2006 para Argentina. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/deie_mendoza/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.1.1 + scope: 1 +- + datasource_id: ae849774-309e-4091-8461-1be91db5a958 + publisher_id: DEIE Mendoza + datasource_name: Direccion de Estadisticas e Investigaciones Economicas Gobierno Mendoza + dataset_name: + en: Natural Gas consumption by Commercial Buildings in Mendoza cities + es: Consumo de gas natural por edificios comerciales en ciudades de Mendoza + dataset_description: + en: Gas distributed by type of user, according to year reported in the Directorate of Statistics and Economic Research based on data provided by EPRE (Provincial Electrical Regulatory Entity) + es: Gas distribuido por tipo de usuario, según año reportado en la Dirección de Estadística e Investigaciones Económicas con base en datos proporcionados por EPRE (Ente Regulador Eléctrico Provincial) + source_type: third_party + access_type: public + dataset_url: https://deie.mendoza.gov.ar/#!/ + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The Directorate of Statistics and Economic Research is a public technical organization that coordinates the statistical activities carried out in the territory of the province of Mendoza. One of its objectives is to collect and systematize relevant economic data of the territory. + es: La Dirección de Estadística e Investigaciones Económicas es un organismo técnico público que coordina las actividades estadísticas que se realizan en el territorio de la provincia de Mendoza. Uno de sus objetivos es recopilar y sistematizar datos económicos relevantes del territorio. + methodology_url: https://deie.mendoza.gov.ar/#!/ + transformation_description: + en: Emissions data calculated for natural gas consumption using the fuel sales methodology for residential buildings proposed by GPC. Besides, GPC subsector was assign and emission factors by IPCC 2006 for Argentina were applied. + es: Datos de emisiones calculados para el consumo de gas natural utilizando la metodología de venta de combustible para edificios residenciales propuesta por GPC. Además, se asignó el subsector GPC y se aplicaron los factores de emisión del IPCC 2006 para Argentina. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/deie_mendoza/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.2.1 + scope: 1 +- + datasource_id: 70f80ab9-622a-4665-8176-e4e21bf9a634 + publisher_id: DEIE Mendoza + datasource_name: Direccion de Estadisticas e Investigaciones Economicas Gobierno Mendoza + dataset_name: + en: Natural Gas consumption by Manufactoring Industries and Construction in Mendoza cities + es: Consumo de gas natural por industrias manufactureras y de construcción en ciudades de Mendoza + dataset_description: + en: Gas distributed by type of user, according to year reported in the Directorate of Statistics and Economic Research based on data provided by EPRE (Provincial Electrical Regulatory Entity) + es: Gas distribuido por tipo de usuario, según año reportado en la Dirección de Estadística e Investigaciones Económicas con base en datos proporcionados por EPRE (Ente Regulador Eléctrico Provincial) + source_type: third_party + access_type: public + dataset_url: https://deie.mendoza.gov.ar/#!/ + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The Directorate of Statistics and Economic Research is a public technical organization that coordinates the statistical activities carried out in the territory of the province of Mendoza. One of its objectives is to collect and systematize relevant economic data of the territory. + es: La Dirección de Estadística e Investigaciones Económicas es un organismo técnico público que coordina las actividades estadísticas que se realizan en el territorio de la provincia de Mendoza. Uno de sus objetivos es recopilar y sistematizar datos económicos relevantes del territorio. + methodology_url: https://deie.mendoza.gov.ar/#!/ + transformation_description: + en: Emissions data calculated for natural gas consumption using the fuel sales methodology for residential buildings proposed by GPC. Besides, GPC subsector was assign and emission factors by IPCC 2006 for Argentina were applied. + es: Datos de emisiones calculados para el consumo de gas natural utilizando la metodología de venta de combustible para edificios residenciales propuesta por GPC. Además, se asignó el subsector GPC y se aplicaron los factores de emisión del IPCC 2006 para Argentina. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/deie_mendoza/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.3.1 + scope: 1 +- + datasource_id: de8dc6b3-6c78-4fc7-9b4a-df24a2326634 + publisher_id: Google EIE + datasource_name: Google Environmental Insights Explorer + dataset_name: + en: On-road transportation estimated emissions + es: Estimación de emisiones por transporte en carretera + dataset_description: + en: Estimation of On-road transportation emissions per kilometer traveled and number of trips reported by Google EIE + es: Estimación de emisiones del transporte en carretera por kilómetro recorrido y número de viajes reportados por Google EIE + source_type: third_party + access_type: private + dataset_url: https://insights.sustainability.google/ + geographical_location: EARTH + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: Google Maps utilizes user trip data to deduce city traffic, travel modes, and distances traveled. This is then paired with vehicle types and average fuel consumption estimates for each mode + es: Google Maps utiliza datos de viajes de los usuarios para deducir el tráfico de la ciudad, los modos de viaje y las distancias recorridas. Luego, esto se combina con los tipos de vehículos y las estimaciones de consumo promedio de combustible para cada modo. + methodology_url: https://insights.sustainability.google/ + transformation_description: + en: Adaptation of the raw format to the scheme required by the GPC, renaming of variables and assignment of the GPC reference number + es: Adaptación del crudo formato al esquema requerido por el GPC, renombramiento de variables y asignación del número de referencia del GPC + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/Google EIE/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: II.1.1 + scope: 1 +- + datasource_id: fdf77b4a-5fb8-4b33-92b5-07b92f839c9b + publisher_id: Carbon Monitor + datasource_name: Carbon Monitor Cities + dataset_name: + en: Estimation of residential energy emissions + es: + dataset_description: Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. + en: + es: + source_type: third_party + access_type: public + dataset_url: https://carbonmonitor.org/ + geographical_location: EARTH + start_year: 2019 + end_year: 2021 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. + en: + es: + methodology_url: https://carbonmonitor.org/ + transformation_description: + en: Emissions data are matched to cities by name and ISO code for the region + es: Los datos de emisiones fueron relacionados con las ciudades por nombre y código ISO de la región + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/Carbon Monitor Cities/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: I.1.1 + scope: 1 +- + datasource_id: e2143a90-0e5f-48fa-9a1d-85505f90b95f + publisher_id: Carbon Monitor + datasource_name: Carbon Monitor Cities + dataset_name: Carbon Monitor Cities On-Road Transportation + en: + es: + dataset_description: Estimation of on-road transportation emissions from Carbon Monitor. Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. + en: + es: + source_type: third_party + access_type: public + dataset_url: https://carbonmonitor.org/ + geographical_location: EARTH + start_year: 2019 + end_year: 2021 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. + en: + es: + methodology_url: https://carbonmonitor.org/ + transformation_description: + en: Emissions data are matched to cities by name and ISO code for the region + es: Los datos de emisiones fueron relacionados con las ciudades por nombre y código ISO de la región + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/Carbon Monitor Cities/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: II.1.1 + scope: 1 +- + datasource_id: 1007a979-3c3c-4115-b61a-c85e3e39b165 + publisher_id: Carbon Monitor + datasource_name: Carbon Monitor Cities + dataset_name: Carbon Monitor Cities Aviation + en: + es: + dataset_description: Estimation of aviation emissions from Carbon Monitor. Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. + en: + es: + source_type: third_party + access_type: public + dataset_url: https://carbonmonitor.org/ + geographical_location: EARTH + start_year: 2019 + end_year: 2021 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: city + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. + en: + es: + methodology_url: https://carbonmonitor.org/ + transformation_description: + en: Emissions data are matched to cities by name and ISO code for the region + es: Los datos de emisiones fueron relacionados con las ciudades por nombre y código ISO de la región + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/Carbon Monitor Cities/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: II.4.3 + scope: 3 +- + datasource_id: c0ef94f0-5ecf-45bc-9e3e-f273396b101d + publisher_id: EDGAR + datasource_name: Emissions Database for Global Atmospheric Research + dataset_name: Aviation Estimated Emissions + en: Estimated emissions for aviation + es: Emisiones estimadas para aviación + dataset_description: + en: Grid cell estimates of GHG emissions for aviation, employing a standardized method utilizing technology-based emission factors and spatial allocation through a grid system, considering country-specific activity data and relevant spatial factors. + es: Estimaciones de celdas de cuadrícula de las emisiones de GEI provenientes de aviación, empleando un método estandarizado que utiliza factores de emisión basados en tecnología y asignación espacial a través de un sistema de cuadrícula, considerando datos de actividad específicos de cada país y factores espaciales relevantes. + source_type: Third-party + access_type: globalapi + dataset_url: https://joint-research-centre.ec.europa.eu/index_en + geographical_location: EARTH + start_year: 2021 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: 0.1 degree + language: en + accessibility: + data_quality: medium + notes: + units: kg + methodology_description: + en: The emission calculation method utilizes a standardized approach across all countries, employing technology-based emission factors to estimate annual emissions for each compound and sector. This involves multiplying country-specific activity data with the mix of technologies and their associated abatement measures, considering both emission factors and reductions due to installed abatement measures. Spatial allocation of emissions is achieved through a grid system, utilizing geographical databases and spatial proxy datasets to distribute emissions across a country's area based on relevant spatial factors such as population density and land use. + es: El método de cálculo de emisiones utiliza un enfoque estandarizado en todos los países, empleando factores de emisión basados en tecnología para estimar las emisiones anuales de cada compuesto y sector. Esto implica multiplicar los datos de actividad específicos de cada país con la combinación de tecnologías y sus medidas de mitigación asociadas, considerando tanto los factores de emisión como las reducciones debidas a las medidas de mitigación instaladas. La asignación espacial de las emisiones se logra a través de un sistema de cuadrícula, que utiliza bases de datos geográficas y conjuntos de datos proxy espaciales para distribuir las emisiones en el área de un país en función de factores espaciales relevantes, como la densidad de población y el uso de la tierra. + methodology_url: https://edgar.jrc.ec.europa.eu/dataset_ghg70#intro + transformation_description: + en: Utilizing the central latitude and longitude coordinates of the grid, the assignment of the corresponding city locode is performed. Following identification, the aggregation of all the grid cells within the city boundary ensues to derive the total sector emissions. In instances where the grid extends beyond the city limits, the proportional fraction is calculated, and that specific emission fraction is assigned to the respective city. + es: Utilizando las coordenadas centrales de latitud y longitud de la cuadrícula, se realiza la asignación del código local de la ciudad correspondiente. Después de la identificación, se agregan todas las celdas de la cuadrícula dentro de los límites de la ciudad para derivar las emisiones totales del sector. En los casos en que la red se extiende más allá de los límites de la ciudad, se calcula la fracción proporcional y esa fracción de emisión específica se asigna a la ciudad respectiva. + retrieval_method: global_api + api_endpoint: https://ccglobal.openearth.dev/api/v0/edgar/city/:locode/:year/:gpcReferenceNumber + gpc_reference_number: II.4.3 + scope: 3 +- + datasource_id: 492537be-6eca-4508-ba27-ea6c7c42b019 + publisher_id: BEN + datasource_name: Balances Energéticos Nacionales + dataset_name: + en: National energy balances for residential buildings for Argentina + es: Balances energéticos nacionales para edificios residenciales en Argentina + dataset_description: + en: The BEN summarizes the information related to the production, import, export, transformation and consumption of energy in Argentina, being the main statistical instrument for national energy planning. The fuels included are LPG, kerosene, firewood charcoal. + es: Ben resume la información reacionada con la producción, importación, exportación, transformación y consumo de energía en Argentina, siendo el principal instrumento estadístico nacional para la planificación energética. Los combustibles incluídos son LGP, keroseno, carbón de leña. + source_type: Third-party + access_type: Public + dataset_url: http://datos.energia.gob.ar/dataset/balances-energeticos + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: country + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The BEN is a methodology that analyzes and records energy flows throughout different events, from its production to its final consumption, in a national territory during a specific year. The physical flows of energy are converted into caloric flows in order to compare different sources, using the calorific values of the different fuel sources and expressing them in Tons of Oil Equivalent (TEP). + es: Ben es una metodolodía que analiza y registra los flujos energéticos a través de diferentes eventos, desde su producción hasta el consumo final, en el territorio nacional durante un año específico. El flujo físico energético es convertido en flujos caloricos con el fin de comparar diferentes fuentes, usando el valor calorico de las diferentes fuentes de combustible y expresarlos en toneladas de petróleo equivalente (TEP). + methodology_url: https://www.energia.gob.ar/contenidos/archivos/Reorganizacion/informacion_del_mercado/publicaciones/energia_en_gral/balances_2021/sintesisbalancesenergeticos2021v1.pdf + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/BEN/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.1.1 + scope: 1 +- + datasource_id: 38918e8a-bb0a-466a-91c7-d085c8e26992 + publisher_id: BEN + datasource_name: Balances Energéticos Nacionales + dataset_name: + en: National energy balances for commercial buildings for Argentina + es: Balances energéticos nacionales para edificios comerciales en Argentina + dataset_description: + en: The BEN summarizes the information related to the production, import, export, transformation and consumption of energy in Argentina, being the main statistical instrument for national energy planning. The fuels included are LPG, kerosene, firewood charcoal. + es: Ben resume la información reacionada con la producción, importación, exportación, transformación y consumo de energía en Argentina, siendo el principal instrumento estadístico nacional para la planificación energética. Los combustibles incluídos son LGP, keroseno, carbón de leña. + source_type: Third-party + access_type: Public + dataset_url: http://datos.energia.gob.ar/dataset/balances-energeticos + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: country + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The BEN is a methodology that analyzes and records energy flows throughout different events, from its production to its final consumption, in a national territory during a specific year. The physical flows of energy are converted into caloric flows in order to compare different sources, using the calorific values of the different fuel sources and expressing them in Tons of Oil Equivalent (TEP). + es: Ben es una metodolodía que analiza y registra los flujos energéticos a través de diferentes eventos, desde su producción hasta el consumo final, en el territorio nacional durante un año específico. El flujo físico energético es convertido en flujos caloricos con el fin de comparar diferentes fuentes, usando el valor calorico de las diferentes fuentes de combustible y expresarlos en toneladas de petróleo equivalente (TEP). + methodology_url: https://www.energia.gob.ar/contenidos/archivos/Reorganizacion/informacion_del_mercado/publicaciones/energia_en_gral/balances_2021/sintesisbalancesenergeticos2021v1.pdf + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/BEN/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.2.1 + scope: 1 +- + datasource_id: 8bff6600-e3b3-4d1c-85b7-f1aa2edbc1f3 + publisher_id: BEN + datasource_name: Balances Energéticos Nacionales + dataset_name: + en: National energy balances for agriculture activities for Argentina + es: Balances energéticos nacionales para actividades agrícolas en Argentina + dataset_description: + en: The BEN summarizes the information related to the production, import, export, transformation and consumption of energy in Argentina, being the main statistical instrument for national energy planning. The fuels included are LPG, kerosene, firewood charcoal. + es: Ben resume la información reacionada con la producción, importación, exportación, transformación y consumo de energía en Argentina, siendo el principal instrumento estadístico nacional para la planificación energética. Los combustibles incluídos son LGP, keroseno, carbón de leña. + source_type: Third-party + access_type: Public + dataset_url: http://datos.energia.gob.ar/dataset/balances-energeticos + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: country + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The BEN is a methodology that analyzes and records energy flows throughout different events, from its production to its final consumption, in a national territory during a specific year. The physical flows of energy are converted into caloric flows in order to compare different sources, using the calorific values of the different fuel sources and expressing them in Tons of Oil Equivalent (TEP). + es: Ben es una metodolodía que analiza y registra los flujos energéticos a través de diferentes eventos, desde su producción hasta el consumo final, en el territorio nacional durante un año específico. El flujo físico energético es convertido en flujos caloricos con el fin de comparar diferentes fuentes, usando el valor calorico de las diferentes fuentes de combustible y expresarlos en toneladas de petróleo equivalente (TEP). + methodology_url: https://www.energia.gob.ar/contenidos/archivos/Reorganizacion/informacion_del_mercado/publicaciones/energia_en_gral/balances_2021/sintesisbalancesenergeticos2021v1.pdf + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/BEN/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.5.1 + scope: 1 +- + datasource_id: 059c5cb5-98d4-4b7f-a1c2-9e94756365a4 + publisher_id: BEN + datasource_name: Balances Energéticos Nacionales + dataset_name: + en: National energy balances for manufacturing industries and construction for Argentina + es: Balances energéticos nacionales para industrias manufactureras y de construcción en Argentina + dataset_description: + en: The BEN summarizes the information related to the production, import, export, transformation and consumption of energy in Argentina, being the main statistical instrument for national energy planning. The fuels included are LPG, kerosene, firewood charcoal. + es: Ben resume la información reacionada con la producción, importación, exportación, transformación y consumo de energía en Argentina, siendo el principal instrumento estadístico nacional para la planificación energética. Los combustibles incluídos son LGP, keroseno, carbón de leña. + source_type: Third-party + access_type: Public + dataset_url: http://datos.energia.gob.ar/dataset/balances-energeticos + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: country + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The BEN is a methodology that analyzes and records energy flows throughout different events, from its production to its final consumption, in a national territory during a specific year. The physical flows of energy are converted into caloric flows in order to compare different sources, using the calorific values of the different fuel sources and expressing them in Tons of Oil Equivalent (TEP). + es: Ben es una metodolodía que analiza y registra los flujos energéticos a través de diferentes eventos, desde su producción hasta el consumo final, en el territorio nacional durante un año específico. El flujo físico energético es convertido en flujos caloricos con el fin de comparar diferentes fuentes, usando el valor calorico de las diferentes fuentes de combustible y expresarlos en toneladas de petróleo equivalente (TEP). + methodology_url: https://www.energia.gob.ar/contenidos/archivos/Reorganizacion/informacion_del_mercado/publicaciones/energia_en_gral/balances_2021/sintesisbalancesenergeticos2021v1.pdf + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/BEN/country/:country/:year/:gpcReferenceNumber + gpc_reference_number: I.3.1 + scope: 1 +- + datasource_id: 96bd45c8-259b-4e41-89f1-cd4e2dbff959 + publisher_id: ENARGAS + datasource_name: Entidad Nacional Regulatoria de Gas + dataset_name: + en: Province gas consumption data of natural gas by residential buildings in Argentina + es: Datos provinciales de consumo de gas natural por edificios residenciales en Argentina + dataset_description: + en: Volume of gas delivered by the Distributors in each province per end user + es: Volumne de gas entregado por los distribuidores en cada provincia por usuario final + source_type: Third-party + access_type: Public + dataset_url: https://www.enargas.gob.ar/secciones/transporte-y-distribucion/datos-operativos-subsec.php?sec=1&subsec=10&subsecord=10 + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The source recorded the data utilized in the table I-7 of the Operational Data, it contains information on the distribution service licensees. This table includes the so-called "commercial by pass", or gas delivered on behalf of third parties. + es: La fuente registra los datos utilizados en la tabla I-7 de Datos Operativos, contiene información de las licencias de servicio de distribución. Esta tabla incluye el llamado "pase comercial", o gas entregado + methodology_url: https://www.enargas.gob.ar/secciones/transporte-y-distribucion/glosario.pdfdf + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/ENARGAS/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: I.1.1 + scope: 1 +- + datasource_id: 775c21ad-d203-4fd6-bdbd-a778a7cac07e + publisher_id: ENARGAS + datasource_name: Entidad Nacional Regulatoria de Gas + dataset_name: + en: Province gas consumption data of natural gas by commercial buildings in Argentina + es: Datos provinciales de consumo de gas natural por edificios comerciales en Argentina + dataset_description: + en: Volume of gas delivered by the Distributors in each province per end user + es: Volumne de gas entregado por los distribuidores en cada provincia por usuario final + source_type: Third-party + access_type: Public + dataset_url: https://www.enargas.gob.ar/secciones/transporte-y-distribucion/datos-operativos-subsec.php?sec=1&subsec=10&subsecord=10 + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The source recorded the data utilized in the table I-7 of the Operational Data, it contains information on the distribution service licensees. This table includes the so-called "commercial by pass", or gas delivered on behalf of third parties. + es: La fuente registra los datos utilizados en la tabla I-7 de Datos Operativos, contiene información de las licencias de servicio de distribución. Esta tabla incluye el llamado "pase comercial", o gas entregado + methodology_url: https://www.enargas.gob.ar/secciones/transporte-y-distribucion/glosario.pdfdf + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/ENARGAS/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: I.2.1 + scope: 1 +- + datasource_id: 04ee4655-5d9a-4778-a6e4-4ed15052a8a5 + publisher_id: ENARGAS + datasource_name: Entidad Nacional Regulatoria de Gas + dataset_name: + en: Province gas consumption data of natural gas by manufacturing industries and construction in Argentina + es: Datos provinciales de consumo de gas natural por industrias manufactureras y de construcción en Argentina + dataset_description: + en: Volume of gas delivered by the Distributors in each province per end user + es: Volumne de gas entregado por los distribuidores en cada provincia por usuario final + source_type: Third-party + access_type: Public + dataset_url: https://www.enargas.gob.ar/secciones/transporte-y-distribucion/datos-operativos-subsec.php?sec=1&subsec=10&subsecord=10 + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The source recorded the data utilized in the table I-7 of the Operational Data, it contains information on the distribution service licensees. This table includes the so-called "commercial by pass", or gas delivered on behalf of third parties. + es: La fuente registra los datos utilizados en la tabla I-7 de Datos Operativos, contiene información de las licencias de servicio de distribución. Esta tabla incluye el llamado "pase comercial", o gas entregado + methodology_url: https://www.enargas.gob.ar/secciones/transporte-y-distribucion/glosario.pdfdf + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/ENARGAS/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: I.3.1 + scope: 1 +- + datasource_id: 75ac9523-3079-4fd7-8d2e-9547f2eda010 + publisher_id: ENARGAS + datasource_name: Entidad Nacional Regulatoria de Gas + dataset_name: + en: Province gas consumption data of natural gas by on-road transportation in Argentina + es: Datos provinciales de consumo de gas natural por transporte en carretera en Argentina + dataset_description: + en: Volume of gas delivered by the Distributors in each province per end user + es: Volumne de gas entregado por los distribuidores en cada provincia por usuario final + source_type: Third-party + access_type: Public + dataset_url: https://www.enargas.gob.ar/secciones/transporte-y-distribucion/datos-operativos-subsec.php?sec=1&subsec=10&subsecord=10 + geographical_location: AR + start_year: 2018 + end_year: 2022 + latest_accounting_year: 2022 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The source recorded the data utilized in the table I-7 of the Operational Data, it contains information on the distribution service licensees. This table includes the so-called "commercial by pass", or gas delivered on behalf of third parties. + es: La fuente registra los datos utilizados en la tabla I-7 de Datos Operativos, contiene información de las licencias de servicio de distribución. Esta tabla incluye el llamado "pase comercial", o gas entregado + methodology_url: https://www.enargas.gob.ar/secciones/transporte-y-distribucion/glosario.pdfdf + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/ENARGAS/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: II.1.1 + scope: 1 +- + datasource_id: cfb06d16-381a-4dfe-bf6c-53900950845a + publisher_id: SESCO + datasource_name: SESCO + dataset_name: + en: Fuel sales to manufacturing industries and construction in Argentina + es: Ventas de combustibles a industrias manufactureras y de construcción en Argentina + dataset_description: + en: Refining and Marketing of oil, gas and derivatives. Market Sales by sector and province reported by the Secretary of Energy, National Government + es: Refinación y Comercialización de petróleo, gas y derivados. Ventas del Mercado por sector y provincia reportadas por la Secretaría de Energía del Gobierno Nacional + source_type: Third-party + access_type: Public + dataset_url: http://datos.energia.gob.ar + geographical_location: AR + start_year: 2010 + end_year: 2023 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: Accounting of market sales by the Undersecretary of Hydrocarbons + es: Contabilidad de ventas de mercado por parte de la Subsecretaria de Hidrocarburos + methodology_url: https://www.argentina.gob.ar/economia/energia/hidrocarburos/produccion-de-petroleo-y-gas + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/SESCO/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: I.3.1 + scope: 1 +- + datasource_id: 9bdb03c4-1fbb-40a7-becf-61262d1f488c + publisher_id: SESCO + datasource_name: SESCO + dataset_name: + en: Fuel sales to on-road transportation in Argentina + es: Ventas de combustibles a transporte en carretera en Argentina + dataset_description: + en: Refining and Marketing of oil, gas and derivatives. Market Sales by sector and province reported by the Secretary of Energy, National Government + es: Refinación y Comercialización de petróleo, gas y derivados. Ventas del Mercado por sector y provincia reportadas por la Secretaría de Energía del Gobierno Nacional + source_type: Third-party + access_type: Public + dataset_url: http://datos.energia.gob.ar + geographical_location: AR + start_year: 2010 + end_year: 2023 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: Accounting of market sales by the Undersecretary of Hydrocarbons + es: Contabilidad de ventas de mercado por parte de la Subsecretaria de Hidrocarburos + methodology_url: https://www.argentina.gob.ar/economia/energia/hidrocarburos/produccion-de-petroleo-y-gas + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/SESCO/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: II.1.1 + scope: 1 +- + datasource_id: cf301691-f6db-4c69-90c6-5be062cf2454 + publisher_id: SESCO + datasource_name: SESCO + dataset_name: + en: Fuel sales to off-road transportation in Argentina + es: Ventas de combustibles a transporte fuera de carreteras en Argentina + dataset_description: + en: Refining and Marketing of oil, gas and derivatives. Market Sales by sector and province reported by the Secretary of Energy, National Government + es: Refinación y Comercialización de petróleo, gas y derivados. Ventas del Mercado por sector y provincia reportadas por la Secretaría de Energía del Gobierno Nacional + source_type: Third-party + access_type: Public + dataset_url: http://datos.energia.gob.ar + geographical_location: AR + start_year: 2010 + end_year: 2023 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: Accounting of market sales by the Undersecretary of Hydrocarbons + es: Contabilidad de ventas de mercado por parte de la Subsecretaria de Hidrocarburos + methodology_url: https://www.argentina.gob.ar/economia/energia/hidrocarburos/produccion-de-petroleo-y-gas + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/SESCO/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: II.5.1 + scope: 1 +- + datasource_id: ef6d15ea-66a3-43c0-9a9a-fe8596ab6447 + publisher_id: SESCO + datasource_name: SESCO + dataset_name: + en: Fuel sales to railway transportation in Argentina + es: Ventas de combustibles a transporte ferroviario en Argentina + dataset_description: + en: Refining and Marketing of oil, gas and derivatives. Market Sales by sector and province reported by the Secretary of Energy, National Government + es: Refinación y Comercialización de petróleo, gas y derivados. Ventas del Mercado por sector y provincia reportadas por la Secretaría de Energía del Gobierno Nacional + source_type: Third-party + access_type: Public + dataset_url: http://datos.energia.gob.ar + geographical_location: AR + start_year: 2010 + end_year: 2023 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: Accounting of market sales by the Undersecretary of Hydrocarbons + es: Contabilidad de ventas de mercado por parte de la Subsecretaria de Hidrocarburos + methodology_url: https://www.argentina.gob.ar/economia/energia/hidrocarburos/produccion-de-petroleo-y-gas + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/SESCO/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: II.2.1 + scope: 1 +- + datasource_id: e81bb333-d0a0-4621-b15f-f6f0012c2a5e + publisher_id: cammesa + datasource_name: CAMMESA + dataset_name: + en: Annual electricity generation in power plants + es: Generación anual de electricidad en centrales eléctricas + dataset_description: + en: Local data of energy generation by power plants in Argentine provinces + es: Datos locales de generación de energía por centrales eléctricas en provincias argentinas + source_type: Third-party + access_type: Public + dataset_url: https://cammesaweb.cammesa.com/download/factor-de-emision/ + geographical_location: AR + start_year: 2020 + end_year: 2023 + latest_accounting_year: 2023 + frequency_of_update: annual + spatial_resolution: region + language: es + accessibility: + data_quality: high + notes: + units: kg + methodology_description: + en: The report contains the behavior of the main physical and economic variables of the MEM throughout the month of analysis and its comparison with previous months. Among the variables, electricity demand, energy supply, installed power, generation, fuel consumption, energy costs and prices stand out. + es: El informe contiene el comportamiento de las principales variables físicas y económicas del MEM a lo largo del mes de análisis y su comparación con meses anteriores; Entre las variables destacan la demanda eléctrica, la oferta de energía, la potencia instalada, la generación, el consumo de combustible, los costos y precios de la energía. + methodology_url: https://cammesaweb.cammesa.com/informes-y-estadisticas/ + transformation_description: + en: The nacional information is scaled-down at the city level using population as scaling factor, then the corresponding emission factor is applied according to the type of fuel. + es: La información nacional es escalada al nivel de la ciudad usando población como factor de escalamiento, luego los factores de emisión correspondientes son aplicados de acuerdo al tipo de combustible. + retrieval_method: global_api_downscaled_by_population + api_endpoint: https://ccglobal.openearth.dev/api/v0/source/CAMMESA/region/:region/:year/:gpcReferenceNumber + gpc_reference_number: I.4.4 + scope: 1 \ No newline at end of file diff --git a/global-api/importer/datasource_seeder/import_datasource_seeder.sql b/global-api/importer/datasource_seeder/import_datasource_seeder.sql index 27c66a554..b313432cc 100644 --- a/global-api/importer/datasource_seeder/import_datasource_seeder.sql +++ b/global-api/importer/datasource_seeder/import_datasource_seeder.sql @@ -9,7 +9,7 @@ TRUNCATE datasource_staging; /* Load the staging table from the transformed file */ -\copy datasource_staging (datasource_id,publisher_id,datasource_name,dataset_name,dataset_description,source_type,access_type,dataset_url,geographical_location,start_year,end_year,latest_accounting_year,frequency_of_update,spatial_resolution,language,accessibility,data_quality,notes,units,methodology_description,methodology_url,transformation_description,retrieval_method,api_endpoint,gpc_reference_number,scope) from 'datasource_seeder.csv' with CSV HEADER; +\copy datasource_staging (datasource_id,publisher_id,datasource_name,dataset_name,dataset_description,source_type,access_type,dataset_url,geographical_location,start_year,end_year,latest_accounting_year,frequency_of_update,spatial_resolution,language,accessibility,data_quality,notes,units,methodology_description,methodology_url,transformation_description,retrieval_method,api_endpoint,gpc_reference_number,scope) from 'datasource_seeder.yaml' with CSV HEADER; /* Update the main table with the staging table */ diff --git a/global-api/migrations/versions/77d1cb7b24df_allowing_other_languages.py b/global-api/migrations/versions/77d1cb7b24df_allowing_other_languages.py new file mode 100644 index 000000000..584bba995 --- /dev/null +++ b/global-api/migrations/versions/77d1cb7b24df_allowing_other_languages.py @@ -0,0 +1,44 @@ +"""allowing_other_languages + +Revision ID: 77d1cb7b24df +Revises: 949c5b9cc18d +Create Date: 2024-05-01 13:06:46.227806 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects.postgresql import JSONB + +# revision identifiers, used by Alembic. +revision: str = '77d1cb7b24df' +down_revision: Union[str, None] = '949c5b9cc18d' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + +def upgrade(): + # Drop the old TEXT columns + op.drop_column('datasource', 'dataset_name') + op.drop_column('datasource', 'dataset_description') + op.drop_column('datasource', 'methodology_description') + op.drop_column('datasource', 'transformation_description') + + # Add the new jsonb columns with the original column names + op.add_column('datasource', sa.Column('dataset_name', JSONB, nullable=True)) + op.add_column('datasource', sa.Column('dataset_description', JSONB, nullable=True)) + op.add_column('datasource', sa.Column('methodology_description', JSONB, nullable=True)) + op.add_column('datasource', sa.Column('transformation_description', JSONB, nullable=True)) + +def downgrade(): + # Drop the new jsonb columns + op.drop_column('datasource', 'dataset_name') + op.drop_column('datasource', 'dataset_description') + op.drop_column('datasource', 'methodology_description') + op.drop_column('datasource', 'transformation_description') + + # Add back the old TEXT columns + op.add_column('datasource', sa.Column('dataset_name', sa.TEXT(), nullable=True)) + op.add_column('datasource', sa.Column('dataset_description', sa.Text(), nullable=True)) + op.add_column('datasource', sa.Column('methodology_description', sa.TEXT(), nullable=True)) + op.add_column('datasource', sa.Column('transformation_description', sa.TEXT(), nullable=True)) From d4821ddb24690c8f94ee4c897eb0380a2d8f56ce Mon Sep 17 00:00:00 2001 From: mfonsecaOEF Date: Thu, 23 May 2024 08:17:57 -0300 Subject: [PATCH 002/128] feat:jsonb_column_added --- ...c6541b9_change_text_to_jsonb_datasource.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 global-api/migrations/versions/fbc6cc6541b9_change_text_to_jsonb_datasource.py diff --git a/global-api/migrations/versions/fbc6cc6541b9_change_text_to_jsonb_datasource.py b/global-api/migrations/versions/fbc6cc6541b9_change_text_to_jsonb_datasource.py new file mode 100644 index 000000000..e00163ec0 --- /dev/null +++ b/global-api/migrations/versions/fbc6cc6541b9_change_text_to_jsonb_datasource.py @@ -0,0 +1,42 @@ +"""change_text_to_jsonb_datasource + +Revision ID: fbc6cc6541b9 +Revises: 77d1cb7b24df +Create Date: 2024-05-22 08:44:41.670233 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision: str = 'fbc6cc6541b9' +down_revision: Union[str, None] = '77d1cb7b24df' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + op.drop_column('datasource', 'dataset_name') + op.drop_column('datasource', 'dataset_description') + op.drop_column('datasource', 'methodology_description') + op.drop_column('datasource', 'transformation_description') + + op.add_column('datasource', sa.Column('dataset_name', postgresql.JSONB)) + op.add_column('datasource', sa.Column('dataset_description', postgresql.JSONB)) + op.add_column('datasource', sa.Column('methodology_description', postgresql.JSONB)) + op.add_column('datasource', sa.Column('transformation_description', postgresql.JSONB)) + + +def downgrade() -> None: + op.drop_column('datasource', 'dataset_name') + op.drop_column('datasource', 'dataset_description') + op.drop_column('datasource', 'methodology_description') + op.drop_column('datasource', 'transformation_description') + + op.add_column('datasource', sa.Column('dataset_name', sa.TEXT)) + op.add_column('datasource', sa.Column('dataset_description', sa.TEXT)) + op.add_column('datasource', sa.Column('methodology_description', sa.TEXT)) + op.add_column('datasource', sa.Column('transformation_description', sa.TEXT)) From 9f924e277c7540f5a88c7f1a765bcd2e57a2357e Mon Sep 17 00:00:00 2001 From: mfonsecaOEF Date: Thu, 23 May 2024 08:21:25 -0300 Subject: [PATCH 003/128] duplicate_file --- ...c6541b9_change_text_to_jsonb_datasource.py | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 global-api/migrations/versions/fbc6cc6541b9_change_text_to_jsonb_datasource.py diff --git a/global-api/migrations/versions/fbc6cc6541b9_change_text_to_jsonb_datasource.py b/global-api/migrations/versions/fbc6cc6541b9_change_text_to_jsonb_datasource.py deleted file mode 100644 index e00163ec0..000000000 --- a/global-api/migrations/versions/fbc6cc6541b9_change_text_to_jsonb_datasource.py +++ /dev/null @@ -1,42 +0,0 @@ -"""change_text_to_jsonb_datasource - -Revision ID: fbc6cc6541b9 -Revises: 77d1cb7b24df -Create Date: 2024-05-22 08:44:41.670233 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -# revision identifiers, used by Alembic. -revision: str = 'fbc6cc6541b9' -down_revision: Union[str, None] = '77d1cb7b24df' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - op.drop_column('datasource', 'dataset_name') - op.drop_column('datasource', 'dataset_description') - op.drop_column('datasource', 'methodology_description') - op.drop_column('datasource', 'transformation_description') - - op.add_column('datasource', sa.Column('dataset_name', postgresql.JSONB)) - op.add_column('datasource', sa.Column('dataset_description', postgresql.JSONB)) - op.add_column('datasource', sa.Column('methodology_description', postgresql.JSONB)) - op.add_column('datasource', sa.Column('transformation_description', postgresql.JSONB)) - - -def downgrade() -> None: - op.drop_column('datasource', 'dataset_name') - op.drop_column('datasource', 'dataset_description') - op.drop_column('datasource', 'methodology_description') - op.drop_column('datasource', 'transformation_description') - - op.add_column('datasource', sa.Column('dataset_name', sa.TEXT)) - op.add_column('datasource', sa.Column('dataset_description', sa.TEXT)) - op.add_column('datasource', sa.Column('methodology_description', sa.TEXT)) - op.add_column('datasource', sa.Column('transformation_description', sa.TEXT)) From 87d2912c837a2a5562b4ea8884e21029877a59cb Mon Sep 17 00:00:00 2001 From: Amanda Eames Date: Fri, 24 May 2024 08:33:14 -0300 Subject: [PATCH 004/128] updated import steps for yaml file --- global-api/import_argentiniandatasets.sh | 7 +- global-api/import_everything.sh | 7 +- .../importer/datasource_seeder/README.md | 3 +- .../datasource_seeder/datasource_seeder.yaml | 62 ++++----- .../datasource_seeder/import_dataseeder.py | 131 ++++++++++++++++++ 5 files changed, 170 insertions(+), 40 deletions(-) create mode 100644 global-api/importer/datasource_seeder/import_dataseeder.py diff --git a/global-api/import_argentiniandatasets.sh b/global-api/import_argentiniandatasets.sh index 9180d286c..5224ccea5 100755 --- a/global-api/import_argentiniandatasets.sh +++ b/global-api/import_argentiniandatasets.sh @@ -60,8 +60,7 @@ popd # Import datasources pushd importer/datasource_seeder -psql -h $CC_GLOBAL_API_DB_HOST \ - -U $CC_GLOBAL_API_DB_USER \ - -d $CC_GLOBAL_API_DB_NAME \ - -f ./import_datasource_seeder.sql + +$python_cmd ./import_dataseeder.py --database_uri $DB_URI + popd \ No newline at end of file diff --git a/global-api/import_everything.sh b/global-api/import_everything.sh index 8303e3a52..4c0648664 100755 --- a/global-api/import_everything.sh +++ b/global-api/import_everything.sh @@ -126,10 +126,9 @@ popd # Import datasources pushd importer/datasource_seeder -psql -h $CC_GLOBAL_API_DB_HOST \ - -U $CC_GLOBAL_API_DB_USER \ - -d $CC_GLOBAL_API_DB_NAME \ - -f ./import_datasource_seeder.sql + +$python_cmd ./import_dataseeder.py --database_uri $DB_URI + popd diff --git a/global-api/importer/datasource_seeder/README.md b/global-api/importer/datasource_seeder/README.md index 1631f30cd..49bb701fb 100644 --- a/global-api/importer/datasource_seeder/README.md +++ b/global-api/importer/datasource_seeder/README.md @@ -6,8 +6,9 @@ This is a catalogue of datasources that are available for use by CityCatalyst. - `import_datasource_seeder.sql` imports the `datasource_seeder.csv` file into the database. It will update existing records and add new ones. You can run it like this: ```bash -psql -U ccglobal -d ccglobal -f import_datasource_seeder.sql +python3 import_dataseeder.py --database_uri postgresql://ccglobal:@localhost/ccglobal ``` + ## Datasource catalogue structure - `datasource_id`: unique UUID for the datasource diff --git a/global-api/importer/datasource_seeder/datasource_seeder.yaml b/global-api/importer/datasource_seeder/datasource_seeder.yaml index b2f893d97..c94398718 100644 --- a/global-api/importer/datasource_seeder/datasource_seeder.yaml +++ b/global-api/importer/datasource_seeder/datasource_seeder.yaml @@ -492,11 +492,11 @@ datasource_id: A284E16D-F04E-46C9-A977-8BDDD396F1FB publisher_id: IEA datasource_name: International Energy Agency - dataset_name: Residential grid energy consumption reported by the International Energy Agency - en: + dataset_name: + en: Residential grid energy consumption reported by the International Energy Agency es: - dataset_description: Residential contains all emissions from fuel combustion in households. This corresponds to IPCC Source/Sink Category 1 A 4 b. - en: + dataset_description: + en: Residential contains all emissions from fuel combustion in households. This corresponds to IPCC Source/Sink Category 1 A 4 b. es: source_type: third_party access_type: public @@ -516,8 +516,8 @@ en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf - transformation_description: 'A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Residential" as ''I.1.1''' - en: + transformation_description: + en: A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Residential" as ''I.1.1'' es: retrieval_method: global_api_downscaled_by_population api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber @@ -527,11 +527,11 @@ datasource_id: CAD04116-1B60-4290-A158-85F4B2BCED28 publisher_id: IEA datasource_name: International Energy Agency - dataset_name: Manufacturing industries and construction grid energy consumption reported by the International Energy Agency - en: + dataset_name: + en: Manufacturing industries and construction grid energy consumption reported by the International Energy Agency es: - dataset_description: Manufacturing and construction industries contribute to emissions through fuel combustion, classified under IPCC Source/Sink Category 1 A 2. The 2006 GLs include emissions from industry autoproducers generating electricity and/or heat in this category. IEA data lacks the specific end-use breakdown, resulting in unallocated autoproducers. - en: + dataset_description: + en: Manufacturing and construction industries contribute to emissions through fuel combustion, classified under IPCC Source/Sink Category 1 A 2. The 2006 GLs include emissions from industry autoproducers generating electricity and/or heat in this category. IEA data lacks the specific end-use breakdown, resulting in unallocated autoproducers. es: source_type: third_party access_type: public @@ -551,8 +551,8 @@ en: IEA calculates CO2 emissions from fuel combustion using a Tier 1 methodology. This approach is the simplest level of the IPCC's emission estimation methods, utilizing globally sourced default values and energy data without requiring country-specific details. To estimate emissions, average net calorific values are applied, which differ based on the type of oil or coal. es: La IEA calcula las emisiones de CO2 procedentes de la quema de combustible utilizando una metodología de Nivel 1. Este enfoque es el nivel más simple de los métodos de estimación de emisiones del IPCC, y utiliza valores predeterminados y datos energéticos de origen global sin requerir detalles específicos de cada país. Para estimar las emisiones se aplican valores caloríficos netos medios, que difieren según el tipo de petróleo o carbón. methodology_url: https://iea.blob.core.windows.net/assets/e6e332ed-24ab-4977-9ef9-cf3865934d63/Databasedocumentation2023Worldedition.pdf - transformation_description: 'A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Manufactoring Industries and Construction" as ''I.3.1''' - en: + transformation_description: + en: A reassignment of the categories proposed by IEA was carried out to consider some of the subsectors of the GPC. For this case, the reassignment was "Manufactoring Industries and Construction" as ''I.3.1'' es: retrieval_method: global_api_downscaled_by_population api_endpoint: https://ccglobal.openearth.dev/api/v0/source/IEA_energy/country/:country/:year/:gpcReferenceNumber @@ -1020,7 +1020,7 @@ dataset_name: en: Commercial buildings electricity consumption in Mendoza cities es: Consumo de energía eléctrica por edificios comerciales en ciudades de Mendoza -dataset_description: + dataset_description: en: Electric energy users by tariff category, according to year reported in the Directorate of Statistics and Economic Research based on data provided by EPRE (Provincial Electrical Regulatory Entity) es: Usuarios de energía eléctrica por categoría tarifaria, según año reportado en la Dirección de Estadística e Investigaciones Económicas con base en datos proporcionados por el EPRE (Ente Regulador Eléctrico Provincial) source_type: third_party @@ -1265,8 +1265,8 @@ dataset_description: dataset_name: en: Estimation of residential energy emissions es: - dataset_description: Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. - en: + dataset_description: + en: Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. es: source_type: third_party access_type: public @@ -1282,8 +1282,8 @@ dataset_description: data_quality: medium notes: units: kg - methodology_description: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. - en: + methodology_description: + en: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. es: methodology_url: https://carbonmonitor.org/ transformation_description: @@ -1297,11 +1297,11 @@ dataset_description: datasource_id: e2143a90-0e5f-48fa-9a1d-85505f90b95f publisher_id: Carbon Monitor datasource_name: Carbon Monitor Cities - dataset_name: Carbon Monitor Cities On-Road Transportation - en: + dataset_name: + en: Carbon Monitor Cities On-Road Transportation es: - dataset_description: Estimation of on-road transportation emissions from Carbon Monitor. Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. - en: + dataset_description: + en: Estimation of on-road transportation emissions from Carbon Monitor. Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. es: source_type: third_party access_type: public @@ -1317,8 +1317,8 @@ dataset_description: data_quality: medium notes: units: kg - methodology_description: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. - en: + methodology_description: + en: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. es: methodology_url: https://carbonmonitor.org/ transformation_description: @@ -1332,11 +1332,11 @@ dataset_description: datasource_id: 1007a979-3c3c-4115-b61a-c85e3e39b165 publisher_id: Carbon Monitor datasource_name: Carbon Monitor Cities - dataset_name: Carbon Monitor Cities Aviation - en: + dataset_name: + en: Carbon Monitor Cities Aviation es: - dataset_description: Estimation of aviation emissions from Carbon Monitor. Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. - en: + dataset_description: + en: Estimation of aviation emissions from Carbon Monitor. Carbon Monitor Cities is a global initiative to provide real-time and historical data on CO2 emissions from cities around the world. es: source_type: third_party access_type: public @@ -1352,8 +1352,8 @@ dataset_description: data_quality: medium notes: units: kg - methodology_description: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. - en: + methodology_description: + en: The data is based on satellite observations of CO2 concentrations and a data-driven model to estimate emissions. es: methodology_url: https://carbonmonitor.org/ transformation_description: @@ -1367,7 +1367,7 @@ dataset_description: datasource_id: c0ef94f0-5ecf-45bc-9e3e-f273396b101d publisher_id: EDGAR datasource_name: Emissions Database for Global Atmospheric Research - dataset_name: Aviation Estimated Emissions + dataset_name: en: Estimated emissions for aviation es: Emisiones estimadas para aviación dataset_description: @@ -1387,7 +1387,7 @@ dataset_description: data_quality: medium notes: units: kg - methodology_description: + methodology_description: en: The emission calculation method utilizes a standardized approach across all countries, employing technology-based emission factors to estimate annual emissions for each compound and sector. This involves multiplying country-specific activity data with the mix of technologies and their associated abatement measures, considering both emission factors and reductions due to installed abatement measures. Spatial allocation of emissions is achieved through a grid system, utilizing geographical databases and spatial proxy datasets to distribute emissions across a country's area based on relevant spatial factors such as population density and land use. es: El método de cálculo de emisiones utiliza un enfoque estandarizado en todos los países, empleando factores de emisión basados en tecnología para estimar las emisiones anuales de cada compuesto y sector. Esto implica multiplicar los datos de actividad específicos de cada país con la combinación de tecnologías y sus medidas de mitigación asociadas, considerando tanto los factores de emisión como las reducciones debidas a las medidas de mitigación instaladas. La asignación espacial de las emisiones se logra a través de un sistema de cuadrícula, que utiliza bases de datos geográficas y conjuntos de datos proxy espaciales para distribuir las emisiones en el área de un país en función de factores espaciales relevantes, como la densidad de población y el uso de la tierra. methodology_url: https://edgar.jrc.ec.europa.eu/dataset_ghg70#intro diff --git a/global-api/importer/datasource_seeder/import_dataseeder.py b/global-api/importer/datasource_seeder/import_dataseeder.py new file mode 100644 index 000000000..8170bcc0f --- /dev/null +++ b/global-api/importer/datasource_seeder/import_dataseeder.py @@ -0,0 +1,131 @@ +import yaml +import pandas as pd +from sqlalchemy import create_engine +import json +import argparse +import os +from sqlalchemy.sql import text + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "--database_uri", + help="database URI (e.g. postgresql://ccglobal:@localhost/ccglobal)", + default=os.environ.get("DB_URI"), + ) + args = parser.parse_args() + + # Load YAML file into Python dictionary + with open('datasource_seeder.yaml', 'r') as file: + data_dict = yaml.safe_load(file) + + # Convert dictionary to DataFrame + df = pd.DataFrame.from_dict(data_dict) + + # Check if column contains dictionaries convert to json + for column in df.columns: + if df[column].apply(lambda x: isinstance(x, dict)).all(): + df[column] = df[column].apply(json.dumps) + + # Connect to PostgreSQL + engine = create_engine(args.database_uri) + + # Insert DataFrame into PostgreSQL table + df.to_sql('datasource_staging', engine, if_exists='replace', index=False) + + #update sql script + + sql_query = """ + INSERT INTO datasource ( + datasource_id, + publisher_id, + datasource_name, + dataset_name, + dataset_description, + source_type, + access_type, + dataset_url, + geographical_location, + start_year, + end_year, + latest_accounting_year, + frequency_of_update, + spatial_resolution, + language, + accessibility, + data_quality, + notes, + units, + methodology_description, + methodology_url, + transformation_description, + retrieval_method, + api_endpoint, + gpc_reference_number, + scope + ) + SELECT + datasource_id::uuid, + publisher_id, + datasource_name, + dataset_name::jsonb as dataset_name, + dataset_description::jsonb as dataset_description, + source_type, + access_type, + dataset_url, + geographical_location, + start_year, + end_year, + latest_accounting_year, + frequency_of_update, + spatial_resolution, + language, + accessibility, + data_quality, + notes, + units, + methodology_description::jsonb as methodology_description, + methodology_url, + transformation_description::jsonb as transformation_description, + retrieval_method, + api_endpoint, + gpc_reference_number, + scope + FROM datasource_staging + ON CONFLICT ON CONSTRAINT datasource_pkey + DO UPDATE SET + publisher_id = EXCLUDED.publisher_id, + datasource_name = EXCLUDED.datasource_name, + dataset_name = EXCLUDED.dataset_name, + dataset_description = EXCLUDED.dataset_description, + source_type = EXCLUDED.source_type, + access_type = EXCLUDED.access_type, + dataset_url = EXCLUDED.dataset_url, + geographical_location = EXCLUDED.geographical_location, + start_year = EXCLUDED.start_year, + end_year = EXCLUDED.end_year, + latest_accounting_year = EXCLUDED.latest_accounting_year, + frequency_of_update = EXCLUDED.frequency_of_update, + spatial_resolution = EXCLUDED.spatial_resolution, + language = EXCLUDED.language, + accessibility = EXCLUDED.accessibility, + data_quality = EXCLUDED.data_quality, + notes = EXCLUDED.notes, + units = EXCLUDED.units, + methodology_description = EXCLUDED.methodology_description, + methodology_url = EXCLUDED.methodology_url, + transformation_description = EXCLUDED.transformation_description, + retrieval_method = EXCLUDED.retrieval_method, + api_endpoint = EXCLUDED.api_endpoint, + gpc_reference_number = EXCLUDED.gpc_reference_number, + scope = EXCLUDED.scope, + modified_date = now(); + """ + + with engine.connect() as connection: + try: + result = connection.execute(text(sql_query)) + connection.commit() + print("Query completed successfully.") + except Exception as e: + print("Error updating osm table:", e) \ No newline at end of file From 9f8a637b4b0397f02e03585e9c4c190f6730814c Mon Sep 17 00:00:00 2001 From: Amanda Eames Date: Tue, 28 May 2024 08:31:58 -0300 Subject: [PATCH 005/128] merged migration file heads --- ...7f44_fix_column_type_activity_emissions.py | 39 +++++++++++++++++++ ..._merge_heads_from_develop_and_languages.py | 26 +++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 global-api/migrations/versions/c360f7e67f44_fix_column_type_activity_emissions.py create mode 100644 global-api/migrations/versions/f8f5b2a87fff_merge_heads_from_develop_and_languages.py diff --git a/global-api/migrations/versions/c360f7e67f44_fix_column_type_activity_emissions.py b/global-api/migrations/versions/c360f7e67f44_fix_column_type_activity_emissions.py new file mode 100644 index 000000000..78c0d84d9 --- /dev/null +++ b/global-api/migrations/versions/c360f7e67f44_fix_column_type_activity_emissions.py @@ -0,0 +1,39 @@ +"""fix_column_type_activity_emissions + +Revision ID: c360f7e67f44 +Revises: 949c5b9cc18d +Create Date: 2024-05-22 08:21:13.727742 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = 'c360f7e67f44' +down_revision: Union[str, None] = '949c5b9cc18d' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + op.alter_column('country_code', 'activity_value', + existing_type=sa.String(), + type_=sa.Float(), + postgresql_using='activity_value::double precision') + op.alter_column('country_code', 'emissions_value', + existing_type=sa.String(), + type_=sa.Float(), + postgresql_using='emissions_value::double precision') + +def downgrade() -> None: + op.alter_column('country_code', 'activity_value', + existing_type=sa.Float(), + type_=sa.String(), + postgresql_using='activity_value::text') + op.alter_column('country_code', 'emissions_value', + existing_type=sa.Float(), + type_=sa.String(), + postgresql_using='emissions_value::text') diff --git a/global-api/migrations/versions/f8f5b2a87fff_merge_heads_from_develop_and_languages.py b/global-api/migrations/versions/f8f5b2a87fff_merge_heads_from_develop_and_languages.py new file mode 100644 index 000000000..4e5f918fc --- /dev/null +++ b/global-api/migrations/versions/f8f5b2a87fff_merge_heads_from_develop_and_languages.py @@ -0,0 +1,26 @@ +"""Merge heads from develop and languages + +Revision ID: f8f5b2a87fff +Revises: c360f7e67f44, 77d1cb7b24df +Create Date: 2024-05-28 08:30:14.654581 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = 'f8f5b2a87fff' +down_revision: Union[str, None] = ('c360f7e67f44', '77d1cb7b24df') +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + pass + + +def downgrade() -> None: + pass From de08d136ff215f0a6328ceb491045b6c3d859dc1 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Tue, 23 Jul 2024 15:00:22 +0200 Subject: [PATCH 006/128] WIP: Added basic support for OpenAI assistant API --- app/env.example | 5 ++-- app/src/app/api/v0/assistants/route.ts | 21 +++++++++++++++ .../threads/[threadId]/messages/route.ts | 24 +++++++++++++++++ .../app/api/v0/assistants/threads/route.ts | 26 +++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 app/src/app/api/v0/assistants/route.ts create mode 100644 app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts create mode 100644 app/src/app/api/v0/assistants/threads/route.ts diff --git a/app/env.example b/app/env.example index 51e022cd0..47625420a 100644 --- a/app/env.example +++ b/app/env.example @@ -14,8 +14,9 @@ SMTP_FROM_EMAIL="ethereal.user@ethereal.email" RESET_TOKEN_SECRET="WwjFGhcP8VikgsmtcPv+ufPhTGS8t7e+/aN5k2qY4ms=" NEXT_PUBLIC_SUPPORT_EMAILS="info@openearth.org,greta@openearth.org" VERIFICATION_TOKEN_SECRET="80c70dfdeedf2c01757b880d39c79214e915c786dd48d5473c9c0aecf81d67cf" -HUGGINGFACE_API_KEY=hf_MY_SECRET_KEY -OPENAI_API_KEY=sk-MY_SECRET_KEY +HUGGINGFACE_API_KEY="hf_MY_SECRET_KEY" +OPENAI_API_KEY="sk-MY_SECRET_KEY" +OPENAI_ASSISTANT_ID="asst_ASSISTANT_ID" CHAT_PROVIDER=huggingface OPEN_AI_MODEL="gpt-4o-mini" ADMIN_EMAILS="admin@mail.com" diff --git a/app/src/app/api/v0/assistants/route.ts b/app/src/app/api/v0/assistants/route.ts new file mode 100644 index 000000000..693bda96a --- /dev/null +++ b/app/src/app/api/v0/assistants/route.ts @@ -0,0 +1,21 @@ +import OpenAI from "openai"; +import { apiHandler } from "@/util/api"; + +const openai = new OpenAI({ + apiKey: process.env.OPENAI_API_KEY, +}); + +// Create a new assistant +export const POST = apiHandler(async () => { + const assistant = await openai.beta.assistants.create({ + instructions: "You are a helpful assistant.", + name: "Quickstart Assistant", + model: "gpt-4o-mini", // gpt4o-mini not working currently + tools: [ + { + type: "code_interpreter", + }, + ], + }); + return Response.json({ assistantId: assistant.id }); +}); diff --git a/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts b/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts new file mode 100644 index 000000000..9f2cde4c0 --- /dev/null +++ b/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts @@ -0,0 +1,24 @@ +import OpenAI from "openai"; +import { apiHandler } from "@/util/api"; + +const openai = new OpenAI({ + apiKey: process.env.OPENAI_API_KEY, +}); + +const assistantId = process.env.OPENAI_ASSISTANT_ID as string; + +// Send a new message to a thread +export const POST = apiHandler(async (req, { params: { threadId } }) => { + const { content } = await req.json(); + + await openai.beta.threads.messages.create(threadId, { + role: "user", + content: content, + }); + + const stream = openai.beta.threads.runs.stream(threadId, { + assistant_id: assistantId, + }); + + return new Response(stream.toReadableStream()); +}); diff --git a/app/src/app/api/v0/assistants/threads/route.ts b/app/src/app/api/v0/assistants/threads/route.ts new file mode 100644 index 000000000..6c8327328 --- /dev/null +++ b/app/src/app/api/v0/assistants/threads/route.ts @@ -0,0 +1,26 @@ +import OpenAI from "openai"; +import { apiHandler } from "@/util/api"; + +const openai = new OpenAI({ + apiKey: process.env.OPENAI_API_KEY, +}); + +export const POST = apiHandler(async () => { + const thread = await openai.beta.threads.create({ + messages: [ + { + role: "user", + content: + "How many shares of AAPL were outstanding at the end of of October 2023?", + // Attach the new file to the message. + attachments: [ + { + file_id: "file-nI3Chhp90NOfufUM68jFsIkQ", + tools: [{ type: "file_search" }], + }, + ], + }, + ], + }); + return Response.json({ threadId: thread.id }); +}); From 78de87bf87832a9f2ccae662df40c9af1d19e628 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jul 2024 10:08:19 -0400 Subject: [PATCH 007/128] chore: v0.13.0-dev.0 Signed-off-by: Evan Prodromou --- app/package-lock.json | 4 ++-- app/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index fb85097a5..bdb4cafa5 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "city-catalyst", - "version": "0.12.0-rc.0", + "version": "0.13.0-dev.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "city-catalyst", - "version": "0.12.0-rc.0", + "version": "0.13.0-dev.0", "dependencies": { "@chakra-ui/icons": "^2.1.0", "@chakra-ui/next-js": "^2.2.0", diff --git a/app/package.json b/app/package.json index 8345766ed..d9aaae882 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "city-catalyst", - "version": "0.12.0-rc.0", + "version": "0.13.0-dev.0", "private": true, "type": "module", "scripts": { From 838b47b39d2a77703a33b909d9999f2965f4a989 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jul 2024 16:51:23 -0400 Subject: [PATCH 008/128] feat: start mapping out data-driven manual input hierarchy Signed-off-by: Evan Prodromou --- .../form-schema/manual-input-hierarchy.json | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/src/util/form-schema/manual-input-hierarchy.json diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json new file mode 100644 index 000000000..95c9a8bbe --- /dev/null +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -0,0 +1,24 @@ +{ + "methodologies": { + "fakemethod": { + "gpcrefnos": ["I.1.1", "I.2.1", "IV.1"], + "name": "fakemethod-name", + "status": "enabled", + "description": "fakemethod-description", + "extra-fields": { + "building-type": {}, + "fuel-type": {} + }, + "subcategories": [ + { + "building-type-and-fuel": { + "status": "required", + "name": "commercial-building-fakevalue-name", + "formula": "activity-times-emissions-factor", + "activity-title": "commercial-building-fakevalue-title", + } + } + ] + } + } +} \ No newline at end of file From 5a2eb85ff51c9d49d02130ba977655dbf7716c36 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Jul 2024 16:53:50 -0400 Subject: [PATCH 009/128] fix: extra comma Signed-off-by: Evan Prodromou --- app/src/util/form-schema/manual-input-hierarchy.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 95c9a8bbe..3ec603b46 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -15,7 +15,7 @@ "status": "required", "name": "commercial-building-fakevalue-name", "formula": "activity-times-emissions-factor", - "activity-title": "commercial-building-fakevalue-title", + "activity-title": "commercial-building-fakevalue-title" } } ] From ca8fcd44da622334f9b349742e39b230fdba58cb Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Wed, 24 Jul 2024 13:02:18 +0200 Subject: [PATCH 010/128] added utils openai.ts, added mock prompt to assistant creation --- app/src/app/api/v0/assistants/route.ts | 62 +++++++++++++++---- .../threads/[threadId]/messages/route.ts | 9 +-- .../app/api/v0/assistants/threads/route.ts | 36 +++++------ app/src/util/openai.ts | 5 ++ 4 files changed, 75 insertions(+), 37 deletions(-) create mode 100644 app/src/util/openai.ts diff --git a/app/src/app/api/v0/assistants/route.ts b/app/src/app/api/v0/assistants/route.ts index 693bda96a..03aa88205 100644 --- a/app/src/app/api/v0/assistants/route.ts +++ b/app/src/app/api/v0/assistants/route.ts @@ -1,21 +1,57 @@ -import OpenAI from "openai"; +// import OpenAI from "openai"; import { apiHandler } from "@/util/api"; +import { openai } from "@/util/openai"; -const openai = new OpenAI({ - apiKey: process.env.OPENAI_API_KEY, -}); +// import UserService from "@/backend/UserService"; +// import { db } from "@/models"; +// import { Inventory } from "@/models/Inventory"; +// import { PopulationEntry, findClosestYear } from "@/util/helpers"; +// import { PopulationAttributes } from "@/models/Population"; + +// const openai = new OpenAI({ +// apiKey: process.env.OPENAI_API_KEY, +// }); + +/** + * Creates a system message with context included + */ +function createPromptTemplate( + cityName: string, + regionName: string, + countryName: string, +): string { + return `You are a climate assistant for creating +'Global Protocol for Community-Scale (GPC) Greenhouse Gas (GHG) Inventories' using CityCatalyst, +an open source tool for creating climate inventories by Open Earth Foundation. +You try to be as helpful as possible when answering the user\'s questions about their inventory +or any climate science or data science related questions. +Try to be as scientific as possible. Use primarily the provided context below, to support the user. +If you need information that is not provided in the context below or in the attached documents, +use your own, internal knowledge. + +CONTEXT ++ Name of city name that the inventory is being created for: ${cityName}, ++ Name of the corresponding region: ${regionName}, ++ Name of the corresponding country: ${countryName},`; +} // TODO: Currently testing via Postman without access to inventory data. // Create a new assistant -export const POST = apiHandler(async () => { +export const POST = apiHandler(async (req, { params, session }) => { + // TODO: fix mock values, (only used because of Postman) + const prompt = createPromptTemplate("Achim", "Niedersachsen", "Germany"); + + const userID = "id_123456"; // TODO: Get userID + const assistant = await openai.beta.assistants.create({ - instructions: "You are a helpful assistant.", - name: "Quickstart Assistant", - model: "gpt-4o-mini", // gpt4o-mini not working currently - tools: [ - { - type: "code_interpreter", - }, - ], + instructions: prompt, + name: `ClimateAdvisor_v0.1_${userID}`, + model: "gpt-3.5-turbo", // gpt4o-mini not working currently + temperature: 0.2, + tools: [{ type: "file_search" }], + tool_resources: { + file_search: { vector_store_ids: ["vs_oS3uJ02f4enB7oK5pSU8pIHq"] }, // TODO: Hardcoded vectorstore ID + }, }); return Response.json({ assistantId: assistant.id }); + return Response.json({ error: "Method Not Allowed", status: 405 }); }); diff --git a/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts b/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts index 9f2cde4c0..d5f0f0c5d 100644 --- a/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts +++ b/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts @@ -1,9 +1,10 @@ -import OpenAI from "openai"; +// import OpenAI from "openai"; import { apiHandler } from "@/util/api"; +import { openai } from "@/util/openai"; -const openai = new OpenAI({ - apiKey: process.env.OPENAI_API_KEY, -}); +// const openai = new OpenAI({ +// apiKey: process.env.OPENAI_API_KEY, +// }); const assistantId = process.env.OPENAI_ASSISTANT_ID as string; diff --git a/app/src/app/api/v0/assistants/threads/route.ts b/app/src/app/api/v0/assistants/threads/route.ts index 6c8327328..9f930109a 100644 --- a/app/src/app/api/v0/assistants/threads/route.ts +++ b/app/src/app/api/v0/assistants/threads/route.ts @@ -1,26 +1,22 @@ -import OpenAI from "openai"; +// import OpenAI from "openai"; import { apiHandler } from "@/util/api"; +import { openai } from "@/util/openai"; -const openai = new OpenAI({ - apiKey: process.env.OPENAI_API_KEY, -}); +// const openai = new OpenAI({ +// apiKey: process.env.OPENAI_API_KEY, +// }); export const POST = apiHandler(async () => { - const thread = await openai.beta.threads.create({ - messages: [ - { - role: "user", - content: - "How many shares of AAPL were outstanding at the end of of October 2023?", - // Attach the new file to the message. - attachments: [ - { - file_id: "file-nI3Chhp90NOfufUM68jFsIkQ", - tools: [{ type: "file_search" }], - }, - ], - }, - ], - }); + const thread = await openai.beta.threads.create(); + // { + // messages: [ + // { + // role: "user", // ADD SYSTEM MESSAGE HERE? + // content: + // "How many shares of AAPL were outstanding at the end of of October 2023?", + // // Attach the new file to the message. + // }, + // ], + // }); return Response.json({ threadId: thread.id }); }); diff --git a/app/src/util/openai.ts b/app/src/util/openai.ts new file mode 100644 index 000000000..8cdaa6a8f --- /dev/null +++ b/app/src/util/openai.ts @@ -0,0 +1,5 @@ +import OpenAI from "openai"; + +export const openai = new OpenAI({ + apiKey: process.env.OPENAI_API_KEY, +}); From 31883f02014ba702101fef6ba7894419b174b4e0 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Wed, 24 Jul 2024 13:15:24 +0200 Subject: [PATCH 011/128] feat(ui): extract emissions factor types from deduplicated data sources --- .../components/Modals/add-activity-modal.tsx | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/app/src/components/Modals/add-activity-modal.tsx b/app/src/components/Modals/add-activity-modal.tsx index 0ee176cde..db560f6d8 100644 --- a/app/src/components/Modals/add-activity-modal.tsx +++ b/app/src/components/Modals/add-activity-modal.tsx @@ -28,7 +28,7 @@ import { Tooltip, useToast, } from "@chakra-ui/react"; -import { FC, useState } from "react"; +import { FC, useMemo, useState } from "react"; import { SubmitHandler, useForm } from "react-hook-form"; import { TFunction } from "i18next"; import BuildingTypeSelectInput from "../building-select-input"; @@ -137,7 +137,27 @@ const AddActivityModal: FC = ({ } = useForm(); let prefix = ""; - let emissionsFactors: any = []; + let { data: emissionsFactors, isLoading: emissionsFactorsLoading } = + api.useGetEmissionsFactorsQuery(); + // extract and deduplicate data sources from emissions factors + const emissionsFactorTypes = useMemo(() => { + if (!emissionsFactors) { + return []; + } + const seen: Record = {}; + return emissionsFactors + .flatMap((factor) => { + return factor.dataSources.map((source) => ({ + id: source.datasourceId, + name: source.datasetName, + })); + }) + .filter((source) => { + return seen.hasOwnProperty(source.id) + ? false + : (seen[source.id] = true); + }); + }, [emissionsFactors]); const toast = useToast(); @@ -374,11 +394,14 @@ const AddActivityModal: FC = ({ onChange={(e: any) => onEmissionFactorTypeChange(e)} > {/* TODO translate values and use internal value for saving */} - {formInputs?.fields[3].options?.map((item: string) => ( - ))} + {errors.activity?.emissionFactorType ? ( Date: Wed, 24 Jul 2024 13:18:47 +0200 Subject: [PATCH 012/128] fix(ui): type issues and remove resolved TODO comment --- app/src/components/Modals/add-activity-modal.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/components/Modals/add-activity-modal.tsx b/app/src/components/Modals/add-activity-modal.tsx index db560f6d8..35c5a80cb 100644 --- a/app/src/components/Modals/add-activity-modal.tsx +++ b/app/src/components/Modals/add-activity-modal.tsx @@ -149,7 +149,7 @@ const AddActivityModal: FC = ({ .flatMap((factor) => { return factor.dataSources.map((source) => ({ id: source.datasourceId, - name: source.datasetName, + name: source.datasetName ?? "unknown", })); }) .filter((source) => { @@ -393,8 +393,7 @@ const AddActivityModal: FC = ({ placeholder="Select emission factor type" onChange={(e: any) => onEmissionFactorTypeChange(e)} > - {/* TODO translate values and use internal value for saving */} - {emissionsFactorTypes.map((id: string, name: string) => ( + {emissionsFactorTypes.map(({ id, name }) => ( From bce0a3c411a1e45edb4b383626f5810ef5998ee8 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Wed, 24 Jul 2024 14:51:52 +0200 Subject: [PATCH 013/128] fix(api): merge local emissions factor changes --- .../20231114094254-emissions-factors.cjs | 7 +- app/src/models/InventoryValue.ts | 8 ++ .../util/form-schema/sector-form-schema.json | 111 ++++++++---------- 3 files changed, 61 insertions(+), 65 deletions(-) diff --git a/app/seeders/20231114094254-emissions-factors.cjs b/app/seeders/20231114094254-emissions-factors.cjs index df38a44b9..83c87f1de 100644 --- a/app/seeders/20231114094254-emissions-factors.cjs +++ b/app/seeders/20231114094254-emissions-factors.cjs @@ -32,15 +32,12 @@ module.exports = { folder, ); - const emissionsFactorsStationaryEnergy = await parseFile("EmissionsFactor_Stationary_Energy", folder); - const emissionsFactorsStationaryEnergyScope1 = await parseFile("EmissionsFactor_Stationary_Energy_Scope1", folder); - const emissionsFactorsRaw = emissionsFactorsStationaryEnergy.concat(emissionsFactorsStationaryEnergyScope1); - + const emissionsFactorsRaw = await parseFile("EmissionsFactor", folder); const emissionsFactors = emissionsFactorsRaw.map((ef) => { delete ef["EF ID_x"]; // delete ef["ipcc_2006_category"]; return ef; - }) + }); const publishers = await parseFile("Publisher", folder); diff --git a/app/src/models/InventoryValue.ts b/app/src/models/InventoryValue.ts index 1be0fc0e0..c0989475b 100644 --- a/app/src/models/InventoryValue.ts +++ b/app/src/models/InventoryValue.ts @@ -17,6 +17,7 @@ export interface InventoryValueAttributes { co2eqYears?: number; unavailableReason?: string; unavailableExplanation?: string; + inputMethodology?: string; sectorId?: string; subSectorId?: string; subCategoryId?: string; @@ -36,6 +37,7 @@ export type InventoryValueOptionalAttributes = | "co2eqYears" | "unavailableReason" | "unavailableExplanation" + | "inputMethodology" | "sectorId" | "subSectorId" | "subCategoryId" @@ -60,6 +62,7 @@ export class InventoryValue co2eqYears?: number; unavailableReason?: string; unavailableExplanation?: string; + inputMethodology?: string; sectorId?: string; subSectorId?: string; subCategoryId?: string; @@ -176,6 +179,11 @@ export class InventoryValue allowNull: true, field: "unavailable_explanation", }, + inputMethodology: { + type: DataTypes.TEXT, + allowNull: true, + field: "input_methodology", + }, sectorId: { type: DataTypes.UUID, allowNull: true, diff --git a/app/src/util/form-schema/sector-form-schema.json b/app/src/util/form-schema/sector-form-schema.json index ce56e4d3f..a75fba4bd 100644 --- a/app/src/util/form-schema/sector-form-schema.json +++ b/app/src/util/form-schema/sector-form-schema.json @@ -1,5 +1,5 @@ { - "1":{ + "1": { "1": { "fields": [ { @@ -34,13 +34,13 @@ "addon": { "name": "fuelConsumptionUnits", "options": [ - "Gallons (gal)", - "Liters (L)", - "Cubic meters (m3)", - "Kilograms (kg)", - "Terajoules (TJ)", - "Kilowatt hour (kWh)" - ] + "Gallons (gal)", + "Liters (L)", + "Cubic meters (m3)", + "Kilograms (kg)", + "Terajoules (TJ)", + "Kilowatt hour (kWh)" + ] } }, { @@ -72,7 +72,6 @@ "name": "ch4EmissionFactor", "unit": "kg/Gal" } - ], "submit": { "label": "Add Activity", @@ -120,60 +119,52 @@ "Terajoules (TJ)", "Kilowatt-kilometer (kW/m2)" ] - } - }, - { - "label": "Emission factor type", - "type": "select", - "name": "emissionFactorType", - "options": [ - "Carbon Footprint", - "Local", - "Regional", - "National" - ] - }, - { - "label": "CO2 emission factor", - "type": "number", - "name": "co2EmissionFactor", - "unit": "CO2/kWh" - }, - { - "label": "N2O emission factor", - "type": "number", - "name": "n2oEmissionFactor", - "unit": "NO2/kWh" - }, - { - "label": "CH4 emission factor", - "type": "number", - "name": "ch4EmissionFactor", - "unit": "CH4/kWh" - }, - { - "label": "Data quality", - "type": "select", - "name": "dataQuality", - "options": [ - "High", - "Medium", - "Low" - ] - }, - { - "label": "Source reference", - "type": "text", - "name": "sourceReference", - "placeholder": "Write in detail from which source the entered values come from." } - ], - "submit": { - "label": "Add Activity", - "action": "/submit-activity" + }, + { + "label": "Emission factor type", + "type": "select", + "name": "emissionFactorType", + "options": ["Carbon Footprint", "Local", "Regional", "National"] + }, + { + "label": "CO2 emission factor", + "type": "number", + "name": "co2EmissionFactor", + "unit": "CO2/kWh" + }, + { + "label": "N2O emission factor", + "type": "number", + "name": "n2oEmissionFactor", + "unit": "NO2/kWh" + }, + { + "label": "CH4 emission factor", + "type": "number", + "name": "ch4EmissionFactor", + "unit": "CH4/kWh" + }, + { + "label": "Data quality", + "type": "select", + "name": "dataQuality", + "options": ["High", "Medium", "Low"] + }, + { + "label": "Source reference", + "type": "text", + "name": "sourceReference", + "placeholder": "Write in detail from which source the entered values come from." } + ], + "submit": { + "label": "Add Activity", + "action": "/submit-activity" } + } }, "2": {}, "3": {} -} \ No newline at end of file +} + From 1e98e91e07c116e189877e3f671963f72fa4eb7f Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Wed, 24 Jul 2024 15:16:21 +0200 Subject: [PATCH 014/128] fix(db): change type of column EmissionsFactor.region from VARCHAR(10) to TEXT --- ...4130917-emissions-factor-region-length.cjs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/migrations/20240724130917-emissions-factor-region-length.cjs diff --git a/app/migrations/20240724130917-emissions-factor-region-length.cjs b/app/migrations/20240724130917-emissions-factor-region-length.cjs new file mode 100644 index 000000000..9767ba132 --- /dev/null +++ b/app/migrations/20240724130917-emissions-factor-region-length.cjs @@ -0,0 +1,20 @@ +"use strict"; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.changeColumn( + "EmissionsFactor", + "region", + Sequelize.TEXT, + ); + }, + + async down(queryInterface, Sequelize) { + await queryInterface.changeColumn( + "EmissionsFactor", + "region", + Sequelize.VARCHAR(10), + ); + }, +}; From 7cd84b3a6b35a7f676f1d53871eed7a581cb5482 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Wed, 24 Jul 2024 15:16:50 +0200 Subject: [PATCH 015/128] fix(seed): wrong column names for id and gpc_reference_number in EF CSV seeders --- .../data_processed/CarbonFootPrint_2023/EmissionsFactor.csv | 2 +- .../EFDB_2006_IPCC_guidelines/EmissionsFactor.csv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/seed-data/emissions_factors/data_processed/CarbonFootPrint_2023/EmissionsFactor.csv b/app/seed-data/emissions_factors/data_processed/CarbonFootPrint_2023/EmissionsFactor.csv index 31d13a249..579171bb1 100644 --- a/app/seed-data/emissions_factors/data_processed/CarbonFootPrint_2023/EmissionsFactor.csv +++ b/app/seed-data/emissions_factors/data_processed/CarbonFootPrint_2023/EmissionsFactor.csv @@ -1,4 +1,4 @@ -actor_id,region,year,reference,gas,emissions_per_activity,gpc_refno,methodology_name,units,metadata,emissions_factor_id +actor_id,region,year,reference,gas,emissions_per_activity,gpc_reference_number,methodology_name,units,metadata,id AF,Afghanistan,2021,Calculated from Fuel Mix,CO2,0.08352979738447883,I.1.2,electricity_consumption,kg/kWh,CO2e_value:0.104,f01a557f-cded-47a2-bcfc-73e3a640fee9 AF,Afghanistan,2021,Calculated from Fuel Mix,CO2,0.08352979738447883,I.1.2,energy_consumptionsampling_scaled_data,kg/kWh,CO2e_value:0.104,e52fa22f-140b-4e8e-bb7a-cf81457739d5 AF,Afghanistan,2021,Calculated from Fuel Mix,CO2,0.08352979738447883,I.1.2,modeled_data,kg/kWh,CO2e_value:0.104,3728dea9-bbd2-44ec-b43e-74de2c83d614 diff --git a/app/seed-data/emissions_factors/data_processed/EFDB_2006_IPCC_guidelines/EmissionsFactor.csv b/app/seed-data/emissions_factors/data_processed/EFDB_2006_IPCC_guidelines/EmissionsFactor.csv index b0799a6f2..3cbc722f5 100644 --- a/app/seed-data/emissions_factors/data_processed/EFDB_2006_IPCC_guidelines/EmissionsFactor.csv +++ b/app/seed-data/emissions_factors/data_processed/EFDB_2006_IPCC_guidelines/EmissionsFactor.csv @@ -1,4 +1,4 @@ -gas,region,units,reference,gpc_refno,actor_id,emissions_per_activity,methodology_name,metadata,year,emissions_factor_id +gas,region,units,reference,gpc_reference_number,actor_id,emissions_per_activity,methodology_name,metadata,year,id CO2,world,kg/TJ,"Grubb,M.J.(1989),On Coefficients for determining Greenhouse Gas Emissions from Fossil Fuel Production and Consumption. Energy and Environment Programme, Royal Institute of International Affairs ,London, UK April. Prepared for IEA/OECD Expert Seminar on Energy Technologies for reducing Emissions of Greenhouse Gases, Paris France.",I.1.1,,98.26666666666667,fuel_combustion_consumption,"fuel_type:Anthracite, density_value:1506.0, density_units:kg/m3, NCV_value:26.7, NCV_units:TJ/Gg",,6b5ab3ee-46bc-4026-a02d-bce70c8ec22b CO2,world,kg/TJ,"Grubb,M.J.(1989),On Coefficients for determining Greenhouse Gas Emissions from Fossil Fuel Production and Consumption. Energy and Environment Programme, Royal Institute of International Affairs ,London, UK April. Prepared for IEA/OECD Expert Seminar on Energy Technologies for reducing Emissions of Greenhouse Gases, Paris France.",I.1.1,,98.26666666666667,sampling_scaled_data,"fuel_type:Anthracite, density_value:1506.0, density_units:kg/m3, NCV_value:26.7, NCV_units:TJ/Gg",,06019252-cf4c-4160-b803-7a41072faa8b CO2,world,kg/TJ,"Grubb,M.J.(1989),On Coefficients for determining Greenhouse Gas Emissions from Fossil Fuel Production and Consumption. Energy and Environment Programme, Royal Institute of International Affairs ,London, UK April. Prepared for IEA/OECD Expert Seminar on Energy Technologies for reducing Emissions of Greenhouse Gases, Paris France.",I.1.1,,98.26666666666667,modeled_data,"fuel_type:Anthracite, density_value:1506.0, density_units:kg/m3, NCV_value:26.7, NCV_units:TJ/Gg",,af9cffdf-3b42-4bcc-a88f-5330f1e7519d From 4431c1c0019bcb117464326db52687f449a19e43 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Wed, 24 Jul 2024 15:17:17 +0200 Subject: [PATCH 016/128] feat(seed): convert metadata to JSON and remove empty strings for year --- app/seeders/20231114094254-emissions-factors.cjs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/seeders/20231114094254-emissions-factors.cjs b/app/seeders/20231114094254-emissions-factors.cjs index 83c87f1de..5359c4360 100644 --- a/app/seeders/20231114094254-emissions-factors.cjs +++ b/app/seeders/20231114094254-emissions-factors.cjs @@ -34,8 +34,14 @@ module.exports = { const emissionsFactorsRaw = await parseFile("EmissionsFactor", folder); const emissionsFactors = emissionsFactorsRaw.map((ef) => { - delete ef["EF ID_x"]; - // delete ef["ipcc_2006_category"]; + const metadata = (ef.metadata ? ef.metadata : "") + .split(", ") + .map((entry) => entry.split(":")); + ef.metadata = JSON.stringify(Object.fromEntries(metadata)); + if (!ef.year) { + ef.year = null; + } + return ef; }); @@ -65,7 +71,6 @@ module.exports = { emissionsFactors, "id", transaction, - true, ); console.info("Finished adding emissions factors"); await bulkUpsert( From 7e8f19771216fa5f813b0cb58d5995dc72b68836 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Wed, 24 Jul 2024 15:51:10 +0200 Subject: [PATCH 017/128] feat(db): add inputMethodology property to InventoryValue model in migration --- .../20240724134914-input-methodology.cjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app/migrations/20240724134914-input-methodology.cjs diff --git a/app/migrations/20240724134914-input-methodology.cjs b/app/migrations/20240724134914-input-methodology.cjs new file mode 100644 index 000000000..bebd846da --- /dev/null +++ b/app/migrations/20240724134914-input-methodology.cjs @@ -0,0 +1,16 @@ +"use strict"; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + queryInterface.addColumn( + "InventoryValue", + "input_methodology", + Sequelize.TEXT, + ); + }, + + async down(queryInterface) { + queryInterface.removeColumn("InventoryValue", "input_methodology"); + }, +}; From 8842b187ca230452763095c9601b2c3f19bfa25e Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Wed, 24 Jul 2024 15:52:07 +0200 Subject: [PATCH 018/128] feat(seed): also load CarbonFootPrint_2023 emissions factors --- app/seeders/20231114094254-emissions-factors.cjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/seeders/20231114094254-emissions-factors.cjs b/app/seeders/20231114094254-emissions-factors.cjs index 5359c4360..80f1bd3ae 100644 --- a/app/seeders/20231114094254-emissions-factors.cjs +++ b/app/seeders/20231114094254-emissions-factors.cjs @@ -4,7 +4,11 @@ const fs = require("node:fs"); const { parse } = require("csv-parse"); const { bulkUpsert } = require("./util/util.cjs"); -const folders = ["EFDB_2006_IPCC_guidelines", "EFDB_US"]; +const folders = [ + "EFDB_2006_IPCC_guidelines", + "EFDB_US", + "CarbonFootPrint_2023", +]; async function parseFile(filename, folder) { const records = []; @@ -26,6 +30,7 @@ module.exports = { async up(queryInterface) { await queryInterface.sequelize.transaction(async (transaction) => { for (const folder of folders) { + console.log("Loading emissions factor folder " + folder + "..."); const dataSources = await parseFile("DataSource", folder); const dataSourceEmissionsFactors = await parseFile( "DataSourceEmissionsFactor", @@ -71,6 +76,7 @@ module.exports = { emissionsFactors, "id", transaction, + folder == "CarbonFootPrint_2023", ); console.info("Finished adding emissions factors"); await bulkUpsert( From 4dcdf4e559b46a9114668cf7f017b1b01f3020c9 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 24 Jul 2024 11:57:41 -0400 Subject: [PATCH 019/128] fix: more formatted manual input --- .../form-schema/manual-input-hierarchy.json | 159 ++++++++++++++++-- 1 file changed, 141 insertions(+), 18 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 3ec603b46..bd8c719fe 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -1,24 +1,147 @@ { - "methodologies": { - "fakemethod": { - "gpcrefnos": ["I.1.1", "I.2.1", "IV.1"], - "name": "fakemethod-name", - "status": "enabled", - "description": "fakemethod-description", - "extra-fields": { - "building-type": {}, - "fuel-type": {} - }, - "subcategories": [ + "I.2.1": { + "methodologies": [ { - "building-type-and-fuel": { - "status": "required", - "name": "commercial-building-fakevalue-name", - "formula": "activity-times-emissions-factor", - "activity-title": "commercial-building-fakevalue-title" - } + "id": "fuel-combustion-commercial-buildings-methodology", + "activities": [ + { + "id": "fuel-combustion-commercial-buildings-activity", + "unique-by": [ + "commercial-building-type", + "commercial-building-fuel-type", + "commercial-buildings-fuel-source" + ], + "activity-title": "activity-total-fuel-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "commercial-building-type", + "options": [ + "commercial-building-type-all", + "commercial-building-type-commercial-institutional", + "commercial-building-type-commercial-buildings", + "commercial-building-type-institutional-buildings", + "commercial-building-type-street-lighting" + ], + "exclusive": "commercial-building-type-all" + }, + { + "id": "commercial-building-fuel-type", + "options": [ + "commercial-building-fuel-type-propane", + "commercial-building-fuel-type-natural-gas", + "commercial-building-fuel-type-heating-oil" + ] + }, + { + "id": "commercial-buildings-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-other" + ] + } + ] + }, + { + "id": "direct-measurement-commercial-buildings-methodology", + "activities": [ + { + "id": "direct-measurement-commercial-buildings-activity", + "unique-by": ["commercial-building-type"], + "activity-title": "activity-emissions", + "minimum": 1, + "extra-fields": [ + { + "id": "commercial-building-type", + "options": [ + "commercial-building-type-all", + "commercial-building-type-commercial-institutional", + "commercial-building-type-commercial-buildings", + "commercial-building-type-institutional-buildings", + "commercial-building-type-street-lighting" + ], + "exclusive": "commercial-building-type-all" + }, + { + "id": "commercial-building-co2", + "type": "number", + "units": ["units-tons"] + }, + { + "id": "commercial-building-ch4", + "type": "number", + "units": ["units-tons"] + }, + { + "id": "commercial-building-n2o", + "type": "number", + "units": ["units-tons"] + } + ], + "units": [] + } + ] + } + ] + }, + "II.1.1": { + "methodologies": [ + { + "id": "fuel-sales-on-road-transport-methodology", + "activities": [ + { + "id": "fuel-sales-on-road-transport-activity", + "unique-by": [ + "on-road-transport-vehicle-type", + "on-road-transport-fuel-type", + "on-road-transport-fuel-source" + ], + "activity-title": "activity-total-fuel-sales", + "minimum": 1, + "extra-fields": [ + { + "id": "on-road-transport-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "on-road-transport-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-vehicles", + "vehicle-type-commercial-vehicles", + "vehicle-type-public-transport-vehicles", + "vehicle-type-emergency-vehicles", + "vehicle-type-service-vehicles" + ] + }, + { + "id": "on-road-transport-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-terajoules", + "units-kilowatt-hours" + ] + } + ] } ] } - } } \ No newline at end of file From d1fe8d558a2cddde00261069edbb9cee88828298 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 25 Jul 2024 11:08:56 +0200 Subject: [PATCH 020/128] added streaming output to console --- app/src/app/api/v0/assistants/route.ts | 49 +++++-------------- .../threads/[threadId]/messages/route.ts | 21 ++++---- .../app/api/v0/assistants/threads/route.ts | 18 +------ 3 files changed, 25 insertions(+), 63 deletions(-) diff --git a/app/src/app/api/v0/assistants/route.ts b/app/src/app/api/v0/assistants/route.ts index 03aa88205..b5fcfbd74 100644 --- a/app/src/app/api/v0/assistants/route.ts +++ b/app/src/app/api/v0/assistants/route.ts @@ -1,49 +1,23 @@ -// import OpenAI from "openai"; import { apiHandler } from "@/util/api"; import { openai } from "@/util/openai"; +import { NextResponse } from "next/server"; -// import UserService from "@/backend/UserService"; -// import { db } from "@/models"; -// import { Inventory } from "@/models/Inventory"; -// import { PopulationEntry, findClosestYear } from "@/util/helpers"; -// import { PopulationAttributes } from "@/models/Population"; - -// const openai = new OpenAI({ -// apiKey: process.env.OPENAI_API_KEY, -// }); +// Create a new assistant +export const POST = apiHandler(async () => { + // Currently we create the assistant via OpenAI web interface and do not implement this function here + return NextResponse.json({ error: "Method Not Allowed", status: 405 }); + const userID = "id_123456"; // TODO: Get userID -/** - * Creates a system message with context included - */ -function createPromptTemplate( - cityName: string, - regionName: string, - countryName: string, -): string { - return `You are a climate assistant for creating + const systemPrompt = `You are CLIMA, a climate assistant for creating 'Global Protocol for Community-Scale (GPC) Greenhouse Gas (GHG) Inventories' using CityCatalyst, an open source tool for creating climate inventories by Open Earth Foundation. You try to be as helpful as possible when answering the user\'s questions about their inventory or any climate science or data science related questions. -Try to be as scientific as possible. Use primarily the provided context below, to support the user. -If you need information that is not provided in the context below or in the attached documents, -use your own, internal knowledge. - -CONTEXT -+ Name of city name that the inventory is being created for: ${cityName}, -+ Name of the corresponding region: ${regionName}, -+ Name of the corresponding country: ${countryName},`; -} // TODO: Currently testing via Postman without access to inventory data. - -// Create a new assistant -export const POST = apiHandler(async (req, { params, session }) => { - // TODO: fix mock values, (only used because of Postman) - const prompt = createPromptTemplate("Achim", "Niedersachsen", "Germany"); - - const userID = "id_123456"; // TODO: Get userID +Try to be as scientific as possible. Use primarily the provided context of the attached documents, +or context provided by the user.`; const assistant = await openai.beta.assistants.create({ - instructions: prompt, + instructions: systemPrompt, name: `ClimateAdvisor_v0.1_${userID}`, model: "gpt-3.5-turbo", // gpt4o-mini not working currently temperature: 0.2, @@ -52,6 +26,5 @@ export const POST = apiHandler(async (req, { params, session }) => { file_search: { vector_store_ids: ["vs_oS3uJ02f4enB7oK5pSU8pIHq"] }, // TODO: Hardcoded vectorstore ID }, }); - return Response.json({ assistantId: assistant.id }); - return Response.json({ error: "Method Not Allowed", status: 405 }); + return NextResponse.json({ assistantId: assistant.id }); }); diff --git a/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts b/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts index d5f0f0c5d..d6b806d4c 100644 --- a/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts +++ b/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts @@ -1,10 +1,6 @@ -// import OpenAI from "openai"; import { apiHandler } from "@/util/api"; import { openai } from "@/util/openai"; - -// const openai = new OpenAI({ -// apiKey: process.env.OPENAI_API_KEY, -// }); +import { NextResponse } from "next/server"; const assistantId = process.env.OPENAI_ASSISTANT_ID as string; @@ -17,9 +13,16 @@ export const POST = apiHandler(async (req, { params: { threadId } }) => { content: content, }); - const stream = openai.beta.threads.runs.stream(threadId, { - assistant_id: assistantId, - }); + const stream = openai.beta.threads.runs + .stream(threadId, { + assistant_id: assistantId, + }) + .on("textCreated", () => process.stdout.write("\nassistant > ")) + .on("textDelta", (textDelta) => { + if (typeof textDelta.value === "string") { + process.stdout.write(textDelta.value); + } + }); - return new Response(stream.toReadableStream()); + return new NextResponse(stream.toReadableStream()); }); diff --git a/app/src/app/api/v0/assistants/threads/route.ts b/app/src/app/api/v0/assistants/threads/route.ts index 9f930109a..3436ef3fe 100644 --- a/app/src/app/api/v0/assistants/threads/route.ts +++ b/app/src/app/api/v0/assistants/threads/route.ts @@ -1,22 +1,8 @@ -// import OpenAI from "openai"; import { apiHandler } from "@/util/api"; import { openai } from "@/util/openai"; - -// const openai = new OpenAI({ -// apiKey: process.env.OPENAI_API_KEY, -// }); +import { NextResponse } from "next/server"; export const POST = apiHandler(async () => { const thread = await openai.beta.threads.create(); - // { - // messages: [ - // { - // role: "user", // ADD SYSTEM MESSAGE HERE? - // content: - // "How many shares of AAPL were outstanding at the end of of October 2023?", - // // Attach the new file to the message. - // }, - // ], - // }); - return Response.json({ threadId: thread.id }); + return NextResponse.json({ threadId: thread.id }); }); From ea171fc6755d0c2e0167e94d111bbbbc8d84cd6c Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 25 Jul 2024 18:11:32 +0200 Subject: [PATCH 021/128] updated ai package version --- app/package-lock.json | 260 +++++++++++++++++------------------------- app/package.json | 2 +- 2 files changed, 108 insertions(+), 154 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index 4643fe825..0982aa560 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -30,7 +30,7 @@ "@types/uuid": "^9.0.8", "@types/wellknown": "^0.5.8", "accept-language": "^3.0.18", - "ai": "^3.2.27", + "ai": "^3.2.35", "autoprefixer": "10.4.16", "bcrypt": "^5.1.1", "csv-parse": "^5.5.5", @@ -110,9 +110,9 @@ "dev": true }, "node_modules/@ai-sdk/provider": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-0.0.12.tgz", - "integrity": "sha512-oOwPQD8i2Ynpn22cur4sk26FW3mSy6t6/X/K1Ay2yGBKYiSpRyLfObhOrZEGsXDx+3euKy4nEZ193R36NM+tpQ==", + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-0.0.13.tgz", + "integrity": "sha512-RBstpG/3RqVBBJgTvjZpou/+1fNQMDIwB9enqQPXqr0MoCrJHscLD2Zsfr6cKM5HFfY1D4KhdSPTycCDebVGlQ==", "dependencies": { "json-schema": "0.4.0" }, @@ -121,11 +121,11 @@ } }, "node_modules/@ai-sdk/provider-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-1.0.2.tgz", - "integrity": "sha512-57f6O4OFVNEpI8Z8o+K40tIB3YQiTw+VCql/qrAO9Utq7Ti1o6+X9tvm177DlZJL7ft0Rwzvgy48S9YhrEKgmA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-1.0.4.tgz", + "integrity": "sha512-2TldHn54+HrvVHMCos9lrSMcDIp3cgnpphpYT/95RXcIzcGwAFM5MioDWnsrki3noplU5pVld6ylD3Vu/Xt3Vw==", "dependencies": { - "@ai-sdk/provider": "0.0.12", + "@ai-sdk/provider": "0.0.13", "eventsource-parser": "1.1.2", "nanoid": "3.3.6", "secure-json-parse": "2.7.0" @@ -160,13 +160,13 @@ } }, "node_modules/@ai-sdk/react": { - "version": "0.0.22", - "resolved": "https://registry.npmjs.org/@ai-sdk/react/-/react-0.0.22.tgz", - "integrity": "sha512-r84qhn08GHtVGjvbveMekP1CeXDs5sIrdDvMaoxhCL8o90HjYTWBSDywuRJU1Jk1uPE/BwZWQu9f5bqaIx6AgA==", + "version": "0.0.28", + "resolved": "https://registry.npmjs.org/@ai-sdk/react/-/react-0.0.28.tgz", + "integrity": "sha512-wOYtnXKGWjgO8jEX059GFAa8Jys2vrA8CUKxvfO1dD3GTyb7oiRZ9eVjtGEM5wQ2fepX2xIQj8oDxJh0EjKiNA==", "dependencies": { - "@ai-sdk/provider-utils": "1.0.2", - "@ai-sdk/ui-utils": "0.0.14", - "swr": "2.2.0" + "@ai-sdk/provider-utils": "1.0.4", + "@ai-sdk/ui-utils": "0.0.19", + "swr": "2.2.5" }, "engines": { "node": ">=18" @@ -185,11 +185,11 @@ } }, "node_modules/@ai-sdk/solid": { - "version": "0.0.16", - "resolved": "https://registry.npmjs.org/@ai-sdk/solid/-/solid-0.0.16.tgz", - "integrity": "sha512-rhBTHLY2fx+weF/vrNmYY8S+D6Gcni77YlDDq9kANpNycL99WQo1hRy9fVJ44ICMJCpVrY/kHIl3Jlumdy3oPw==", + "version": "0.0.21", + "resolved": "https://registry.npmjs.org/@ai-sdk/solid/-/solid-0.0.21.tgz", + "integrity": "sha512-5uF4AGy2jk9j8sMu2cebfWregaXiebV1N/l/5wGW01Y+7NvGNHUuVC/aSVcF5BvXGZiKjwkVvoU7h5VQIq+IZw==", "dependencies": { - "@ai-sdk/ui-utils": "0.0.14" + "@ai-sdk/ui-utils": "0.0.19" }, "engines": { "node": ">=18" @@ -204,12 +204,12 @@ } }, "node_modules/@ai-sdk/svelte": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@ai-sdk/svelte/-/svelte-0.0.17.tgz", - "integrity": "sha512-dkN8tTMNq7U4Ya02aKd1nH2gZLj0BdleuSY6PAeIQ3huo2Z8Ixgf90ZdnWEf1BSUtdIuXwkkVz6gn+jbh3IbQQ==", + "version": "0.0.22", + "resolved": "https://registry.npmjs.org/@ai-sdk/svelte/-/svelte-0.0.22.tgz", + "integrity": "sha512-ij5rNA+QSSstcOit+p5EWvyujz368u73K6QrwCpMPMEUNoyxJbazVdU79PlMviFHRsrjA9I7WmEDIXH/YBKZCQ==", "dependencies": { - "@ai-sdk/provider-utils": "1.0.2", - "@ai-sdk/ui-utils": "0.0.14", + "@ai-sdk/provider-utils": "1.0.4", + "@ai-sdk/ui-utils": "0.0.19", "sswr": "2.1.0" }, "engines": { @@ -225,11 +225,11 @@ } }, "node_modules/@ai-sdk/ui-utils": { - "version": "0.0.14", - "resolved": "https://registry.npmjs.org/@ai-sdk/ui-utils/-/ui-utils-0.0.14.tgz", - "integrity": "sha512-mm9jAkdZW+UTrSLMGwRcT7o8pHGO7Z5FmmLC0B1NH7BRzLfh1/t0ZuF1U6T7GQbmRQXwQUWjdjnlpY83kc62zw==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@ai-sdk/ui-utils/-/ui-utils-0.0.19.tgz", + "integrity": "sha512-nLCUNoQ4hY+v/5pMLz7mIe8ZUW6tR644Zaqh9gg8ScKVfc3EMvyxJ/AoAjcgD00iXOmbT1/xTsF6TkXRGExZ1Q==", "dependencies": { - "@ai-sdk/provider-utils": "1.0.2", + "@ai-sdk/provider-utils": "1.0.4", "secure-json-parse": "2.7.0" }, "engines": { @@ -245,12 +245,12 @@ } }, "node_modules/@ai-sdk/vue": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@ai-sdk/vue/-/vue-0.0.17.tgz", - "integrity": "sha512-DoWimMtYNQbqaZZZT00NlfR/G/hEMZLwOZLC58Jp0iIxagJnAcamMJlS1rSR4+vd2UWNk4iPdgsMFdkpDvD9aA==", + "version": "0.0.23", + "resolved": "https://registry.npmjs.org/@ai-sdk/vue/-/vue-0.0.23.tgz", + "integrity": "sha512-01zCo6mJJSPwDYjjUvSqWebGAjqUNOb6qzd/ZVPB77mW2XEYVXxBoOSBv5ARPIH3cRwovj7YQVvgh9oKGgE+3A==", "dependencies": { - "@ai-sdk/provider-utils": "0.0.14", - "@ai-sdk/ui-utils": "0.0.14", + "@ai-sdk/provider-utils": "1.0.4", + "@ai-sdk/ui-utils": "0.0.19", "swrv": "1.0.4" }, "engines": { @@ -265,56 +265,6 @@ } } }, - "node_modules/@ai-sdk/vue/node_modules/@ai-sdk/provider": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-0.0.10.tgz", - "integrity": "sha512-NzkrtREQpHID1cTqY/C4CI30PVOaXWKYytDR2EcytmFgnP7Z6+CrGIA/YCnNhYAuUm6Nx+nGpRL/Hmyrv7NYzg==", - "dependencies": { - "json-schema": "0.4.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@ai-sdk/vue/node_modules/@ai-sdk/provider-utils": { - "version": "0.0.14", - "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-0.0.14.tgz", - "integrity": "sha512-PCQFN3MlC6DShS/81IFU9NVvt9OekQGiZTEowRc2AwAwWrDsv7er3UkcMswFAL/Z7xZKjgu0dZTNH1z9oUlo7A==", - "dependencies": { - "@ai-sdk/provider": "0.0.10", - "eventsource-parser": "1.1.2", - "nanoid": "3.3.6", - "secure-json-parse": "2.7.0" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "zod": "^3.0.0" - }, - "peerDependenciesMeta": { - "zod": { - "optional": true - } - } - }, - "node_modules/@ai-sdk/vue/node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -11609,13 +11559,13 @@ "dev": true }, "node_modules/@vue/compiler-core": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.32.tgz", - "integrity": "sha512-8tCVWkkLe/QCWIsrIvExUGnhYCAOroUs5dzhSoKL5w4MJS8uIYiou+pOPSVIOALOQ80B0jBs+Ri+kd5+MBnCDw==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.34.tgz", + "integrity": "sha512-Z0izUf32+wAnQewjHu+pQf1yw00EGOmevl1kE+ljjjMe7oEfpQ+BI3/JNK7yMB4IrUsqLDmPecUrpj3mCP+yJQ==", "peer": true, "dependencies": { "@babel/parser": "^7.24.7", - "@vue/shared": "3.4.32", + "@vue/shared": "3.4.34", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.0" @@ -11637,26 +11587,26 @@ } }, "node_modules/@vue/compiler-dom": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.32.tgz", - "integrity": "sha512-PbSgt9KuYo4fyb90dynuPc0XFTfFPs3sCTbPLOLlo+PrUESW1gn/NjSsUvhR+mI2AmmEzexwYMxbHDldxSOr2A==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.34.tgz", + "integrity": "sha512-3PUOTS1h5cskdOJMExCu2TInXuM0j60DRPpSCJDqOCupCfUZCJoyQmKtRmA8EgDNZ5kcEE7vketamRZfrEuVDw==", "peer": true, "dependencies": { - "@vue/compiler-core": "3.4.32", - "@vue/shared": "3.4.32" + "@vue/compiler-core": "3.4.34", + "@vue/shared": "3.4.34" } }, "node_modules/@vue/compiler-sfc": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.32.tgz", - "integrity": "sha512-STy9im/WHfaguJnfKjjVpMHukxHUrOKjm2vVCxiojQJyo3Sb6Os8SMXBr/MI+ekpstEGkDONfqAQoSbZhspLYw==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.34.tgz", + "integrity": "sha512-x6lm0UrM03jjDXTPZgD9Ad8bIVD1ifWNit2EaWQIZB5CULr46+FbLQ5RpK7AXtDHGjx9rmvC7QRCTjsiGkAwRw==", "peer": true, "dependencies": { "@babel/parser": "^7.24.7", - "@vue/compiler-core": "3.4.32", - "@vue/compiler-dom": "3.4.32", - "@vue/compiler-ssr": "3.4.32", - "@vue/shared": "3.4.32", + "@vue/compiler-core": "3.4.34", + "@vue/compiler-dom": "3.4.34", + "@vue/compiler-ssr": "3.4.34", + "@vue/shared": "3.4.34", "estree-walker": "^2.0.2", "magic-string": "^0.30.10", "postcss": "^8.4.39", @@ -11670,9 +11620,9 @@ "peer": true }, "node_modules/@vue/compiler-sfc/node_modules/postcss": { - "version": "8.4.39", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.39.tgz", - "integrity": "sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==", + "version": "8.4.40", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz", + "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", "funding": [ { "type": "opencollective", @@ -11707,63 +11657,63 @@ } }, "node_modules/@vue/compiler-ssr": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.32.tgz", - "integrity": "sha512-nyu/txTecF6DrxLrpLcI34xutrvZPtHPBj9yRoPxstIquxeeyywXpYZrQMsIeDfBhlw1abJb9CbbyZvDw2kjdg==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.34.tgz", + "integrity": "sha512-8TDBcLaTrFm5rnF+Qm4BlliaopJgqJ28Nsrc80qazynm5aJO+Emu7y0RWw34L8dNnTRdcVBpWzJxhGYzsoVu4g==", "peer": true, "dependencies": { - "@vue/compiler-dom": "3.4.32", - "@vue/shared": "3.4.32" + "@vue/compiler-dom": "3.4.34", + "@vue/shared": "3.4.34" } }, "node_modules/@vue/reactivity": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.32.tgz", - "integrity": "sha512-1P7QvghAzhSIWmiNmh4MNkLVjr2QTNDcFv2sKmytEWhR6t7BZzNicgm5ENER4uU++wbWxgRh/pSEYgdI3MDcvg==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.34.tgz", + "integrity": "sha512-ua+Lo+wBRlBEX9TtgPOShE2JwIO7p6BTZ7t1KZVPoaBRfqbC7N3c8Mpzicx173fXxx5VXeU6ykiHo7WgLzJQDA==", "peer": true, "dependencies": { - "@vue/shared": "3.4.32" + "@vue/shared": "3.4.34" } }, "node_modules/@vue/runtime-core": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.32.tgz", - "integrity": "sha512-FxT2dTHUs1Hki8Ui/B1Hu339mx4H5kRJooqrNM32tGUHBPStJxwMzLIRbeGO/B1NMplU4Pg9fwOqrJtrOzkdfA==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.34.tgz", + "integrity": "sha512-PXhkiRPwcPGJ1BnyBZFI96GfInCVskd0HPNIAZn7i3YOmLbtbTZpB7/kDTwC1W7IqdGPkTVC63IS7J2nZs4Ebg==", "peer": true, "dependencies": { - "@vue/reactivity": "3.4.32", - "@vue/shared": "3.4.32" + "@vue/reactivity": "3.4.34", + "@vue/shared": "3.4.34" } }, "node_modules/@vue/runtime-dom": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.32.tgz", - "integrity": "sha512-Xz9G+ZViRyPFQtRBCPFkhMzKn454ihCPMKUiacNaUhuTIXvyfkAq8l89IZ/kegFVyw/7KkJGRGqYdEZrf27Xsg==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.34.tgz", + "integrity": "sha512-dXqIe+RqFAK2Euak4UsvbIupalrhc67OuQKpD7HJ3W2fv8jlqvI7szfBCsAEcE8o/wyNpkloxB6J8viuF/E3gw==", "peer": true, "dependencies": { - "@vue/reactivity": "3.4.32", - "@vue/runtime-core": "3.4.32", - "@vue/shared": "3.4.32", + "@vue/reactivity": "3.4.34", + "@vue/runtime-core": "3.4.34", + "@vue/shared": "3.4.34", "csstype": "^3.1.3" } }, "node_modules/@vue/server-renderer": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.32.tgz", - "integrity": "sha512-3c4rd0522Ao8hKjzgmUAbcjv2mBnvnw0Ld2f8HOMCuWJZjYie/p8cpIoYJbeP0VV2JYmrJJMwGQDO5RH4iQ30A==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.34.tgz", + "integrity": "sha512-GeyEUfMVRZMD/mZcNONEqg7MiU10QQ1DB3O/Qr6+8uXpbwdlmVgQ5Qs1/ZUAFX1X2UUtqMoGrDRbxdWfOJFT7Q==", "peer": true, "dependencies": { - "@vue/compiler-ssr": "3.4.32", - "@vue/shared": "3.4.32" + "@vue/compiler-ssr": "3.4.34", + "@vue/shared": "3.4.34" }, "peerDependencies": { - "vue": "3.4.32" + "vue": "3.4.34" } }, "node_modules/@vue/shared": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.32.tgz", - "integrity": "sha512-ep4mF1IVnX/pYaNwxwOpJHyBtOMKWoKZMbnUyd+z0udqIxLUh7YCCd/JfDna8aUrmnG9SFORyIq2HzEATRrQsg==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.34.tgz", + "integrity": "sha512-x5LmiRLpRsd9KTjAB8MPKf0CDPMcuItjP0gbNqFCIgL1I8iYp4zglhj9w9FPCdIbHG2M91RVeIbArFfFTz9I3A==", "peer": true }, "node_modules/@webassemblyjs/ast": { @@ -12107,24 +12057,23 @@ } }, "node_modules/ai": { - "version": "3.2.27", - "resolved": "https://registry.npmjs.org/ai/-/ai-3.2.27.tgz", - "integrity": "sha512-J0SCozj1c8ZTprYVAH3LL1XYR5TRT6oGsXZ5leSqXeEo1SWBx6rFEqDKZLFskLvOf3Ta/AG6EDDrP1EErwapMQ==", - "dependencies": { - "@ai-sdk/provider": "0.0.12", - "@ai-sdk/provider-utils": "1.0.2", - "@ai-sdk/react": "0.0.22", - "@ai-sdk/solid": "0.0.16", - "@ai-sdk/svelte": "0.0.17", - "@ai-sdk/ui-utils": "0.0.14", - "@ai-sdk/vue": "0.0.17", + "version": "3.2.35", + "resolved": "https://registry.npmjs.org/ai/-/ai-3.2.35.tgz", + "integrity": "sha512-H4/gAuum6kL4NP22ZoBPKzp9/uCLUUW6r6L0+ll1WihgbNBUhH2ahxDG+y4p7H7DJOEoUwHlqQ9u/1evPxXtDQ==", + "dependencies": { + "@ai-sdk/provider": "0.0.13", + "@ai-sdk/provider-utils": "1.0.4", + "@ai-sdk/react": "0.0.28", + "@ai-sdk/solid": "0.0.21", + "@ai-sdk/svelte": "0.0.22", + "@ai-sdk/ui-utils": "0.0.19", + "@ai-sdk/vue": "0.0.23", "@opentelemetry/api": "1.9.0", "eventsource-parser": "1.1.2", "json-schema": "0.4.0", "jsondiffpatch": "0.6.0", "nanoid": "3.3.6", "secure-json-parse": "2.7.0", - "sswr": "2.1.0", "zod-to-json-schema": "3.22.5" }, "engines": { @@ -12133,6 +12082,7 @@ "peerDependencies": { "openai": "^4.42.0", "react": "^18 || ^19", + "sswr": "^2.1.0", "svelte": "^3.0.0 || ^4.0.0", "zod": "^3.0.0" }, @@ -12143,6 +12093,9 @@ "react": { "optional": true }, + "sswr": { + "optional": true + }, "svelte": { "optional": true }, @@ -26251,10 +26204,11 @@ } }, "node_modules/swr": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/swr/-/swr-2.2.0.tgz", - "integrity": "sha512-AjqHOv2lAhkuUdIiBu9xbuettzAzWXmCEcLONNKJRba87WAefz8Ca9d6ds/SzrPc235n1IxWYdhJ2zF3MNUaoQ==", + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/swr/-/swr-2.2.5.tgz", + "integrity": "sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg==", "dependencies": { + "client-only": "^0.0.1", "use-sync-external-store": "^1.2.0" }, "peerDependencies": { @@ -27943,16 +27897,16 @@ } }, "node_modules/vue": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.32.tgz", - "integrity": "sha512-9mCGIAi/CAq7GtaLLLp2J92pEic+HArstG+pq6F+H7+/jB9a0Z7576n4Bh4k79/50L1cKMIhZC3MC0iGpl+1IA==", + "version": "3.4.34", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.34.tgz", + "integrity": "sha512-VZze05HWlA3ItreQ/ka7Sx7PoD0/3St8FEiSlSTVgb6l4hL+RjtP2/8g5WQBzZgyf8WG2f+g1bXzC7zggLhAJA==", "peer": true, "dependencies": { - "@vue/compiler-dom": "3.4.32", - "@vue/compiler-sfc": "3.4.32", - "@vue/runtime-dom": "3.4.32", - "@vue/server-renderer": "3.4.32", - "@vue/shared": "3.4.32" + "@vue/compiler-dom": "3.4.34", + "@vue/compiler-sfc": "3.4.34", + "@vue/runtime-dom": "3.4.34", + "@vue/server-renderer": "3.4.34", + "@vue/shared": "3.4.34" }, "peerDependencies": { "typescript": "*" diff --git a/app/package.json b/app/package.json index b28420c26..7e3a8037a 100644 --- a/app/package.json +++ b/app/package.json @@ -51,7 +51,7 @@ "@types/uuid": "^9.0.8", "@types/wellknown": "^0.5.8", "accept-language": "^3.0.18", - "ai": "^3.2.27", + "ai": "^3.2.35", "autoprefixer": "10.4.16", "bcrypt": "^5.1.1", "csv-parse": "^5.5.5", From 8073382b512960226637c87174c7065fb5c2ff34 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 25 Jul 2024 18:12:32 +0200 Subject: [PATCH 022/128] WIP: added useAssistant hook to frontend, refined apis --- app/src/app/api/v0/assistants/route.ts | 2 +- .../threads/[threadId]/messages/route.ts | 37 ++++++++++++----- app/src/components/ChatBot/chat-bot.tsx | 40 ++++++++++++------- app/src/components/ChatBot/chat-popover.tsx | 6 ++- 4 files changed, 58 insertions(+), 27 deletions(-) diff --git a/app/src/app/api/v0/assistants/route.ts b/app/src/app/api/v0/assistants/route.ts index b5fcfbd74..f2131bf6e 100644 --- a/app/src/app/api/v0/assistants/route.ts +++ b/app/src/app/api/v0/assistants/route.ts @@ -8,7 +8,7 @@ export const POST = apiHandler(async () => { return NextResponse.json({ error: "Method Not Allowed", status: 405 }); const userID = "id_123456"; // TODO: Get userID - const systemPrompt = `You are CLIMA, a climate assistant for creating + const systemPrompt = `Your name is CLIMA and you are a climate assistant for creating 'Global Protocol for Community-Scale (GPC) Greenhouse Gas (GHG) Inventories' using CityCatalyst, an open source tool for creating climate inventories by Open Earth Foundation. You try to be as helpful as possible when answering the user\'s questions about their inventory diff --git a/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts b/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts index d6b806d4c..8f9df6b63 100644 --- a/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts +++ b/app/src/app/api/v0/assistants/threads/[threadId]/messages/route.ts @@ -1,28 +1,45 @@ import { apiHandler } from "@/util/api"; import { openai } from "@/util/openai"; import { NextResponse } from "next/server"; +import { AssistantStream } from "openai/lib/AssistantStream"; const assistantId = process.env.OPENAI_ASSISTANT_ID as string; +const handleReadableStream = (stream: AssistantStream) => { + // Messages + stream.on("textCreated", () => console.log("Created")); + stream.on("textDelta", (delta) => console.log(delta.value)); + + // Events without helpers yet (e.g. requires_action and run.done) + // stream.on("event", (event) => { + // if (event.event === "thread.run.requires_action") console.log(event); + // if (event.event === "thread.run.completed") console.log(event); + // }); +}; + // Send a new message to a thread export const POST = apiHandler(async (req, { params: { threadId } }) => { const { content } = await req.json(); + // Create a message on the thread + await openai.beta.threads.messages.create(threadId, { + role: "user", + content: `###### CONTEXT ###### + + ###### END OF CONTEXT ######`, + }); + await openai.beta.threads.messages.create(threadId, { role: "user", content: content, }); - const stream = openai.beta.threads.runs - .stream(threadId, { - assistant_id: assistantId, - }) - .on("textCreated", () => process.stdout.write("\nassistant > ")) - .on("textDelta", (textDelta) => { - if (typeof textDelta.value === "string") { - process.stdout.write(textDelta.value); - } - }); + // Run the thread with streaming output + const stream = openai.beta.threads.runs.stream(threadId, { + assistant_id: assistantId, + }); + + handleReadableStream(stream); return new NextResponse(stream.toReadableStream()); }); diff --git a/app/src/components/ChatBot/chat-bot.tsx b/app/src/components/ChatBot/chat-bot.tsx index c5e58f35d..395efa0c6 100644 --- a/app/src/components/ChatBot/chat-bot.tsx +++ b/app/src/components/ChatBot/chat-bot.tsx @@ -12,7 +12,8 @@ import { Text, Textarea, } from "@chakra-ui/react"; -import { useChat } from "ai/react"; +// import { useChat } from "ai/react"; +import { useAssistant } from 'ai/react' import { TFunction } from "i18next"; import { BsStars } from "react-icons/bs"; import { @@ -31,7 +32,6 @@ function useEnterSubmit(): { onKeyDown: (event: React.KeyboardEvent) => void; } { const formRef = useRef(null); - const handleKeyDown = ( event: React.KeyboardEvent, ): void => { @@ -52,26 +52,36 @@ export default function ChatBot({ inputRef, t, inventoryId, + threadId, }: { userName?: string; inputRef?: React.Ref; t: TFunction; inventoryId: string; + threadId: string }) { const { messages, input, - handleInputChange, - handleSubmit, - isLoading, + handleInputChange,// had to change handleSubmit to handleInputChange + // handleSubmit, + submitMessage, + // isLoading, append, - reload, - } = useChat({ - api: `/api/v0/chat/${inventoryId}`, - initialMessages: [ - { id: "-1", content: t("initial-message"), role: "assistant" }, - ], - }); + // reload, + } = useAssistant({ + api: `/api/v0/assistants/threads/${threadId}/messages`, + threadId: threadId, + // body: { + // content: "I am a pirate" + // } + }) + // } = useChat({ + // api: `/api/v0/chat/${inventoryId}`, + // initialMessages: [ + // { id: "-1", content: t("initial-message"), role: "assistant" }, + // ], + // }); const { copyToClipboard, isCopied } = useCopyToClipboard({}); const { formRef, onKeyDown } = useEnterSubmit(); const messagesWrapperRef = useRef(null); @@ -163,7 +173,7 @@ export default function ChatBot({ /> + */} )} @@ -197,7 +222,7 @@ export default function ChatBot({ ); })} diff --git a/app/src/components/ChatBot/chat-popover.tsx b/app/src/components/ChatBot/chat-popover.tsx index 7da746d61..776918151 100644 --- a/app/src/components/ChatBot/chat-popover.tsx +++ b/app/src/components/ChatBot/chat-popover.tsx @@ -16,10 +16,6 @@ import { BsStars } from "react-icons/bs"; import ChatBot from "./chat-bot"; import { useTranslation } from "@/i18n/client"; -// TODO: Hard coded threadID, exchange with threadId retrieved from API call -// app\src\app\api\v0\assistants\threads\route.ts -const threadId = "thread_9s7HTj5S6beeUOJWFBqP21Xq" - export default function ChatPopover({ lng = "en", inventoryId, @@ -79,7 +75,7 @@ export default function ChatPopover({ /> - + From c4c0336a984a2a7f1d67ca0401d7f6946e8a3b55 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 07:05:54 +0000 Subject: [PATCH 028/128] chore(deps): bump osmnx from 1.9.3 to 1.9.4 in /global-api Bumps [osmnx](https://github.com/gboeing/osmnx) from 1.9.3 to 1.9.4. - [Changelog](https://github.com/gboeing/osmnx/blob/main/CHANGELOG.md) - [Commits](https://github.com/gboeing/osmnx/compare/v1.9.3...v1.9.4) --- updated-dependencies: - dependency-name: osmnx dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- global-api/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global-api/requirements.txt b/global-api/requirements.txt index c84568bed..e3b79bb07 100644 --- a/global-api/requirements.txt +++ b/global-api/requirements.txt @@ -6,7 +6,7 @@ flake8==7.1.0 fsspec==2024.* geopandas==1.0.1 mypy==1.11.0 -osmnx==1.9.3 +osmnx==1.9.4 pandas==2.2.2 psycopg2-binary==2.9.9 pydantic-settings==2.* From f8bd83c5a0c8917ea704e0e65b4474201dc86aae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 07:05:58 +0000 Subject: [PATCH 029/128] chore(deps): bump uvicorn from 0.30.1 to 0.30.3 in /global-api Bumps [uvicorn](https://github.com/encode/uvicorn) from 0.30.1 to 0.30.3. - [Release notes](https://github.com/encode/uvicorn/releases) - [Changelog](https://github.com/encode/uvicorn/blob/master/CHANGELOG.md) - [Commits](https://github.com/encode/uvicorn/compare/0.30.1...0.30.3) --- updated-dependencies: - dependency-name: uvicorn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- global-api/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global-api/requirements.txt b/global-api/requirements.txt index c84568bed..d0ce835e5 100644 --- a/global-api/requirements.txt +++ b/global-api/requirements.txt @@ -16,7 +16,7 @@ scipy==1.14.* shapely==2.0.5 SQLAlchemy==2.0.31 tqdm==4.66.* -uvicorn==0.30.1 +uvicorn==0.30.3 xarray==2024.* geojson==3.1.* openclimate==0.1.* From e8d010e2b1bfc25d75f995ad1ed7e67ddaa22588 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 07:06:05 +0000 Subject: [PATCH 030/128] chore(deps): bump pytest from 8.2.2 to 8.3.2 in /global-api Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.2.2 to 8.3.2. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.2.2...8.3.2) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- global-api/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global-api/requirements.txt b/global-api/requirements.txt index c84568bed..bf5202c59 100644 --- a/global-api/requirements.txt +++ b/global-api/requirements.txt @@ -10,7 +10,7 @@ osmnx==1.9.3 pandas==2.2.2 psycopg2-binary==2.9.9 pydantic-settings==2.* -pytest==8.2.2 +pytest==8.3.2 rioxarray==0.17.* scipy==1.14.* shapely==2.0.5 @@ -24,7 +24,7 @@ nest_asyncio==1.6.* xlrd==2.0.* dns-cache==0.3.* openpyxl==3.1.* -pytest==8.2.2 +pytest==8.3.2 pytest-cov==5.0.0 httpx==0.27.0 pyproj==3.6.* \ No newline at end of file From 9bb7d385e64efa3864245271a6d3c44c8e89911c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 07:12:48 +0000 Subject: [PATCH 031/128] chore(deps): bump react-redux from 9.1.1 to 9.1.2 in /app Bumps [react-redux](https://github.com/reduxjs/react-redux) from 9.1.1 to 9.1.2. - [Release notes](https://github.com/reduxjs/react-redux/releases) - [Changelog](https://github.com/reduxjs/react-redux/blob/master/CHANGELOG.md) - [Commits](https://github.com/reduxjs/react-redux/compare/v9.1.1...v9.1.2) --- updated-dependencies: - dependency-name: react-redux dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- app/package-lock.json | 12 ++++-------- app/package.json | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index bdb4cafa5..5cd197e7c 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -65,7 +65,7 @@ "react-i18next": "^14.1.2", "react-icons": "^5.1.0", "react-intersection-observer": "^9.8.2", - "react-redux": "^9.1.1", + "react-redux": "^9.1.2", "redux-persist": "^6.0.0", "sequelize": "^6.37.3", "sequelize-cli": "^6.6.2", @@ -23741,9 +23741,9 @@ "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==" }, "node_modules/react-redux": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.1.tgz", - "integrity": "sha512-5ynfGDzxxsoV73+4czQM56qF43vsmgJsO22rmAvU5tZT2z5Xow/A2uhhxwXuGTxgdReF3zcp7A80gma2onRs1A==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.2.tgz", + "integrity": "sha512-0OA4dhM1W48l3uzmv6B7TXPCGmokUU4p1M44DGN2/D9a1FjVPukVjER1PcPX97jIg6aUeLq1XJo1IpfbgULn0w==", "dependencies": { "@types/use-sync-external-store": "^0.0.3", "use-sync-external-store": "^1.0.0" @@ -23751,16 +23751,12 @@ "peerDependencies": { "@types/react": "^18.2.25", "react": "^18.0", - "react-native": ">=0.69", "redux": "^5.0.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true }, - "react-native": { - "optional": true - }, "redux": { "optional": true } diff --git a/app/package.json b/app/package.json index d9aaae882..d146b239a 100644 --- a/app/package.json +++ b/app/package.json @@ -86,7 +86,7 @@ "react-i18next": "^14.1.2", "react-icons": "^5.1.0", "react-intersection-observer": "^9.8.2", - "react-redux": "^9.1.1", + "react-redux": "^9.1.2", "redux-persist": "^6.0.0", "sequelize": "^6.37.3", "sequelize-cli": "^6.6.2", From 045eeb7dcf4261fd30b4bba0628960d04903aff1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 07:12:59 +0000 Subject: [PATCH 032/128] chore(deps): bump @reduxjs/toolkit from 2.2.3 to 2.2.7 in /app Bumps [@reduxjs/toolkit](https://github.com/reduxjs/redux-toolkit) from 2.2.3 to 2.2.7. - [Release notes](https://github.com/reduxjs/redux-toolkit/releases) - [Commits](https://github.com/reduxjs/redux-toolkit/compare/v2.2.3...v2.2.7) --- updated-dependencies: - dependency-name: "@reduxjs/toolkit" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- app/package-lock.json | 10 +++++----- app/package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index bdb4cafa5..b52e1af1b 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -13,7 +13,7 @@ "@chakra-ui/react": "^2.8.2", "@huggingface/inference": "^2.8.0", "@react-email/components": "^0.0.19", - "@reduxjs/toolkit": "^2.2.3", + "@reduxjs/toolkit": "^2.2.7", "@storybook/cli": "^8.0.8", "@storybook/react": "^8.1.6", "@storybook/testing-library": "^0.2.2", @@ -6076,14 +6076,14 @@ } }, "node_modules/@reduxjs/toolkit": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.3.tgz", - "integrity": "sha512-76dll9EnJXg4EVcI5YNxZA/9hSAmZsFqzMmNRHvIlzw2WS/twfcVX3ysYrWGJMClwEmChQFC4yRq74tn6fdzRA==", + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.7.tgz", + "integrity": "sha512-faI3cZbSdFb8yv9dhDTmGwclW0vk0z5o1cia+kf7gCbaCwHI5e+7tP57mJUv22pNcNbeA62GSrPpfrUfdXcQ6g==", "dependencies": { "immer": "^10.0.3", "redux": "^5.0.1", "redux-thunk": "^3.1.0", - "reselect": "^5.0.1" + "reselect": "^5.1.0" }, "peerDependencies": { "react": "^16.9.0 || ^17.0.0 || ^18", diff --git a/app/package.json b/app/package.json index d9aaae882..f1b7e984c 100644 --- a/app/package.json +++ b/app/package.json @@ -34,7 +34,7 @@ "@chakra-ui/react": "^2.8.2", "@huggingface/inference": "^2.8.0", "@react-email/components": "^0.0.19", - "@reduxjs/toolkit": "^2.2.3", + "@reduxjs/toolkit": "^2.2.7", "@storybook/cli": "^8.0.8", "@storybook/react": "^8.1.6", "@storybook/testing-library": "^0.2.2", From 0f184028f7a4f00d43569af162c546d70c73d4d2 Mon Sep 17 00:00:00 2001 From: Cephas Chapa Date: Mon, 29 Jul 2024 13:58:45 +0200 Subject: [PATCH 033/128] fix(ui): adds addon options for emission factor values --- .../components/Modals/add-activity-modal.tsx | 13 ++++---- .../util/form-schema/sector-form-schema.json | 30 +++++++++++++++---- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/app/src/components/Modals/add-activity-modal.tsx b/app/src/components/Modals/add-activity-modal.tsx index 0ee176cde..85fc4c191 100644 --- a/app/src/components/Modals/add-activity-modal.tsx +++ b/app/src/components/Modals/add-activity-modal.tsx @@ -78,7 +78,6 @@ export type Inputs = { buildingType: string; fuelType: string; totalFuelConsumption: string; - formStruct: ActivityDataScope; }; direct: DirectMeasureData; subcategoryData: Record; @@ -458,10 +457,10 @@ const AddActivityModal: FC = ({ zIndex={10} {...register( ("activity." + - formInputs?.fields[4]?.name) as ActivityKey, + formInputs?.fields[4]?.addon.name) as ActivityKey, )} > - {formInputs?.fields[4].unit} + {formInputs?.fields[4].addon.unit} @@ -510,10 +509,10 @@ const AddActivityModal: FC = ({ zIndex={10} {...register( ("activity." + - formInputs?.fields[5].name) as ActivityKey, + formInputs?.fields[5].addon.name) as ActivityKey, )} > - {formInputs?.fields[5].unit} + {formInputs?.fields[5].addon.unit} @@ -562,10 +561,10 @@ const AddActivityModal: FC = ({ zIndex={10} {...register( ("activity." + - formInputs?.fields[6].name) as ActivityKey, + formInputs?.fields[6].addon.name) as ActivityKey, )} > - {formInputs?.fields[6].unit} + {formInputs?.fields[6].addon.unit} diff --git a/app/src/util/form-schema/sector-form-schema.json b/app/src/util/form-schema/sector-form-schema.json index ce56e4d3f..300d3f89e 100644 --- a/app/src/util/form-schema/sector-form-schema.json +++ b/app/src/util/form-schema/sector-form-schema.json @@ -58,19 +58,28 @@ "label": "CO2 emission factor", "type": "number", "name": "co2EmissionFactor", - "unit": "CO2/Gal" + "addon": { + "name": "co2EmissionFactorUnit", + "unit": "CO2/Gal" + } }, { "label": "N2O emission factor", "type": "number", "name": "n2oEmissionFactor", - "unit": "NO2/Gal" + "addon": { + "name": "n2oEmissionFactorUnit", + "unit": "NO2/Gal" + } }, { "label": "CH4 emission factor", "type": "number", "name": "ch4EmissionFactor", - "unit": "kg/Gal" + "addon": { + "name": "ch4EmissionFactorUnit", + "unit": "Kg/Gal" + } } ], @@ -137,19 +146,28 @@ "label": "CO2 emission factor", "type": "number", "name": "co2EmissionFactor", - "unit": "CO2/kWh" + "addon": { + "name": "co2EmissionFactorUnit", + "unit": "CO2/kWh" + } }, { "label": "N2O emission factor", "type": "number", "name": "n2oEmissionFactor", - "unit": "NO2/kWh" + "addon": { + "name": "n2oEmissionFactorUnit", + "unit": "NO2/kWh" + } }, { "label": "CH4 emission factor", "type": "number", "name": "ch4EmissionFactor", - "unit": "CH4/kWh" + "addon": { + "name": "ch4EmissionFactorUnit", + "unit": "CH4/kWh" + } }, { "label": "Data quality", From 2f02d304ff4f2cf4bcce140a83b18418f7cd48d1 Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Mon, 29 Jul 2024 09:59:37 -0300 Subject: [PATCH 034/128] fix: remove empty inventory string from request --- .gitignore | 3 +++ app/src/app/[lng]/auth/signup/page.tsx | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d7c001e11..a83733057 100644 --- a/.gitignore +++ b/.gitignore @@ -153,3 +153,6 @@ global-api/data/** #Python virtual env global-api/env + +#Intellij +/.idea/** diff --git a/app/src/app/[lng]/auth/signup/page.tsx b/app/src/app/[lng]/auth/signup/page.tsx index 14cfda1c1..e872f0c9b 100644 --- a/app/src/app/[lng]/auth/signup/page.tsx +++ b/app/src/app/[lng]/auth/signup/page.tsx @@ -23,6 +23,7 @@ import { Trans } from "react-i18next/TransWithoutContext"; import { logger } from "@/services/logger"; type Inputs = { + inventory?: string; name: string; email: string; password: string; @@ -78,10 +79,14 @@ export default function Signup({ return; } + if(inventoryId && inventoryId !== '') { + data.inventory = inventoryId + } + try { const res = await fetch("/api/v0/auth/register", { method: "POST", - body: JSON.stringify({ ...data, inventory: inventoryId }), + body: JSON.stringify(data), headers: { "Content-Type": "application/json", }, From 724156ec2b69fce84602676298325f3823b0661c Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Mon, 29 Jul 2024 10:11:01 -0300 Subject: [PATCH 035/128] fix: set "scaled sample data" as disabled ("coming soon") --- app/src/features/city/subsectorSlice.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/features/city/subsectorSlice.ts b/app/src/features/city/subsectorSlice.ts index d72d3193a..f18c97e90 100644 --- a/app/src/features/city/subsectorSlice.ts +++ b/app/src/features/city/subsectorSlice.ts @@ -42,7 +42,7 @@ const initialState = { methodologyName: 'Scaled sample data', description: 'Extrapolates emissions from a representative sample of buildings.', inputRequired: ["Sample fuel consumed amount", "Scaling data (population, GDP, area, etc.) for sample and city level"], - disabled: false, + disabled: true, },{ methodologyId: "3", @@ -70,7 +70,7 @@ const initialState = { methodologyName: 'Scaled sample data', description: 'Extrapolates emissions from a representative sample of buildings.', inputRequired: ["Sample fuel consumed amount", "Scaling data (population, GDP, area, etc.) for sample and city level"], - disabled: false, + disabled: true, },{ methodologyId: "3", From 3f70b085688f9fecae7f38a5224db968928d3085 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Mon, 29 Jul 2024 17:29:42 +0200 Subject: [PATCH 036/128] Implemented Assistant API, improved UI slightly (e.g. disabling buttons while LLM is processing) --- .../assistants/threads/[inventory]/route.ts | 11 ++-- .../v0/assistants/threads/messages/route.ts | 32 +++++++---- app/src/components/ChatBot/chat-bot.tsx | 57 +++++++++++-------- 3 files changed, 59 insertions(+), 41 deletions(-) diff --git a/app/src/app/api/v0/assistants/threads/[inventory]/route.ts b/app/src/app/api/v0/assistants/threads/[inventory]/route.ts index e4121c0e8..12025e86f 100644 --- a/app/src/app/api/v0/assistants/threads/[inventory]/route.ts +++ b/app/src/app/api/v0/assistants/threads/[inventory]/route.ts @@ -7,9 +7,7 @@ import { Inventory } from "@/models/Inventory"; import { PopulationEntry, findClosestYear } from "@/util/helpers"; import { PopulationAttributes } from "@/models/Population"; -// TODO: Add t object to new message below. - -function createPromptTemplate(inventory: Inventory): string { +function createContext(inventory: Inventory): string { const inventoryYear = inventory.dataValues.year; const countryPopulations = inventory.city.populations.filter( @@ -70,6 +68,7 @@ function createPromptTemplate(inventory: Inventory): string { } export const POST = apiHandler(async (req, { params, session }) => { + const { content } = await req.json(); const inventory = await UserService.findUserInventory( params.inventory, session, @@ -105,20 +104,20 @@ export const POST = apiHandler(async (req, { params, session }) => { ], ); - const prompt = createPromptTemplate(inventory); + const context = createContext(inventory); const thread = await openai.beta.threads.create(); // Add an optional context message on the thread await openai.beta.threads.messages.create(thread.id, { role: "user", - content: prompt, + content: context, }); // Add custom initial message to newly created thread. await openai.beta.threads.messages.create(thread.id, { role: "assistant", - content: "Hello! I am CLIMA", + content: content, }); return NextResponse.json({ threadId: thread.id }); diff --git a/app/src/app/api/v0/assistants/threads/messages/route.ts b/app/src/app/api/v0/assistants/threads/messages/route.ts index 8ab4bb2e1..d600b6da1 100644 --- a/app/src/app/api/v0/assistants/threads/messages/route.ts +++ b/app/src/app/api/v0/assistants/threads/messages/route.ts @@ -1,16 +1,29 @@ import { apiHandler } from "@/util/api"; import { openai } from "@/util/openai"; -// import { NextResponse } from "next/server"; -// import { AssistantStream } from "openai/lib/AssistantStream"; +import { AssistantStream } from "openai/lib/AssistantStream"; import { AssistantResponse } from "ai"; const assistantId = process.env.OPENAI_ASSISTANT_ID as string; -// const handleReadableStream = (stream: AssistantStream) => { -// // Messages -// stream.on("textCreated", () => console.log("Created")); -// stream.on("textDelta", (delta) => console.log(delta.value)); -// }; +// Helper function for debugging +// Extracting tokens, looking into events, ... +const handleReadableStream = (stream: AssistantStream): AssistantStream => { + // stream.on("textCreated", () => console.log("Created")); + stream.on("textDelta", async (delta) => { + // Make sure token has annotation value + if (delta.annotations !== undefined && delta.annotations.length > 0) { + console.log(delta.value); + console.log(delta.annotations); + // Token can have only one annotation + const file_id = delta.annotations[0].file_citation.file_id; + + const citedFile = await openai.files.retrieve(file_id); + console.log(citedFile.filename); + } + }); + + return stream; +}; // Send a new message to a thread export const POST = apiHandler(async (req) => { @@ -32,13 +45,10 @@ export const POST = apiHandler(async (req) => { assistant_id: assistantId, }); - // handleReadableStream(stream); - return AssistantResponse( { threadId, messageId: createdMessage.id }, async ({ forwardStream, sendDataMessage }) => { - // forward run status would stream message deltas - let runStream = await forwardStream(stream); + let runStream = await forwardStream(handleReadableStream(stream)); }, ); }); diff --git a/app/src/components/ChatBot/chat-bot.tsx b/app/src/components/ChatBot/chat-bot.tsx index 3cba1d9f7..029f912ba 100644 --- a/app/src/components/ChatBot/chat-bot.tsx +++ b/app/src/components/ChatBot/chat-bot.tsx @@ -62,54 +62,60 @@ export default function ChatBot({ const [threadId, setthreadId] = useState(""); + // Creating the thread id for the given inventory on initial render + // Passing the initial message to api to be set in thread useEffect(() => { const fetchData = async () => { try { - const response = await fetch(`/api/v0/assistants/threads/${inventoryId}`, { method: "POST" }); + const response = await fetch(`/api/v0/assistants/threads/${inventoryId}`, { + method: "POST", + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + content: t("initial-message") + }) + }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); - console.log('API Response:', data.threadId); setthreadId(data.threadId) - // Handle your response data here } catch (error) { console.error('API Call Failed:', error); - // Handle error here, maybe update state with the error, and reflect it in the UI + // Handle error here } }; fetchData(); - }, []); // Empty dependency array means this effect runs only once - - console.log("threadId") - console.log(threadId) + }, []); // Empty dependency array means this effect runs only once, + // HOWEVER currently it always runs twiche const { status, - messages, input, - submitMessage, // had to change handleSubmit to submitMessage + messages, + submitMessage, + setMessages, handleInputChange, - // isLoading, // does not exist in useAssistant append, - // reload, // does not exist in useAssistant } = useAssistant({ - // api: `/api/v0/assistants/threads/${threadId}/messages`, api: `/api/v0/assistants/threads/messages`, threadId: threadId, }) - console.log(threadId) - console.log(status) - console.log(messages) + // Setting the initial message to display for the user + // This message will not be passed to the assistant api + // It will be set additionally when creating the threadId + // to pass to the assistant api + useEffect(() => { + setMessages([{ + id: "-1", + role: "assistant", + content: t("initial-message"), + }]) + }, []) - // } = useChat({ - // api: `/api/v0/chat/${inventoryId}`, - // initialMessages: [ - // { id: "-1", content: t("initial-message"), role: "assistant" }, - // ], - // }); const { copyToClipboard, isCopied } = useCopyToClipboard({}); const { formRef, onKeyDown } = useEnterSubmit(); const messagesWrapperRef = useRef(null); @@ -171,7 +177,7 @@ export default function ChatBot({ <> - } aria-label="Vote good" @@ -182,7 +188,7 @@ export default function ChatBot({ icon={} aria-label="Vote bad" color="content.tertiary" - /> + /> */} copyToClipboard(m.content)} variant="ghost" @@ -251,6 +257,7 @@ export default function ChatBot({ fontWeight="400" whiteSpace="nowrap" display="inline-block" + isDisabled={status==="in_progress"} > {suggestion.preview} @@ -280,6 +287,8 @@ export default function ChatBot({ icon={} color="content.tertiary" aria-label="Send message" + disabled={true} + isDisabled={status==="in_progress"} /> From 7fa75a0c48441aebe5cc9bb72a564c51e4df3143 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Mon, 29 Jul 2024 18:17:05 +0200 Subject: [PATCH 037/128] removed console.logs --- app/src/app/api/v0/assistants/threads/messages/route.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/app/api/v0/assistants/threads/messages/route.ts b/app/src/app/api/v0/assistants/threads/messages/route.ts index d600b6da1..ecc20ec41 100644 --- a/app/src/app/api/v0/assistants/threads/messages/route.ts +++ b/app/src/app/api/v0/assistants/threads/messages/route.ts @@ -12,13 +12,13 @@ const handleReadableStream = (stream: AssistantStream): AssistantStream => { stream.on("textDelta", async (delta) => { // Make sure token has annotation value if (delta.annotations !== undefined && delta.annotations.length > 0) { - console.log(delta.value); - console.log(delta.annotations); + // console.log(delta.value); + // console.log(delta.annotations); // Token can have only one annotation const file_id = delta.annotations[0].file_citation.file_id; const citedFile = await openai.files.retrieve(file_id); - console.log(citedFile.filename); + // console.log(citedFile.filename); } }); From b49e5e6649c5a212e18903fd0e23c506d7f16c35 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 29 Jul 2024 14:56:42 -0400 Subject: [PATCH 038/128] feat: add more subsectors --- .../form-schema/manual-input-hierarchy.json | 164 ++++++++++++++++-- 1 file changed, 148 insertions(+), 16 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index bd8c719fe..47cbcb17c 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -49,12 +49,28 @@ ] }, { - "id": "direct-measurement-commercial-buildings-methodology", + "id": "scaled-sample-fuel-combustion-commercial-buildings-methodology", + "implemented": false + }, + { + "id": "modeled-data-fuel-consumption-commercial-buildings-methodology", + "implemented": false + } + ] + }, + "I.2.2": { + "methodologies": [ + { + "id": "energy-consumption-commercial-buildings-methodology", "activities": [ { - "id": "direct-measurement-commercial-buildings-activity", - "unique-by": ["commercial-building-type"], - "activity-title": "activity-emissions", + "id": "energy-consumption-commercial-buildings-activity", + "unique-by": [ + "commercial-building-type", + "commercial-building-energy-usage", + "commercial-buildings-energy-source" + ], + "activity-title": "activity-energy-consumption", "minimum": 1, "extra-fields": [ { @@ -69,24 +85,38 @@ "exclusive": "commercial-building-type-all" }, { - "id": "commercial-building-co2", - "type": "number", - "units": ["units-tons"] - }, - { - "id": "commercial-building-ch4", - "type": "number", - "units": ["units-tons"] + "id": "commercial-building-energy-usage", + "options": [ + "commercial-building-energy-usage-all", + "commercial-building-energy-usage-electricity", + "commercial-building-energy-usage-electricity-chp", + "commercial-building-energy-usage-heating", + "commercial-building-energy-usage-heating-chp", + "commercial-building-energy-usage-steam", + "commercial-building-energy-usage-steam-chp", + "commercial-building-energy-usage-refrigeration", + "commercial-building-energy-usage-refrigeration-chp" + ] }, { - "id": "commercial-building-n2o", - "type": "number", - "units": ["units-tons"] + "id": "commercial-buildings-energy-source", + "type": "text" } ], - "units": [] + "units": [ + "units-kilowatt-hours", + "units-terajoules" + ] } ] + }, + { + "id": "scaled-sample-energy-usage-commercial-buildings-methodology", + "implemented": false + }, + { + "id": "modeled-data-energy-usage-commercial-buildings-methodology", + "implemented": false } ] }, @@ -141,6 +171,108 @@ ] } ] + }, + { + "id": "induced-activity-transboundary-trips-on-road-transport-methodology", + "implemented": false + }, + { + "id": "induced-activity-only-departing-trips-on-road-transport-methodology", + "implemented": false + }, + { + "id": "geographic-on-road-transport-methodology", + "implemented": false + }, + { + "id": "resident-activity-on-road-transport-methodology", + "implemented": false + } + ] + }, + "II.1.2": { + "methodologies": [ + { + "id": "electricity-consumption-on-road-transport-methodology", + "activities": [ + { + "id": "electricity-consumption-on-road-transport-activity", + "unique-by": [ + "on-road-transport-vehicle-type", + "on-road-transport-electricity-source" + ], + "extra-fields": [ + { + "id": "on-road-transport-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-vehicles", + "vehicle-type-commercial-vehicles", + "vehicle-type-public-transport-vehicles", + "vehicle-type-emergency-vehicles", + "vehicle-type-service-vehicles" + ] + }, + { + "id": "on-road-transport-electricity-source", + "type": "text" + } + ] + } + ] + } + ] + }, + "III.1.1": { + "methodologies": [ + { + "id": "methane-commitment-solid-waste-methodology", + "activities": { + "unique-by": [ + "methane-commitment-solid-waste-landfill-id" + ], + "activity-title": "total-municipal-solid-waste-disposed", + "extra-fields": [ + { + "id": "methane-commitment-solid-waste-landfill-id", + "type": "text" + }, + { + "id": "methane-commitment-solid-waste-landfill-address", + "type": "text", + "required": false + }, + { + "id": "methane-commitment-solid-waste-oxidation-factor", + "options": [ + "methane-commitment-solid-waste-well-managed-landfill", + "methane-commitment-solid-waste-unmanaged-landfill" + ] + }, + { + "id": "methane-commitment-solid-waste-landfill-methane-collected-and-removed", + "type": "number" + }, + { + "id": "methane-commitment-solid-waste-landfill-waste-composition", + "type": "percentage-breakdown", + "total-required": 100, + "subtypes": [ + "methane-commitment-solid-waste-landfill-waste-composition-food", + "methane-commitment-solid-waste-landfill-waste-composition-garden", + "methane-commitment-solid-waste-landfill-waste-composition-paper", + "methane-commitment-solid-waste-landfill-waste-composition-wood", + "methane-commitment-solid-waste-landfill-waste-composition-textiles", + "methane-commitment-solid-waste-landfill-waste-composition-plastics", + "methane-commitment-solid-waste-landfill-waste-composition-nappies" + ] + } + ] + } + }, + { + "id": "first-order-of-decay-solid-waste-methodology", + "implemented": false } ] } From 37acfffc0a0b3919362940c005445fb1a31cbe68 Mon Sep 17 00:00:00 2001 From: isaacbello Date: Tue, 30 Jul 2024 10:27:32 +0100 Subject: [PATCH 039/128] fix: sector-form-schema.json, add @next/env to package.json --- app/package.json | 1 + app/src/util/form-schema/sector-form-schema.json | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/package.json b/app/package.json index d9aaae882..97c0e85af 100644 --- a/app/package.json +++ b/app/package.json @@ -33,6 +33,7 @@ "@chakra-ui/next-js": "^2.2.0", "@chakra-ui/react": "^2.8.2", "@huggingface/inference": "^2.8.0", + "@next/env": "^14.2.5", "@react-email/components": "^0.0.19", "@reduxjs/toolkit": "^2.2.3", "@storybook/cli": "^8.0.8", diff --git a/app/src/util/form-schema/sector-form-schema.json b/app/src/util/form-schema/sector-form-schema.json index 590ee29b0..3d9ded3b8 100644 --- a/app/src/util/form-schema/sector-form-schema.json +++ b/app/src/util/form-schema/sector-form-schema.json @@ -183,8 +183,7 @@ "type": "text", "name": "sourceReference", "placeholder": "Write in detail from which source the entered values come from." - } - }, + }, { "label": "Emission factor type", "type": "select", From 201077808e54b60ae9a898d6e50bc65a4aa9b0cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:29:46 +0000 Subject: [PATCH 040/128] chore(deps): bump react-i18next from 14.1.2 to 15.0.0 in /app Bumps [react-i18next](https://github.com/i18next/react-i18next) from 14.1.2 to 15.0.0. - [Changelog](https://github.com/i18next/react-i18next/blob/master/CHANGELOG.md) - [Commits](https://github.com/i18next/react-i18next/compare/v14.1.2...v15.0.0) --- updated-dependencies: - dependency-name: react-i18next dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- app/package-lock.json | 16 ++++++++-------- app/package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index 399a72a1f..27397a88a 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -62,7 +62,7 @@ "react-dom": "18.2.0", "react-email": "^2.1.4", "react-hook-form": "^7.52.0", - "react-i18next": "^14.1.2", + "react-i18next": "^15.0.0", "react-icons": "^5.1.0", "react-intersection-observer": "^9.8.2", "react-redux": "^9.1.2", @@ -2314,9 +2314,9 @@ "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==" }, "node_modules/@babel/runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", - "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.0.tgz", + "integrity": "sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -23680,11 +23680,11 @@ } }, "node_modules/react-i18next": { - "version": "14.1.2", - "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-14.1.2.tgz", - "integrity": "sha512-FSIcJy6oauJbGEXfhUgVeLzvWBhIBIS+/9c6Lj4niwKZyGaGb4V4vUbATXSlsHJDXXB+ociNxqFNiFuV1gmoqg==", + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.0.0.tgz", + "integrity": "sha512-2O3IgF4zivg57Q6p6i+ChDgJ371IDcEWbuWC6gvoh5NbkDMs0Q+O7RPr4v61+Se32E0V+LmtwePAeqWZW0bi6g==", "dependencies": { - "@babel/runtime": "^7.23.9", + "@babel/runtime": "^7.24.8", "html-parse-stringify": "^3.0.1" }, "peerDependencies": { diff --git a/app/package.json b/app/package.json index 7d33a61f6..c57605028 100644 --- a/app/package.json +++ b/app/package.json @@ -83,7 +83,7 @@ "react-dom": "18.2.0", "react-email": "^2.1.4", "react-hook-form": "^7.52.0", - "react-i18next": "^14.1.2", + "react-i18next": "^15.0.0", "react-icons": "^5.1.0", "react-intersection-observer": "^9.8.2", "react-redux": "^9.1.2", From 1d54c4105558009a46470ef47e9b0ead7b4113e4 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Tue, 30 Jul 2024 11:52:12 +0200 Subject: [PATCH 041/128] fix(ci): update package-lock.json --- app/package-lock.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index bdb4cafa5..c082310b6 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -12,6 +12,7 @@ "@chakra-ui/next-js": "^2.2.0", "@chakra-ui/react": "^2.8.2", "@huggingface/inference": "^2.8.0", + "@next/env": "^14.2.5", "@react-email/components": "^0.0.19", "@reduxjs/toolkit": "^2.2.3", "@storybook/cli": "^8.0.8", @@ -4577,9 +4578,9 @@ } }, "node_modules/@next/env": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.3.tgz", - "integrity": "sha512-W7fd7IbkfmeeY2gXrzJYDx8D2lWKbVoTIj1o1ScPHNzvp30s1AuoEFSdr39bC5sjxJaxTtq3OTCZboNp0lNWHA==" + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.5.tgz", + "integrity": "sha512-/zZGkrTOsraVfYjGP8uM0p6r0BDT6xWpkjdVbcz66PJVSpwXX3yNiRycxAuDfBKGWBrZBXRuK/YVlkNgxHGwmA==" }, "node_modules/@next/eslint-plugin-next": { "version": "14.1.3", @@ -20924,6 +20925,11 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" }, + "node_modules/next/node_modules/@next/env": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.3.tgz", + "integrity": "sha512-W7fd7IbkfmeeY2gXrzJYDx8D2lWKbVoTIj1o1ScPHNzvp30s1AuoEFSdr39bC5sjxJaxTtq3OTCZboNp0lNWHA==" + }, "node_modules/next/node_modules/@swc/helpers": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.5.tgz", From 3f801f304620b0f44efcefbee7aedda224d7cb0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:59:16 +0000 Subject: [PATCH 042/128] chore(deps-dev): bump storybook from 8.2.5 to 8.2.6 in /app Bumps [storybook](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/cli) from 8.2.5 to 8.2.6. - [Release notes](https://github.com/storybookjs/storybook/releases) - [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md) - [Commits](https://github.com/storybookjs/storybook/commits/v8.2.6/code/lib/cli) --- updated-dependencies: - dependency-name: storybook dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- app/package-lock.json | 32 ++++++++++++++++---------------- app/package.json | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index 5c90b56c1..43913d344 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -90,7 +90,7 @@ "prettier": "3.2.5", "sequelize-auto": "^0.8.8", "start-server-and-test": "^2.0.3", - "storybook": "^8.2.5" + "storybook": "^8.2.6" }, "engines": { "node": ">=20.5.0" @@ -8140,9 +8140,9 @@ } }, "node_modules/@storybook/core": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/@storybook/core/-/core-8.2.5.tgz", - "integrity": "sha512-KjaeIkbdcog4Jmx3MoSjQZpfESin1qHEcFiLoOkICOpuKsj37xdMFcuSre8IbcVGCJPkt1RvEmfeu1N90jOgww==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/core/-/core-8.2.6.tgz", + "integrity": "sha512-XY71g3AcpD6IiER9k9Lt+vlUMYfPIYgWekd7e0Ggzz2gJkPuLunKEdQccLGDSHf5OFAobHhrTJc7ZsvWhmDMag==", "dev": true, "dependencies": { "@storybook/csf": "0.1.11", @@ -8777,9 +8777,9 @@ "dev": true }, "node_modules/@storybook/core/node_modules/@types/node": { - "version": "18.19.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.41.tgz", - "integrity": "sha512-LX84pRJ+evD2e2nrgYCHObGWkiQJ1mL+meAgbvnwk/US6vmMY7S2ygBTGV2Jw91s9vUsLSXeDEkUHZIJGLrhsg==", + "version": "18.19.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.42.tgz", + "integrity": "sha512-d2ZFc/3lnK2YCYhos8iaNIYu9Vfhr92nHiyJHRltXWjXUBjEE+A4I58Tdbnw4VhggSW+2j5y5gTrLs4biNnubg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -25575,15 +25575,15 @@ "integrity": "sha512-siT1RiqlfQnGqgT/YzXVUNsom9S0H1OX+dpdGN1xkyYATo4I6sep5NmsRD/40s3IIOvlCq6akxkqG82urIZW1w==" }, "node_modules/storybook": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/storybook/-/storybook-8.2.5.tgz", - "integrity": "sha512-nfcly5CY3D6KuHbsfhScPaGeraRA9EJhO9GF00/dnI0GXW4ILS8Kwket515IkKAuKcdjdZis6maEuosbG//Kbg==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/storybook/-/storybook-8.2.6.tgz", + "integrity": "sha512-8j30wDxQmkcqI0fWcSYFsUCjErsY1yTWbTW+yjbwM8DyW18Cud6CwbFRCxjFsH+2M0CjP6Pqs/m1PGI0vcQscQ==", "dev": true, "dependencies": { "@babel/core": "^7.24.4", "@babel/types": "^7.24.0", - "@storybook/codemod": "8.2.5", - "@storybook/core": "8.2.5", + "@storybook/codemod": "8.2.6", + "@storybook/core": "8.2.6", "@types/semver": "^7.3.4", "@yarnpkg/fslib": "2.10.3", "@yarnpkg/libzip": "2.3.0", @@ -25620,15 +25620,15 @@ } }, "node_modules/storybook/node_modules/@storybook/codemod": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/@storybook/codemod/-/codemod-8.2.5.tgz", - "integrity": "sha512-bUCvOqW3LUjz6epmTfocWBm0S7Ae52xmHvhVqgAUsKp9bVw2CGt9uaPR8dVE4IfI1yJZKRjf3u7Y60OTfWew4g==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/codemod/-/codemod-8.2.6.tgz", + "integrity": "sha512-+mFJ6R+JhJLpU7VPDlXU5Yn6nqIBq745GaEosnIiFOdNo3jaxJ58wq/sGhbQvoCHPUxMA+sDQvR7pS62YFoLRQ==", "dev": true, "dependencies": { "@babel/core": "^7.24.4", "@babel/preset-env": "^7.24.4", "@babel/types": "^7.24.0", - "@storybook/core": "8.2.5", + "@storybook/core": "8.2.6", "@storybook/csf": "0.1.11", "@types/cross-spawn": "^6.0.2", "cross-spawn": "^7.0.3", diff --git a/app/package.json b/app/package.json index 8696e6b93..e8e4a8621 100644 --- a/app/package.json +++ b/app/package.json @@ -111,7 +111,7 @@ "prettier": "3.2.5", "sequelize-auto": "^0.8.8", "start-server-and-test": "^2.0.3", - "storybook": "^8.2.5" + "storybook": "^8.2.6" }, "engines": { "node": ">=20.5.0" From c80c2dcfd65b9caca4fcda4a846bc8882ac9f1ce Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Tue, 30 Jul 2024 12:27:19 +0200 Subject: [PATCH 043/128] fix(deps): audit security issues resolved --- app/package-lock.json | 2187 +++-------------------------------------- 1 file changed, 134 insertions(+), 2053 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index 43913d344..be6b79198 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -339,17 +339,6 @@ "node": ">=6.0.0" } }, - "node_modules/@aw-web-design/x-default-browser": { - "version": "1.4.126", - "resolved": "https://registry.npmjs.org/@aw-web-design/x-default-browser/-/x-default-browser-1.4.126.tgz", - "integrity": "sha512-Xk1sIhyNC/esHGGVjL/niHLowM0csl/kFO5uawBy4IrWwy0o1G8LGt3jP6nmWGz+USxeeqbihAmp/oVZju6wug==", - "dependencies": { - "default-browser-id": "3.0.0" - }, - "bin": { - "x-default-browser": "bin/x-default-browser.js" - } - }, "node_modules/@babel/code-frame": { "version": "7.24.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.6.tgz", @@ -3566,6 +3555,7 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "dev": true, "optional": true, "engines": { "node": ">=0.1.90" @@ -3657,14 +3647,6 @@ "ms": "^2.1.1" } }, - "node_modules/@discoveryjs/json-ext": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", - "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/@emotion/babel-plugin": { "version": "11.11.0", "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.11.0.tgz", @@ -4243,11 +4225,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@fal-works/esbuild-plugin-global-externals": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@fal-works/esbuild-plugin-global-externals/-/esbuild-plugin-global-externals-2.1.2.tgz", - "integrity": "sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==" - }, "node_modules/@fast-csv/format": { "version": "4.3.5", "resolved": "https://registry.npmjs.org/@fast-csv/format/-/format-4.3.5.tgz", @@ -4567,16 +4544,6 @@ "react": ">=16" } }, - "node_modules/@ndelangen/get-tarball": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@ndelangen/get-tarball/-/get-tarball-3.0.9.tgz", - "integrity": "sha512-9JKTEik4vq+yGosHYhZ1tiH/3WpUS0Nh0kej4Agndhox8pAdWhEx5knFVRcb/ya9knCRCs1rPxNrSXTDdfVqpA==", - "dependencies": { - "gunzip-maybe": "^1.4.2", - "pump": "^3.0.0", - "tar-fs": "^2.1.1" - } - }, "node_modules/@next/env": { "version": "14.2.5", "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.5.tgz", @@ -7126,215 +7093,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@storybook/builder-manager": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/builder-manager/-/builder-manager-8.1.3.tgz", - "integrity": "sha512-VIYgF6PreiteJMGlz716P27yyL/JF1dR7M2htVJij5IP2X6HUgyzFXScElKljX9fETq7vig+UZWksZ2M2Q9dYg==", - "dependencies": { - "@fal-works/esbuild-plugin-global-externals": "^2.1.2", - "@storybook/core-common": "8.1.3", - "@storybook/manager": "8.1.3", - "@storybook/node-logger": "8.1.3", - "@types/ejs": "^3.1.1", - "@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.10", - "browser-assert": "^1.2.1", - "ejs": "^3.1.10", - "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", - "esbuild-plugin-alias": "^0.2.1", - "express": "^4.17.3", - "fs-extra": "^11.1.0", - "process": "^0.11.10", - "util": "^0.12.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/builder-manager/node_modules/@storybook/channels": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.3.tgz", - "integrity": "sha512-iDoHFX3ty7vhSXegFRevJkQ6cV+QQ1JjDnoXK/SHeloMT26sn5gPtetn3ET9+6ZoFkU05Pf5d0DoywVOfumfcg==", - "dependencies": { - "@storybook/client-logger": "8.1.3", - "@storybook/core-events": "8.1.3", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/builder-manager/node_modules/@storybook/client-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.3.tgz", - "integrity": "sha512-dX1jZ+HhJ8hVhAKHQ8gs/FalHjIGo5j1Xk+2UqdsGjLoBlwHIHfHzkVbzrc/gCxxXL0juisk7BzbXaz7lME0KA==", - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/builder-manager/node_modules/@storybook/core-common": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-common/-/core-common-8.1.3.tgz", - "integrity": "sha512-VLG2Kg6oX0msq/Gjo+Pveqg7oLnJBClzms43/nwh6oxjJ/TFehRi3DyLjLqL+Nj726LI5lQetFZZyrsHudVskg==", - "dependencies": { - "@storybook/core-events": "8.1.3", - "@storybook/csf-tools": "8.1.3", - "@storybook/node-logger": "8.1.3", - "@storybook/types": "8.1.3", - "@yarnpkg/fslib": "2.10.3", - "@yarnpkg/libzip": "2.3.0", - "chalk": "^4.1.0", - "cross-spawn": "^7.0.3", - "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", - "esbuild-register": "^3.5.0", - "execa": "^5.0.0", - "file-system-cache": "2.3.0", - "find-cache-dir": "^3.0.0", - "find-up": "^5.0.0", - "fs-extra": "^11.1.0", - "glob": "^10.0.0", - "handlebars": "^4.7.7", - "lazy-universal-dotenv": "^4.0.0", - "node-fetch": "^2.0.0", - "picomatch": "^2.3.0", - "pkg-dir": "^5.0.0", - "prettier-fallback": "npm:prettier@^3", - "pretty-hrtime": "^1.0.3", - "resolve-from": "^5.0.0", - "semver": "^7.3.7", - "tempy": "^1.0.1", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util": "^0.12.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "prettier": "^2 || ^3" - }, - "peerDependenciesMeta": { - "prettier": { - "optional": true - } - } - }, - "node_modules/@storybook/builder-manager/node_modules/@storybook/core-events": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.3.tgz", - "integrity": "sha512-eOs4HRrsEZz2FZFlMGwPuH9CGYBK8fkUS7mcHNPv8CqoHV8d3ErvDax8zA/KGRj3S6kWJ4PzI9IGuiDVvwuxhA==", - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/builder-manager/node_modules/@storybook/csf-tools": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/csf-tools/-/csf-tools-8.1.3.tgz", - "integrity": "sha512-22h6Uv7w29v8HjoFsJvAkBci9POVH0aQhlfZ4NNYkiMbgD4X4HWeD2wqob6fTKpVWP3tDaNS9FfCWHxQXFE+ag==", - "dependencies": { - "@babel/generator": "^7.24.4", - "@babel/parser": "^7.24.4", - "@babel/traverse": "^7.24.1", - "@babel/types": "^7.24.0", - "@storybook/csf": "^0.1.7", - "@storybook/types": "8.1.3", - "fs-extra": "^11.1.0", - "recast": "^0.23.5", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/builder-manager/node_modules/@storybook/node-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-8.1.3.tgz", - "integrity": "sha512-MpQ7Zl5n58zbFr1Yu3qgInGENoScEnfqsCxipMhj57b5SWJJ7NoOdSAWznjFFffo8NoaqxldHscuaQfzPBN9hA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/builder-manager/node_modules/@storybook/types": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.3.tgz", - "integrity": "sha512-2uUC1z7heMceRPHQ4KCcZwwKjtW2YiToUODsEw0YOq6NC/Q9elZta1FABSG0Bq7XM08EiAgjyc7P9CZPJ2QxUQ==", - "dependencies": { - "@storybook/channels": "8.1.3", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/builder-manager/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/@storybook/builder-manager/node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/builder-manager/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/@storybook/builder-manager/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@storybook/builder-webpack5": { "version": "8.0.8", "resolved": "https://registry.npmjs.org/@storybook/builder-webpack5/-/builder-webpack5-8.0.8.tgz", @@ -7628,63 +7386,55 @@ "dev": true }, "node_modules/@storybook/cli": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/cli/-/cli-8.1.3.tgz", - "integrity": "sha512-eqzjy7YOIF0WkeUPT5Mv+WKibk3z+IfP0voTKIWzYKAqZ8sD36NQV/lE7bHy0JAPw+rfw1Fq0gMOiFVcx3ZaUQ==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/cli/-/cli-8.2.6.tgz", + "integrity": "sha512-xW1r9LfLc7GHI3WlCF2AefK94g2l/NZNoaaWlNCChcf4+L3UKSsWORYSvcU8qmpxQrmQdEVBxues7VbQkZn36Q==", "dependencies": { - "@babel/core": "^7.24.4", - "@babel/types": "^7.24.0", - "@ndelangen/get-tarball": "^3.0.7", - "@storybook/codemod": "8.1.3", - "@storybook/core-common": "8.1.3", - "@storybook/core-events": "8.1.3", - "@storybook/core-server": "8.1.3", - "@storybook/csf-tools": "8.1.3", - "@storybook/node-logger": "8.1.3", - "@storybook/telemetry": "8.1.3", - "@storybook/types": "8.1.3", - "@types/semver": "^7.3.4", - "@yarnpkg/fslib": "2.10.3", - "@yarnpkg/libzip": "2.3.0", - "chalk": "^4.1.0", - "commander": "^6.2.1", - "cross-spawn": "^7.0.3", - "detect-indent": "^6.1.0", - "envinfo": "^7.7.3", - "execa": "^5.0.0", - "find-up": "^5.0.0", - "fs-extra": "^11.1.0", - "get-npm-tarball-url": "^2.0.3", - "giget": "^1.0.0", - "globby": "^14.0.1", - "jscodeshift": "^0.15.1", - "leven": "^3.1.0", - "ora": "^5.4.1", - "prettier": "^3.1.1", - "prompts": "^2.4.0", - "read-pkg-up": "^7.0.1", - "semver": "^7.3.7", - "strip-json-comments": "^3.0.1", - "tempy": "^1.0.1", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0" + "storybook": "8.2.6" }, "bin": { - "getstorybook": "bin/index.js", - "sb": "bin/index.js" + "sb": "index.js", + "storybook": "index.js" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/storybook" + } + }, + "node_modules/@storybook/components": { + "version": "8.1.6", + "resolved": "https://registry.npmjs.org/@storybook/components/-/components-8.1.6.tgz", + "integrity": "sha512-RDcSj2gBVhK/klfcXQgINtvWe5hpJ1CYUv8hrAon3fWtZmX1+IrTJTorsdISvdHQ99o0WHZ+Ouz42O0yJnHzRg==", + "dev": true, + "dependencies": { + "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-slot": "^1.0.2", + "@storybook/client-logger": "8.1.6", + "@storybook/csf": "^0.1.7", + "@storybook/global": "^5.0.0", + "@storybook/icons": "^1.2.5", + "@storybook/theming": "8.1.6", + "@storybook/types": "8.1.6", + "memoizerific": "^1.11.3", + "util-deprecate": "^1.0.2" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta" } }, - "node_modules/@storybook/cli/node_modules/@storybook/channels": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.3.tgz", - "integrity": "sha512-iDoHFX3ty7vhSXegFRevJkQ6cV+QQ1JjDnoXK/SHeloMT26sn5gPtetn3ET9+6ZoFkU05Pf5d0DoywVOfumfcg==", + "node_modules/@storybook/components/node_modules/@storybook/channels": { + "version": "8.1.6", + "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.6.tgz", + "integrity": "sha512-CzDnP6qfI8OC8pGUk+wPUzLPYcKhX8XbriF2gBtwl6qVM8YfkHP2mLTiDYDwBIi0rLuUbSm/SpILXQ/ouOHOGw==", + "dev": true, "dependencies": { - "@storybook/client-logger": "8.1.3", - "@storybook/core-events": "8.1.3", + "@storybook/client-logger": "8.1.6", + "@storybook/core-events": "8.1.6", "@storybook/global": "^5.0.0", "telejson": "^7.2.0", "tiny-invariant": "^1.3.1" @@ -7694,10 +7444,11 @@ "url": "https://opencollective.com/storybook" } }, - "node_modules/@storybook/cli/node_modules/@storybook/client-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.3.tgz", - "integrity": "sha512-dX1jZ+HhJ8hVhAKHQ8gs/FalHjIGo5j1Xk+2UqdsGjLoBlwHIHfHzkVbzrc/gCxxXL0juisk7BzbXaz7lME0KA==", + "node_modules/@storybook/components/node_modules/@storybook/client-logger": { + "version": "8.1.6", + "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", + "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", + "dev": true, "dependencies": { "@storybook/global": "^5.0.0" }, @@ -7706,842 +7457,55 @@ "url": "https://opencollective.com/storybook" } }, - "node_modules/@storybook/cli/node_modules/@storybook/core-common": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-common/-/core-common-8.1.3.tgz", - "integrity": "sha512-VLG2Kg6oX0msq/Gjo+Pveqg7oLnJBClzms43/nwh6oxjJ/TFehRi3DyLjLqL+Nj726LI5lQetFZZyrsHudVskg==", + "node_modules/@storybook/components/node_modules/@storybook/core-events": { + "version": "8.1.6", + "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.6.tgz", + "integrity": "sha512-DaIVe4TUp/7uQdSJYGmJv9S/S364tSgZ3S3dZ1vsf1rgoUbCp5kTBtcd/fcqgukMPREgCgO9oDhmemI3SLAqzw==", + "dev": true, "dependencies": { - "@storybook/core-events": "8.1.3", - "@storybook/csf-tools": "8.1.3", - "@storybook/node-logger": "8.1.3", - "@storybook/types": "8.1.3", - "@yarnpkg/fslib": "2.10.3", - "@yarnpkg/libzip": "2.3.0", - "chalk": "^4.1.0", - "cross-spawn": "^7.0.3", - "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", - "esbuild-register": "^3.5.0", - "execa": "^5.0.0", - "file-system-cache": "2.3.0", - "find-cache-dir": "^3.0.0", - "find-up": "^5.0.0", - "fs-extra": "^11.1.0", - "glob": "^10.0.0", - "handlebars": "^4.7.7", - "lazy-universal-dotenv": "^4.0.0", - "node-fetch": "^2.0.0", - "picomatch": "^2.3.0", - "pkg-dir": "^5.0.0", - "prettier-fallback": "npm:prettier@^3", - "pretty-hrtime": "^1.0.3", - "resolve-from": "^5.0.0", - "semver": "^7.3.7", - "tempy": "^1.0.1", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util": "^0.12.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "prettier": "^2 || ^3" - }, - "peerDependenciesMeta": { - "prettier": { - "optional": true - } - } - }, - "node_modules/@storybook/cli/node_modules/@storybook/core-events": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.3.tgz", - "integrity": "sha512-eOs4HRrsEZz2FZFlMGwPuH9CGYBK8fkUS7mcHNPv8CqoHV8d3ErvDax8zA/KGRj3S6kWJ4PzI9IGuiDVvwuxhA==", - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/cli/node_modules/@storybook/csf-tools": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/csf-tools/-/csf-tools-8.1.3.tgz", - "integrity": "sha512-22h6Uv7w29v8HjoFsJvAkBci9POVH0aQhlfZ4NNYkiMbgD4X4HWeD2wqob6fTKpVWP3tDaNS9FfCWHxQXFE+ag==", - "dependencies": { - "@babel/generator": "^7.24.4", - "@babel/parser": "^7.24.4", - "@babel/traverse": "^7.24.1", - "@babel/types": "^7.24.0", - "@storybook/csf": "^0.1.7", - "@storybook/types": "8.1.3", - "fs-extra": "^11.1.0", - "recast": "^0.23.5", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/cli/node_modules/@storybook/node-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-8.1.3.tgz", - "integrity": "sha512-MpQ7Zl5n58zbFr1Yu3qgInGENoScEnfqsCxipMhj57b5SWJJ7NoOdSAWznjFFffo8NoaqxldHscuaQfzPBN9hA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/cli/node_modules/@storybook/types": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.3.tgz", - "integrity": "sha512-2uUC1z7heMceRPHQ4KCcZwwKjtW2YiToUODsEw0YOq6NC/Q9elZta1FABSG0Bq7XM08EiAgjyc7P9CZPJ2QxUQ==", - "dependencies": { - "@storybook/channels": "8.1.3", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/cli/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/@storybook/cli/node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/cli/node_modules/globby": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", - "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", - "dependencies": { - "@sindresorhus/merge-streams": "^2.1.0", - "fast-glob": "^3.3.2", - "ignore": "^5.2.4", - "path-type": "^5.0.0", - "slash": "^5.1.0", - "unicorn-magic": "^0.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/cli/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/@storybook/cli/node_modules/path-type": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", - "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/cli/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@storybook/cli/node_modules/slash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", - "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/codemod": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/codemod/-/codemod-8.1.3.tgz", - "integrity": "sha512-U21HQICKKm/xsfLKEODDphJJiBkzq5wFZzKN2DyMPd3vOfLpCWcaPsO9Pi5IX1cekyCz2o+phYt2r9aSRQUbOg==", - "dependencies": { - "@babel/core": "^7.24.4", - "@babel/preset-env": "^7.24.4", - "@babel/types": "^7.24.0", - "@storybook/csf": "^0.1.7", - "@storybook/csf-tools": "8.1.3", - "@storybook/node-logger": "8.1.3", - "@storybook/types": "8.1.3", - "@types/cross-spawn": "^6.0.2", - "cross-spawn": "^7.0.3", - "globby": "^14.0.1", - "jscodeshift": "^0.15.1", - "lodash": "^4.17.21", - "prettier": "^3.1.1", - "recast": "^0.23.5", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/codemod/node_modules/@storybook/channels": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.3.tgz", - "integrity": "sha512-iDoHFX3ty7vhSXegFRevJkQ6cV+QQ1JjDnoXK/SHeloMT26sn5gPtetn3ET9+6ZoFkU05Pf5d0DoywVOfumfcg==", - "dependencies": { - "@storybook/client-logger": "8.1.3", - "@storybook/core-events": "8.1.3", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/codemod/node_modules/@storybook/client-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.3.tgz", - "integrity": "sha512-dX1jZ+HhJ8hVhAKHQ8gs/FalHjIGo5j1Xk+2UqdsGjLoBlwHIHfHzkVbzrc/gCxxXL0juisk7BzbXaz7lME0KA==", - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/codemod/node_modules/@storybook/core-events": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.3.tgz", - "integrity": "sha512-eOs4HRrsEZz2FZFlMGwPuH9CGYBK8fkUS7mcHNPv8CqoHV8d3ErvDax8zA/KGRj3S6kWJ4PzI9IGuiDVvwuxhA==", - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/codemod/node_modules/@storybook/csf-tools": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/csf-tools/-/csf-tools-8.1.3.tgz", - "integrity": "sha512-22h6Uv7w29v8HjoFsJvAkBci9POVH0aQhlfZ4NNYkiMbgD4X4HWeD2wqob6fTKpVWP3tDaNS9FfCWHxQXFE+ag==", - "dependencies": { - "@babel/generator": "^7.24.4", - "@babel/parser": "^7.24.4", - "@babel/traverse": "^7.24.1", - "@babel/types": "^7.24.0", - "@storybook/csf": "^0.1.7", - "@storybook/types": "8.1.3", - "fs-extra": "^11.1.0", - "recast": "^0.23.5", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/codemod/node_modules/@storybook/node-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-8.1.3.tgz", - "integrity": "sha512-MpQ7Zl5n58zbFr1Yu3qgInGENoScEnfqsCxipMhj57b5SWJJ7NoOdSAWznjFFffo8NoaqxldHscuaQfzPBN9hA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/codemod/node_modules/@storybook/types": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.3.tgz", - "integrity": "sha512-2uUC1z7heMceRPHQ4KCcZwwKjtW2YiToUODsEw0YOq6NC/Q9elZta1FABSG0Bq7XM08EiAgjyc7P9CZPJ2QxUQ==", - "dependencies": { - "@storybook/channels": "8.1.3", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/codemod/node_modules/globby": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", - "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", - "dependencies": { - "@sindresorhus/merge-streams": "^2.1.0", - "fast-glob": "^3.3.2", - "ignore": "^5.2.4", - "path-type": "^5.0.0", - "slash": "^5.1.0", - "unicorn-magic": "^0.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/codemod/node_modules/path-type": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", - "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/codemod/node_modules/slash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", - "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/components": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/components/-/components-8.1.6.tgz", - "integrity": "sha512-RDcSj2gBVhK/klfcXQgINtvWe5hpJ1CYUv8hrAon3fWtZmX1+IrTJTorsdISvdHQ99o0WHZ+Ouz42O0yJnHzRg==", - "dev": true, - "dependencies": { - "@radix-ui/react-dialog": "^1.0.5", - "@radix-ui/react-slot": "^1.0.2", - "@storybook/client-logger": "8.1.6", - "@storybook/csf": "^0.1.7", - "@storybook/global": "^5.0.0", - "@storybook/icons": "^1.2.5", - "@storybook/theming": "8.1.6", - "@storybook/types": "8.1.6", - "memoizerific": "^1.11.3", - "util-deprecate": "^1.0.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta" - } - }, - "node_modules/@storybook/components/node_modules/@storybook/channels": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.6.tgz", - "integrity": "sha512-CzDnP6qfI8OC8pGUk+wPUzLPYcKhX8XbriF2gBtwl6qVM8YfkHP2mLTiDYDwBIi0rLuUbSm/SpILXQ/ouOHOGw==", - "dev": true, - "dependencies": { - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/components/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/components/node_modules/@storybook/core-events": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.6.tgz", - "integrity": "sha512-DaIVe4TUp/7uQdSJYGmJv9S/S364tSgZ3S3dZ1vsf1rgoUbCp5kTBtcd/fcqgukMPREgCgO9oDhmemI3SLAqzw==", - "dev": true, - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/components/node_modules/@storybook/types": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.6.tgz", - "integrity": "sha512-cWpS9+x1pxCO39spR8QmumMK2ub2p5cvMtrRvWaIjBFPbCwm2CvjBXFWIra2veBCZTxUKJ9VWxvi7pzRHjN/nw==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core": { - "version": "8.2.6", - "resolved": "https://registry.npmjs.org/@storybook/core/-/core-8.2.6.tgz", - "integrity": "sha512-XY71g3AcpD6IiER9k9Lt+vlUMYfPIYgWekd7e0Ggzz2gJkPuLunKEdQccLGDSHf5OFAobHhrTJc7ZsvWhmDMag==", - "dev": true, - "dependencies": { - "@storybook/csf": "0.1.11", - "@types/express": "^4.17.21", - "@types/node": "^18.0.0", - "browser-assert": "^1.2.1", - "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0", - "esbuild-register": "^3.5.0", - "express": "^4.19.2", - "process": "^0.11.10", - "recast": "^0.23.5", - "util": "^0.12.4", - "ws": "^8.2.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-server/-/core-server-8.1.3.tgz", - "integrity": "sha512-bOHbLI5atDFBOsFc5M0V0ikURVw+Kx/jRXGO5dnc6kr5SwW+ZfWooy1hiFKHRnI8hmVpGXcS6YqTHkUbcrAWgA==", - "dependencies": { - "@aw-web-design/x-default-browser": "1.4.126", - "@babel/core": "^7.24.4", - "@babel/parser": "^7.24.4", - "@discoveryjs/json-ext": "^0.5.3", - "@storybook/builder-manager": "8.1.3", - "@storybook/channels": "8.1.3", - "@storybook/core-common": "8.1.3", - "@storybook/core-events": "8.1.3", - "@storybook/csf": "^0.1.7", - "@storybook/csf-tools": "8.1.3", - "@storybook/docs-mdx": "3.1.0-next.0", - "@storybook/global": "^5.0.0", - "@storybook/manager": "8.1.3", - "@storybook/manager-api": "8.1.3", - "@storybook/node-logger": "8.1.3", - "@storybook/preview-api": "8.1.3", - "@storybook/telemetry": "8.1.3", - "@storybook/types": "8.1.3", - "@types/detect-port": "^1.3.0", - "@types/diff": "^5.0.9", - "@types/node": "^18.0.0", - "@types/pretty-hrtime": "^1.0.0", - "@types/semver": "^7.3.4", - "better-opn": "^3.0.2", - "chalk": "^4.1.0", - "cli-table3": "^0.6.1", - "compression": "^1.7.4", - "detect-port": "^1.3.0", - "diff": "^5.2.0", - "express": "^4.17.3", - "fs-extra": "^11.1.0", - "globby": "^14.0.1", - "ip": "^2.0.1", - "lodash": "^4.17.21", - "open": "^8.4.0", - "pretty-hrtime": "^1.0.3", - "prompts": "^2.4.0", - "read-pkg-up": "^7.0.1", - "semver": "^7.3.7", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util": "^0.12.4", - "util-deprecate": "^1.0.2", - "watchpack": "^2.2.0", - "ws": "^8.2.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/channels": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.3.tgz", - "integrity": "sha512-iDoHFX3ty7vhSXegFRevJkQ6cV+QQ1JjDnoXK/SHeloMT26sn5gPtetn3ET9+6ZoFkU05Pf5d0DoywVOfumfcg==", - "dependencies": { - "@storybook/client-logger": "8.1.3", - "@storybook/core-events": "8.1.3", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/client-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.3.tgz", - "integrity": "sha512-dX1jZ+HhJ8hVhAKHQ8gs/FalHjIGo5j1Xk+2UqdsGjLoBlwHIHfHzkVbzrc/gCxxXL0juisk7BzbXaz7lME0KA==", - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/core-common": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-common/-/core-common-8.1.3.tgz", - "integrity": "sha512-VLG2Kg6oX0msq/Gjo+Pveqg7oLnJBClzms43/nwh6oxjJ/TFehRi3DyLjLqL+Nj726LI5lQetFZZyrsHudVskg==", - "dependencies": { - "@storybook/core-events": "8.1.3", - "@storybook/csf-tools": "8.1.3", - "@storybook/node-logger": "8.1.3", - "@storybook/types": "8.1.3", - "@yarnpkg/fslib": "2.10.3", - "@yarnpkg/libzip": "2.3.0", - "chalk": "^4.1.0", - "cross-spawn": "^7.0.3", - "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", - "esbuild-register": "^3.5.0", - "execa": "^5.0.0", - "file-system-cache": "2.3.0", - "find-cache-dir": "^3.0.0", - "find-up": "^5.0.0", - "fs-extra": "^11.1.0", - "glob": "^10.0.0", - "handlebars": "^4.7.7", - "lazy-universal-dotenv": "^4.0.0", - "node-fetch": "^2.0.0", - "picomatch": "^2.3.0", - "pkg-dir": "^5.0.0", - "prettier-fallback": "npm:prettier@^3", - "pretty-hrtime": "^1.0.3", - "resolve-from": "^5.0.0", - "semver": "^7.3.7", - "tempy": "^1.0.1", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util": "^0.12.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "prettier": "^2 || ^3" - }, - "peerDependenciesMeta": { - "prettier": { - "optional": true - } - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/core-events": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.3.tgz", - "integrity": "sha512-eOs4HRrsEZz2FZFlMGwPuH9CGYBK8fkUS7mcHNPv8CqoHV8d3ErvDax8zA/KGRj3S6kWJ4PzI9IGuiDVvwuxhA==", - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/csf-tools": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/csf-tools/-/csf-tools-8.1.3.tgz", - "integrity": "sha512-22h6Uv7w29v8HjoFsJvAkBci9POVH0aQhlfZ4NNYkiMbgD4X4HWeD2wqob6fTKpVWP3tDaNS9FfCWHxQXFE+ag==", - "dependencies": { - "@babel/generator": "^7.24.4", - "@babel/parser": "^7.24.4", - "@babel/traverse": "^7.24.1", - "@babel/types": "^7.24.0", - "@storybook/csf": "^0.1.7", - "@storybook/types": "8.1.3", - "fs-extra": "^11.1.0", - "recast": "^0.23.5", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/manager-api": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/manager-api/-/manager-api-8.1.3.tgz", - "integrity": "sha512-2OpbHK0a3Tak+Wba0ZW/b17C62hdXMFa++rzGT7KzFcVmzg8Nx464wVx2hlrNxjlfBJkHoT723irAiAwmIl2Pg==", - "dependencies": { - "@storybook/channels": "8.1.3", - "@storybook/client-logger": "8.1.3", - "@storybook/core-events": "8.1.3", - "@storybook/csf": "^0.1.7", - "@storybook/global": "^5.0.0", - "@storybook/icons": "^1.2.5", - "@storybook/router": "8.1.3", - "@storybook/theming": "8.1.3", - "@storybook/types": "8.1.3", - "dequal": "^2.0.2", - "lodash": "^4.17.21", - "memoizerific": "^1.11.3", - "store2": "^2.14.2", - "telejson": "^7.2.0", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/node-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-8.1.3.tgz", - "integrity": "sha512-MpQ7Zl5n58zbFr1Yu3qgInGENoScEnfqsCxipMhj57b5SWJJ7NoOdSAWznjFFffo8NoaqxldHscuaQfzPBN9hA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/preview-api": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/preview-api/-/preview-api-8.1.3.tgz", - "integrity": "sha512-2eyNVr5wLzglE7KABdXu4nu+rPjJ8gVDP9TiovgU1MHhE5rX8qbKmJ47ymWSfJT1DMvH2dPISh4/wRK3WVNjmw==", - "dependencies": { - "@storybook/channels": "8.1.3", - "@storybook/client-logger": "8.1.3", - "@storybook/core-events": "8.1.3", - "@storybook/csf": "^0.1.7", - "@storybook/global": "^5.0.0", - "@storybook/types": "8.1.3", - "@types/qs": "^6.9.5", - "dequal": "^2.0.2", - "lodash": "^4.17.21", - "memoizerific": "^1.11.3", - "qs": "^6.10.0", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/router": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/router/-/router-8.1.3.tgz", - "integrity": "sha512-CVEMpRD+PDVb+oZ3Sd0SV4P9vBJhYDgYiO9Km9X1jV6iyg/CXIALlo5Rd9pT+/U8IdqI2QX3bkZBUgCFDff67w==", - "dependencies": { - "@storybook/client-logger": "8.1.3", - "memoizerific": "^1.11.3", - "qs": "^6.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/theming": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/theming/-/theming-8.1.3.tgz", - "integrity": "sha512-BXtD5pna4eAAxNbzZUijP6W25IFVhvANG5P96xYM+OH+5OMSdLpDANnG2qWcZumwX5JFd74KqOIuV8yIO0AYXQ==", - "dependencies": { - "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1", - "@storybook/client-logger": "8.1.3", - "@storybook/global": "^5.0.0", - "memoizerific": "^1.11.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-dom": { - "optional": true - } - } - }, - "node_modules/@storybook/core-server/node_modules/@storybook/types": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.3.tgz", - "integrity": "sha512-2uUC1z7heMceRPHQ4KCcZwwKjtW2YiToUODsEw0YOq6NC/Q9elZta1FABSG0Bq7XM08EiAgjyc7P9CZPJ2QxUQ==", - "dependencies": { - "@storybook/channels": "8.1.3", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/core-server/node_modules/@types/node": { - "version": "18.19.33", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.33.tgz", - "integrity": "sha512-NR9+KrpSajr2qBVp/Yt5TU/rp+b5Mayi3+OlMlcg2cVCfRmcG5PWZ7S4+MG9PZ5gWBoc9Pd0BKSRViuBCRPu0A==", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@storybook/core-server/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/@storybook/core-server/node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "engines": { - "node": ">=10" + "@storybook/csf": "^0.1.7", + "ts-dedent": "^2.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "opencollective", + "url": "https://opencollective.com/storybook" } }, - "node_modules/@storybook/core-server/node_modules/globby": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", - "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", + "node_modules/@storybook/components/node_modules/@storybook/types": { + "version": "8.1.6", + "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.6.tgz", + "integrity": "sha512-cWpS9+x1pxCO39spR8QmumMK2ub2p5cvMtrRvWaIjBFPbCwm2CvjBXFWIra2veBCZTxUKJ9VWxvi7pzRHjN/nw==", + "dev": true, "dependencies": { - "@sindresorhus/merge-streams": "^2.1.0", - "fast-glob": "^3.3.2", - "ignore": "^5.2.4", - "path-type": "^5.0.0", - "slash": "^5.1.0", - "unicorn-magic": "^0.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/core-server/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/@storybook/core-server/node_modules/path-type": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", - "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", - "engines": { - "node": ">=12" + "@storybook/channels": "8.1.6", + "@types/express": "^4.7.0", + "file-system-cache": "2.3.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/core-server/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" + "type": "opencollective", + "url": "https://opencollective.com/storybook" } }, - "node_modules/@storybook/core-server/node_modules/slash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", - "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", - "engines": { - "node": ">=14.16" + "node_modules/@storybook/core": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/core/-/core-8.2.6.tgz", + "integrity": "sha512-XY71g3AcpD6IiER9k9Lt+vlUMYfPIYgWekd7e0Ggzz2gJkPuLunKEdQccLGDSHf5OFAobHhrTJc7ZsvWhmDMag==", + "dependencies": { + "@storybook/csf": "0.1.11", + "@types/express": "^4.17.21", + "@types/node": "^18.0.0", + "browser-assert": "^1.2.1", + "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0", + "esbuild-register": "^3.5.0", + "express": "^4.19.2", + "process": "^0.11.10", + "recast": "^0.23.5", + "util": "^0.12.4", + "ws": "^8.2.3" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "opencollective", + "url": "https://opencollective.com/storybook" } }, "node_modules/@storybook/core-webpack": { @@ -8780,7 +7744,6 @@ "version": "18.19.42", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.42.tgz", "integrity": "sha512-d2ZFc/3lnK2YCYhos8iaNIYu9Vfhr92nHiyJHRltXWjXUBjEE+A4I58Tdbnw4VhggSW+2j5y5gTrLs4biNnubg==", - "dev": true, "dependencies": { "undici-types": "~5.26.4" } @@ -8882,11 +7845,6 @@ "url": "https://opencollective.com/storybook" } }, - "node_modules/@storybook/docs-mdx": { - "version": "3.1.0-next.0", - "resolved": "https://registry.npmjs.org/@storybook/docs-mdx/-/docs-mdx-3.1.0-next.0.tgz", - "integrity": "sha512-t4syFIeSyufieNovZbLruPt2DmRKpbwL4fERCZ1MifWDRIORCKLc4NCEHy+IqvIqd71/SJV2k4B51nF7vlJfmQ==" - }, "node_modules/@storybook/global": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@storybook/global/-/global-5.0.0.tgz", @@ -8896,6 +7854,7 @@ "version": "1.2.9", "resolved": "https://registry.npmjs.org/@storybook/icons/-/icons-1.2.9.tgz", "integrity": "sha512-cOmylsz25SYXaJL/gvTk/dl3pyk7yBFRfeXTsHvTA3dfhoU/LWSq0NKL9nM7WBasJyn6XPSGnLS4RtKXLw5EUg==", + "dev": true, "engines": { "node": ">=14.0.0" }, @@ -8922,15 +7881,6 @@ "storybook": "^8.2.5" } }, - "node_modules/@storybook/manager": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/manager/-/manager-8.1.3.tgz", - "integrity": "sha512-hmfQJJNLSqlM+jfcCXo5wnhUIugTsCxv6a+2UnRAt2AnF6J746QaV0npMThw1QG/7fi/ofaRY8hPGxgCN9uHRA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, "node_modules/@storybook/manager-api": { "version": "8.1.6", "resolved": "https://registry.npmjs.org/@storybook/manager-api/-/manager-api-8.1.6.tgz", @@ -10172,229 +9122,26 @@ "integrity": "sha512-tvuhB2uXHEKK640Epm1SqVzPhQ9lXYfF7FX6FleJgVYEvZpJpNTD4RojedQoLI6SUUSXNy1Vs2QV26VM0XIPHQ==", "dev": true, "dependencies": { - "@storybook/client-logger": "8.1.6", - "memoizerific": "^1.11.3", - "qs": "^6.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/router/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/telemetry": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/telemetry/-/telemetry-8.1.3.tgz", - "integrity": "sha512-edFj0AJ3DEF8Z6Ym6ue7N8U9HZ2khAfXIcpk6RDgL/8FrpAZKC96XSEBMSnem3BLHxMi2bddQH1UTU6rKXrfBA==", - "dependencies": { - "@storybook/client-logger": "8.1.3", - "@storybook/core-common": "8.1.3", - "@storybook/csf-tools": "8.1.3", - "chalk": "^4.1.0", - "detect-package-manager": "^2.0.1", - "fetch-retry": "^5.0.2", - "fs-extra": "^11.1.0", - "read-pkg-up": "^7.0.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/telemetry/node_modules/@storybook/channels": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.3.tgz", - "integrity": "sha512-iDoHFX3ty7vhSXegFRevJkQ6cV+QQ1JjDnoXK/SHeloMT26sn5gPtetn3ET9+6ZoFkU05Pf5d0DoywVOfumfcg==", - "dependencies": { - "@storybook/client-logger": "8.1.3", - "@storybook/core-events": "8.1.3", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/telemetry/node_modules/@storybook/client-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.3.tgz", - "integrity": "sha512-dX1jZ+HhJ8hVhAKHQ8gs/FalHjIGo5j1Xk+2UqdsGjLoBlwHIHfHzkVbzrc/gCxxXL0juisk7BzbXaz7lME0KA==", - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/telemetry/node_modules/@storybook/core-common": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-common/-/core-common-8.1.3.tgz", - "integrity": "sha512-VLG2Kg6oX0msq/Gjo+Pveqg7oLnJBClzms43/nwh6oxjJ/TFehRi3DyLjLqL+Nj726LI5lQetFZZyrsHudVskg==", - "dependencies": { - "@storybook/core-events": "8.1.3", - "@storybook/csf-tools": "8.1.3", - "@storybook/node-logger": "8.1.3", - "@storybook/types": "8.1.3", - "@yarnpkg/fslib": "2.10.3", - "@yarnpkg/libzip": "2.3.0", - "chalk": "^4.1.0", - "cross-spawn": "^7.0.3", - "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", - "esbuild-register": "^3.5.0", - "execa": "^5.0.0", - "file-system-cache": "2.3.0", - "find-cache-dir": "^3.0.0", - "find-up": "^5.0.0", - "fs-extra": "^11.1.0", - "glob": "^10.0.0", - "handlebars": "^4.7.7", - "lazy-universal-dotenv": "^4.0.0", - "node-fetch": "^2.0.0", - "picomatch": "^2.3.0", - "pkg-dir": "^5.0.0", - "prettier-fallback": "npm:prettier@^3", - "pretty-hrtime": "^1.0.3", - "resolve-from": "^5.0.0", - "semver": "^7.3.7", - "tempy": "^1.0.1", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util": "^0.12.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "prettier": "^2 || ^3" - }, - "peerDependenciesMeta": { - "prettier": { - "optional": true - } - } - }, - "node_modules/@storybook/telemetry/node_modules/@storybook/core-events": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.3.tgz", - "integrity": "sha512-eOs4HRrsEZz2FZFlMGwPuH9CGYBK8fkUS7mcHNPv8CqoHV8d3ErvDax8zA/KGRj3S6kWJ4PzI9IGuiDVvwuxhA==", - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/telemetry/node_modules/@storybook/csf-tools": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/csf-tools/-/csf-tools-8.1.3.tgz", - "integrity": "sha512-22h6Uv7w29v8HjoFsJvAkBci9POVH0aQhlfZ4NNYkiMbgD4X4HWeD2wqob6fTKpVWP3tDaNS9FfCWHxQXFE+ag==", - "dependencies": { - "@babel/generator": "^7.24.4", - "@babel/parser": "^7.24.4", - "@babel/traverse": "^7.24.1", - "@babel/types": "^7.24.0", - "@storybook/csf": "^0.1.7", - "@storybook/types": "8.1.3", - "fs-extra": "^11.1.0", - "recast": "^0.23.5", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/telemetry/node_modules/@storybook/node-logger": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-8.1.3.tgz", - "integrity": "sha512-MpQ7Zl5n58zbFr1Yu3qgInGENoScEnfqsCxipMhj57b5SWJJ7NoOdSAWznjFFffo8NoaqxldHscuaQfzPBN9hA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/telemetry/node_modules/@storybook/types": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.3.tgz", - "integrity": "sha512-2uUC1z7heMceRPHQ4KCcZwwKjtW2YiToUODsEw0YOq6NC/Q9elZta1FABSG0Bq7XM08EiAgjyc7P9CZPJ2QxUQ==", - "dependencies": { - "@storybook/channels": "8.1.3", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/telemetry/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/@storybook/telemetry/node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "engines": { - "node": ">=10" + "@storybook/client-logger": "8.1.6", + "memoizerific": "^1.11.3", + "qs": "^6.10.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/telemetry/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "engines": { - "node": ">=10.17.0" + "type": "opencollective", + "url": "https://opencollective.com/storybook" } }, - "node_modules/@storybook/telemetry/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "bin": { - "semver": "bin/semver.js" + "node_modules/@storybook/router/node_modules/@storybook/client-logger": { + "version": "8.1.6", + "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", + "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", + "dev": true, + "dependencies": { + "@storybook/global": "^5.0.0" }, - "engines": { - "node": ">=10" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/storybook" } }, "node_modules/@storybook/test": { @@ -10898,16 +9645,6 @@ "@types/ms": "*" } }, - "node_modules/@types/detect-port": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/@types/detect-port/-/detect-port-1.3.5.tgz", - "integrity": "sha512-Rf3/lB9WkDfIL9eEKaSYKc+1L/rNVYBjThk22JTqQw0YozXarX8YljFAz+HCoC6h4B4KwCMsBPZHaFezwT4BNA==" - }, - "node_modules/@types/diff": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.2.1.tgz", - "integrity": "sha512-uxpcuwWJGhe2AR1g8hD9F5OYGCqjqWnBUQFD8gMZsDbv8oPHzxJF6iMO6n8Tk0AdzlxoaaoQhOYlIg/PukVU8g==" - }, "node_modules/@types/diff-match-patch": { "version": "1.0.36", "resolved": "https://registry.npmjs.org/@types/diff-match-patch/-/diff-match-patch-1.0.36.tgz", @@ -10918,11 +9655,6 @@ "resolved": "https://registry.npmjs.org/@types/doctrine/-/doctrine-0.0.3.tgz", "integrity": "sha512-w5jZ0ee+HaPOaX25X2/2oGR/7rgAQSYII7X7pp0m9KgBfMP7uKfMfTvcpl5Dj+eDBbpxKGiqE+flqDr6XTd2RA==" }, - "node_modules/@types/ejs": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/@types/ejs/-/ejs-3.1.5.tgz", - "integrity": "sha512-nv+GSx77ZtXiJzwKdsASqi+YQ5Z7vwHsTP0JY2SiQgjGckkBRKZnk8nIM+7oUZ1VCtuTz0+By4qVR7fqzp/Dfg==" - }, "node_modules/@types/emscripten": { "version": "1.39.8", "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.8.tgz", @@ -11109,11 +9841,6 @@ "@types/node": "*" } }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==" - }, "node_modules/@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", @@ -11129,11 +9856,6 @@ "pg-types": "^4.0.1" } }, - "node_modules/@types/pretty-hrtime": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/pretty-hrtime/-/pretty-hrtime-1.0.1.tgz", - "integrity": "sha512-VjID5MJb1eGKthz2qUerWT8+R4b9N+CHvGCzg9fn4kWZgaF9AhdYikQio3R7wV8YY1NsQKPaCwKz1Yff+aHNUQ==" - }, "node_modules/@types/prismjs": { "version": "1.26.3", "resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.3.tgz", @@ -11908,20 +10630,6 @@ "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" }, - "node_modules/@yarnpkg/esbuild-plugin-pnp": { - "version": "3.0.0-rc.15", - "resolved": "https://registry.npmjs.org/@yarnpkg/esbuild-plugin-pnp/-/esbuild-plugin-pnp-3.0.0-rc.15.tgz", - "integrity": "sha512-kYzDJO5CA9sy+on/s2aIW0411AklfCi8Ck/4QDivOqsMKpStZA2SsR+X27VTggGwpStWaLrjJcDcdDMowtG8MA==", - "dependencies": { - "tslib": "^2.4.0" - }, - "engines": { - "node": ">=14.15.0" - }, - "peerDependencies": { - "esbuild": ">=0.10.0" - } - }, "node_modules/@yarnpkg/fslib": { "version": "2.10.3", "resolved": "https://registry.npmjs.org/@yarnpkg/fslib/-/fslib-2.10.3.tgz", @@ -12038,14 +10746,6 @@ "node": ">=0.4.0" } }, - "node_modules/address": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/address/-/address-1.2.2.tgz", - "integrity": "sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==", - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/adjust-sourcemap-loader": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-4.0.0.tgz", @@ -12099,6 +10799,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" @@ -13189,17 +11890,6 @@ "tweetnacl": "^0.14.3" } }, - "node_modules/better-opn": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/better-opn/-/better-opn-3.0.2.tgz", - "integrity": "sha512-aVNobHnJqLiUelTaHat9DZ1qM2w0C0Eym4LPI/3JxOnSokGVdsl1T1kN7TFvsEAD8G47A6VKQ0TVHqbBnYMJlQ==", - "dependencies": { - "open": "^8.0.4" - }, - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/big-integer": { "version": "1.6.52", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", @@ -13333,17 +12023,6 @@ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "dev": true }, - "node_modules/bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", - "dependencies": { - "big-integer": "^1.6.44" - }, - "engines": { - "node": ">= 5.10.0" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -13839,6 +12518,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, "engines": { "node": ">=6" } @@ -13884,6 +12564,7 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", + "dev": true, "dependencies": { "string-width": "^4.2.0" }, @@ -14135,60 +12816,6 @@ "node": ">= 6" } }, - "node_modules/compressible": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", - "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", - "dependencies": { - "mime-db": ">= 1.43.0 < 2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/compression": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", - "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", - "dependencies": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.16", - "debug": "2.6.9", - "on-headers": "~1.0.2", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/compression/node_modules/bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/compression/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/compression/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/compression/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, "node_modules/compute-scroll-into-view": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-3.0.3.tgz", @@ -14458,6 +13085,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, "engines": { "node": ">=8" } @@ -14956,21 +13584,6 @@ "node": ">=0.10.0" } }, - "node_modules/default-browser-id": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", - "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", - "dependencies": { - "bplist-parser": "^0.2.0", - "untildify": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -14995,14 +13608,6 @@ "node": ">= 0.4" } }, - "node_modules/define-lazy-prop": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", - "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", - "engines": { - "node": ">=8" - } - }, "node_modules/define-properties": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", @@ -15028,6 +13633,7 @@ "version": "6.1.1", "resolved": "https://registry.npmjs.org/del/-/del-6.1.1.tgz", "integrity": "sha512-ua8BhapfP0JUJKC/zV9yHHDW/rDoDxP4Zhn3AkA6/xT6gY7jYXJiaeyBZznYVujhZZET+UgcbZiQ7sN3WqcImg==", + "dev": true, "dependencies": { "globby": "^11.0.1", "graceful-fs": "^4.2.4", @@ -15114,87 +13720,11 @@ "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==" }, - "node_modules/detect-package-manager": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/detect-package-manager/-/detect-package-manager-2.0.1.tgz", - "integrity": "sha512-j/lJHyoLlWi6G1LDdLgvUtz60Zo5GEj+sVYtTVXnYLDPuzgC3llMxonXym9zIwhhUII8vjdw0LXxavpLqTbl1A==", - "dependencies": { - "execa": "^5.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/detect-package-manager/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/detect-package-manager/node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/detect-package-manager/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/detect-port": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-1.6.1.tgz", - "integrity": "sha512-CmnVc+Hek2egPx1PeTFVta2W78xy2K/9Rkf6cC4T59S50tVnzKj+tnx5mmx5lwvCkujZ4uRrpRSuV+IVs3f90Q==", - "dependencies": { - "address": "^1.0.1", - "debug": "4" - }, - "bin": { - "detect": "bin/detect-port.js", - "detect-port": "bin/detect-port.js" - }, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, - "node_modules/diff": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/diff-match-patch": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz", @@ -15410,49 +13940,6 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/duplexify": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", - "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", - "dependencies": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - } - }, - "node_modules/duplexify/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" - }, - "node_modules/duplexify/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/duplexify/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/duplexify/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -15558,20 +14045,6 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, - "node_modules/ejs": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", - "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", - "dependencies": { - "jake": "^10.8.5" - }, - "bin": { - "ejs": "bin/cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/electron-to-chromium": { "version": "1.4.783", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.783.tgz", @@ -15966,11 +14439,6 @@ "@esbuild/win32-x64": "0.18.20" } }, - "node_modules/esbuild-plugin-alias": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/esbuild-plugin-alias/-/esbuild-plugin-alias-0.2.1.tgz", - "integrity": "sha512-jyfL/pwPqaFXyKnj8lP8iLk6Z0m099uXR45aSN8Av1XD4vhvQutxxPzgA2bTcAwQpa1zCXDcWOlhFgyP3GKqhQ==" - }, "node_modules/esbuild-register": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.5.0.tgz", @@ -17269,7 +15737,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/fd-package-json/-/fd-package-json-1.2.0.tgz", "integrity": "sha512-45LSPmWf+gC5tdCQMNH4s9Sr00bIkiD9aN7dc5hqkrEw1geRYyDQS1v1oMHAW3ysfxfndqGsrDREHHjNNbKUfA==", - "dev": true, "dependencies": { "walk-up-path": "^3.0.1" } @@ -17364,11 +15831,6 @@ "webidl-conversions": "^4.0.2" } }, - "node_modules/fetch-retry": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/fetch-retry/-/fetch-retry-5.0.6.tgz", - "integrity": "sha512-3yurQZ2hD9VISAhJJP9bpYFNQrHHBXE2JxxjY5aLEcDi46RmAzJE2OC9FAde0yis5ElW0jTTzs0zfg/Cca4XqQ==" - }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -17394,50 +15856,23 @@ } }, "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/file-system-cache": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/file-system-cache/-/file-system-cache-2.3.0.tgz", - "integrity": "sha512-l4DMNdsIPsVnKrgEXbJwDJsA5mB8rGwHYERMgqQx/xAUtChPJMre1bXBzDEqqVbWv9AIbFezXMxeEkZDSrXUOQ==", - "dependencies": { - "fs-extra": "11.1.1", - "ramda": "0.29.0" - } - }, - "node_modules/filelist": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", - "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", - "dependencies": { - "minimatch": "^5.0.1" - } - }, - "node_modules/filelist/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/filelist/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dependencies": { - "brace-expansion": "^2.0.1" + "flat-cache": "^3.0.4" }, "engines": { - "node": ">=10" + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/file-system-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/file-system-cache/-/file-system-cache-2.3.0.tgz", + "integrity": "sha512-l4DMNdsIPsVnKrgEXbJwDJsA5mB8rGwHYERMgqQx/xAUtChPJMre1bXBzDEqqVbWv9AIbFezXMxeEkZDSrXUOQ==", + "dependencies": { + "fs-extra": "11.1.1", + "ramda": "0.29.0" } }, "node_modules/fill-range": { @@ -18099,14 +16534,6 @@ "node": ">=6" } }, - "node_modules/get-npm-tarball-url": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/get-npm-tarball-url/-/get-npm-tarball-url-2.0.3.tgz", - "integrity": "sha512-R/PW6RqyaBQNWYaSyfrh54/qtcnOp22FHCCiRhSSZj0FP3KQWCsxxt0DzIdVTbwTqe9CtQfvl/FPD4UIPt4pqw==", - "engines": { - "node": ">=12.17" - } - }, "node_modules/get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -18348,35 +16775,6 @@ "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" }, - "node_modules/gunzip-maybe": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/gunzip-maybe/-/gunzip-maybe-1.4.2.tgz", - "integrity": "sha512-4haO1M4mLO91PW57BMsDFf75UmwoRX0GkdD+Faw+Lr+r/OZrOCS0pIBwOL1xCKQqnQzbNFGgK2V2CpBUPeFNTw==", - "dependencies": { - "browserify-zlib": "^0.1.4", - "is-deflate": "^1.0.0", - "is-gzip": "^1.0.0", - "peek-stream": "^1.1.0", - "pumpify": "^1.3.3", - "through2": "^2.0.3" - }, - "bin": { - "gunzip-maybe": "bin.js" - } - }, - "node_modules/gunzip-maybe/node_modules/browserify-zlib": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", - "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==", - "dependencies": { - "pako": "~0.2.0" - } - }, - "node_modules/gunzip-maybe/node_modules/pako": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==" - }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", @@ -18590,11 +16988,6 @@ "react-is": "^16.7.0" } }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" - }, "node_modules/html-entities": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", @@ -18941,6 +17334,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, "engines": { "node": ">=8" } @@ -19005,11 +17399,6 @@ "loose-envify": "^1.0.0" } }, - "node_modules/ip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", - "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==" - }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -19162,25 +17551,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-deflate": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-deflate/-/is-deflate-1.0.0.tgz", - "integrity": "sha512-YDoFpuZWu1VRXlsnlYMzKyVRITXj7Ej/V9gXQ2/pAe7X1J7M/RNOqaIYi6qUn+B7nGyB9pDXrv02dsB58d2ZAQ==" - }, - "node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -19233,14 +17603,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-gzip": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-gzip/-/is-gzip-1.0.0.tgz", - "integrity": "sha512-rcfALRIb1YewtnksfRIHGcIY93QnK8BIQ/2c9yDYcG/Y6+vRoJuTWBmmSEbyLLYtXm7q35pHOHbZFQBaLrhlWQ==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-installed-globally": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", @@ -19325,6 +17687,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", + "dev": true, "engines": { "node": ">=6" } @@ -19499,17 +17862,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", @@ -19562,23 +17914,6 @@ "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/jake": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.1.tgz", - "integrity": "sha512-61btcOHNnLnsOdtLgA5efqQWjnSi/vow5HbI7HMdKKWqvrKR1bLK3BPlJn9gcSaP2ewuamUSMB5XEy76KUIS2w==", - "dependencies": { - "async": "^3.2.3", - "chalk": "^4.0.2", - "filelist": "^1.0.4", - "minimatch": "^3.1.2" - }, - "bin": { - "jake": "bin/cli.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/jiti": { "version": "1.21.0", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", @@ -20751,7 +19086,8 @@ "node_modules/mkdirp-classic": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true }, "node_modules/moment": { "version": "2.29.4", @@ -21148,25 +19484,6 @@ "node": ">=6" } }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "bin": { - "semver": "bin/semver" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -21392,14 +19709,6 @@ "node": ">= 0.8" } }, - "node_modules/on-headers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -21422,22 +19731,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/open": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", - "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", - "dependencies": { - "define-lazy-prop": "^2.0.0", - "is-docker": "^2.1.1", - "is-wsl": "^2.2.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/openai": { "version": "4.52.7", "resolved": "https://registry.npmjs.org/openai/-/openai-4.52.7.tgz", @@ -21576,6 +19869,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, "dependencies": { "aggregate-error": "^3.0.0" }, @@ -21798,16 +20092,6 @@ "url": "https://ko-fi.com/killymxi" } }, - "node_modules/peek-stream": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz", - "integrity": "sha512-FhJ+YbOSBb9/rIl2ZeE/QHEsWn7PqNYt8ARAY3kIgNGOk13g9FGyIY6JIl/xB/3TFRVoTv5as0l11weORrTekA==", - "dependencies": { - "buffer-from": "^1.0.0", - "duplexify": "^3.5.0", - "through2": "^2.0.3" - } - }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -22755,25 +21039,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/pumpify": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", - "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", - "dependencies": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - } - }, - "node_modules/pumpify/node_modules/pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -23852,100 +22118,6 @@ "pify": "^2.3.0" } }, - "node_modules/read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "engines": { - "node": ">=8" - } - }, "node_modules/readable-stream": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.2.tgz", @@ -25367,34 +23539,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.13", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz", - "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==" - }, "node_modules/split": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", @@ -25572,13 +23716,13 @@ "node_modules/store2": { "version": "2.14.2", "resolved": "https://registry.npmjs.org/store2/-/store2-2.14.2.tgz", - "integrity": "sha512-siT1RiqlfQnGqgT/YzXVUNsom9S0H1OX+dpdGN1xkyYATo4I6sep5NmsRD/40s3IIOvlCq6akxkqG82urIZW1w==" + "integrity": "sha512-siT1RiqlfQnGqgT/YzXVUNsom9S0H1OX+dpdGN1xkyYATo4I6sep5NmsRD/40s3IIOvlCq6akxkqG82urIZW1w==", + "dev": true }, "node_modules/storybook": { "version": "8.2.6", "resolved": "https://registry.npmjs.org/storybook/-/storybook-8.2.6.tgz", "integrity": "sha512-8j30wDxQmkcqI0fWcSYFsUCjErsY1yTWbTW+yjbwM8DyW18Cud6CwbFRCxjFsH+2M0CjP6Pqs/m1PGI0vcQscQ==", - "dev": true, "dependencies": { "@babel/core": "^7.24.4", "@babel/types": "^7.24.0", @@ -25623,7 +23767,6 @@ "version": "8.2.6", "resolved": "https://registry.npmjs.org/@storybook/codemod/-/codemod-8.2.6.tgz", "integrity": "sha512-+mFJ6R+JhJLpU7VPDlXU5Yn6nqIBq745GaEosnIiFOdNo3jaxJ58wq/sGhbQvoCHPUxMA+sDQvR7pS62YFoLRQ==", - "dev": true, "dependencies": { "@babel/core": "^7.24.4", "@babel/preset-env": "^7.24.4", @@ -25648,7 +23791,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", "integrity": "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==", - "dev": true, "dependencies": { "type-fest": "^1.0.1" }, @@ -25663,7 +23805,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", - "dev": true, "engines": { "node": ">=10" }, @@ -25675,7 +23816,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -25698,7 +23838,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, "engines": { "node": ">=10" }, @@ -25710,7 +23849,6 @@ "version": "14.0.2", "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.2.tgz", "integrity": "sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==", - "dev": true, "dependencies": { "@sindresorhus/merge-streams": "^2.1.0", "fast-glob": "^3.3.2", @@ -25730,7 +23868,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, "engines": { "node": ">=10.17.0" } @@ -25739,7 +23876,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", - "dev": true, "engines": { "node": ">=12" }, @@ -25751,7 +23887,6 @@ "version": "7.6.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "dev": true, "bin": { "semver": "bin/semver.js" }, @@ -25763,7 +23898,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", - "dev": true, "engines": { "node": ">=14.16" }, @@ -25775,7 +23909,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", - "dev": true, "engines": { "node": ">=14.16" } @@ -25784,7 +23917,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.1.0.tgz", "integrity": "sha512-7jDLIdD2Zp0bDe5r3D2qtkd1QOCacylBuL7oa4udvN6v2pqr4+LcCr67C8DR1zkpaZ8XosF5m1yQSabKAW6f2g==", - "dev": true, "dependencies": { "is-stream": "^3.0.0", "temp-dir": "^3.0.0", @@ -25802,7 +23934,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, @@ -25814,7 +23945,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", - "dev": true, "dependencies": { "crypto-random-string": "^4.0.0" }, @@ -25884,11 +24014,6 @@ "node": ">= 6" } }, - "node_modules/stream-shift": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", - "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" - }, "node_modules/streamsearch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", @@ -26360,6 +24485,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", @@ -26370,7 +24496,8 @@ "node_modules/tar-fs/node_modules/chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true }, "node_modules/tar-stream": { "version": "2.2.0", @@ -26436,6 +24563,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz", "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==", + "dev": true, "engines": { "node": ">=8" } @@ -26476,6 +24604,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/tempy/-/tempy-1.0.1.tgz", "integrity": "sha512-biM9brNqxSc04Ee71hzFbryD11nX7VPhQQY32AdDmjFvodsRFz/3ufeoTZ6uYkRFfGo188tENcASNs3vTdsM0w==", + "dev": true, "dependencies": { "del": "^6.0.0", "is-stream": "^2.0.0", @@ -26494,6 +24623,7 @@ "version": "0.16.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.16.0.tgz", "integrity": "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg==", + "dev": true, "engines": { "node": ">=10" }, @@ -26638,47 +24768,6 @@ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "node_modules/through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "node_modules/through2/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" - }, - "node_modules/through2/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/through2/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/through2/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/timers-browserify": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", @@ -27540,6 +25629,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, "dependencies": { "crypto-random-string": "^2.0.0" }, @@ -27678,6 +25768,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", + "dev": true, "engines": { "node": ">=8" } @@ -27891,15 +25982,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "node_modules/validator": { "version": "13.11.0", "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", @@ -27987,8 +26069,7 @@ "node_modules/walk-up-path": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-3.0.1.tgz", - "integrity": "sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==", - "dev": true + "integrity": "sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==" }, "node_modules/watchpack": { "version": "2.4.0", From 1b05510b05cd2fa1b3fea1b57c9a6cc7711656e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 10:29:03 +0000 Subject: [PATCH 044/128] chore(deps-dev): bump @storybook/addon-essentials in /app Bumps [@storybook/addon-essentials](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/essentials) from 8.1.6 to 8.2.6. - [Release notes](https://github.com/storybookjs/storybook/releases) - [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md) - [Commits](https://github.com/storybookjs/storybook/commits/v8.2.6/code/addons/essentials) --- updated-dependencies: - dependency-name: "@storybook/addon-essentials" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- app/package-lock.json | 1417 +++++------------------------------------ app/package.json | 2 +- 2 files changed, 174 insertions(+), 1245 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index be6b79198..85ae09b42 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -79,7 +79,7 @@ }, "devDependencies": { "@playwright/test": "^1.43.1", - "@storybook/addon-essentials": "^8.1.6", + "@storybook/addon-essentials": "^8.2.6", "@storybook/addon-interactions": "^8.2.5", "@storybook/addon-links": "^7.6.17", "@storybook/blocks": "^8.0.4", @@ -3773,6 +3773,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.0.1.tgz", "integrity": "sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==", + "peer": true, "peerDependencies": { "react": ">=16.8.0" } @@ -5020,146 +5021,6 @@ } } }, - "node_modules/@radix-ui/react-dialog": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.0.5.tgz", - "integrity": "sha512-GjWJX/AUpB703eEBanuBnIWdIXg6NvJFCXcNlSZk4xdszCdhrJgBoUd1cGk67vFO+WdA2pfI/plOpqz/5GUP6Q==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.13.10", - "@radix-ui/primitive": "1.0.1", - "@radix-ui/react-compose-refs": "1.0.1", - "@radix-ui/react-context": "1.0.1", - "@radix-ui/react-dismissable-layer": "1.0.5", - "@radix-ui/react-focus-guards": "1.0.1", - "@radix-ui/react-focus-scope": "1.0.4", - "@radix-ui/react-id": "1.0.1", - "@radix-ui/react-portal": "1.0.4", - "@radix-ui/react-presence": "1.0.1", - "@radix-ui/react-primitive": "1.0.3", - "@radix-ui/react-slot": "1.0.2", - "@radix-ui/react-use-controllable-state": "1.0.1", - "aria-hidden": "^1.1.1", - "react-remove-scroll": "2.5.5" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0", - "react-dom": "^16.8 || ^17.0 || ^18.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.5.tgz", - "integrity": "sha512-aJeDjQhywg9LBu2t/At58hCvr7pEm0o2Ke1x33B+MhjNmmZ17sy4KImo0KPLgsnc/zN7GPdce8Cnn0SWvwZO7g==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.13.10", - "@radix-ui/primitive": "1.0.1", - "@radix-ui/react-compose-refs": "1.0.1", - "@radix-ui/react-primitive": "1.0.3", - "@radix-ui/react-use-callback-ref": "1.0.1", - "@radix-ui/react-use-escape-keydown": "1.0.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0", - "react-dom": "^16.8 || ^17.0 || ^18.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-scope": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.4.tgz", - "integrity": "sha512-sL04Mgvf+FmyvZeYfNu1EPAaaxD+aw7cYeIB9L9Fvq8+urhltTRaEo5ysKOpHuKPclsZcSUMKlN05x4u+CINpA==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.13.10", - "@radix-ui/react-compose-refs": "1.0.1", - "@radix-ui/react-primitive": "1.0.3", - "@radix-ui/react-use-callback-ref": "1.0.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0", - "react-dom": "^16.8 || ^17.0 || ^18.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.4.tgz", - "integrity": "sha512-Qki+C/EuGUVCQTOTD5vzJzJuMUlewbzuKyUy+/iHM2uwGiru9gZeBJtHAPKAEkB5KWGi9mP/CHKcY0wt1aW45Q==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.13.10", - "@radix-ui/react-primitive": "1.0.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0", - "react-dom": "^16.8 || ^17.0 || ^18.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll": { - "version": "2.5.5", - "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz", - "integrity": "sha512-ImKhrzJJsyXJfBZ4bzu8Bwpka14c/fQt0k+cyFp/PBhTfyDnU5hjOtM4AG/0AMyy8oKzOTR0lDgJIM7pYXI0kw==", - "dev": true, - "dependencies": { - "react-remove-scroll-bar": "^2.3.3", - "react-style-singleton": "^2.2.1", - "tslib": "^2.1.0", - "use-callback-ref": "^1.3.0", - "use-sidecar": "^1.1.2" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, "node_modules/@radix-ui/react-direction": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.0.1.tgz", @@ -6127,12 +5988,11 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" }, "node_modules/@storybook/addon-actions": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-actions/-/addon-actions-8.1.6.tgz", - "integrity": "sha512-EbiAdbtXN/UM4by3+qisbrQmElaIfahgNqffbst6GiCTmUCVE5if6geL1mzKd/u/rZOzx5g0EG76x8N9yDjOtg==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-actions/-/addon-actions-8.2.6.tgz", + "integrity": "sha512-iCsf3V28/jJ95w2zd8aSvR4denoA2UYV3fpNCTGOURqICyKOG3cyVxvqKp8Hhcwn7trNOsK+HlL6q5gpv56ViA==", "dev": true, "dependencies": { - "@storybook/core-events": "8.1.6", "@storybook/global": "^5.0.0", "@types/uuid": "^9.0.1", "dequal": "^2.0.2", @@ -6142,26 +6002,15 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-actions/node_modules/@storybook/core-events": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.6.tgz", - "integrity": "sha512-DaIVe4TUp/7uQdSJYGmJv9S/S364tSgZ3S3dZ1vsf1rgoUbCp5kTBtcd/fcqgukMPREgCgO9oDhmemI3SLAqzw==", - "dev": true, - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" + "peerDependencies": { + "storybook": "^8.2.6" } }, "node_modules/@storybook/addon-backgrounds": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-backgrounds/-/addon-backgrounds-8.1.6.tgz", - "integrity": "sha512-mrBG5mkcMg6vpRUtNxyYaseD4ucrG+mZiqZnXcx8LWzwDMOd4mOODvap286z+Si0Fl1etbGDDhPU9+hV+o1arw==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-backgrounds/-/addon-backgrounds-8.2.6.tgz", + "integrity": "sha512-61NFowA6EmCw+Eyzp0U4fat9MlPDdnT7aoDyzqSImLwWLITY9IvmWuTeo7XKJZN3fe22z1r7cZseKdYrtaHcKw==", "dev": true, "dependencies": { "@storybook/global": "^5.0.0", @@ -6171,15 +6020,17 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.6" } }, "node_modules/@storybook/addon-controls": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-controls/-/addon-controls-8.1.6.tgz", - "integrity": "sha512-hDMsu4yRP/ySb/G7hbd7nSFhVNz+F9hnizJGJX4XGuiSx7rAEYjvfKQKkawxTP+VeAw6iZPj1fukvOrMCQ0xxQ==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-controls/-/addon-controls-8.2.6.tgz", + "integrity": "sha512-EHUwHy+oZZv3pXzN7fuXWrS/meHFjqcELY3RBvOyEkGf21agl6co6R1tnf6d5N5QoYAGfIbDO7dkauSL2RfNAw==", "dev": true, "dependencies": { - "@storybook/blocks": "8.1.6", "dequal": "^2.0.2", "lodash": "^4.17.21", "ts-dedent": "^2.0.0" @@ -6187,27 +6038,23 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.6" } }, "node_modules/@storybook/addon-docs": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-docs/-/addon-docs-8.1.6.tgz", - "integrity": "sha512-ejTbjDhaHn6IeTma/pwn8OutDzIqbMJKNhZx24W4FE/qvYInZIK/9gYPU9/oLKZ7FImqP3s1e4+RxDBgsq21lA==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-docs/-/addon-docs-8.2.6.tgz", + "integrity": "sha512-qe7hxntaezqjKdU9QS+Q9NFL6i/uNdBxdvOnCKgPhBAY/zY6yhk5t3sOvonynPK5nkaNAowfSNPIzNxAXlJ1sA==", "dev": true, "dependencies": { "@babel/core": "^7.24.4", "@mdx-js/react": "^3.0.0", - "@storybook/blocks": "8.1.6", - "@storybook/client-logger": "8.1.6", - "@storybook/components": "8.1.6", - "@storybook/csf-plugin": "8.1.6", - "@storybook/csf-tools": "8.1.6", + "@storybook/blocks": "8.2.6", + "@storybook/csf-plugin": "8.2.6", "@storybook/global": "^5.0.0", - "@storybook/node-logger": "8.1.6", - "@storybook/preview-api": "8.1.6", - "@storybook/react-dom-shim": "8.1.6", - "@storybook/theming": "8.1.6", - "@storybook/types": "8.1.6", + "@storybook/react-dom-shim": "8.2.6", "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", "fs-extra": "^11.1.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0", @@ -6219,29 +6066,40 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.6" } }, - "node_modules/@storybook/addon-docs/node_modules/@storybook/channels": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.6.tgz", - "integrity": "sha512-CzDnP6qfI8OC8pGUk+wPUzLPYcKhX8XbriF2gBtwl6qVM8YfkHP2mLTiDYDwBIi0rLuUbSm/SpILXQ/ouOHOGw==", - "dev": true, - "dependencies": { - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" + "node_modules/@storybook/addon-essentials": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-essentials/-/addon-essentials-8.2.6.tgz", + "integrity": "sha512-diGjGZcZNov+RCAVQBTm8JKP2kUtMRuJIQFBeXdPWpu6hYBk6lw1FlAf2GywWGCvdny1pJT90hfoD33qUMNuDg==", + "dev": true, + "dependencies": { + "@storybook/addon-actions": "8.2.6", + "@storybook/addon-backgrounds": "8.2.6", + "@storybook/addon-controls": "8.2.6", + "@storybook/addon-docs": "8.2.6", + "@storybook/addon-highlight": "8.2.6", + "@storybook/addon-measure": "8.2.6", + "@storybook/addon-outline": "8.2.6", + "@storybook/addon-toolbars": "8.2.6", + "@storybook/addon-viewport": "8.2.6", + "ts-dedent": "^2.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.6" } }, - "node_modules/@storybook/addon-docs/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", + "node_modules/@storybook/addon-highlight": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-highlight/-/addon-highlight-8.2.6.tgz", + "integrity": "sha512-03cV9USsfP3bS4wYV06DYcIaGPfoheQe53Q0Jr1B2yJUVyIPKvmO2nGjLBsqzeL3Wl7vSfLQn0/dUdxCcbqLsw==", "dev": true, "dependencies": { "@storybook/global": "^5.0.0" @@ -6249,848 +6107,154 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.6" } }, - "node_modules/@storybook/addon-docs/node_modules/@storybook/core-events": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.6.tgz", - "integrity": "sha512-DaIVe4TUp/7uQdSJYGmJv9S/S364tSgZ3S3dZ1vsf1rgoUbCp5kTBtcd/fcqgukMPREgCgO9oDhmemI3SLAqzw==", + "node_modules/@storybook/addon-interactions": { + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/@storybook/addon-interactions/-/addon-interactions-8.2.5.tgz", + "integrity": "sha512-YVdpU/VRrRvX3BUiYxno6jDttbbQxngOkgcY8u+LLXbo3LfFLeXwpUmJXvGOrIU1wDHsZ4FAPBS/beFntcFhBw==", "dev": true, "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" + "@storybook/global": "^5.0.0", + "@storybook/instrumenter": "8.2.5", + "@storybook/test": "8.2.5", + "polished": "^4.2.2", + "ts-dedent": "^2.2.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.5" } }, - "node_modules/@storybook/addon-docs/node_modules/@storybook/node-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-8.1.6.tgz", - "integrity": "sha512-IZEiTLFHu8Oom/vdEGpisSw5CfU+cw6/fTaX1P3EVClFOWVuy8/3X5MPu4wJH3jPym6E2DBduIUFeRsiuq61gA==", + "node_modules/@storybook/addon-links": { + "version": "7.6.17", + "resolved": "https://registry.npmjs.org/@storybook/addon-links/-/addon-links-7.6.17.tgz", + "integrity": "sha512-iFUwKObRn0EKI0zMETsil2p9a/81rCuSMEWECsi+khkCAs1FUnD2cT6Ag5ydcNcBXsdtdfDJdtXQrkw+TSoStQ==", "dev": true, + "dependencies": { + "@storybook/csf": "^0.1.2", + "@storybook/global": "^5.0.0", + "ts-dedent": "^2.0.0" + }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } } }, - "node_modules/@storybook/addon-docs/node_modules/@storybook/preview-api": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/preview-api/-/preview-api-8.1.6.tgz", - "integrity": "sha512-g9EvVg/DYqmjMh1uivJBJnSIvURyuK4LLabYicQNmYdQJscAeXX2bpMcA4aeci9BBm9B2RP7JbSnq7DbXZaJYA==", + "node_modules/@storybook/addon-measure": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-measure/-/addon-measure-8.2.6.tgz", + "integrity": "sha512-neI8YeSOAtOmzasLxo6O8ZLr2ebMaD7XVF+kYatl5+SpyuwwvUGcP9NkKe5S+mB8V2zxFUIsXS74XrhmQhRoaQ==", "dev": true, "dependencies": { - "@storybook/channels": "8.1.6", - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/csf": "^0.1.7", "@storybook/global": "^5.0.0", - "@storybook/types": "8.1.6", - "@types/qs": "^6.9.5", - "dequal": "^2.0.2", - "lodash": "^4.17.21", - "memoizerific": "^1.11.3", - "qs": "^6.10.0", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" + "tiny-invariant": "^1.3.1" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.6" } }, - "node_modules/@storybook/addon-docs/node_modules/@storybook/react-dom-shim": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/react-dom-shim/-/react-dom-shim-8.1.6.tgz", - "integrity": "sha512-qP5nkAmpGFy/gshO+bVjRo1rgo/6UVDElgOd2dlUtYnfdPONiOfWko2XGYKKfxa6Cp7KU35JlZz/kHGqWG31zQ==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta" - } - }, - "node_modules/@storybook/addon-docs/node_modules/@storybook/types": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.6.tgz", - "integrity": "sha512-cWpS9+x1pxCO39spR8QmumMK2ub2p5cvMtrRvWaIjBFPbCwm2CvjBXFWIra2veBCZTxUKJ9VWxvi7pzRHjN/nw==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-essentials": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-essentials/-/addon-essentials-8.1.6.tgz", - "integrity": "sha512-8ve9eM9dL6JsC5hV98unXtADvwyhIZoa3iWSeTicxWab49tvAfIM9ExwcWmUyPaB4m5q45jBSBXg66bzW2+TFw==", - "dev": true, - "dependencies": { - "@storybook/addon-actions": "8.1.6", - "@storybook/addon-backgrounds": "8.1.6", - "@storybook/addon-controls": "8.1.6", - "@storybook/addon-docs": "8.1.6", - "@storybook/addon-highlight": "8.1.6", - "@storybook/addon-measure": "8.1.6", - "@storybook/addon-outline": "8.1.6", - "@storybook/addon-toolbars": "8.1.6", - "@storybook/addon-viewport": "8.1.6", - "@storybook/core-common": "8.1.6", - "@storybook/manager-api": "8.1.6", - "@storybook/node-logger": "8.1.6", - "@storybook/preview-api": "8.1.6", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/@storybook/channels": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.6.tgz", - "integrity": "sha512-CzDnP6qfI8OC8pGUk+wPUzLPYcKhX8XbriF2gBtwl6qVM8YfkHP2mLTiDYDwBIi0rLuUbSm/SpILXQ/ouOHOGw==", + "node_modules/@storybook/addon-outline": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-outline/-/addon-outline-8.2.6.tgz", + "integrity": "sha512-uAlPtqDWlq7MQQ4zJT80qdjbSdLF/zsvtPhidX6h9cjLKNPWAv79xJQ14AJHaMv+Hzy5xKnM4wdEhgPbzKabQg==", "dev": true, "dependencies": { - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" + "ts-dedent": "^2.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" + "peerDependencies": { + "storybook": "^8.2.6" } }, - "node_modules/@storybook/addon-essentials/node_modules/@storybook/core-common": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-common/-/core-common-8.1.6.tgz", - "integrity": "sha512-OTlfJFaTOB588ibXrrFm0TAXam6E5xV1VXSjNXL+fIifx8Kjln2HNSy1JKjvcblQneYiV4J1xPCVnAIe0EGHDg==", + "node_modules/@storybook/addon-toolbars": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-toolbars/-/addon-toolbars-8.2.6.tgz", + "integrity": "sha512-0JmRirMpxHS6VZzBk0kY871xWTpkk3TN4S1sxoFf5fcnCfVTHDjEJ5Ws/QWru1RJlIZHuJKRdQIA6Vuq5X+KfQ==", "dev": true, - "dependencies": { - "@storybook/core-events": "8.1.6", - "@storybook/csf-tools": "8.1.6", - "@storybook/node-logger": "8.1.6", - "@storybook/types": "8.1.6", - "@yarnpkg/fslib": "2.10.3", - "@yarnpkg/libzip": "2.3.0", - "chalk": "^4.1.0", - "cross-spawn": "^7.0.3", - "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", - "esbuild-register": "^3.5.0", - "execa": "^5.0.0", - "file-system-cache": "2.3.0", - "find-cache-dir": "^3.0.0", - "find-up": "^5.0.0", - "fs-extra": "^11.1.0", - "glob": "^10.0.0", - "handlebars": "^4.7.7", - "lazy-universal-dotenv": "^4.0.0", - "node-fetch": "^2.0.0", - "picomatch": "^2.3.0", - "pkg-dir": "^5.0.0", - "prettier-fallback": "npm:prettier@^3", - "pretty-hrtime": "^1.0.3", - "resolve-from": "^5.0.0", - "semver": "^7.3.7", - "tempy": "^3.1.0", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util": "^0.12.4" - }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" }, "peerDependencies": { - "prettier": "^2 || ^3" - }, - "peerDependenciesMeta": { - "prettier": { - "optional": true - } + "storybook": "^8.2.6" } }, - "node_modules/@storybook/addon-essentials/node_modules/@storybook/core-events": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.6.tgz", - "integrity": "sha512-DaIVe4TUp/7uQdSJYGmJv9S/S364tSgZ3S3dZ1vsf1rgoUbCp5kTBtcd/fcqgukMPREgCgO9oDhmemI3SLAqzw==", + "node_modules/@storybook/addon-viewport": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/addon-viewport/-/addon-viewport-8.2.6.tgz", + "integrity": "sha512-IAxH9H8tVFzSmZhKf5E+EALiAdkp19RzGqP/rWluD8LH7oW5HumQE/4oN0ZhVMy1RxYsCKFYjWyAp7AuxeMRSw==", "dev": true, "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" + "memoizerific": "^1.11.3" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.6" } }, - "node_modules/@storybook/addon-essentials/node_modules/@storybook/node-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-8.1.6.tgz", - "integrity": "sha512-IZEiTLFHu8Oom/vdEGpisSw5CfU+cw6/fTaX1P3EVClFOWVuy8/3X5MPu4wJH3jPym6E2DBduIUFeRsiuq61gA==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/@storybook/preview-api": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/preview-api/-/preview-api-8.1.6.tgz", - "integrity": "sha512-g9EvVg/DYqmjMh1uivJBJnSIvURyuK4LLabYicQNmYdQJscAeXX2bpMcA4aeci9BBm9B2RP7JbSnq7DbXZaJYA==", + "node_modules/@storybook/blocks": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/blocks/-/blocks-8.2.6.tgz", + "integrity": "sha512-nMlZJjVTyfOJ6xwORptsNuS1AZZlDbJUVXc2R8uukGd5GIXxxCdrPk4NvUsjfQslMT9LhYuFld3z62FATsM2rw==", "dev": true, "dependencies": { - "@storybook/channels": "8.1.6", - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/csf": "^0.1.7", + "@storybook/csf": "0.1.11", "@storybook/global": "^5.0.0", - "@storybook/types": "8.1.6", - "@types/qs": "^6.9.5", + "@storybook/icons": "^1.2.5", + "@types/lodash": "^4.14.167", + "color-convert": "^2.0.1", "dequal": "^2.0.2", "lodash": "^4.17.21", + "markdown-to-jsx": "^7.4.5", "memoizerific": "^1.11.3", - "qs": "^6.10.0", - "tiny-invariant": "^1.3.1", + "polished": "^4.2.2", + "react-colorful": "^5.1.2", + "telejson": "^7.2.0", "ts-dedent": "^2.0.0", "util-deprecate": "^1.0.2" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/@storybook/types": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.6.tgz", - "integrity": "sha512-cWpS9+x1pxCO39spR8QmumMK2ub2p5cvMtrRvWaIjBFPbCwm2CvjBXFWIra2veBCZTxUKJ9VWxvi7pzRHjN/nw==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/crypto-random-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", - "integrity": "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==", - "dev": true, - "dependencies": { - "type-fest": "^1.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/crypto-random-string/node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/temp-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", - "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", - "dev": true, - "engines": { - "node": ">=14.16" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/tempy": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.1.0.tgz", - "integrity": "sha512-7jDLIdD2Zp0bDe5r3D2qtkd1QOCacylBuL7oa4udvN6v2pqr4+LcCr67C8DR1zkpaZ8XosF5m1yQSabKAW6f2g==", - "dev": true, - "dependencies": { - "is-stream": "^3.0.0", - "temp-dir": "^3.0.0", - "type-fest": "^2.12.2", - "unique-string": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/tempy/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/addon-essentials/node_modules/unique-string": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", - "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", - "dev": true, - "dependencies": { - "crypto-random-string": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/addon-highlight": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-highlight/-/addon-highlight-8.1.6.tgz", - "integrity": "sha512-QT95TS4OT0SJJVz/1m038COUdS2yWukQOwyq2rCgSM6nU3OHOPf/CldDK4Sdch7Z4jV9kRdRS0Pu4FB5SV+uOw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-interactions": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/@storybook/addon-interactions/-/addon-interactions-8.2.5.tgz", - "integrity": "sha512-YVdpU/VRrRvX3BUiYxno6jDttbbQxngOkgcY8u+LLXbo3LfFLeXwpUmJXvGOrIU1wDHsZ4FAPBS/beFntcFhBw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0", - "@storybook/instrumenter": "8.2.5", - "@storybook/test": "8.2.5", - "polished": "^4.2.2", - "ts-dedent": "^2.2.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "storybook": "^8.2.5" - } - }, - "node_modules/@storybook/addon-links": { - "version": "7.6.17", - "resolved": "https://registry.npmjs.org/@storybook/addon-links/-/addon-links-7.6.17.tgz", - "integrity": "sha512-iFUwKObRn0EKI0zMETsil2p9a/81rCuSMEWECsi+khkCAs1FUnD2cT6Ag5ydcNcBXsdtdfDJdtXQrkw+TSoStQ==", - "dev": true, - "dependencies": { - "@storybook/csf": "^0.1.2", - "@storybook/global": "^5.0.0", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - } - } - }, - "node_modules/@storybook/addon-measure": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-measure/-/addon-measure-8.1.6.tgz", - "integrity": "sha512-afG6XzClrkBQ9ZUZQs0rI9z/RYB+qhebG5k1NTCGYJnj7K4c+jso9nQ9vmypOBqlYKwTT2ZG+9xSK1/IhudEvg==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-outline": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-outline/-/addon-outline-8.1.6.tgz", - "integrity": "sha512-YjH3L4kxln0fLF77oDGJ2KF1I0RNrBQ9FRtqZkGMUbplxwYU0BBrguSgVeGxTLN1q/69LmL6wjFP4nLzqZARhA==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-toolbars": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-toolbars/-/addon-toolbars-8.1.6.tgz", - "integrity": "sha512-d1GciLzD2ZRqh7+b8+JGuCdx8x/MAobhTy+jKeK79d+QKNtPhqZ1OvyUbwObgD6XLF8B/3DvyP3r52lmYMwlnQ==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/addon-viewport": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/addon-viewport/-/addon-viewport-8.1.6.tgz", - "integrity": "sha512-4EpEkJW1fPqlHIqG7OQtnAaHh9DPj7k+guXpzWjVwHfF6AE0fXIg7Yx6iVDGPyKkRaagPw6nL8DOr2U8YwK4rQ==", - "dev": true, - "dependencies": { - "memoizerific": "^1.11.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/blocks": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/blocks/-/blocks-8.1.6.tgz", - "integrity": "sha512-HBp80G9puOejqlBA0iNlV3gUxc7TkBlNIVG2rmhjcvPZUueldxTUGIGvEfTLdEM6nqzNVZT+duXwqeHHnDcynA==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@storybook/client-logger": "8.1.6", - "@storybook/components": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/csf": "^0.1.7", - "@storybook/docs-tools": "8.1.6", - "@storybook/global": "^5.0.0", - "@storybook/icons": "^1.2.5", - "@storybook/manager-api": "8.1.6", - "@storybook/preview-api": "8.1.6", - "@storybook/theming": "8.1.6", - "@storybook/types": "8.1.6", - "@types/lodash": "^4.14.167", - "color-convert": "^2.0.1", - "dequal": "^2.0.2", - "lodash": "^4.17.21", - "markdown-to-jsx": "7.3.2", - "memoizerific": "^1.11.3", - "polished": "^4.2.2", - "react-colorful": "^5.1.2", - "telejson": "^7.2.0", - "tocbot": "^4.20.1", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-dom": { - "optional": true - } - } - }, - "node_modules/@storybook/blocks/node_modules/@storybook/channels": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.6.tgz", - "integrity": "sha512-CzDnP6qfI8OC8pGUk+wPUzLPYcKhX8XbriF2gBtwl6qVM8YfkHP2mLTiDYDwBIi0rLuUbSm/SpILXQ/ouOHOGw==", - "dev": true, - "dependencies": { - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/blocks/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/blocks/node_modules/@storybook/core-common": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-common/-/core-common-8.1.6.tgz", - "integrity": "sha512-OTlfJFaTOB588ibXrrFm0TAXam6E5xV1VXSjNXL+fIifx8Kjln2HNSy1JKjvcblQneYiV4J1xPCVnAIe0EGHDg==", - "dev": true, - "dependencies": { - "@storybook/core-events": "8.1.6", - "@storybook/csf-tools": "8.1.6", - "@storybook/node-logger": "8.1.6", - "@storybook/types": "8.1.6", - "@yarnpkg/fslib": "2.10.3", - "@yarnpkg/libzip": "2.3.0", - "chalk": "^4.1.0", - "cross-spawn": "^7.0.3", - "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", - "esbuild-register": "^3.5.0", - "execa": "^5.0.0", - "file-system-cache": "2.3.0", - "find-cache-dir": "^3.0.0", - "find-up": "^5.0.0", - "fs-extra": "^11.1.0", - "glob": "^10.0.0", - "handlebars": "^4.7.7", - "lazy-universal-dotenv": "^4.0.0", - "node-fetch": "^2.0.0", - "picomatch": "^2.3.0", - "pkg-dir": "^5.0.0", - "prettier-fallback": "npm:prettier@^3", - "pretty-hrtime": "^1.0.3", - "resolve-from": "^5.0.0", - "semver": "^7.3.7", - "tempy": "^3.1.0", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util": "^0.12.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "prettier": "^2 || ^3" - }, - "peerDependenciesMeta": { - "prettier": { - "optional": true - } - } - }, - "node_modules/@storybook/blocks/node_modules/@storybook/core-events": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.6.tgz", - "integrity": "sha512-DaIVe4TUp/7uQdSJYGmJv9S/S364tSgZ3S3dZ1vsf1rgoUbCp5kTBtcd/fcqgukMPREgCgO9oDhmemI3SLAqzw==", - "dev": true, - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/blocks/node_modules/@storybook/docs-tools": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/docs-tools/-/docs-tools-8.1.6.tgz", - "integrity": "sha512-IhqQHSJ5nEBEJ162P/6/6c45toLinWpAkB7pwbAoP00djZSzfHNdQ4HfpZSGfD4GUJIvzsqMzUlyqCKLAoRPPA==", - "dev": true, - "dependencies": { - "@storybook/core-common": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/preview-api": "8.1.6", - "@storybook/types": "8.1.6", - "@types/doctrine": "^0.0.3", - "assert": "^2.1.0", - "doctrine": "^3.0.0", - "lodash": "^4.17.21" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/blocks/node_modules/@storybook/node-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/node-logger/-/node-logger-8.1.6.tgz", - "integrity": "sha512-IZEiTLFHu8Oom/vdEGpisSw5CfU+cw6/fTaX1P3EVClFOWVuy8/3X5MPu4wJH3jPym6E2DBduIUFeRsiuq61gA==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/blocks/node_modules/@storybook/preview-api": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/preview-api/-/preview-api-8.1.6.tgz", - "integrity": "sha512-g9EvVg/DYqmjMh1uivJBJnSIvURyuK4LLabYicQNmYdQJscAeXX2bpMcA4aeci9BBm9B2RP7JbSnq7DbXZaJYA==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/csf": "^0.1.7", - "@storybook/global": "^5.0.0", - "@storybook/types": "8.1.6", - "@types/qs": "^6.9.5", - "dequal": "^2.0.2", - "lodash": "^4.17.21", - "memoizerific": "^1.11.3", - "qs": "^6.10.0", - "tiny-invariant": "^1.3.1", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/blocks/node_modules/@storybook/types": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.6.tgz", - "integrity": "sha512-cWpS9+x1pxCO39spR8QmumMK2ub2p5cvMtrRvWaIjBFPbCwm2CvjBXFWIra2veBCZTxUKJ9VWxvi7pzRHjN/nw==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/blocks/node_modules/crypto-random-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", - "integrity": "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==", - "dev": true, - "dependencies": { - "type-fest": "^1.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/blocks/node_modules/crypto-random-string/node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/blocks/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/@storybook/blocks/node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/blocks/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/@storybook/blocks/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@storybook/blocks/node_modules/temp-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", - "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", - "dev": true, - "engines": { - "node": ">=14.16" - } - }, - "node_modules/@storybook/blocks/node_modules/tempy": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.1.0.tgz", - "integrity": "sha512-7jDLIdD2Zp0bDe5r3D2qtkd1QOCacylBuL7oa4udvN6v2pqr4+LcCr67C8DR1zkpaZ8XosF5m1yQSabKAW6f2g==", - "dev": true, - "dependencies": { - "is-stream": "^3.0.0", - "temp-dir": "^3.0.0", - "type-fest": "^2.12.2", - "unique-string": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/blocks/node_modules/tempy/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@storybook/blocks/node_modules/unique-string": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", - "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", - "dev": true, - "dependencies": { - "crypto-random-string": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "opencollective", + "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", + "storybook": "^8.2.6" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } } }, "node_modules/@storybook/builder-webpack5": { @@ -7401,91 +6565,6 @@ "url": "https://opencollective.com/storybook" } }, - "node_modules/@storybook/components": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/components/-/components-8.1.6.tgz", - "integrity": "sha512-RDcSj2gBVhK/klfcXQgINtvWe5hpJ1CYUv8hrAon3fWtZmX1+IrTJTorsdISvdHQ99o0WHZ+Ouz42O0yJnHzRg==", - "dev": true, - "dependencies": { - "@radix-ui/react-dialog": "^1.0.5", - "@radix-ui/react-slot": "^1.0.2", - "@storybook/client-logger": "8.1.6", - "@storybook/csf": "^0.1.7", - "@storybook/global": "^5.0.0", - "@storybook/icons": "^1.2.5", - "@storybook/theming": "8.1.6", - "@storybook/types": "8.1.6", - "memoizerific": "^1.11.3", - "util-deprecate": "^1.0.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta" - } - }, - "node_modules/@storybook/components/node_modules/@storybook/channels": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.6.tgz", - "integrity": "sha512-CzDnP6qfI8OC8pGUk+wPUzLPYcKhX8XbriF2gBtwl6qVM8YfkHP2mLTiDYDwBIi0rLuUbSm/SpILXQ/ouOHOGw==", - "dev": true, - "dependencies": { - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/components/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/components/node_modules/@storybook/core-events": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.6.tgz", - "integrity": "sha512-DaIVe4TUp/7uQdSJYGmJv9S/S364tSgZ3S3dZ1vsf1rgoUbCp5kTBtcd/fcqgukMPREgCgO9oDhmemI3SLAqzw==", - "dev": true, - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/components/node_modules/@storybook/types": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.6.tgz", - "integrity": "sha512-cWpS9+x1pxCO39spR8QmumMK2ub2p5cvMtrRvWaIjBFPbCwm2CvjBXFWIra2veBCZTxUKJ9VWxvi7pzRHjN/nw==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, "node_modules/@storybook/core": { "version": "8.2.6", "resolved": "https://registry.npmjs.org/@storybook/core/-/core-8.2.6.tgz", @@ -7757,17 +6836,19 @@ } }, "node_modules/@storybook/csf-plugin": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/csf-plugin/-/csf-plugin-8.1.6.tgz", - "integrity": "sha512-y2OW84leoWsqfBXb7EoRy2QUmtsI3gpqYqpyD/d5K+vQ+E9CBel2WB8RPrwcYm2L88WPDaufQQDzqyB7aMx4fQ==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/csf-plugin/-/csf-plugin-8.2.6.tgz", + "integrity": "sha512-USn7E/bMQYVqvFBuW6d9rKoSuCImjk0BAmc/0wIOuMQ/yQNp2Xze0m8eVkNHUIUDokyx0TXDjRjwq10Xxk16ag==", "dev": true, "dependencies": { - "@storybook/csf-tools": "8.1.6", "unplugin": "^1.3.1" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "storybook": "^8.2.6" } }, "node_modules/@storybook/csf-tools": { @@ -7851,9 +6932,9 @@ "integrity": "sha512-FcOqPAXACP0I3oJ/ws6/rrPT9WGhu915Cg8D02a9YxLo0DE9zI+a9A5gRGvmQ09fiWPukqI8ZAEoQEdWUKMQdQ==" }, "node_modules/@storybook/icons": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/@storybook/icons/-/icons-1.2.9.tgz", - "integrity": "sha512-cOmylsz25SYXaJL/gvTk/dl3pyk7yBFRfeXTsHvTA3dfhoU/LWSq0NKL9nM7WBasJyn6XPSGnLS4RtKXLw5EUg==", + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/@storybook/icons/-/icons-1.2.10.tgz", + "integrity": "sha512-310apKdDcjbbX2VSLWPwhEwAgjxTzVagrwucVZIdGPErwiAppX8KvBuWZgPo+rQLVrtH8S+pw1dbUwjcE6d7og==", "dev": true, "engines": { "node": ">=14.0.0" @@ -7881,92 +6962,6 @@ "storybook": "^8.2.5" } }, - "node_modules/@storybook/manager-api": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/manager-api/-/manager-api-8.1.6.tgz", - "integrity": "sha512-L/s1FdFh/P+eFmQwLtFtJHwFJrGD9H7nauaQlKJOrU3GeXfjBjtlAZQF0Q6B4ZTGxwZjQrzShpt/0yKc6gymtw==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/csf": "^0.1.7", - "@storybook/global": "^5.0.0", - "@storybook/icons": "^1.2.5", - "@storybook/router": "8.1.6", - "@storybook/theming": "8.1.6", - "@storybook/types": "8.1.6", - "dequal": "^2.0.2", - "lodash": "^4.17.21", - "memoizerific": "^1.11.3", - "store2": "^2.14.2", - "telejson": "^7.2.0", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/manager-api/node_modules/@storybook/channels": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.6.tgz", - "integrity": "sha512-CzDnP6qfI8OC8pGUk+wPUzLPYcKhX8XbriF2gBtwl6qVM8YfkHP2mLTiDYDwBIi0rLuUbSm/SpILXQ/ouOHOGw==", - "dev": true, - "dependencies": { - "@storybook/client-logger": "8.1.6", - "@storybook/core-events": "8.1.6", - "@storybook/global": "^5.0.0", - "telejson": "^7.2.0", - "tiny-invariant": "^1.3.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/manager-api/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/manager-api/node_modules/@storybook/core-events": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-8.1.6.tgz", - "integrity": "sha512-DaIVe4TUp/7uQdSJYGmJv9S/S364tSgZ3S3dZ1vsf1rgoUbCp5kTBtcd/fcqgukMPREgCgO9oDhmemI3SLAqzw==", - "dev": true, - "dependencies": { - "@storybook/csf": "^0.1.7", - "ts-dedent": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/manager-api/node_modules/@storybook/types": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/types/-/types-8.1.6.tgz", - "integrity": "sha512-cWpS9+x1pxCO39spR8QmumMK2ub2p5cvMtrRvWaIjBFPbCwm2CvjBXFWIra2veBCZTxUKJ9VWxvi7pzRHjN/nw==", - "dev": true, - "dependencies": { - "@storybook/channels": "8.1.6", - "@types/express": "^4.7.0", - "file-system-cache": "2.3.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, "node_modules/@storybook/nextjs": { "version": "8.0.8", "resolved": "https://registry.npmjs.org/@storybook/nextjs/-/nextjs-8.0.8.tgz", @@ -8812,6 +7807,21 @@ "webpack": ">= 4" } }, + "node_modules/@storybook/react-dom-shim": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@storybook/react-dom-shim/-/react-dom-shim-8.2.6.tgz", + "integrity": "sha512-B+x8UAEQPDp1yhN3tMh09NvSL38QNfJB7PAyLgKrfE7xIAzvewq+RLW2DfGkoZCy+Zr7QSHm1p7NOgud8+sQCg==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/storybook" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", + "storybook": "^8.2.6" + } + }, "node_modules/@storybook/react/node_modules/@storybook/channels": { "version": "8.1.6", "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-8.1.6.tgz", @@ -9116,34 +8126,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@storybook/router": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/router/-/router-8.1.6.tgz", - "integrity": "sha512-tvuhB2uXHEKK640Epm1SqVzPhQ9lXYfF7FX6FleJgVYEvZpJpNTD4RojedQoLI6SUUSXNy1Vs2QV26VM0XIPHQ==", - "dev": true, - "dependencies": { - "@storybook/client-logger": "8.1.6", - "memoizerific": "^1.11.3", - "qs": "^6.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, - "node_modules/@storybook/router/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, "node_modules/@storybook/test": { "version": "8.2.5", "resolved": "https://registry.npmjs.org/@storybook/test/-/test-8.2.5.tgz", @@ -9205,47 +8187,6 @@ "ts-dedent": "^2.2.0" } }, - "node_modules/@storybook/theming": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/theming/-/theming-8.1.6.tgz", - "integrity": "sha512-0Cl/7/0z2WSfXhZ9XSw6rgEjb0fXac7jfktieX0vYo1YckrNpWFRQP9NCpVPAcYZaFLlRSOqYark6CLoutEsIg==", - "dev": true, - "dependencies": { - "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1", - "@storybook/client-logger": "8.1.6", - "@storybook/global": "^5.0.0", - "memoizerific": "^1.11.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-dom": { - "optional": true - } - } - }, - "node_modules/@storybook/theming/node_modules/@storybook/client-logger": { - "version": "8.1.6", - "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-8.1.6.tgz", - "integrity": "sha512-QfSoUxS1rmrBzO7o99og9g+Gkm7sTmU5ZOpTkjszjlRqfV6/77eUnUOzUikej4LqPLmlJV5fqGuvoP0aNVksDw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, "node_modules/@swc/core": { "version": "1.3.101", "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.101.tgz", @@ -18796,9 +17737,9 @@ "dev": true }, "node_modules/markdown-to-jsx": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.3.2.tgz", - "integrity": "sha512-B+28F5ucp83aQm+OxNrPkS8z0tMKaeHiy0lHJs3LqCyDQFtWuenaIrkaVTgAm1pf1AU85LXltva86hlaT17i8Q==", + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.4.7.tgz", + "integrity": "sha512-0+ls1IQZdU6cwM1yu0ZjjiVWYtkbExSyUIFU2ZeDIFuZM1W42Mh4OlJ4nb4apX4H8smxDHRdFaoIVJGwfv5hkg==", "dev": true, "engines": { "node": ">= 10" @@ -23713,12 +22654,6 @@ "node": ">= 0.4" } }, - "node_modules/store2": { - "version": "2.14.2", - "resolved": "https://registry.npmjs.org/store2/-/store2-2.14.2.tgz", - "integrity": "sha512-siT1RiqlfQnGqgT/YzXVUNsom9S0H1OX+dpdGN1xkyYATo4I6sep5NmsRD/40s3IIOvlCq6akxkqG82urIZW1w==", - "dev": true - }, "node_modules/storybook": { "version": "8.2.6", "resolved": "https://registry.npmjs.org/storybook/-/storybook-8.2.6.tgz", @@ -24830,12 +23765,6 @@ "node": ">=8.0" } }, - "node_modules/tocbot": { - "version": "4.21.1", - "resolved": "https://registry.npmjs.org/tocbot/-/tocbot-4.21.1.tgz", - "integrity": "sha512-IfajhBTeg0HlMXu1f+VMbPef05QpDTsZ9X2Yn1+8npdaXsXg/+wrm9Ze1WG5OS1UDC3qJ5EQN/XOZ3gfXjPFCw==", - "dev": true - }, "node_modules/toggle-selection": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", @@ -25696,24 +24625,24 @@ } }, "node_modules/unplugin": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.10.1.tgz", - "integrity": "sha512-d6Mhq8RJeGA8UfKCu54Um4lFA0eSaRa3XxdAJg8tIdxbu1ubW0hBCZUL7yI2uGyYCRndvbK8FLHzqy2XKfeMsg==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.12.0.tgz", + "integrity": "sha512-KeczzHl2sATPQUx1gzo+EnUkmN4VmGBYRRVOZSGvGITE9rGHRDGqft6ONceP3vgXcyJ2XjX5axG5jMWUwNCYLw==", "dev": true, "dependencies": { - "acorn": "^8.11.3", + "acorn": "^8.12.1", "chokidar": "^3.6.0", "webpack-sources": "^3.2.3", - "webpack-virtual-modules": "^0.6.1" + "webpack-virtual-modules": "^0.6.2" }, "engines": { "node": ">=14.0.0" } }, "node_modules/unplugin/node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "bin": { "acorn": "bin/acorn" diff --git a/app/package.json b/app/package.json index e8e4a8621..c49769aa3 100644 --- a/app/package.json +++ b/app/package.json @@ -100,7 +100,7 @@ }, "devDependencies": { "@playwright/test": "^1.43.1", - "@storybook/addon-essentials": "^8.1.6", + "@storybook/addon-essentials": "^8.2.6", "@storybook/addon-interactions": "^8.2.5", "@storybook/addon-links": "^7.6.17", "@storybook/blocks": "^8.0.4", From c1b0aff414bd5e63589c09c36aa5e4c6bef9188c Mon Sep 17 00:00:00 2001 From: Mirco Rudolph <55689855+mircorudolph@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:25:02 +0200 Subject: [PATCH 045/128] Update app/src/app/api/v0/assistants/route.ts to include user roles/auth Co-authored-by: Milan Gruner --- app/src/app/api/v0/assistants/route.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/app/api/v0/assistants/route.ts b/app/src/app/api/v0/assistants/route.ts index 2b5895913..0433cc617 100644 --- a/app/src/app/api/v0/assistants/route.ts +++ b/app/src/app/api/v0/assistants/route.ts @@ -2,11 +2,14 @@ import { apiHandler } from "@/util/api"; import { openai } from "@/util/openai"; import { NextResponse } from "next/server"; +import { Roles } from "@/lib/auth"; + // Create a new assistant -export const POST = apiHandler(async () => { +export const POST = apiHandler(async (_req, { session }) => { // Currently we create the assistant via OpenAI web interface and do not implement this function here - return NextResponse.json({ error: "Method Not Allowed", status: 405 }); - // TODO: should be an admin function + if (session.role !== Roles.Admin) { + return NextResponse.json({ error: "Method Not Allowed", status: 405 }); + } const userID = "id_123456"; // TODO: Get userID const systemPrompt = `Your name is CLIMA and you are a climate assistant for creating From 5178884b798e344e50cc76e3f2fc03e0b93face6 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Tue, 30 Jul 2024 13:28:01 +0200 Subject: [PATCH 046/128] removed hard coded vector store --- app/src/app/api/v0/assistants/route.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/app/api/v0/assistants/route.ts b/app/src/app/api/v0/assistants/route.ts index 2b5895913..c7cc3d3d0 100644 --- a/app/src/app/api/v0/assistants/route.ts +++ b/app/src/app/api/v0/assistants/route.ts @@ -24,7 +24,8 @@ or context provided by the user.`; temperature: 0.2, tools: [{ type: "file_search" }], tool_resources: { - file_search: { vector_store_ids: ["vs_oS3uJ02f4enB7oK5pSU8pIHq"] }, // TODO: Hardcoded vectorstore ID + // Hardcoded vectorstore ID. Should be implemented setting via admin page or similar + file_search: { vector_store_ids: ["vs_"] }, }, }); return NextResponse.json({ assistantId: assistant.id }); From faaa7b2416769b82f05ec3ac958887f320c9093f Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Tue, 30 Jul 2024 13:53:20 +0200 Subject: [PATCH 047/128] Added additional role based access and messages; added user.id --- app/src/app/api/v0/assistants/route.ts | 37 +++++++++++++------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/app/src/app/api/v0/assistants/route.ts b/app/src/app/api/v0/assistants/route.ts index 812360ae2..05fc7980e 100644 --- a/app/src/app/api/v0/assistants/route.ts +++ b/app/src/app/api/v0/assistants/route.ts @@ -1,18 +1,18 @@ import { apiHandler } from "@/util/api"; import { openai } from "@/util/openai"; import { NextResponse } from "next/server"; - import { Roles } from "@/lib/auth"; // Create a new assistant export const POST = apiHandler(async (_req, { session }) => { - // Currently we create the assistant via OpenAI web interface and do not implement this function here - if (session.role !== Roles.Admin) { + if (session?.user.role !== Roles.Admin) { return NextResponse.json({ error: "Method Not Allowed", status: 405 }); - } - const userID = "id_123456"; // TODO: Get userID + } else { + // API rooute not yet fully implemented + return NextResponse.json({ error: "Not Implemented", status: 501 }); + const userID = session?.user.id; - const systemPrompt = `Your name is CLIMA and you are a climate assistant for creating + const systemPrompt = `Your name is CLIMA and you are a climate assistant for creating 'Global Protocol for Community-Scale (GPC) Greenhouse Gas (GHG) Inventories' using CityCatalyst, an open source tool for creating climate inventories by Open Earth Foundation. You try to be as helpful as possible when answering the user\'s questions about their inventory @@ -20,16 +20,17 @@ or any climate science or data science related questions. Try to be as scientific as possible. Use primarily the provided context of the attached documents, or context provided by the user.`; - const assistant = await openai.beta.assistants.create({ - instructions: systemPrompt, - name: `ClimateAdvisor_v0.1_${userID}`, - model: "gpt-3.5-turbo", // gpt4o-mini not working currently - temperature: 0.2, - tools: [{ type: "file_search" }], - tool_resources: { - // Hardcoded vectorstore ID. Should be implemented setting via admin page or similar - file_search: { vector_store_ids: ["vs_"] }, - }, - }); - return NextResponse.json({ assistantId: assistant.id }); + const assistant = await openai.beta.assistants.create({ + instructions: systemPrompt, + name: `ClimateAdvisor_v0.1_${userID}`, + model: "gpt-3.5-turbo", // gpt4o-mini not working currently + temperature: 0.2, + tools: [{ type: "file_search" }], + tool_resources: { + // Hardcoded vectorstore ID. Should be implemented setting via admin page or similar + file_search: { vector_store_ids: ["vs_"] }, + }, + }); + return NextResponse.json({ assistantId: assistant.id }); + } }); From a3bb88c99af598ebed97924cb0cd467345c14423 Mon Sep 17 00:00:00 2001 From: Amanda Eames Date: Tue, 30 Jul 2024 08:17:35 -0400 Subject: [PATCH 048/128] fix: geopandas compaitable version --- global-api/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global-api/requirements.txt b/global-api/requirements.txt index e3b79bb07..496f9572e 100644 --- a/global-api/requirements.txt +++ b/global-api/requirements.txt @@ -4,7 +4,7 @@ black==24.4.2 fastapi==0.111.1 flake8==7.1.0 fsspec==2024.* -geopandas==1.0.1 +geopandas>=0.12,<0.15 mypy==1.11.0 osmnx==1.9.4 pandas==2.2.2 From fdf860c4eb93f447ad6a6048bd10a733b1f135cb Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 30 Jul 2024 09:15:49 -0400 Subject: [PATCH 049/128] feat: direct measure subcategories --- .../form-schema/manual-input-hierarchy.json | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 47cbcb17c..3fc05fd6b 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -56,7 +56,17 @@ "id": "modeled-data-fuel-consumption-commercial-buildings-methodology", "implemented": false } - ] + ], + "direct_measure": { + "subcategories": [ + "commercial-buildings-all", + "commercial-buildings-commercial-institutional", + "commercial-buildings-commercial-buildings", + "commercial-buildings-institutional-buildings", + "commercial-buildings-street-lighting" + ], + "exclusive": "commercial-buildings-all" + } }, "I.2.2": { "methodologies": [ @@ -188,7 +198,17 @@ "id": "resident-activity-on-road-transport-methodology", "implemented": false } - ] + ], + "direct_measure": { + "subcategories": [ + "on-road-transport-passenger-vehicles", + "on-road-transport-commercial-vehicles", + "on-road-transport-public-transport-vehicles", + "on-road-transport-emergency-vehicles", + "on-road-transport-service-vehicles" + ], + "multiselect": true + } }, "II.1.2": { "methodologies": [ From e7bf46cecab31b725d17614a01117886724fa6c1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 30 Jul 2024 09:30:12 -0400 Subject: [PATCH 050/128] feat: direct measure on all gpc refnos --- .../form-schema/manual-input-hierarchy.json | 140 +++++++++++++++--- 1 file changed, 121 insertions(+), 19 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 3fc05fd6b..9934a2c0c 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -58,14 +58,32 @@ } ], "direct_measure": { - "subcategories": [ - "commercial-buildings-all", - "commercial-buildings-commercial-institutional", - "commercial-buildings-commercial-buildings", - "commercial-buildings-institutional-buildings", - "commercial-buildings-street-lighting" - ], - "exclusive": "commercial-buildings-all" + "extra-fields": [ + { + "id": "commercial-building-type", + "options": [ + "commercial-building-type-all", + "commercial-building-type-commercial-institutional", + "commercial-building-type-commercial-buildings", + "commercial-building-type-institutional-buildings", + "commercial-building-type-street-lighting" + ], + "exclusive": "commercial-building-type-all" + }, + { + "id": "commercial-building-fuel-type", + "options": [ + "commercial-building-fuel-type-all", + "commercial-building-fuel-type-propane", + "commercial-building-fuel-type-natural-gas", + "commercial-building-fuel-type-heating-oil" + ] + }, + { + "id": "commercial-buildings-fuel-source", + "type": "text" + } + ] } }, "I.2.2": { @@ -128,7 +146,40 @@ "id": "modeled-data-energy-usage-commercial-buildings-methodology", "implemented": false } - ] + ], + "direct_measure": { + "extra-fields": [ + { + "id": "commercial-building-type", + "options": [ + "commercial-building-type-all", + "commercial-building-type-commercial-institutional", + "commercial-building-type-commercial-buildings", + "commercial-building-type-institutional-buildings", + "commercial-building-type-street-lighting" + ], + "exclusive": "commercial-building-type-all" + }, + { + "id": "commercial-building-energy-usage", + "options": [ + "commercial-building-energy-usage-all", + "commercial-building-energy-usage-electricity", + "commercial-building-energy-usage-electricity-chp", + "commercial-building-energy-usage-heating", + "commercial-building-energy-usage-heating-chp", + "commercial-building-energy-usage-steam", + "commercial-building-energy-usage-steam-chp", + "commercial-building-energy-usage-refrigeration", + "commercial-building-energy-usage-refrigeration-chp" + ] + }, + { + "id": "commercial-buildings-energy-source", + "type": "text" + } + ] + } }, "II.1.1": { "methodologies": [ @@ -200,14 +251,33 @@ } ], "direct_measure": { - "subcategories": [ - "on-road-transport-passenger-vehicles", - "on-road-transport-commercial-vehicles", - "on-road-transport-public-transport-vehicles", - "on-road-transport-emergency-vehicles", - "on-road-transport-service-vehicles" - ], - "multiselect": true + "extra-fields": [ + { + "id": "on-road-transport-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "on-road-transport-vehicle-type", + "options": [ + "vehicle-type-passenger-vehicles", + "vehicle-type-commercial-vehicles", + "vehicle-type-public-transport-vehicles", + "vehicle-type-emergency-vehicles", + "vehicle-type-service-vehicles" + ], + "multiselect": true + }, + { + "id": "on-road-transport-fuel-source", + "type": "text" + } + ] } }, "II.1.2": { @@ -241,7 +311,26 @@ } ] } - ] + ], + "direct_measure": { + "extra-fields": [ + { + "id": "on-road-transport-vehicle-type", + "options": [ + "vehicle-type-passenger-vehicles", + "vehicle-type-commercial-vehicles", + "vehicle-type-public-transport-vehicles", + "vehicle-type-emergency-vehicles", + "vehicle-type-service-vehicles" + ], + "multiselect": true + }, + { + "id": "on-road-transport-electricity-source", + "type": "text" + } + ] + } }, "III.1.1": { "methodologies": [ @@ -294,6 +383,19 @@ "id": "first-order-of-decay-solid-waste-methodology", "implemented": false } - ] + ], + "direct_measure": { + "extra-fields": [ + { + "id": "landfill-id", + "type": "text" + }, + { + "id": "landfill-address", + "type": "text", + "required": false + } + ] + } } } \ No newline at end of file From 436ebe15c1a4319d37f62894705ae56ed95eb9d8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 30 Jul 2024 09:51:07 -0400 Subject: [PATCH 051/128] feat: formula tag for solid waste --- app/src/util/form-schema/manual-input-hierarchy.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 9934a2c0c..8b78f3bbc 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -372,11 +372,11 @@ "methane-commitment-solid-waste-landfill-waste-composition-paper", "methane-commitment-solid-waste-landfill-waste-composition-wood", "methane-commitment-solid-waste-landfill-waste-composition-textiles", - "methane-commitment-solid-waste-landfill-waste-composition-plastics", - "methane-commitment-solid-waste-landfill-waste-composition-nappies" + "methane-commitment-solid-waste-landfill-waste-composition-industrial" ] } - ] + ], + "formula": "methane-commitment" } }, { From 4dd65ec4b5904463abc431d1f7279ed19db8edb8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 30 Jul 2024 10:05:16 -0400 Subject: [PATCH 052/128] feat: suggested activities --- .../util/form-schema/manual-input-hierarchy.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 8b78f3bbc..5a7b7bbcd 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -46,6 +46,20 @@ "units-other" ] } + ], + "suggested_activities": [ + { + "id": "fuel-combustion-commercial-buildings-activity", + "commercial-building-type": "commercial-building-type-all" + }, + { + "id": "fuel-combustion-commercial-buildings-activity", + "commercial-building-type": "commercial-building-type-commercial-buildings" + }, + { + "id": "fuel-combustion-commercial-buildings-activity", + "commercial-building-type": "commercial-building-type-institutional-buildings" + } ] }, { From 8cd494ae4d1b08ed9d4da2e5993c91b87570dc05 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Tue, 30 Jul 2024 17:00:37 +0200 Subject: [PATCH 053/128] added new redux api to /src/services/api and used it in chat-bot.tsx --- app/src/components/ChatBot/chat-bot.tsx | 76 ++++++++++++------------- app/src/services/api.ts | 45 ++++++++++++--- 2 files changed, 73 insertions(+), 48 deletions(-) diff --git a/app/src/components/ChatBot/chat-bot.tsx b/app/src/components/ChatBot/chat-bot.tsx index 029f912ba..1402ff368 100644 --- a/app/src/components/ChatBot/chat-bot.tsx +++ b/app/src/components/ChatBot/chat-bot.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState } from "react"; import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard"; import { Box, @@ -13,8 +13,7 @@ import { Text, Textarea, } from "@chakra-ui/react"; -// import { useChat } from "ai/react"; -import { useAssistant } from 'ai/react' +import { useAssistant } from "ai/react"; import { TFunction } from "i18next"; import { BsStars } from "react-icons/bs"; import { @@ -27,6 +26,7 @@ import { } from "react-icons/md"; import { ScrollAnchor } from "./scroll-anchor"; import { RefObject, useRef } from "react"; +import { api, useCreateThreadIdMutation } from "@/services/api"; function useEnterSubmit(): { formRef: RefObject; @@ -59,37 +59,33 @@ export default function ChatBot({ t: TFunction; inventoryId: string; }) { + const [threadId, setThreadId] = useState(""); + const [createThreadId, { data: threadData }] = useCreateThreadIdMutation(); - const [threadId, setthreadId] = useState(""); + // Function to create the threadId with initial message + const handleSubmit = async () => { + try { + await createThreadId({ + inventoryId: inventoryId, + content: t("initial-message"), + }).unwrap(); + } catch (err) { + console.error("Failed to create thread ID:", err); + } + }; // Creating the thread id for the given inventory on initial render - // Passing the initial message to api to be set in thread useEffect(() => { - const fetchData = async () => { - try { - const response = await fetch(`/api/v0/assistants/threads/${inventoryId}`, { - method: "POST", - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - content: t("initial-message") - }) - }); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - const data = await response.json(); - setthreadId(data.threadId) - } catch (error) { - console.error('API Call Failed:', error); - // Handle error here - } - }; + handleSubmit(); + }, []); // Empty dependency array means this effect runs only once, + // HOWEVER currently it always runs twice - fetchData(); - }, []); // Empty dependency array means this effect runs only once, - // HOWEVER currently it always runs twiche + // Set threadId once the value from API call is returned to threadData + useEffect(() => { + if (threadData) { + setThreadId(threadData); + } + }, [threadData]); const { status, @@ -102,19 +98,21 @@ export default function ChatBot({ } = useAssistant({ api: `/api/v0/assistants/threads/messages`, threadId: threadId, - }) + }); // Setting the initial message to display for the user // This message will not be passed to the assistant api // It will be set additionally when creating the threadId // to pass to the assistant api useEffect(() => { - setMessages([{ - id: "-1", - role: "assistant", - content: t("initial-message"), - }]) - }, []) + setMessages([ + { + id: "-1", + role: "assistant", + content: t("initial-message"), + }, + ]); + }, []); const { copyToClipboard, isCopied } = useCopyToClipboard({}); const { formRef, onKeyDown } = useEnterSubmit(); @@ -228,7 +226,7 @@ export default function ChatBot({ ); })} @@ -257,7 +255,7 @@ export default function ChatBot({ fontWeight="400" whiteSpace="nowrap" display="inline-block" - isDisabled={status==="in_progress"} + isDisabled={status === "in_progress"} > {suggestion.preview} @@ -288,7 +286,7 @@ export default function ChatBot({ color="content.tertiary" aria-label="Send message" disabled={true} - isDisabled={status==="in_progress"} + isDisabled={status === "in_progress"} /> diff --git a/app/src/services/api.ts b/app/src/services/api.ts index 79891da77..aa013ebd4 100644 --- a/app/src/services/api.ts +++ b/app/src/services/api.ts @@ -404,19 +404,32 @@ export const api = createApi({ transformResponse: (response: { data: [] }) => response.data, }), connectToCDP: builder.mutation({ - query: ({inventoryId}) => { - return{ - method: 'POST', - url: `/inventory/${inventoryId}/cdp` - } - } + query: ({ inventoryId }) => { + return { + method: "POST", + url: `/inventory/${inventoryId}/cdp`, + }; + }, }), // ActivityValue CRUD getActivityValues: builder.query({ - query: ({inventoryId, subCategoryIds, subSectorId, methodologyId}: {inventoryId: string, subCategoryIds?: string[], subSectorId?: string, methodologyId?: string }) => ({ + query: ({ + inventoryId, + subCategoryIds, + subSectorId, + methodologyId, + }: { + inventoryId: string; + subCategoryIds?: string[]; + subSectorId?: string; + methodologyId?: string; + }) => ({ url: `/inventory/${inventoryId}/activity-value`, - params: { subCategoryIds: subCategoryIds?.join(",") ?? undefined, subSectorId: subSectorId ?? undefined }, + params: { + subCategoryIds: subCategoryIds?.join(",") ?? undefined, + subSectorId: subSectorId ?? undefined, + }, method: "GET", }), transformResponse: (response: any) => response.data, @@ -456,6 +469,19 @@ export const api = createApi({ transformResponse: (response: any) => response.data, invalidatesTags: ["ActivityValue"], }), + createThreadId: builder.mutation({ + query: (data: { inventoryId: string; content: string }) => ({ + url: `/assistants/threads/${data.inventoryId}`, + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + content: data.content, + }), + }), + transformResponse: (response: { threadId: string }) => response.threadId, + }), }), }); @@ -511,6 +537,7 @@ export const { useInviteUserMutation, useCheckUserMutation, useMockDataQuery, - useConnectToCDPMutation + useConnectToCDPMutation, + useCreateThreadIdMutation, } = api; export const { useGetOCCityQuery, useGetOCCityDataQuery } = openclimateAPI; From 5e461df1cb64828edd07d91639007047e8aa7e0b Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Tue, 30 Jul 2024 17:08:37 +0200 Subject: [PATCH 054/128] removed old, not needed code 'disabled' --- app/src/components/ChatBot/chat-bot.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/components/ChatBot/chat-bot.tsx b/app/src/components/ChatBot/chat-bot.tsx index 1402ff368..82397b4ae 100644 --- a/app/src/components/ChatBot/chat-bot.tsx +++ b/app/src/components/ChatBot/chat-bot.tsx @@ -285,7 +285,6 @@ export default function ChatBot({ icon={} color="content.tertiary" aria-label="Send message" - disabled={true} isDisabled={status === "in_progress"} /> From bf108ac2bb099a98f13e8a368965d7b245f446d5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 30 Jul 2024 16:25:48 -0400 Subject: [PATCH 055/128] style: run all ts and json files through prettier Signed-off-by: Evan Prodromou --- .../[inventory]/data/[step]/subsectors.json | 78 ++------ app/src/app/api/v0/auth/delete/route.ts | 2 +- .../v0/inventory/[inventory]/value/route.ts | 32 ++-- app/src/app/api/v0/user/route.ts | 8 +- app/src/features/city/subsectorSlice.ts | 166 +++++++++------- app/src/i18n/locales/de/root-page.json | 4 +- app/src/i18n/locales/de/settings.json | 122 ++++++------ app/src/i18n/locales/en/footer.json | 1 - app/src/i18n/locales/en/not-found.json | 6 +- app/src/i18n/locales/en/root-page.json | 4 +- app/src/i18n/locales/en/settings.json | 124 ++++++------ app/src/i18n/locales/es/footer.json | 1 - app/src/i18n/locales/es/root-page.json | 4 +- app/src/lib/app-theme.ts | 2 +- app/src/lib/auth.ts | 3 +- app/src/lib/store.ts | 2 +- app/src/middleware.ts | 2 +- app/src/models/Catalogue.ts | 51 +++-- app/src/models/EmissionsFactor.ts | 3 +- app/src/models/GasValue.ts | 3 +- app/src/models/InventoryValue.ts | 25 +-- app/src/models/Scope.ts | 25 +-- app/src/models/User.ts | 13 +- app/src/util/form-schema/index.ts | 4 +- .../form-schema/manual-input-hierarchy.json | 11 +- .../util/form-schema/sector-form-schema.json | 179 ++++++++---------- app/src/util/helpers.ts | 6 +- app/src/util/series.ts | 49 ++--- 28 files changed, 433 insertions(+), 497 deletions(-) diff --git a/app/src/app/[lng]/[inventory]/data/[step]/subsectors.json b/app/src/app/[lng]/[inventory]/data/[step]/subsectors.json index 38bd52a3a..40add4fd2 100644 --- a/app/src/app/[lng]/[inventory]/data/[step]/subsectors.json +++ b/app/src/app/[lng]/[inventory]/data/[step]/subsectors.json @@ -3,68 +3,49 @@ { "id": 0, "title": "residential-buildings", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": true, "sectorName": "stationary-energy" }, { "id": 1, "title": "commercial-buildings", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": true, "sectorName": "stationary-energy" }, { "id": 2, "title": "manufacturing-construction", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": false, "sectorName": "stationary-energy" }, { "id": 3, "title": "energy-industries", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": true, "sectorName": "stationary-energy" }, { "id": 4, "title": "emissions-oil-natural-gas", - "scopes": [ - 1 - ], + "scopes": [1], "isAdded": true, "sectorName": "stationary-energy" }, { "id": 5, "title": "emissions-coal", - "scopes": [ - 1 - ], + "scopes": [1], "isAdded": true, "sectorName": "stationary-energy" }, { "id": 6, "title": "agriculture", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": true, "sectorName": "stationary-energy" } @@ -73,50 +54,35 @@ { "id": 0, "title": "on-road", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": true, "sectorName": "transportation" }, { "id": 1, "title": "railways", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": true, "sectorName": "transportation" }, { "id": 2, "title": "aviation", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": false, "sectorName": "transportation" }, { "id": 3, "title": "off-road", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": true, "sectorName": "transportation" }, { "id": 4, "title": "waterborne-navigation", - "scopes": [ - 1, - 2 - ], + "scopes": [1, 2], "isAdded": true, "sectorName": "transportation" } @@ -125,40 +91,28 @@ { "id": 0, "title": "disposal-solid-waste", - "scopes": [ - 1, - 3 - ], + "scopes": [1, 3], "isAdded": false, "sectorName": "waste-water" }, { "id": 1, "title": "biological-treatment-waste", - "scopes": [ - 1, - 3 - ], + "scopes": [1, 3], "isAdded": false, "sectorName": "waste-water" }, { "id": 2, "title": "incineration-waste", - "scopes": [ - 1, - 3 - ], + "scopes": [1, 3], "isAdded": false, "sectorName": "waste-water" }, { "id": 3, "title": "waste-water", - "scopes": [ - 1, - 3 - ], + "scopes": [1, 3], "isAdded": false, "sectorName": "waste-water" } diff --git a/app/src/app/api/v0/auth/delete/route.ts b/app/src/app/api/v0/auth/delete/route.ts index 55f3ffa3d..3e3ded54d 100644 --- a/app/src/app/api/v0/auth/delete/route.ts +++ b/app/src/app/api/v0/auth/delete/route.ts @@ -9,7 +9,7 @@ import { logger } from "@/services/logger"; export const POST = apiHandler(async (req: NextRequest) => { logger.debug("Cookies", req.cookies); - const token = await getToken({req}); + const token = await getToken({ req }); logger.debug("Token", token); const session = await getServerSession(authOptions); if (!session) { diff --git a/app/src/app/api/v0/inventory/[inventory]/value/route.ts b/app/src/app/api/v0/inventory/[inventory]/value/route.ts index 1cedfb6a6..784cc4e6c 100644 --- a/app/src/app/api/v0/inventory/[inventory]/value/route.ts +++ b/app/src/app/api/v0/inventory/[inventory]/value/route.ts @@ -14,7 +14,10 @@ export const GET = apiHandler(async (req, { params, session }) => { } const subCategoryIds = subCategoryIdsParam.split(","); - const inventory = await UserService.findUserInventory(params.inventory, session); + const inventory = await UserService.findUserInventory( + params.inventory, + session, + ); const inventoryValues = await db.models.InventoryValue.findAll({ where: { @@ -24,17 +27,21 @@ export const GET = apiHandler(async (req, { params, session }) => { include: [ { model: db.models.DataSource, as: "dataSource" }, { - model: db.models.ActivityValue, as: "activityValues", include: [{ - model: db.models.GasValue, - as: "gasValues", - include: [ - { - model: db.models.EmissionsFactor, - as: "emissionsFactor", - include: [{ model: db.models.DataSource, as: "dataSources" }], - }, - ], - }] + model: db.models.ActivityValue, + as: "activityValues", + include: [ + { + model: db.models.GasValue, + as: "gasValues", + include: [ + { + model: db.models.EmissionsFactor, + as: "emissionsFactor", + include: [{ model: db.models.DataSource, as: "dataSources" }], + }, + ], + }, + ], }, ], }); @@ -45,4 +52,3 @@ export const GET = apiHandler(async (req, { params, session }) => { return NextResponse.json({ data: inventoryValues }); }); - diff --git a/app/src/app/api/v0/user/route.ts b/app/src/app/api/v0/user/route.ts index 5a2effa36..291aac7f1 100644 --- a/app/src/app/api/v0/user/route.ts +++ b/app/src/app/api/v0/user/route.ts @@ -10,13 +10,7 @@ export const GET = apiHandler(async (_req: Request, context) => { } const user = await db.models.User.findOne({ - attributes: [ - "userId", - "name", - "defaultInventoryId", - "role", - "email", - ], + attributes: ["userId", "name", "defaultInventoryId", "role", "email"], where: { userId: context.session.user.id, }, diff --git a/app/src/features/city/subsectorSlice.ts b/app/src/features/city/subsectorSlice.ts index f18c97e90..249e0db25 100644 --- a/app/src/features/city/subsectorSlice.ts +++ b/app/src/features/city/subsectorSlice.ts @@ -5,19 +5,18 @@ import { SubCategory, SubCategoryAttributes } from "@/models/SubCategory"; import { SectorFormSchema } from "@/util/form-schema"; export type Methodology = { - methodologyId:string, - methodologyName: string, - description: string, - inputRequired: string[], - disabled:boolean, -} + methodologyId: string; + methodologyName: string; + description: string; + inputRequired: string[]; + disabled: boolean; +}; export type ActivityDataScope = { - scope: number, - formInputs: any, - methodologies: Methodology[] - -} + scope: number; + formInputs: any; + methodologies: Methodology[]; +}; interface SubsectorState { subsector?: SubSectorAttributes; @@ -28,64 +27,86 @@ interface SubsectorState { const initialState = { subsector: undefined, subCategories: [], - scopes: [{ - scope: 1, - formInputs: SectorFormSchema, - methodologies: [{ - methodologyId: "1", - methodologyName: 'Fuel Combustion Consumption', - description: 'Direct recording of fuels combusted in commercial buildings', - inputRequired: ["Total fuel consumed amount"], - disabled: false, - },{ - methodologyId: "2", - methodologyName: 'Scaled sample data', - description: 'Extrapolates emissions from a representative sample of buildings.', - inputRequired: ["Sample fuel consumed amount", "Scaling data (population, GDP, area, etc.) for sample and city level"], - disabled: true, - - },{ - methodologyId: "3", - methodologyName: 'Modeled data', - description: 'Emissions estimated from predictive models.', - inputRequired: ["Modeled fuel intensity consumption", "Build area"], - disabled: true, - },{ - methodologyId: "4", - methodologyName: 'Direct measure', - description: "Direct emission measurements from commercial buildings' combustion sources.", - inputRequired: ["Emissions data"], - disabled: false, - }] - },{ - scope: 2, - formInputs: SectorFormSchema, - methodologies: [{ - methodologyId: "1", - methodologyName: 'Energy Consumption', - description: "Direct recording of fuels combusted in commercial buildings", - - },{ - methodologyId: "2", - methodologyName: 'Scaled sample data', - description: 'Extrapolates emissions from a representative sample of buildings.', - inputRequired: ["Sample fuel consumed amount", "Scaling data (population, GDP, area, etc.) for sample and city level"], - disabled: true, - - },{ - methodologyId: "3", - methodologyName: 'Modeled data', - description: 'Emissions estimated from predictive models.', - inputRequired: ["Modeled fuel intensity consumption", "Build area"], - disabled: true, - },{ - methodologyId: "4", - methodologyName: 'Direct measure', - description: "Direct emission measurements from commercial buildings' combustion sources.", - inputRequired: ["Emissions data"], - disabled: false, - }] - }] + scopes: [ + { + scope: 1, + formInputs: SectorFormSchema, + methodologies: [ + { + methodologyId: "1", + methodologyName: "Fuel Combustion Consumption", + description: + "Direct recording of fuels combusted in commercial buildings", + inputRequired: ["Total fuel consumed amount"], + disabled: false, + }, + { + methodologyId: "2", + methodologyName: "Scaled sample data", + description: + "Extrapolates emissions from a representative sample of buildings.", + inputRequired: [ + "Sample fuel consumed amount", + "Scaling data (population, GDP, area, etc.) for sample and city level", + ], + disabled: true, + }, + { + methodologyId: "3", + methodologyName: "Modeled data", + description: "Emissions estimated from predictive models.", + inputRequired: ["Modeled fuel intensity consumption", "Build area"], + disabled: true, + }, + { + methodologyId: "4", + methodologyName: "Direct measure", + description: + "Direct emission measurements from commercial buildings' combustion sources.", + inputRequired: ["Emissions data"], + disabled: false, + }, + ], + }, + { + scope: 2, + formInputs: SectorFormSchema, + methodologies: [ + { + methodologyId: "1", + methodologyName: "Energy Consumption", + description: + "Direct recording of fuels combusted in commercial buildings", + }, + { + methodologyId: "2", + methodologyName: "Scaled sample data", + description: + "Extrapolates emissions from a representative sample of buildings.", + inputRequired: [ + "Sample fuel consumed amount", + "Scaling data (population, GDP, area, etc.) for sample and city level", + ], + disabled: true, + }, + { + methodologyId: "3", + methodologyName: "Modeled data", + description: "Emissions estimated from predictive models.", + inputRequired: ["Modeled fuel intensity consumption", "Build area"], + disabled: true, + }, + { + methodologyId: "4", + methodologyName: "Direct measure", + description: + "Direct emission measurements from commercial buildings' combustion sources.", + inputRequired: ["Emissions data"], + disabled: false, + }, + ], + }, + ], } as SubsectorState; export const subsectorSlice = createSlice({ @@ -93,7 +114,12 @@ export const subsectorSlice = createSlice({ // state type is inferred from the initial state initialState, reducers: { - setSubsector: (state, action: PayloadAction) => { + setSubsector: ( + state, + action: PayloadAction< + SubSectorAttributes & { subCategories: SubCategoryAttributes[] } + >, + ) => { state.subsector = action.payload; }, clearSubsector: (state) => { diff --git a/app/src/i18n/locales/de/root-page.json b/app/src/i18n/locales/de/root-page.json index 98d0b9f2f..d88bd8128 100644 --- a/app/src/i18n/locales/de/root-page.json +++ b/app/src/i18n/locales/de/root-page.json @@ -1,3 +1,3 @@ { - "loading-dashboard": "Lade Dashboard..." -} \ No newline at end of file + "loading-dashboard": "Lade Dashboard..." +} diff --git a/app/src/i18n/locales/de/settings.json b/app/src/i18n/locales/de/settings.json index 428ee1f49..3eece2d8b 100644 --- a/app/src/i18n/locales/de/settings.json +++ b/app/src/i18n/locales/de/settings.json @@ -1,63 +1,63 @@ { - "settings": "Einstellungen", - "settings-sub-title": "Verbinden Sie Daten von Drittanbietern oder laden Sie Ihre eigenen Daten hoch, um Ihr Treibhausgasinventar mit der GPC-Grundmethodik zu erstellen", - "my-profile": "Mein Profil", - "my-files": "Meine Dateien", - "my-inventories": "Meine Inventare", - "my-profile-sub-title": "Hier können Sie alle Ihre Profilinformationen finden und bearbeiten.", - "account-details": "Kontodetails", - "users": "Benutzer", - "add-city": "Stadt hinzufügen", - "city": "Stadt", - "select": "seleccionar", - "name": "Name", - "city-name": "Stadtname", - "enter-password-description": "Geben Sie Ihr Passwort ein, um die Löschung der Städteinformationen zu bestätigen", - "incorrect-password": "Falsches Passwort! Bitte versuchen Sie es erneut", - "state-province": "Bundesland / Provinz", - "country": "Land", - "full-name": "Vollständiger Name", - "manage-users": "Benutzer verwalten", - "email": "E-Mail", - "search-filter-placeholder": "Nach Name oder E-Mail-Adresse suchen", - "all": "Hinzufügen", - "role": "Rolle", - "admin": "Administrator", - "contributor": "Mitwirkender", - "save-changes": "Änderungen speichern", - "my-files-sub-title": "Hier finden Sie alle Ihre hochgeladenen Dateien, ausstehende Anfragen zur Harmonisierung und im Treibhausgasinventar enthaltene Dateien", - "all-inventory-years": "alle Inventarjahre", - "inventory-year": "Inventarjahr", - "files": "Dateien", - "last-updated": "Zuletzt aktualisiert", - "my-inventories-sub-title": "Hier können Sie alle Ihre Inventare zum Bearbeiten oder Herunterladen finden.", - "add-user": "Benutzer hinzufügen", - "selected-users": "Ausgewählte Benutzer", - "remove-users": "Benutzer entfernen", - "edit-user": "Benutzer bearbeiten", - "remove-user": "Benutzer entfernen", - "update-user": "Benutzer aktualisieren", - "delete-user-prompt-message": "Sind Sie sicher, dass Sie diesen Benutzer dauerhaft aus Ihrem Team entfernen möchten?", - "download-city-data": "Stadtdaten herunterladen", - "remove-city": "Stadt entfernen", - "remove-city-propmt-message": "Sind Sie sicher, dass Sie diese Stadt dauerhaft aus CityCatalyst entfernen möchten?", - "password": "Passwort", - "sector": "Sektor", - "pending": "Ausstehend", - "add-to-inventory": "Zum Inventar hinzufügen", - "download-file": "Datei herunterladen", - "delete-file": "Datei löschen", - "status": "Status", - "download-csv": "Als CSV herunterladen", - "delete-inventory": "Inventar löschen", - "delete-inventory-prompt": "Sind Sie sicher, dass Sie das Inventar dieser Stadt <2>dauerhaft löschen möchten?", - "enter-password-info": "Geben Sie Ihr Passwort ein, um das Löschen der Städteinformationen zu bestätigen.", - "user-details-updated": "Benutzerdaten aktualisiert", - "something-went-wrong": "Etwas ist schief gelaufen", - "user-deleted-from-city": "Benutzerdaten aus Stadt gelöscht", - "email-address": "E-Mail", - "remove-user-prompt": "Sind Sie sicher, dass Sie diesen Benutzer <2>dauerhaft entfernen möchten aus Ihrem Team?", - "city-deleted": "Stadt erfolgreich gelöscht", - "delete-file-prompt": "Sind Sie sicher, dass Sie diese Datei <2>dauerhaft löschen möchten aus dem Repository der Stadt?", - "mark-as-completed": "Als abgeschlossen markieren" + "settings": "Einstellungen", + "settings-sub-title": "Verbinden Sie Daten von Drittanbietern oder laden Sie Ihre eigenen Daten hoch, um Ihr Treibhausgasinventar mit der GPC-Grundmethodik zu erstellen", + "my-profile": "Mein Profil", + "my-files": "Meine Dateien", + "my-inventories": "Meine Inventare", + "my-profile-sub-title": "Hier können Sie alle Ihre Profilinformationen finden und bearbeiten.", + "account-details": "Kontodetails", + "users": "Benutzer", + "add-city": "Stadt hinzufügen", + "city": "Stadt", + "select": "seleccionar", + "name": "Name", + "city-name": "Stadtname", + "enter-password-description": "Geben Sie Ihr Passwort ein, um die Löschung der Städteinformationen zu bestätigen", + "incorrect-password": "Falsches Passwort! Bitte versuchen Sie es erneut", + "state-province": "Bundesland / Provinz", + "country": "Land", + "full-name": "Vollständiger Name", + "manage-users": "Benutzer verwalten", + "email": "E-Mail", + "search-filter-placeholder": "Nach Name oder E-Mail-Adresse suchen", + "all": "Hinzufügen", + "role": "Rolle", + "admin": "Administrator", + "contributor": "Mitwirkender", + "save-changes": "Änderungen speichern", + "my-files-sub-title": "Hier finden Sie alle Ihre hochgeladenen Dateien, ausstehende Anfragen zur Harmonisierung und im Treibhausgasinventar enthaltene Dateien", + "all-inventory-years": "alle Inventarjahre", + "inventory-year": "Inventarjahr", + "files": "Dateien", + "last-updated": "Zuletzt aktualisiert", + "my-inventories-sub-title": "Hier können Sie alle Ihre Inventare zum Bearbeiten oder Herunterladen finden.", + "add-user": "Benutzer hinzufügen", + "selected-users": "Ausgewählte Benutzer", + "remove-users": "Benutzer entfernen", + "edit-user": "Benutzer bearbeiten", + "remove-user": "Benutzer entfernen", + "update-user": "Benutzer aktualisieren", + "delete-user-prompt-message": "Sind Sie sicher, dass Sie diesen Benutzer dauerhaft aus Ihrem Team entfernen möchten?", + "download-city-data": "Stadtdaten herunterladen", + "remove-city": "Stadt entfernen", + "remove-city-propmt-message": "Sind Sie sicher, dass Sie diese Stadt dauerhaft aus CityCatalyst entfernen möchten?", + "password": "Passwort", + "sector": "Sektor", + "pending": "Ausstehend", + "add-to-inventory": "Zum Inventar hinzufügen", + "download-file": "Datei herunterladen", + "delete-file": "Datei löschen", + "status": "Status", + "download-csv": "Als CSV herunterladen", + "delete-inventory": "Inventar löschen", + "delete-inventory-prompt": "Sind Sie sicher, dass Sie das Inventar dieser Stadt <2>dauerhaft löschen möchten?", + "enter-password-info": "Geben Sie Ihr Passwort ein, um das Löschen der Städteinformationen zu bestätigen.", + "user-details-updated": "Benutzerdaten aktualisiert", + "something-went-wrong": "Etwas ist schief gelaufen", + "user-deleted-from-city": "Benutzerdaten aus Stadt gelöscht", + "email-address": "E-Mail", + "remove-user-prompt": "Sind Sie sicher, dass Sie diesen Benutzer <2>dauerhaft entfernen möchten aus Ihrem Team?", + "city-deleted": "Stadt erfolgreich gelöscht", + "delete-file-prompt": "Sind Sie sicher, dass Sie diese Datei <2>dauerhaft löschen möchten aus dem Repository der Stadt?", + "mark-as-completed": "Als abgeschlossen markieren" } diff --git a/app/src/i18n/locales/en/footer.json b/app/src/i18n/locales/en/footer.json index 392ed011d..418bcdcc6 100644 --- a/app/src/i18n/locales/en/footer.json +++ b/app/src/i18n/locales/en/footer.json @@ -10,4 +10,3 @@ "beta-text": "This site is a beta version, we appreciate all feedback to improve the platform.", "send-feedback": "Send Feedback" } - diff --git a/app/src/i18n/locales/en/not-found.json b/app/src/i18n/locales/en/not-found.json index 6ab84fd98..2dccf1411 100644 --- a/app/src/i18n/locales/en/not-found.json +++ b/app/src/i18n/locales/en/not-found.json @@ -1,4 +1,4 @@ { - "not-found-description": "Seems like we've wandered into the emission mist. Please go back to the dashboard", - "goto-dashboard": "Go to dashboard" -} \ No newline at end of file + "not-found-description": "Seems like we've wandered into the emission mist. Please go back to the dashboard", + "goto-dashboard": "Go to dashboard" +} diff --git a/app/src/i18n/locales/en/root-page.json b/app/src/i18n/locales/en/root-page.json index 169b62f95..0d24056c2 100644 --- a/app/src/i18n/locales/en/root-page.json +++ b/app/src/i18n/locales/en/root-page.json @@ -1,3 +1,3 @@ { - "loading-dashboard": "Loading dashboard..." -} \ No newline at end of file + "loading-dashboard": "Loading dashboard..." +} diff --git a/app/src/i18n/locales/en/settings.json b/app/src/i18n/locales/en/settings.json index 99aa4c161..49d70017d 100644 --- a/app/src/i18n/locales/en/settings.json +++ b/app/src/i18n/locales/en/settings.json @@ -1,63 +1,63 @@ { - "settings": "Settings", - "settings-sub-title": "Connect third-party data or upload your own data in order to compile your GHG inventory with GPC Basic methodology", - "my-profile": "My Profile", - "my-files": "My Files", - "my-inventories": "My Inventories", - "my-profile-sub-title": "Here you can find and edit all your profile information.", - "account-details": "Account Details", - "users": "Users", - "city": "City", - "add-city": "Add City", - "enter-password-description": "Enter your password to confirm the deletion of the cities information", - "incorrect-password": "Incorrect password! Please try again", - "full-name": "Full Name", - "manage-users": "manage users", - "search-filter-placeholder":"Search by name or email address", - "all": "All", - "select": "Select", - "city-name": "City Name", - "state-province": "State / Province", - "country": "Country", - "name": "Name", - "email": "Email", - "role": "Role", - "admin": "Admin", - "contributor": "Contributor", - "save-changes": "Save Changes", - "my-files-sub-title": "Here you can find all your files uploaded, pending request harmonization, and included in the GHG Inventory", - "all-inventory-years": "all inventory years", - "inventory-year": "Inventory Year", - "files": "Files", - "last-updated": "Last updated", - "my-inventories-sub-title": "Here you can find all your inventories to edit or download.", - "add-user": "Add User", - "selected-users": "Selected Users", - "remove-users": "Remove Users", - "edit-user": "Edit User", - "remove-user": "Remove User", - "update-user": "Update User", - "delete-user-prompt-message": "Are you sure you want to permanently remove user from your team?", - "download-city-data": "Download City's Data", - "remove-city": "Remove City", - "remove-city-propmt-message": "Are you sure you want to permanently remove this city from CityCatalyst?", - "password": "Password", - "sector": "Sector", - "pending": "Pending", - "add-to-inventory": "Add to inventory", - "download-file": "Download File", - "delete-file": "Delete File", - "status": "Status", - "download-csv": "Download in CSV", - "delete-inventory": "Delete Inventory", - "delete-inventory-prompt": "Are you sure you want to <2>permanently delete this city's inventory?", - "enter-password-info": "Enter your password to confirm the deletion of the cities information.", - "user-details-updated": "User details updatedf", - "something-went-wrong": "Something went wrong", - "user-deleted-from-city": "User(s) details deleted from city", - "email-address": "Email", - "remove-user-prompt": " Are you sure you want to <2> permanently remove this user from your team?", - "city-deleted": "City deleted successfully", - "delete-file-prompt": "Are you sure you want to <2> permanently delete this file from the city's repository?", - "mark-as-completed": "Mark as completed" -} \ No newline at end of file + "settings": "Settings", + "settings-sub-title": "Connect third-party data or upload your own data in order to compile your GHG inventory with GPC Basic methodology", + "my-profile": "My Profile", + "my-files": "My Files", + "my-inventories": "My Inventories", + "my-profile-sub-title": "Here you can find and edit all your profile information.", + "account-details": "Account Details", + "users": "Users", + "city": "City", + "add-city": "Add City", + "enter-password-description": "Enter your password to confirm the deletion of the cities information", + "incorrect-password": "Incorrect password! Please try again", + "full-name": "Full Name", + "manage-users": "manage users", + "search-filter-placeholder": "Search by name or email address", + "all": "All", + "select": "Select", + "city-name": "City Name", + "state-province": "State / Province", + "country": "Country", + "name": "Name", + "email": "Email", + "role": "Role", + "admin": "Admin", + "contributor": "Contributor", + "save-changes": "Save Changes", + "my-files-sub-title": "Here you can find all your files uploaded, pending request harmonization, and included in the GHG Inventory", + "all-inventory-years": "all inventory years", + "inventory-year": "Inventory Year", + "files": "Files", + "last-updated": "Last updated", + "my-inventories-sub-title": "Here you can find all your inventories to edit or download.", + "add-user": "Add User", + "selected-users": "Selected Users", + "remove-users": "Remove Users", + "edit-user": "Edit User", + "remove-user": "Remove User", + "update-user": "Update User", + "delete-user-prompt-message": "Are you sure you want to permanently remove user from your team?", + "download-city-data": "Download City's Data", + "remove-city": "Remove City", + "remove-city-propmt-message": "Are you sure you want to permanently remove this city from CityCatalyst?", + "password": "Password", + "sector": "Sector", + "pending": "Pending", + "add-to-inventory": "Add to inventory", + "download-file": "Download File", + "delete-file": "Delete File", + "status": "Status", + "download-csv": "Download in CSV", + "delete-inventory": "Delete Inventory", + "delete-inventory-prompt": "Are you sure you want to <2>permanently delete this city's inventory?", + "enter-password-info": "Enter your password to confirm the deletion of the cities information.", + "user-details-updated": "User details updatedf", + "something-went-wrong": "Something went wrong", + "user-deleted-from-city": "User(s) details deleted from city", + "email-address": "Email", + "remove-user-prompt": " Are you sure you want to <2> permanently remove this user from your team?", + "city-deleted": "City deleted successfully", + "delete-file-prompt": "Are you sure you want to <2> permanently delete this file from the city's repository?", + "mark-as-completed": "Mark as completed" +} diff --git a/app/src/i18n/locales/es/footer.json b/app/src/i18n/locales/es/footer.json index 15cbbfafb..bcc38e4a0 100644 --- a/app/src/i18n/locales/es/footer.json +++ b/app/src/i18n/locales/es/footer.json @@ -9,4 +9,3 @@ "beta-text": "Este sitio es una versión beta, agradecemos todos los comentarios para mejorar la plataforma.", "send-feedback": "Enviar comentarios" } - diff --git a/app/src/i18n/locales/es/root-page.json b/app/src/i18n/locales/es/root-page.json index 169b62f95..0d24056c2 100644 --- a/app/src/i18n/locales/es/root-page.json +++ b/app/src/i18n/locales/es/root-page.json @@ -1,3 +1,3 @@ { - "loading-dashboard": "Loading dashboard..." -} \ No newline at end of file + "loading-dashboard": "Loading dashboard..." +} diff --git a/app/src/lib/app-theme.ts b/app/src/lib/app-theme.ts index 8f8a68ae5..06cd2a257 100644 --- a/app/src/lib/app-theme.ts +++ b/app/src/lib/app-theme.ts @@ -46,7 +46,7 @@ export const appTheme = extendTheme({ transparentGrey: "rgba(232, 234, 251, 0.20)", backgroundLight: "#FAFAFA", backgroundGreyFlat: "#FAFBFE", - backgroundLoading: "#E8EAFB" + backgroundLoading: "#E8EAFB", }, interactive: { diff --git a/app/src/lib/auth.ts b/app/src/lib/auth.ts index 09d2f25c9..396a699d4 100644 --- a/app/src/lib/auth.ts +++ b/app/src/lib/auth.ts @@ -38,7 +38,7 @@ export type AppSession = DefaultSession & { id: string; role: string; }; -} +}; export class Auth { static async getServerSession(): Promise { @@ -118,4 +118,3 @@ export const authOptions: NextAuthOptions = { }, }, }; -; diff --git a/app/src/lib/store.ts b/app/src/lib/store.ts index b2d68c290..138a82ef3 100644 --- a/app/src/lib/store.ts +++ b/app/src/lib/store.ts @@ -33,7 +33,7 @@ const persistConfig = { key: "root", version: 1, storage, - blacklist: ["api","subsector"], + blacklist: ["api", "subsector"], }; const persistedReducer = persistReducer(persistConfig, reducer); diff --git a/app/src/middleware.ts b/app/src/middleware.ts index 120d9bf46..10c631fc3 100644 --- a/app/src/middleware.ts +++ b/app/src/middleware.ts @@ -55,7 +55,7 @@ export async function middleware(req: NextRequestWithAuth) { } if (response instanceof NextResponse) { - logger.info({status: response.status, url: req.url, method: req.method}); + logger.info({ status: response.status, url: req.url, method: req.method }); } return response; diff --git a/app/src/models/Catalogue.ts b/app/src/models/Catalogue.ts index f5737893a..518beaf1a 100644 --- a/app/src/models/Catalogue.ts +++ b/app/src/models/Catalogue.ts @@ -1,5 +1,5 @@ -import * as Sequelize from 'sequelize'; -import { DataTypes, Model, Optional } from 'sequelize'; +import * as Sequelize from "sequelize"; +import { DataTypes, Model, Optional } from "sequelize"; export interface CatalogueAttributes { type?: string; @@ -7,29 +7,38 @@ export interface CatalogueAttributes { } export type CatalogueOptionalAttributes = "type" | "lastUpdate"; -export type CatalogueCreationAttributes = Optional; +export type CatalogueCreationAttributes = Optional< + CatalogueAttributes, + CatalogueOptionalAttributes +>; -export class Catalogue extends Model implements CatalogueAttributes { +export class Catalogue + extends Model + implements CatalogueAttributes +{ type?: string; lastUpdate?: Date; static initModel(sequelize: Sequelize.Sequelize): typeof Catalogue { - return Catalogue.init({ - type: { - type: DataTypes.TEXT, - allowNull: false, - primaryKey: true, - }, - lastUpdate: { - type: DataTypes.DATE, - allowNull: true, - field: 'last_update' - } - }, { - sequelize, - tableName: 'Catalogue', - schema: 'public', - timestamps: false, - }); + return Catalogue.init( + { + type: { + type: DataTypes.TEXT, + allowNull: false, + primaryKey: true, + }, + lastUpdate: { + type: DataTypes.DATE, + allowNull: true, + field: "last_update", + }, + }, + { + sequelize, + tableName: "Catalogue", + schema: "public", + timestamps: false, + }, + ); } } diff --git a/app/src/models/EmissionsFactor.ts b/app/src/models/EmissionsFactor.ts index edd5cec5c..97a3531d6 100644 --- a/app/src/models/EmissionsFactor.ts +++ b/app/src/models/EmissionsFactor.ts @@ -46,7 +46,8 @@ export type EmissionsFactorCreationAttributes = Optional< export class EmissionsFactor extends Model - implements EmissionsFactorAttributes { + implements EmissionsFactorAttributes +{ id!: string; gpcReferenceNumber?: string; emissionsPerActivity?: number; diff --git a/app/src/models/GasValue.ts b/app/src/models/GasValue.ts index 90e6ed44c..e3ab69ac9 100644 --- a/app/src/models/GasValue.ts +++ b/app/src/models/GasValue.ts @@ -28,7 +28,8 @@ export type GasValueCreationAttributes = Optional< export class GasValue extends Model - implements GasValueAttributes { + implements GasValueAttributes +{ id!: string; inventoryValueId?: string; emissionsFactorId?: string; diff --git a/app/src/models/InventoryValue.ts b/app/src/models/InventoryValue.ts index c0989475b..ee9e47152 100644 --- a/app/src/models/InventoryValue.ts +++ b/app/src/models/InventoryValue.ts @@ -105,18 +105,9 @@ export class InventoryValue // InventoryValue hasMany GasValue via inventoryValueId gasValues!: GasValue[]; getGasValues!: Sequelize.HasManyGetAssociationsMixin; - setGasValues!: Sequelize.HasManySetAssociationsMixin< - GasValue, - GasValueId - >; - addGasValue!: Sequelize.HasManyAddAssociationMixin< - GasValue, - GasValueId - >; - addGasValues!: Sequelize.HasManyAddAssociationsMixin< - GasValue, - GasValueId - >; + setGasValues!: Sequelize.HasManySetAssociationsMixin; + addGasValue!: Sequelize.HasManyAddAssociationMixin; + addGasValues!: Sequelize.HasManyAddAssociationsMixin; createGasValue!: Sequelize.HasManyCreateAssociationMixin; removeGasValue!: Sequelize.HasManyRemoveAssociationMixin< GasValue, @@ -126,14 +117,8 @@ export class InventoryValue GasValue, GasValueId >; - hasGasValue!: Sequelize.HasManyHasAssociationMixin< - GasValue, - GasValueId - >; - hasGasValues!: Sequelize.HasManyHasAssociationsMixin< - GasValue, - GasValueId - >; + hasGasValue!: Sequelize.HasManyHasAssociationMixin; + hasGasValues!: Sequelize.HasManyHasAssociationsMixin; countGasValues!: Sequelize.HasManyCountAssociationsMixin; static initModel(sequelize: Sequelize.Sequelize): typeof InventoryValue { diff --git a/app/src/models/Scope.ts b/app/src/models/Scope.ts index 0654808ad..9387d83d0 100644 --- a/app/src/models/Scope.ts +++ b/app/src/models/Scope.ts @@ -165,18 +165,9 @@ export class Scope // Scope hasMany SubSector via scopeId and subsectorId subSectors!: SubSector[]; getSubSectors!: Sequelize.HasManyGetAssociationsMixin; - setSubSectors!: Sequelize.HasManySetAssociationsMixin< - SubSector, - SubSectorId - >; - addSubSector!: Sequelize.HasManyAddAssociationMixin< - SubSector, - SubSectorId - >; - addSubSectors!: Sequelize.HasManyAddAssociationsMixin< - SubSector, - SubSectorId - >; + setSubSectors!: Sequelize.HasManySetAssociationsMixin; + addSubSector!: Sequelize.HasManyAddAssociationMixin; + addSubSectors!: Sequelize.HasManyAddAssociationsMixin; createSubSector!: Sequelize.HasManyCreateAssociationMixin; removeSubSector!: Sequelize.HasManyRemoveAssociationMixin< SubSector, @@ -186,14 +177,8 @@ export class Scope SubSector, SubSectorId >; - hasSubSector!: Sequelize.HasManyHasAssociationMixin< - SubSector, - SubSectorId - >; - hasSubSectors!: Sequelize.HasManyHasAssociationsMixin< - SubSector, - SubSectorId - >; + hasSubSector!: Sequelize.HasManyHasAssociationMixin; + hasSubSectors!: Sequelize.HasManyHasAssociationsMixin; countSubSectors!: Sequelize.HasManyCountAssociationsMixin; static initModel(sequelize: Sequelize.Sequelize): typeof Scope { diff --git a/app/src/models/User.ts b/app/src/models/User.ts index 942e895db..a68c816b3 100644 --- a/app/src/models/User.ts +++ b/app/src/models/User.ts @@ -36,7 +36,8 @@ export type UserCreationAttributes = Optional< export class User extends Model - implements UserAttributes { + implements UserAttributes +{ userId!: string; name?: string; pictureUrl?: string; @@ -131,14 +132,8 @@ export class User addCity!: Sequelize.HasManyAddAssociationMixin; addCities!: Sequelize.HasManyAddAssociationsMixin; createCity!: Sequelize.HasManyCreateAssociationMixin; - removeCity!: Sequelize.HasManyRemoveAssociationMixin< - City, - CityId - >; - removeCities!: Sequelize.HasManyRemoveAssociationsMixin< - City, - CityId - >; + removeCity!: Sequelize.HasManyRemoveAssociationMixin; + removeCities!: Sequelize.HasManyRemoveAssociationsMixin; hasCity!: Sequelize.HasManyHasAssociationMixin; hasCities!: Sequelize.HasManyHasAssociationsMixin; countCities!: Sequelize.HasManyCountAssociationsMixin; diff --git a/app/src/util/form-schema/index.ts b/app/src/util/form-schema/index.ts index a52439272..fa804bc1e 100644 --- a/app/src/util/form-schema/index.ts +++ b/app/src/util/form-schema/index.ts @@ -1,5 +1,3 @@ import SectorFormSchema from "./sector-form-schema.json"; -export { - SectorFormSchema -} \ No newline at end of file +export { SectorFormSchema }; diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 5a7b7bbcd..ff6b1cd25 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -145,10 +145,7 @@ "type": "text" } ], - "units": [ - "units-kilowatt-hours", - "units-terajoules" - ] + "units": ["units-kilowatt-hours", "units-terajoules"] } ] }, @@ -351,9 +348,7 @@ { "id": "methane-commitment-solid-waste-methodology", "activities": { - "unique-by": [ - "methane-commitment-solid-waste-landfill-id" - ], + "unique-by": ["methane-commitment-solid-waste-landfill-id"], "activity-title": "total-municipal-solid-waste-disposed", "extra-fields": [ { @@ -412,4 +407,4 @@ ] } } -} \ No newline at end of file +} diff --git a/app/src/util/form-schema/sector-form-schema.json b/app/src/util/form-schema/sector-form-schema.json index 3d9ded3b8..7d2a46135 100644 --- a/app/src/util/form-schema/sector-form-schema.json +++ b/app/src/util/form-schema/sector-form-schema.json @@ -47,12 +47,7 @@ "label": "Select emission factor type", "type": "select", "name": "emissionFactorType", - "options": [ - "IPCC", - "Local", - "Regional", - "National" - ] + "options": ["IPCC", "Local", "Regional", "National"] }, { "label": "CO2 emission factor", @@ -88,102 +83,93 @@ } }, "2": { - "fields": [ - { - "label": "Building type", - "type": "select", - "name": "buildingType", - "options": [ - "All", - "Commercial / Institutional", - "Commercial buildings", - "Institutional buildings", - "Street lighting" - ] - }, - { - "label": "Energy usage type", - "type": "select", - "name": "fuelType", + "fields": [ + { + "label": "Building type", + "type": "select", + "name": "buildingType", + "options": [ + "All", + "Commercial / Institutional", + "Commercial buildings", + "Institutional buildings", + "Street lighting" + ] + }, + { + "label": "Energy usage type", + "type": "select", + "name": "fuelType", + "options": [ + "All energy usages", + "Electricity", + "Electricity (CHP)", + "Heating", + "Heating (CHP)", + "Steam", + "Steam (CHP)", + "Refrigeration", + "Refrigeration (CHP)" + ] + }, + { + "label": "Total grid-supplied energy consumption", + "type": "number", + "name": "energyConsumption", + "addon": { + "name": "energyConsumptionUnites", "options": [ - "All energy usages", - "Electricity", - "Electricity (CHP)", - "Heating", - "Heating (CHP)", - "Steam", - "Steam (CHP)", - "Refrigeration", - "Refrigeration (CHP)" - ] - }, - { - "label": "Total grid-supplied energy consumption", - "type": "number", - "name": "energyConsumption", - "addon": { - "name": "energyConsumptionUnites", - "options": [ "Kilowatt hour (kWh)", "Terajoules (TJ)", "Kilowatt-kilometer (kW/m2)" ] - } - }, - { - "label": "Emission factor type", - "type": "select", - "name": "emissionFactorType", - "options": [ - "Carbon Footprint", - "Local", - "Regional", - "National" - ] - }, - { - "label": "CO2 emission factor", - "type": "number", - "name": "co2EmissionFactor", - "addon": { - "name": "co2EmissionFactorUnit", - "unit": "CO2/kWh" - } - }, - { - "label": "N2O emission factor", - "type": "number", - "name": "n2oEmissionFactor", - "addon": { - "name": "n2oEmissionFactorUnit", - "unit": "NO2/kWh" - } - }, - { - "label": "CH4 emission factor", - "type": "number", - "name": "ch4EmissionFactor", - "addon": { - "name": "ch4EmissionFactorUnit", - "unit": "CH4/kWh" } - }, - { - "label": "Data quality", - "type": "select", - "name": "dataQuality", - "options": [ - "High", - "Medium", - "Low" - ] - }, - { - "label": "Source reference", - "type": "text", - "name": "sourceReference", - "placeholder": "Write in detail from which source the entered values come from." - }, + }, + { + "label": "Emission factor type", + "type": "select", + "name": "emissionFactorType", + "options": ["Carbon Footprint", "Local", "Regional", "National"] + }, + { + "label": "CO2 emission factor", + "type": "number", + "name": "co2EmissionFactor", + "addon": { + "name": "co2EmissionFactorUnit", + "unit": "CO2/kWh" + } + }, + { + "label": "N2O emission factor", + "type": "number", + "name": "n2oEmissionFactor", + "addon": { + "name": "n2oEmissionFactorUnit", + "unit": "NO2/kWh" + } + }, + { + "label": "CH4 emission factor", + "type": "number", + "name": "ch4EmissionFactor", + "addon": { + "name": "ch4EmissionFactorUnit", + "unit": "CH4/kWh" + } + }, + { + "label": "Data quality", + "type": "select", + "name": "dataQuality", + "options": ["High", "Medium", "Low"] + }, + { + "label": "Source reference", + "type": "text", + "name": "sourceReference", + "placeholder": "Write in detail from which source the entered values come from." + }, { "label": "Emission factor type", "type": "select", @@ -230,4 +216,3 @@ "2": {}, "3": {} } - diff --git a/app/src/util/helpers.ts b/app/src/util/helpers.ts index ad467b4e4..98ffd27c2 100644 --- a/app/src/util/helpers.ts +++ b/app/src/util/helpers.ts @@ -160,7 +160,7 @@ export function findClosestYear( export function findClosestYearToInventory( populationData: PopulationEntry[] | undefined, year: number, - maxYearDifference: number = 10 + maxYearDifference: number = 10, ): PopulationEntry | null { if (!populationData || populationData.length === 0) { return null; @@ -169,7 +169,7 @@ export function findClosestYearToInventory( let closestEntry = null; let closestDistance = Infinity; // Initialize with a large number - populationData.forEach(entry => { + populationData.forEach((entry) => { // Ensure the entry has a valid population value if (entry.population !== null && entry.population !== undefined) { const currentDistance = Math.abs(entry.year - year); @@ -188,6 +188,6 @@ export function findClosestYearToInventory( // If no entry is within the maxYearDifference, return the closest available entry return closestEntry; } - + return null; // In case all entries are outside the maxYearDifference and no closest entry was found } diff --git a/app/src/util/series.ts b/app/src/util/series.ts index 02453bc98..288d33efb 100644 --- a/app/src/util/series.ts +++ b/app/src/util/series.ts @@ -1,8 +1,10 @@ -export function estimate(series: { year: number, value: number }[], year: number): number | null { - +export function estimate( + series: { year: number; value: number }[], + year: number, +): number | null { // if it's in the series, just return the value - const exact = series.find(e => e.year === year); + const exact = series.find((e) => e.year === year); if (exact) { return exact.value; } @@ -13,34 +15,37 @@ export function estimate(series: { year: number, value: number }[], year: number return null; } - if (year < series[0].year) { // extrapolate backwards - let first = series[0] - let next = series.find(e => e.year - first.year >= first.year - year) + if (year < series[0].year) { + // extrapolate backwards + let first = series[0]; + let next = series.find((e) => e.year - first.year >= first.year - year); if (!next) { - return null + return null; } let rate = (next.value - first.value) / (next.year - first.year); - let value = first.value - rate * (first.year - year) - return value - } else if (year > series[series.length - 1].year) { // extrapolate forwards - let last = series[series.length - 1] - let prev = series.findLast(e => last.year - e.year >= year - last.year) + let value = first.value - rate * (first.year - year); + return value; + } else if (year > series[series.length - 1].year) { + // extrapolate forwards + let last = series[series.length - 1]; + let prev = series.findLast((e) => last.year - e.year >= year - last.year); if (!prev) { - return null + return null; } let rate = (last.value - prev.value) / (last.year - prev.year); - let value = last.value + rate * (year - last.year) - return value - } else { // interpolate - let prev = series.findLast(e => e.year < year) - let next = series.find(e => e.year > year) + let value = last.value + rate * (year - last.year); + return value; + } else { + // interpolate + let prev = series.findLast((e) => e.year < year); + let next = series.find((e) => e.year > year); if (!prev || !next) { - return null + return null; } let rate = (next.value - prev.value) / (next.year - prev.year); - let value = prev.value + rate * (year - prev.year) - return value + let value = prev.value + rate * (year - prev.year); + return value; } return null; -} \ No newline at end of file +} From 0c2b3f8f6e894f019af704a27a9e09d8e2094b93 Mon Sep 17 00:00:00 2001 From: mfonsecaOEF Date: Wed, 31 Jul 2024 06:47:11 -0600 Subject: [PATCH 056/128] feat: residential buildings added --- .../form-schema/manual-input-hierarchy.json | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 5a7b7bbcd..8ddb95b8a 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -1,4 +1,173 @@ { + "I.1.1": { + "methodologies": [ + { + "id": "fuel-combustion-residential-buildings-methodology", + "activities": [ + { + "id": "fuel-combustion-residential-buildings-activity", + "unique-by": [ + "residential-building-type", + "residential-building-fuel-type", + "residential-buildings-fuel-source" + ], + "activity-title": "activity-total-fuel-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "residential-building-type", + "options": [ + "residential-building-type-all" + ] + }, + { + "id": "residential-building-fuel-type", + "options": [ + "residential-building-fuel-type-propane", + "residential-building-fuel-type-natural-gas", + "residential-building-fuel-type-heating-oil" + ] + }, + { + "id": "residential-buildings-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-other" + ] + } + ], + "suggested_activities": [ + { + "id": "fuel-combustion-residential-buildings-activity", + "commercial-building-type": "residential-building-type-all" + } + ] + }, + { + "id": "scaled-sample-fuel-combustion-residential-buildings-methodology", + "implemented": false + }, + { + "id": "modeled-data-fuel-consumption-residential-buildings-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "residential-building-type", + "options": [ + "residential-building-type-all" + ] + }, + { + "id": "residential-building-fuel-type", + "options": [ + "residential-building-fuel-type-all", + "residential-building-fuel-type-propane", + "residential-building-fuel-type-natural-gas", + "residential-building-fuel-type-heating-oil" + ] + }, + { + "id": "residential-buildings-fuel-source", + "type": "text" + } + ] + } + }, + "I.1.2": { + "methodologies": [ + { + "id": "energy-consumption-residential-buildings-methodology", + "activities": [ + { + "id": "energy-consumption-residential-buildings-activity", + "unique-by": [ + "residential-building-type", + "residential-building-energy-usage", + "residential-buildings-energy-source" + ], + "activity-title": "activity-energy-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "residential-building-type", + "options": [ + "commercial-building-type-all" + ] + }, + { + "id": "residential-building-energy-usage", + "options": [ + "residential-building-energy-usage-all", + "residential-building-energy-usage-electricity", + "residential-building-energy-usage-electricity-chp", + "residential-building-energy-usage-heating", + "residential-building-energy-usage-heating-chp", + "residential-building-energy-usage-steam", + "residential-building-energy-usage-steam-chp", + "residential-building-energy-usage-refrigeration", + "residential-building-energy-usage-refrigeration-chp" + ] + }, + { + "id": "residential-buildings-energy-source", + "type": "text" + } + ], + "units": [ + "units-kilowatt-hours", + "units-terajoules" + ] + } + ] + }, + { + "id": "scaled-sample-energy-usage-residential-buildings-methodology", + "implemented": false + }, + { + "id": "modeled-data-energy-usage-residential-buildings-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "residential-building-type", + "options": [ + "residential-building-type-all" + ], + "exclusive": "residential-building-type-all" + }, + { + "id": "residential-building-energy-usage", + "options": [ + "residential-building-energy-usage-all", + "residential-building-energy-usage-electricity", + "residential-building-energy-usage-electricity-chp", + "residential-building-energy-usage-heating", + "residential-building-energy-usage-heating-chp", + "residential-building-energy-usage-steam", + "residential-building-energy-usage-steam-chp", + "residential-building-energy-usage-refrigeration", + "residential-building-energy-usage-refrigeration-chp" + ] + }, + { + "id": "residential-buildings-energy-source", + "type": "text" + } + ] + } + }, "I.2.1": { "methodologies": [ { From 036d66d9d053d579b7bdf88e1a342e0b50392dca Mon Sep 17 00:00:00 2001 From: mfonsecaOEF Date: Wed, 31 Jul 2024 10:23:34 -0600 Subject: [PATCH 057/128] feat:fuel types for I.1.1 anD I.2.1 --- .../form-schema/manual-input-hierarchy.json | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 8ddb95b8a..a50920bab 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -25,7 +25,12 @@ "options": [ "residential-building-fuel-type-propane", "residential-building-fuel-type-natural-gas", - "residential-building-fuel-type-heating-oil" + "residential-building-fuel-type-charcoal", + "residential-building-fuel-type-liquefied-petroleum-gases", + "residential-building-fuel-type-peat", + "residential-building-fuel-type-anthracite", + "residential-building-fuel-type-gasoline", + "residential-building-fuel-type-diesel" ] }, { @@ -72,7 +77,12 @@ "residential-building-fuel-type-all", "residential-building-fuel-type-propane", "residential-building-fuel-type-natural-gas", - "residential-building-fuel-type-heating-oil" + "residential-building-fuel-type-charcoal", + "residential-building-fuel-type-liquefied-petroleum-gases", + "residential-building-fuel-type-peat", + "residential-building-fuel-type-anthracite", + "residential-building-fuel-type-gasoline", + "residential-building-fuel-type-diesel" ] }, { @@ -100,7 +110,7 @@ { "id": "residential-building-type", "options": [ - "commercial-building-type-all" + "residential-building-type-all" ] }, { @@ -198,8 +208,12 @@ "id": "commercial-building-fuel-type", "options": [ "commercial-building-fuel-type-propane", + "commercial-building-fuel-type-wood/wood-waste", "commercial-building-fuel-type-natural-gas", - "commercial-building-fuel-type-heating-oil" + "commercial-building-fuel-type-liquefied-petroleum-gases", + "commercial-building-fuel-type-anthracite", + "commercial-building-fuel-type-gasoline", + "commercial-building-fuel-type-diesel" ] }, { @@ -258,8 +272,12 @@ "options": [ "commercial-building-fuel-type-all", "commercial-building-fuel-type-propane", + "commercial-building-fuel-type-wood/wood-waste", "commercial-building-fuel-type-natural-gas", - "commercial-building-fuel-type-heating-oil" + "commercial-building-fuel-type-liquefied-petroleum-gases", + "commercial-building-fuel-type-anthracite", + "commercial-building-fuel-type-gasoline", + "commercial-building-fuel-type-diesel" ] }, { From f2fe4b0b6f291b65daedc8a7174588e6ef76a7d0 Mon Sep 17 00:00:00 2001 From: mfonsecaOEF Date: Wed, 31 Jul 2024 10:51:35 -0600 Subject: [PATCH 058/128] feat: subsectors I.3.1 and I.3.2 --- .../form-schema/manual-input-hierarchy.json | 262 ++++++++++++++++++ 1 file changed, 262 insertions(+) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index a50920bab..aa8a6639a 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -382,6 +382,268 @@ ] } }, + "I.3.1": { + "methodologies": [ + { + "id": "fuel-combustion-manufacturing-and-construction-methodology", + "activities": [ + { + "id": "fuel-combustion-manufacturing-and-construction-activity", + "unique-by": [ + "manufacturing-and-construction-type", + "manufacturing-and-construction-fuel-type", + "manufacturing-and-construction-fuel-source" + ], + "activity-title": "activity-total-fuel-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "manufacturing-and-construction-type", + "options": [ + "manufacturing-and-construction-type-all", + "manufacturing-and-construction-type-manufacturing-industries-and-construction", + "manufacturing-and-construction-type-steel", + "manufacturing-and-construction-type-cement", + "manufacturing-and-construction-type-iron", + "manufacturing-and-construction-type-non-ferrous-metals", + "manufacturing-and-construction-type-chemical-products", + "manufacturing-and-construction-type-pulp-paper-and-printing", + "manufacturing-and-construction-type-non-metallic-minerals", + "manufacturing-and-construction-type-transport-equipment", + "manufacturing-and-construction-type-machinery", + "manufacturing-and-construction-type-mining-and-quarrying", + "manufacturing-and-construction-type-wood-and-wood-products", + "manufacturing-and-construction-type-construction", + "manufacturing-and-construction-type-textiles-and-leather", + "manufacturing-and-construction-type-unspecified-industry" + ], + "exclusive": "manufacturing-and-construction-type-all" + }, + { + "id": "manufacturing-and-construction-fuel-type", + "options": [ + "manufacturing-and-construction-fuel-type-propane", + "manufacturing-and-construction-fuel-type-natural-gas", + "manufacturing-and-construction-fuel-type-charcoal", + "manufacturing-and-construction-fuel-type-liquefied-petroleum-gases", + "manufacturing-and-construction-fuel-type-peat", + "manufacturing-and-construction-fuel-type-anthracite", + "manufacturing-and-construction-fuel-type-gasoline", + "manufacturing-and-construction-fuel-type-diesel" + ], + "exclusive": "manufacturing-and-construction-fuel-type-all" + }, + { + "id": "manufacturing-and-construction-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-other" + ] + } + ], + "suggested_activities": [ + { + "id": "fuel-combustion-manufacturing-and-construction-activity", + "manufacturing-and-construction-type": "manufacturing-and-construction-type-all" + }, + { + "id": "fuel-combustion-manufacturing-and-construction-activity", + "manufacturing-and-construction-type": "manufacturing-and-construction-type-cement" + }, + { + "id": "fuel-combustion-manufacturing-and-construction-activity", + "manufacturing-and-construction-type": "manufacturing-and-construction-type-iron" + }, + { + "id": "fuel-combustion-manufacturing-and-construction-activity", + "manufacturing-and-construction-type": "manufacturing-and-construction-type-steel" + }, + { + "id": "fuel-combustion-manufacturing-and-construction-activity", + "manufacturing-and-construction-type": "manufacturing-and-construction-type-chemical-products" + } + ] + }, + { + "id": "scaled-sample-fuel-combustion-manufacturing-and-construction-methodology", + "implemented": false + }, + { + "id": "modeled-data-fuel-consumption-manufacturing-and-construction-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "manufacturing-and-construction-type", + "options": [ + "manufacturing-and-construction-type-all", + "manufacturing-and-construction-type-manufacturing-industries-and-construction", + "manufacturing-and-construction-type-steel", + "manufacturing-and-construction-type-cement", + "manufacturing-and-construction-type-iron", + "manufacturing-and-construction-type-non-ferrous-metals", + "manufacturing-and-construction-type-chemical-products", + "manufacturing-and-construction-type-pulp-paper-and-printing", + "manufacturing-and-construction-type-non-metallic-minerals", + "manufacturing-and-construction-type-transport-equipment", + "manufacturing-and-construction-type-machinery", + "manufacturing-and-construction-type-mining-and-quarrying", + "manufacturing-and-construction-type-wood-and-wood-products", + "manufacturing-and-construction-type-construction", + "manufacturing-and-construction-type-textiles-and-leather", + "manufacturing-and-construction-type-unspecified-industry" + ], + "exclusive": "manufacturing-and-construction-type-all" + }, + { + "id": "manufacturing-and-construction-fuel-type", + "options": [ + "manufacturing-and-construction-fuel-type-all", + "manufacturing-and-construction-fuel-type-propane", + "manufacturing-and-construction-fuel-type-natural-gas", + "manufacturing-and-construction-fuel-type-charcoal", + "manufacturing-and-construction-fuel-type-liquefied-petroleum-gases", + "manufacturing-and-construction-fuel-type-peat", + "manufacturing-and-construction-fuel-type-anthracite", + "manufacturing-and-construction-fuel-type-gasoline", + "manufacturing-and-construction-fuel-type-diesel" + ], + "exclusive": "manufacturing-and-construction-fuel-type-all" + }, + { + "id": "manufacturing-and-construction-fuel-source", + "type": "text" + } + ] + } + }, + "I.3.2": { + "methodologies": [ + { + "id": "energy-consumption-manufacturing-and-construction-methodology", + "activities": [ + { + "id": "energy-consumption-manufacturing-and-construction-activity", + "unique-by": [ + "manufacturing-and-construction-type", + "manufacturing-and-construction-energy-usage", + "manufacturing-and-construction-energy-source" + ], + "activity-title": "activity-energy-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "manufacturing-and-construction-type", + "options": [ + "manufacturing-and-construction-type-all", + "manufacturing-and-construction-type-manufacturing-industries-and-construction", + "manufacturing-and-construction-type-steel", + "manufacturing-and-construction-type-cement", + "manufacturing-and-construction-type-iron", + "manufacturing-and-construction-type-non-ferrous-metals", + "manufacturing-and-construction-type-chemical-products", + "manufacturing-and-construction-type-pulp-paper-and-printing", + "manufacturing-and-construction-type-non-metallic-minerals", + "manufacturing-and-construction-type-transport-equipment", + "manufacturing-and-construction-type-machinery", + "manufacturing-and-construction-type-mining-and-quarrying", + "manufacturing-and-construction-type-wood-and-wood-products", + "manufacturing-and-construction-type-construction", + "manufacturing-and-construction-type-textiles-and-leather", + "manufacturing-and-construction-type-unspecified-industry" + ], + "exclusive": "manufacturing-and-construction-type-all" + }, + { + "id": "manufacturing-and-construction-energy-usage", + "options": [ + "manufacturing-and-construction-energy-usage-all", + "manufacturing-and-construction-energy-usage-electricity", + "manufacturing-and-construction-energy-usage-electricity-chp", + "manufacturing-and-construction-energy-usage-heating", + "manufacturing-and-construction-energy-usage-heating-chp", + "manufacturing-and-construction-energy-usage-steam", + "manufacturing-and-construction-energy-usage-steam-chp", + "manufacturing-and-construction-energy-usage-refrigeration", + "manufacturing-and-construction-energy-usage-refrigeration-chp" + ], + "exclusive": "manufacturing-and-construction-energy-usage-all" + }, + { + "id": "manufacturing-and-construction-energy-source", + "type": "text" + } + ], + "units": [ + "units-kilowatt-hours", + "units-terajoules" + ] + } + ] + }, + { + "id": "scaled-sample-energy-usage-manufacturing-and-construction-methodology", + "implemented": false + }, + { + "id": "modeled-data-energy-usage-manufacturing-and-construction-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "manufacturing-and-construction-type", + "options": [ + "manufacturing-and-construction-type-all", + "manufacturing-and-construction-type-manufacturing-industries-and-construction", + "manufacturing-and-construction-type-steel", + "manufacturing-and-construction-type-cement", + "manufacturing-and-construction-type-iron", + "manufacturing-and-construction-type-non-ferrous-metals", + "manufacturing-and-construction-type-chemical-products", + "manufacturing-and-construction-type-pulp-paper-and-printing", + "manufacturing-and-construction-type-non-metallic-minerals", + "manufacturing-and-construction-type-transport-equipment", + "manufacturing-and-construction-type-machinery", + "manufacturing-and-construction-type-mining-and-quarrying", + "manufacturing-and-construction-type-wood-and-wood-products", + "manufacturing-and-construction-type-construction", + "manufacturing-and-construction-type-textiles-and-leather", + "manufacturing-and-construction-type-unspecified-industry", + ], + "exclusive": "manufacturing-and-construction-type-all" + }, + { + "id": "manufacturing-and-construction-energy-usage", + "options": [ + "manufacturing-and-construction-energy-usage-all", + "manufacturing-and-construction-energy-usage-electricity", + "manufacturing-and-construction-energy-usage-electricity-chp", + "manufacturing-and-construction-energy-usage-heating", + "manufacturing-and-construction-energy-usage-heating-chp", + "manufacturing-and-construction-energy-usage-steam", + "manufacturing-and-construction-energy-usage-steam-chp", + "manufacturing-and-construction-energy-usage-refrigeration", + "manufacturing-and-construction-energy-usage-refrigeration-chp" + ], + "exclusive": "manufacturing-and-construction-energy-usage-all" + }, + { + "id": "manufacturing-and-construction-energy-source", + "type": "text" + } + ] + } + }, "II.1.1": { "methodologies": [ { From d21b90657e38f7771b3f8b82e7bcc1d958b4153d Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 1 Aug 2024 10:38:33 +0200 Subject: [PATCH 059/128] Added comments regarding further TODOs --- app/src/app/api/v0/assistants/route.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/app/api/v0/assistants/route.ts b/app/src/app/api/v0/assistants/route.ts index 05fc7980e..39dcfaace 100644 --- a/app/src/app/api/v0/assistants/route.ts +++ b/app/src/app/api/v0/assistants/route.ts @@ -8,7 +8,10 @@ export const POST = apiHandler(async (_req, { session }) => { if (session?.user.role !== Roles.Admin) { return NextResponse.json({ error: "Method Not Allowed", status: 405 }); } else { - // API rooute not yet fully implemented + // API route not yet fully implemented. It gives the baseline for future automation + // TODO: Add API route for creating a vector store + // TODO: Add API route for uploading files to vector store. + // TODO: This vector store needs to passed to this endpoint below. return NextResponse.json({ error: "Not Implemented", status: 501 }); const userID = session?.user.id; From 3323e15f580b14970237aed1f9faeea67b60db43 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 1 Aug 2024 10:48:16 +0200 Subject: [PATCH 060/128] added comments to the usage of this file --- app/src/util/openai.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/util/openai.ts b/app/src/util/openai.ts index 8cdaa6a8f..dafd849bb 100644 --- a/app/src/util/openai.ts +++ b/app/src/util/openai.ts @@ -1,3 +1,6 @@ +// This file is only needed when using OpenAI and will be currently always loaded +// If OpenAI models are not used, this file can be removed. + import OpenAI from "openai"; export const openai = new OpenAI({ From 9fab40bcc447f4f1010492643531e76d571937f1 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 1 Aug 2024 10:49:12 +0200 Subject: [PATCH 061/128] fixed formatting --- app/src/components/ChatBot/chat-popover.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/ChatBot/chat-popover.tsx b/app/src/components/ChatBot/chat-popover.tsx index 776918151..082481747 100644 --- a/app/src/components/ChatBot/chat-popover.tsx +++ b/app/src/components/ChatBot/chat-popover.tsx @@ -75,7 +75,7 @@ export default function ChatPopover({ /> - + From 89e9d7538c467d1af3a882a58cc6d7487bdacdb9 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 1 Aug 2024 11:02:06 +0200 Subject: [PATCH 062/128] Added environment variable for assistantId --- k8s/cc-web-deploy.yml | 2 ++ k8s/test/cc-test-web-deploy.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/k8s/cc-web-deploy.yml b/k8s/cc-web-deploy.yml index b8a9c975c..963559ecf 100644 --- a/k8s/cc-web-deploy.yml +++ b/k8s/cc-web-deploy.yml @@ -52,6 +52,8 @@ spec: value: "openai" - name: OPEN_AI_MODEL value: "gpt-4o-mini" + - name: OPENAI_ASSISTANT_ID + value: "" resources: limits: memory: "1024Mi" diff --git a/k8s/test/cc-test-web-deploy.yml b/k8s/test/cc-test-web-deploy.yml index c26aff810..1dde6e3a0 100644 --- a/k8s/test/cc-test-web-deploy.yml +++ b/k8s/test/cc-test-web-deploy.yml @@ -52,6 +52,8 @@ spec: value: "openai" - name: OPEN_AI_MODEL value: "gpt-4o-mini" + - name: OPENAI_ASSISTANT_ID + value: "" resources: limits: memory: "1024Mi" From 6d0441f734f2556b48c721ebb4d3367b1a38acf8 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 1 Aug 2024 12:34:55 +0200 Subject: [PATCH 063/128] Added @ts-ignore and prepared some code for function calling --- .../v0/assistants/threads/messages/route.ts | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/app/src/app/api/v0/assistants/threads/messages/route.ts b/app/src/app/api/v0/assistants/threads/messages/route.ts index ecc20ec41..a05f92492 100644 --- a/app/src/app/api/v0/assistants/threads/messages/route.ts +++ b/app/src/app/api/v0/assistants/threads/messages/route.ts @@ -6,19 +6,18 @@ import { AssistantResponse } from "ai"; const assistantId = process.env.OPENAI_ASSISTANT_ID as string; // Helper function for debugging -// Extracting tokens, looking into events, ... const handleReadableStream = (stream: AssistantStream): AssistantStream => { - // stream.on("textCreated", () => console.log("Created")); + stream.on("textCreated", () => console.log("Created")); stream.on("textDelta", async (delta) => { // Make sure token has annotation value if (delta.annotations !== undefined && delta.annotations.length > 0) { // console.log(delta.value); // console.log(delta.annotations); - // Token can have only one annotation + // @ts-ignore const file_id = delta.annotations[0].file_citation.file_id; const citedFile = await openai.files.retrieve(file_id); - // console.log(citedFile.filename); + console.log(citedFile.filename); } }); @@ -48,7 +47,33 @@ export const POST = apiHandler(async (req) => { return AssistantResponse( { threadId, messageId: createdMessage.id }, async ({ forwardStream, sendDataMessage }) => { - let runStream = await forwardStream(handleReadableStream(stream)); + const run = await forwardStream(stream); + + // TODO: Implement visiualization on client side + if (run?.required_action?.type === "submit_tool_outputs") { + console.log("tool calls"); + + const runId = run?.id; + const toolCallId = + run.required_action.submit_tool_outputs.tool_calls[0].id; + + // Get tool outputs - here mocked + const toolOutputs = [ + { + tool_call_id: toolCallId, + output: "Mock ooutput", + }, + ]; + + // Submit result of tool outputs here + const modifiedRun = await openai.beta.threads.runs.submitToolOutputs( + threadId, + runId, + { + tool_outputs: toolOutputs, + }, + ); + } }, ); }); From cd325a0f0000ba8e265cdf43a5dfea4564349802 Mon Sep 17 00:00:00 2001 From: mfonsecaOEF Date: Thu, 1 Aug 2024 06:22:55 -0600 Subject: [PATCH 064/128] feat: subsectors I.4.1 and I.4.2 added --- .../form-schema/manual-input-hierarchy.json | 502 +++++++++++++++++- 1 file changed, 487 insertions(+), 15 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index aa8a6639a..f65e8e59a 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -422,14 +422,27 @@ { "id": "manufacturing-and-construction-fuel-type", "options": [ - "manufacturing-and-construction-fuel-type-propane", - "manufacturing-and-construction-fuel-type-natural-gas", - "manufacturing-and-construction-fuel-type-charcoal", - "manufacturing-and-construction-fuel-type-liquefied-petroleum-gases", - "manufacturing-and-construction-fuel-type-peat", "manufacturing-and-construction-fuel-type-anthracite", - "manufacturing-and-construction-fuel-type-gasoline", - "manufacturing-and-construction-fuel-type-diesel" + "manufacturing-and-construction-fuel-type-natural-other-bituminous-coal", + "manufacturing-and-construction-fuel-type-sub-bituminous-coal", + "manufacturing-and-construction-fuel-type-lignite", + "manufacturing-and-construction-fuel-type-coking-coal", + "manufacturing-and-construction-fuel-type-coke-oven-coke-and-lignite-coke", + "manufacturing-and-construction-fuel-type-natural-gas", + "manufacturing-and-construction-fuel-type-residual-fuel-oil", + "manufacturing-and-construction-fuel-type-gas-oil", + "manufacturing-and-construction-fuel-type-diesel-oil", + "manufacturing-and-construction-fuel-type-other-kerosene", + "manufacturing-and-construction-fuel-type-crude-oil", + "manufacturing-and-construction-fuel-type-naphtha", + "manufacturing-and-construction-fuel-type-refinery-gas", + "manufacturing-and-construction-fuel-type-coke-oven-gas", + "manufacturing-and-construction-fuel-type-oxygen-steel-furnace-gas", + "manufacturing-and-construction-fuel-type-natural-gas-liquids", + "manufacturing-and-construction-fuel-type-industrial-wastes", + "manufacturing-and-construction-fuel-type-waste-oils", + "manufacturing-and-construction-fuel-type-bitumen", + "manufacturing-and-construction-fuel-type-municipal-wastes" ], "exclusive": "manufacturing-and-construction-fuel-type-all" }, @@ -507,14 +520,27 @@ "id": "manufacturing-and-construction-fuel-type", "options": [ "manufacturing-and-construction-fuel-type-all", - "manufacturing-and-construction-fuel-type-propane", - "manufacturing-and-construction-fuel-type-natural-gas", - "manufacturing-and-construction-fuel-type-charcoal", - "manufacturing-and-construction-fuel-type-liquefied-petroleum-gases", - "manufacturing-and-construction-fuel-type-peat", "manufacturing-and-construction-fuel-type-anthracite", - "manufacturing-and-construction-fuel-type-gasoline", - "manufacturing-and-construction-fuel-type-diesel" + "manufacturing-and-construction-fuel-type-natural-other-bituminous-coal", + "manufacturing-and-construction-fuel-type-sub-bituminous-coal", + "manufacturing-and-construction-fuel-type-lignite", + "manufacturing-and-construction-fuel-type-coking-coal", + "manufacturing-and-construction-fuel-type-coke-oven-coke-and-lignite-coke", + "manufacturing-and-construction-fuel-type-natural-gas", + "manufacturing-and-construction-fuel-type-residual-fuel-oil", + "manufacturing-and-construction-fuel-type-gas-oil", + "manufacturing-and-construction-fuel-type-diesel-oil", + "manufacturing-and-construction-fuel-type-other-kerosene", + "manufacturing-and-construction-fuel-type-crude-oil", + "manufacturing-and-construction-fuel-type-naphtha", + "manufacturing-and-construction-fuel-type-refinery-gas", + "manufacturing-and-construction-fuel-type-coke-oven-gas", + "manufacturing-and-construction-fuel-type-oxygen-steel-furnace-gas", + "manufacturing-and-construction-fuel-type-natural-gas-liquids", + "manufacturing-and-construction-fuel-type-industrial-wastes", + "manufacturing-and-construction-fuel-type-waste-oils", + "manufacturing-and-construction-fuel-type-bitumen", + "manufacturing-and-construction-fuel-type-municipal-wastes" ], "exclusive": "manufacturing-and-construction-fuel-type-all" }, @@ -618,7 +644,7 @@ "manufacturing-and-construction-type-wood-and-wood-products", "manufacturing-and-construction-type-construction", "manufacturing-and-construction-type-textiles-and-leather", - "manufacturing-and-construction-type-unspecified-industry", + "manufacturing-and-construction-type-unspecified-industry" ], "exclusive": "manufacturing-and-construction-type-all" }, @@ -644,6 +670,452 @@ ] } }, + "I.4.1": { + "methodologies": [ + { + "id": "fuel-combustion-energy-industries-methodology", + "activities": [ + { + "id": "fuel-combustion-energy-industries-activity", + "unique-by": [ + "energy-industries-type", + "energy-industries-fuel-type", + "energy-industries-fuel-source" + ], + "activity-title": "activity-total-fuel-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "energy-industries-type", + "options": [ + "energy-industries-type-all", + "energy-industries-type-electricity_generation", + "energy-industries-type-combined-heat-and-power-generation", + "energy-industries-type-heat-plants", + "energy-industries-type-pretroleum-refining", + "energy-industries-type-non-ferrous-manufacture-of-solid-fuels", + "energy-industries-type-chemical-other-energy-industries" + ], + "exclusive": "energy-industries-type-all" + }, + { + "id": "energy-industries-fuel-type", + "options": [ + "energy-industries-fuel-type-anthracite", + "energy-industries-fuel-type-natural-other-bituminous-coal", + "energy-industries-fuel-type-sub-bituminous-coal", + "energy-industries-fuel-type-lignite", + "energy-industries-fuel-type-coking-coal", + "energy-industries-fuel-type-coke-oven-coke-and-lignite-coke", + "energy-industries-fuel-type-natural-gas", + "energy-industries-fuel-type-residual-fuel-oil", + "energy-industries-fuel-type-crude-oil", + "energy-industries-fuel-type-refinery-gas", + "energy-industries-fuel-type-coke-oven-gas", + "energy-industries-fuel-type-oxygen-steel-furnace-gas", + "energy-industries-fuel-type-natural-gas-liquids", + "energy-industries-fuel-type-jet-kerosene", + "energy-industries-fuel-type-municipal-wastes" + ], + "exclusive": "energy-industries-fuel-type-all" + }, + { + "id": "energy-industries-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-other" + ] + } + ], + "suggested_activities": [ + { + "id": "fuel-combustion-energy-industries-activity", + "energy-industries-type": "energy-industries-type-all" + }, + { + "id": "fuel-combustion-energy-industries-activity", + "energy-industries-type": "energy-industries-type-electricity_generation" + }, + { + "id": "fuel-combustion-energy-industries-activity", + "energy-industries-type": "energy-industries-type-combined-heat-and-power-generation" + }, + { + "id": "fuel-combustion-energy-industries-activity", + "energy-industries-type": "energy-industries-type-heat-pants" + } + ] + }, + { + "id": "scaled-sample-fuel-combustion-energy-industries-methodology", + "implemented": false + }, + { + "id": "modeled-data-fuel-consumption-energy-industries-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "energy-industries-type", + "options": [ + "energy-industries-type-all", + "energy-industries-type-electricity_generation", + "energy-industries-type-combined-heat-and-power-generation", + "energy-industries-type-heat-plants", + "energy-industries-type-pretroleum-refining", + "energy-industries-type-non-ferrous-manufacture-of-solid-fuels", + "energy-industries-type-chemical-other-energy-industries" + ], + "exclusive": "energy-industries-type-all" + }, + { + "id": "energy-industries-fuel-type", + "options": [ + "energy-industries-fuel-type-all", + "energy-industries-fuel-type-anthracite", + "energy-industries-fuel-type-natural-other-bituminous-coal", + "energy-industries-fuel-type-sub-bituminous-coal", + "energy-industries-fuel-type-lignite", + "energy-industries-fuel-type-coking-coal", + "energy-industries-fuel-type-coke-oven-coke-and-lignite-coke", + "energy-industries-fuel-type-natural-gas", + "energy-industries-fuel-type-residual-fuel-oil", + "energy-industries-fuel-type-crude-oil", + "energy-industries-fuel-type-refinery-gas", + "energy-industries-fuel-type-coke-oven-gas", + "energy-industries-fuel-type-oxygen-steel-furnace-gas", + "energy-industries-fuel-type-natural-gas-liquids", + "energy-industries-fuel-type-jet-kerosene", + "energy-industries-fuel-type-municipal-wastes" + ], + "exclusive": "energy-industries-fuel-type-all" + }, + { + "id": "energy-industries-fuel-source", + "type": "text" + } + ] + } + }, + "I.4.2": { + "methodologies": [ + { + "id": "energy-consumption-energy-industries-methodology", + "activities": [ + { + "id": "energy-consumption-energy-industries-activity", + "unique-by": [ + "energy-industries-type", + "energy-industries-energy-usage", + "energy-industries-energy-source" + ], + "activity-title": "activity-energy-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "energy-industries-type", + "options": [ + "energy-industries-type-all", + "energy-industries-type-electricity_generation", + "energy-industries-type-combined-heat-and-power-generation", + "energy-industries-type-heat-plants", + "energy-industries-type-pretroleum-refining", + "energy-industries-type-non-ferrous-manufacture-of-solid-fuels", + "energy-industries-type-chemical-other-energy-industries" + ], + "exclusive": "energy-industries-type-all" + }, + { + "id": "energy-industries-energy-usage", + "options": [ + "energy-industries-energy-usage-all", + "energy-industries-energy-usage-electricity", + "energy-industries-energy-usage-electricity-chp", + "energy-industries-energy-usage-heating", + "energy-industries-energy-usage-heating-chp", + "energy-industries-energy-usage-steam", + "energy-industries-energy-usage-steam-chp", + "energy-industries-energy-usage-refrigeration", + "energy-industries-energy-usage-refrigeration-chp" + ], + "exclusive": "energy-industries-energy-usage-all" + }, + { + "id": "energy-industries-energy-source", + "type": "text" + } + ], + "units": [ + "units-kilowatt-hours", + "units-terajoules" + ] + } + ] + }, + { + "id": "scaled-sample-energy-usage-energy-industries-methodology", + "implemented": false + }, + { + "id": "modeled-data-energy-usage-energy-industries-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "energy-industries-type", + "options": [ + "energy-industries-type-all", + "energy-industries-type-electricity_generation", + "energy-industries-type-combined-heat-and-power-generation", + "energy-industries-type-heat-plants", + "energy-industries-type-pretroleum-refining", + "energy-industries-type-non-ferrous-manufacture-of-solid-fuels", + "energy-industries-type-chemical-other-energy-industries" + ], + "exclusive": "energy-industries-type-all" + }, + { + "id": "energy-industries-energy-usage", + "options": [ + "energy-industries-energy-usage-all", + "energy-industries-energy-usage-electricity", + "energy-industries-energy-usage-electricity-chp", + "energy-industries-energy-usage-heating", + "energy-industries-energy-usage-heating-chp", + "energy-industries-energy-usage-steam", + "energy-industries-energy-usage-steam-chp", + "energy-industries-energy-usage-refrigeration", + "energy-industries-energy-usage-refrigeration-chp" + ], + "exclusive": "energy-industries-energy-usage-all" + }, + { + "id": "energy-industries-energy-source", + "type": "text" + } + ] + } + }, + "I.5.1": { + "methodologies": [ + { + "id": "fuel-combustion-agriculture-forestry-fishing-activities-methodology", + "activities": [ + { + "id": "fuel-combustion-agriculture-forestry-fishing-activities-activity", + "unique-by": [ + "agriculture-forestry-fishing-activities-type", + "agriculture-forestry-fishing-activities-fuel-type", + "agriculture-forestry-fishing-activities-fuel-source" + ], + "activity-title": "activity-total-fuel-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "agriculture-forestry-fishing-activities-type", + "options": [ + "agriculture-forestry-fishing-activities-type-all", + "agriculture-forestry-fishing-activities-type-stationary", + "agriculture-forestry-fishing-activities-type-off-road-vehicles-and-machinery", + "agriculture-forestry-fishing-activities-type-fishing-mobile-combustion" + ], + "exclusive": "agriculture-forestry-fishing-activities-type-all" + }, + { + "id": "agriculture-forestry-fishing-activities-fuel-type", + "options": [ + "agriculture-forestry-fishing-activities-fuel-type-diesel-oil", + "agriculture-forestry-fishing-activities-fuel-type-natural-gas", + "agriculture-forestry-fishing-activities-fuel-type-liquefied-petroleum-gases", + "agriculture-forestry-fishing-activities-fuel-type-wood/wood-waste", + "agriculture-forestry-fishing-activities-fuel-type-other-primary-solid-biomass", + "agriculture-forestry-fishing-activities-fuel-type-natural-charcoal", + "agriculture-forestry-fishing-activities-fuel-type-natural-gas-oil", + "agriculture-forestry-fishing-activities-fuel-type-natural-peat" + ], + "exclusive": "agriculture-forestry-fishing-activities-fuel-type-all" + }, + { + "id": "agriculture-forestry-fishing-activities-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-other" + ] + } + ], + "suggested_activities": [ + { + "id": "fuel-combustion-agriculture-forestry-fishing-activities-activity", + "agriculture-forestry-fishing-activities-type": "agriculture-forestry-fishing-activities-type-all" + }, + { + "id": "fuel-combustion-agriculture-forestry-fishing-activities-activity", + "agriculture-forestry-fishing-activities-type": "agriculture-forestry-fishing-activities-type-stationary" + }, + { + "id": "fuel-combustion-agriculture-forestry-fishing-activities-activity", + "agriculture-forestry-fishing-activities-type": "agriculture-forestry-fishing-activities-type-off-road-vehicles-and-machinery" + }, + { + "id": "fuel-combustion-agriculture-forestry-fishing-activities-activity", + "agriculture-forestry-fishing-activities-type": "agriculture-forestry-fishing-activities-type-fishing-mobile-combustion" + } + ] + }, + { + "id": "scaled-sample-fuel-combustion-agriculture-forestry-fishing-activities-methodology", + "implemented": false + }, + { + "id": "modeled-data-fuel-consumption-agriculture-forestry-fishing-activities-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "agriculture-forestry-fishing-activities-type", + "options": [ + "agriculture-forestry-fishing-activities-type-all", + "agriculture-forestry-fishing-activities-type-stationary", + "agriculture-forestry-fishing-activities-type-off-road-vehicles-and-machinery", + "agriculture-forestry-fishing-activities-type-fishing-mobile-combustion" + ], + "exclusive": "agriculture-forestry-fishing-activities-type-all" + }, + { + "id": "agriculture-forestry-fishing-activities-fuel-type", + "options": [ + "agriculture-forestry-fishing-activities-fuel-type-all", + "agriculture-forestry-fishing-activities-fuel-type-diesel-oil", + "agriculture-forestry-fishing-activities-fuel-type-natural-gas", + "agriculture-forestry-fishing-activities-fuel-type-liquefied-petroleum-gases", + "agriculture-forestry-fishing-activities-fuel-type-wood/wood-waste", + "agriculture-forestry-fishing-activities-fuel-type-other-primary-solid-biomass", + "agriculture-forestry-fishing-activities-fuel-type-natural-charcoal", + "agriculture-forestry-fishing-activities-fuel-type-natural-gas-oil", + "agriculture-forestry-fishing-activities-fuel-type-natural-peat" + ], + "exclusive": "agriculture-forestry-fishing-activities-fuel-type-all" + }, + { + "id": "agriculture-forestry-fishing-activities-fuel-source", + "type": "text" + } + ] + } + }, + "I.5.2": { + "methodologies": [ + { + "id": "energy-consumption-agriculture-forestry-fishing-activities-methodology", + "activities": [ + { + "id": "energy-consumption-agriculture-forestry-fishing-activities-activity", + "unique-by": [ + "agriculture-forestry-fishing-activities-type", + "agriculture-forestry-fishing-activities-energy-usage", + "agriculture-forestry-fishing-activities-energy-source" + ], + "activity-title": "activity-energy-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "agriculture-forestry-fishing-activities-type", + "options": [ + "agriculture-forestry-fishing-activities-type-all", + "agriculture-forestry-fishing-activities-type-stationary", + "agriculture-forestry-fishing-activities-type-off-road-vehicles-and-machinery", + "agriculture-forestry-fishing-activities-type-fishing-mobile-combustion" + ], + "exclusive": "agriculture-forestry-fishing-activities-type-all" + }, + { + "id": "agriculture-forestry-fishing-activities-energy-usage", + "options": [ + "agriculture-forestry-fishing-activities-energy-usage-all", + "agriculture-forestry-fishing-activities-energy-usage-electricity", + "agriculture-forestry-fishing-activities-energy-usage-electricity-chp", + "agriculture-forestry-fishing-activities-energy-usage-heating", + "agriculture-forestry-fishing-activities-energy-usage-heating-chp", + "agriculture-forestry-fishing-activities-energy-usage-steam", + "agriculture-forestry-fishing-activities-energy-usage-steam-chp", + "agriculture-forestry-fishing-activities-energy-usage-refrigeration", + "agriculture-forestry-fishing-activities-energy-usage-refrigeration-chp" + ], + "exclusive": "agriculture-forestry-fishing-activities-energy-usage-all" + }, + { + "id": "agriculture-forestry-fishing-activities-energy-source", + "type": "text" + } + ], + "units": [ + "units-kilowatt-hours", + "units-terajoules" + ] + } + ] + }, + { + "id": "scaled-sample-energy-usage-agriculture-forestry-fishing-activities-methodology", + "implemented": false + }, + { + "id": "modeled-data-energy-usage-agriculture-forestry-fishing-activities-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "agriculture-forestry-fishing-activities-type", + "options": [ + "agriculture-forestry-fishing-activities-type-all", + "agriculture-forestry-fishing-activities-type-stationary", + "agriculture-forestry-fishing-activities-type-off-road-vehicles-and-machinery", + "agriculture-forestry-fishing-activities-type-fishing-mobile-combustion" + ], + "exclusive": "agriculture-forestry-fishing-activities-type-all" + }, + { + "id": "agriculture-forestry-fishing-activities-energy-usage", + "options": [ + "agriculture-forestry-fishing-activities-energy-usage-all", + "agriculture-forestry-fishing-activities-energy-usage-electricity", + "agriculture-forestry-fishing-activities-energy-usage-electricity-chp", + "agriculture-forestry-fishing-activities-energy-usage-heating", + "agriculture-forestry-fishing-activities-energy-usage-heating-chp", + "agriculture-forestry-fishing-activities-energy-usage-steam", + "agriculture-forestry-fishing-activities-energy-usage-steam-chp", + "agriculture-forestry-fishing-activities-energy-usage-refrigeration", + "agriculture-forestry-fishing-activities-energy-usage-refrigeration-chp" + ], + "exclusive": "agriculture-forestry-fishing-activities-energy-usage-all" + }, + { + "id": "agriculture-forestry-fishing-activities-energy-source", + "type": "text" + } + ] + } + }, "II.1.1": { "methodologies": [ { From a93a5fa42307c32658b2d0b64f758454fefc2c75 Mon Sep 17 00:00:00 2001 From: mfonsecaOEF Date: Thu, 1 Aug 2024 06:58:30 -0600 Subject: [PATCH 065/128] feat: subsectors I.6.1 and I.6.2 added --- .../form-schema/manual-input-hierarchy.json | 216 +++++++++++++++++- 1 file changed, 211 insertions(+), 5 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index f65e8e59a..e9d337d64 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -940,8 +940,8 @@ "agriculture-forestry-fishing-activities-fuel-type-wood/wood-waste", "agriculture-forestry-fishing-activities-fuel-type-other-primary-solid-biomass", "agriculture-forestry-fishing-activities-fuel-type-natural-charcoal", - "agriculture-forestry-fishing-activities-fuel-type-natural-gas-oil", - "agriculture-forestry-fishing-activities-fuel-type-natural-peat" + "agriculture-forestry-fishing-activities-fuel-type-gas-oil", + "agriculture-forestry-fishing-activities-fuel-type-peat" ], "exclusive": "agriculture-forestry-fishing-activities-fuel-type-all" }, @@ -1008,9 +1008,9 @@ "agriculture-forestry-fishing-activities-fuel-type-liquefied-petroleum-gases", "agriculture-forestry-fishing-activities-fuel-type-wood/wood-waste", "agriculture-forestry-fishing-activities-fuel-type-other-primary-solid-biomass", - "agriculture-forestry-fishing-activities-fuel-type-natural-charcoal", - "agriculture-forestry-fishing-activities-fuel-type-natural-gas-oil", - "agriculture-forestry-fishing-activities-fuel-type-natural-peat" + "agriculture-forestry-fishing-activities-fuel-type-charcoal", + "agriculture-forestry-fishing-activities-fuel-type-gas-oil", + "agriculture-forestry-fishing-activities-fuel-type-peat" ], "exclusive": "agriculture-forestry-fishing-activities-fuel-type-all" }, @@ -1116,6 +1116,212 @@ ] } }, + "I.6.1": { + "methodologies": [ + { + "id": "fuel-combustion-non-specific-sources-methodology", + "activities": [ + { + "id": "fuel-combustion-non-specific-sources-activity", + "unique-by": [ + "non-specific-sources-type", + "non-specific-sources-fuel-type", + "non-specific-sources-fuel-source" + ], + "activity-title": "activity-total-fuel-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "non-specific-sources-type", + "options": [ + "non-specific-sources-type-all", + "non-specific-sources-type-stationary", + "non-specific-sources-type-mobile" + ], + "exclusive": "non-specific-sources-type-all" + }, + { + "id": "non-specific-sources-fuel-type", + "options": [ + "non-specific-sources-fuel-type-gas-oil", + "non-specific-sources-fuel-type-naphtha", + "non-specific-sources-fuel-type-diesel-oil", + "non-specific-sources-fuel-type-natural-gas", + "non-specific-sources-fuel-type-liquefied-petroleum-gases", + "non-specific-sources-fuel-type-wood/wood-waste", + "non-specific-sources-fuel-type-other-primary-solid-biomass", + "non-specific-sources-fuel-type-charcoal", + "non-specific-sources-fuel-type-natural-gas-oil", + "non-specific-sources-fuel-type-peat" + ], + "exclusive": "non-specific-sources-fuel-type-all" + }, + { + "id": "non-specific-sources-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-other" + ] + } + ], + "suggested_activities": [ + { + "id": "fuel-combustion-non-specific-sources-activity", + "non-specific-sources-type": "non-specific-sources-type-all" + }, + { + "id": "fuel-combustion-non-specific-sources-activity", + "non-specific-sources-type": "non-specific-sources-type-stationary" + }, + { + "id": "fuel-combustion-non-specific-sources-activity", + "non-specific-sources-type": "non-specific-sources-type-mobile" + } + ] + }, + { + "id": "scaled-sample-fuel-combustion-non-specific-sources-methodology", + "implemented": false + }, + { + "id": "modeled-data-fuel-consumption-non-specific-sources-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "non-specific-sources-type", + "options": [ + "non-specific-sources-type-all", + "non-specific-sources-type-stationary", + "non-specific-sources-type-mobile" + ], + "exclusive": "non-specific-sources-type-all" + }, + { + "id": "non-specific-sources-fuel-type", + "options": [ + "non-specific-sources-fuel-type-all", + "non-specific-sources-fuel-type-gas-oil", + "non-specific-sources-fuel-type-naphtha", + "non-specific-sources-fuel-type-diesel-oil", + "non-specific-sources-fuel-type-natural-gas", + "non-specific-sources-fuel-type-liquefied-petroleum-gases", + "non-specific-sources-fuel-type-wood/wood-waste", + "non-specific-sources-fuel-type-other-primary-solid-biomass", + "non-specific-sources-fuel-type-charcoal", + "non-specific-sources-fuel-type-natural-gas-oil", + "non-specific-sources-fuel-type-peat" + ], + "exclusive": "non-specific-sources-fuel-type-all" + }, + { + "id": "non-specific-sources-fuel-source", + "type": "text" + } + ] + } + }, + "I.6.2": { + "methodologies": [ + { + "id": "energy-consumption-non-specific-sources-methodology", + "activities": [ + { + "id": "energy-consumption-non-specific-sources-activity", + "unique-by": [ + "non-specific-sources-type", + "non-specific-sources-energy-usage", + "non-specific-sources-energy-source" + ], + "activity-title": "activity-energy-consumption", + "minimum": 1, + "extra-fields": [ + { + "id": "non-specific-sources-type", + "options": [ + "non-specific-sources-type-all", + "non-specific-sources-type-stationary", + "non-specific-sources-type-mobile" + ], + "exclusive": "non-specific-sources-type-all" + }, + { + "id": "non-specific-sources-energy-usage", + "options": [ + "non-specific-sources-energy-usage-all", + "non-specific-sources-energy-usage-electricity", + "non-specific-sources-energy-usage-electricity-chp", + "non-specific-sources-energy-usage-heating", + "non-specific-sources-energy-usage-heating-chp", + "non-specific-sources-energy-usage-steam", + "non-specific-sources-energy-usage-steam-chp", + "non-specific-sources-energy-usage-refrigeration", + "non-specific-sources-energy-usage-refrigeration-chp" + ], + "exclusive": "non-specific-sources-energy-usage-all" + }, + { + "id": "non-specific-sources-energy-source", + "type": "text" + } + ], + "units": [ + "units-kilowatt-hours", + "units-terajoules" + ] + } + ] + }, + { + "id": "scaled-sample-energy-usage-non-specific-sources-methodology", + "implemented": false + }, + { + "id": "modeled-data-energy-usage-non-specific-sources-methodology", + "implemented": false + } + ], + "direct_measure": { + "extra-fields": [ + { + "id": "non-specific-sources-type", + "options": [ + "non-specific-sources-type-all", + "non-specific-sources-type-stationary", + "non-specific-sources-type-mobile" + ], + "exclusive": "non-specific-sources-type-all" + }, + { + "id": "non-specific-sources-energy-usage", + "options": [ + "non-specific-sources-energy-usage-all", + "non-specific-sources-energy-usage-electricity", + "non-specific-sources-energy-usage-electricity-chp", + "non-specific-sources-energy-usage-heating", + "non-specific-sources-energy-usage-heating-chp", + "non-specific-sources-energy-usage-steam", + "non-specific-sources-energy-usage-steam-chp", + "non-specific-sources-energy-usage-refrigeration", + "non-specific-sources-energy-usage-refrigeration-chp" + ], + "exclusive": "non-specific-sources-energy-usage-all" + }, + { + "id": "non-specific-sources-energy-source", + "type": "text" + } + ] + } + }, "II.1.1": { "methodologies": [ { From 7ed113a31c59a02037d3dd348713577dff70a9f7 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Thu, 1 Aug 2024 16:25:31 +0200 Subject: [PATCH 066/128] WIP: Implemented working function calling with mock data --- .../v0/assistants/threads/messages/route.ts | 114 +++++++++++++----- 1 file changed, 87 insertions(+), 27 deletions(-) diff --git a/app/src/app/api/v0/assistants/threads/messages/route.ts b/app/src/app/api/v0/assistants/threads/messages/route.ts index a05f92492..b48ba4dc4 100644 --- a/app/src/app/api/v0/assistants/threads/messages/route.ts +++ b/app/src/app/api/v0/assistants/threads/messages/route.ts @@ -39,6 +39,58 @@ export const POST = apiHandler(async (req) => { content: input.message, }); + // Run the thread with streaming output + // const stream = openai.beta.threads.runs.stream(threadId, { + // assistant_id: assistantId, + // }); + + // maybe create the run object first, do all the changes on the run object, + // THEN call openai.beta.threads.runs.stream and pass back the streaming object? + + const run = await openai.beta.threads.runs.create(threadId, { + assistant_id: assistantId, + }); + // console.log(run); + + let runStatus; + do { + //await new Promise((resolve) => setTimeout(resolve, 5000)); + const updatedRun = await openai.beta.threads.runs.retrieve( + threadId, + run.id, + ); + runStatus = updatedRun.status; + // console.log("updatedRun"); + // console.log(updatedRun); + // console.log(updatedRun.status); + + if ( + runStatus === "requires_action" && + updatedRun.required_action?.type === "submit_tool_outputs" + ) { + const toolCallId = + updatedRun.required_action?.submit_tool_outputs.tool_calls[0].id; + //const toolOutputs = await handleToolCalls(updatedRun.required_action.submit_tool_outputs.tool_calls, sessionId); + // Get tool outputs - here mocked + const toolOutputs = [ + { + tool_call_id: toolCallId, + output: "SF6, SF8 gases, COmonter Gas and rabbits", + }, + ]; + + // Submit tool outputs to complete the run + await openai.beta.threads.runs.submitToolOutputs(threadId, run.id, { + tool_outputs: toolOutputs, + }); + // re-fetch the run status after submitting tool outputs + const recheckedRun = await openai.beta.threads.runs.retrieve( + threadId, + run.id, + ); + } + } while (runStatus !== "completed"); + // Run the thread with streaming output const stream = openai.beta.threads.runs.stream(threadId, { assistant_id: assistantId, @@ -47,33 +99,41 @@ export const POST = apiHandler(async (req) => { return AssistantResponse( { threadId, messageId: createdMessage.id }, async ({ forwardStream, sendDataMessage }) => { - const run = await forwardStream(stream); - - // TODO: Implement visiualization on client side - if (run?.required_action?.type === "submit_tool_outputs") { - console.log("tool calls"); - - const runId = run?.id; - const toolCallId = - run.required_action.submit_tool_outputs.tool_calls[0].id; - - // Get tool outputs - here mocked - const toolOutputs = [ - { - tool_call_id: toolCallId, - output: "Mock ooutput", - }, - ]; - - // Submit result of tool outputs here - const modifiedRun = await openai.beta.threads.runs.submitToolOutputs( - threadId, - runId, - { - tool_outputs: toolOutputs, - }, - ); - } + const finishedRun = await forwardStream(stream); }, ); + + //return Response.json({}); + // return AssistantResponse( + // { threadId, messageId: createdMessage.id }, + // async ({ forwardStream, sendDataMessage }) => { + // const run = await forwardStream(stream); + + // // TODO: Implement visiualization on client side + // if (run?.required_action?.type === "submit_tool_outputs") { + // console.log("tool calls"); + + // const runId = run?.id; + // const toolCallId = + // run.required_action.submit_tool_outputs.tool_calls[0].id; + + // // Get tool outputs - here mocked + // const toolOutputs = [ + // { + // tool_call_id: toolCallId, + // output: "Mock ooutput", + // }, + // ]; + + // // Submit result of tool outputs here + // const modifiedRun = await openai.beta.threads.runs.submitToolOutputs( + // threadId, + // runId, + // { + // tool_outputs: toolOutputs, + // }, + // ); + // } + // }, + // ); }); From 8ee47598f487ffc0f8f8b5a9339fc91cba6461ad Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Thu, 1 Aug 2024 13:29:39 -0300 Subject: [PATCH 067/128] formatting changes --- .../form-schema/manual-input-hierarchy.json | 130 ++++++++++-------- 1 file changed, 75 insertions(+), 55 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 6da43a867..7465c5e35 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -47,7 +47,7 @@ ] } ], - "suggested_activities": [ + "suggestedActivities": [ { "id": "fuel-combustion-residential-buildings-activity", "commercial-building-type": "residential-building-type-all" @@ -56,14 +56,14 @@ }, { "id": "scaled-sample-fuel-combustion-residential-buildings-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-fuel-consumption-residential-buildings-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "residential-building-type", @@ -141,14 +141,14 @@ }, { "id": "scaled-sample-energy-usage-residential-buildings-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-energy-usage-residential-buildings-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "residential-building-type", @@ -182,6 +182,9 @@ "methodologies": [ { "id": "fuel-combustion-commercial-buildings-methodology", + "inputRequired": [ + "total-fuel-consumption" + ], "activities": [ { "id": "fuel-combustion-commercial-buildings-activity", @@ -230,7 +233,7 @@ ] } ], - "suggested_activities": [ + "suggestedActivities": [ { "id": "fuel-combustion-commercial-buildings-activity", "commercial-building-type": "commercial-building-type-all" @@ -247,14 +250,23 @@ }, { "id": "scaled-sample-fuel-combustion-commercial-buildings-methodology", - "implemented": false + "inputRequired": [ + "sample-fuel", + "scaling-data" + ], + "disabled": true }, { "id": "modeled-data-fuel-consumption-commercial-buildings-methodology", - "implemented": false + "inputRequired": [ + "modeled-fuel", + "built-area" + ], + "disabled": true } ], - "direct_measure": { + "directMeasure": { + "id": "stationary-energy-direct-measure-methodology", "extra-fields": [ { "id": "commercial-building-type", @@ -291,6 +303,9 @@ "methodologies": [ { "id": "energy-consumption-commercial-buildings-methodology", + "inputRequired": [ + "total-grid-consumption" + ], "activities": [ { "id": "energy-consumption-commercial-buildings-activity", @@ -338,14 +353,19 @@ }, { "id": "scaled-sample-energy-usage-commercial-buildings-methodology", - "implemented": false + "inputRequired": [ + "sample-grid-supplied-energy", + "scaling-data" + ], + "disabled": true }, { "id": "modeled-data-energy-usage-commercial-buildings-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { + "id": "stationary-energy-direct-measure-methodology", "extra-fields": [ { "id": "commercial-building-type", @@ -457,7 +477,7 @@ ] } ], - "suggested_activities": [ + "suggestedActivities": [ { "id": "fuel-combustion-manufacturing-and-construction-activity", "manufacturing-and-construction-type": "manufacturing-and-construction-type-all" @@ -482,14 +502,14 @@ }, { "id": "scaled-sample-fuel-combustion-manufacturing-and-construction-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-fuel-consumption-manufacturing-and-construction-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "manufacturing-and-construction-type", @@ -614,14 +634,14 @@ }, { "id": "scaled-sample-energy-usage-manufacturing-and-construction-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-energy-usage-manufacturing-and-construction-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "manufacturing-and-construction-type", @@ -686,7 +706,7 @@ "id": "energy-industries-type", "options": [ "energy-industries-type-all", - "energy-industries-type-electricity_generation", + "energy-industries-type-electricity-generation", "energy-industries-type-combined-heat-and-power-generation", "energy-industries-type-heat-plants", "energy-industries-type-pretroleum-refining", @@ -730,14 +750,14 @@ ] } ], - "suggested_activities": [ + "suggestedActivities": [ { "id": "fuel-combustion-energy-industries-activity", "energy-industries-type": "energy-industries-type-all" }, { "id": "fuel-combustion-energy-industries-activity", - "energy-industries-type": "energy-industries-type-electricity_generation" + "energy-industries-type": "energy-industries-type-electricity-generation" }, { "id": "fuel-combustion-energy-industries-activity", @@ -751,20 +771,20 @@ }, { "id": "scaled-sample-fuel-combustion-energy-industries-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-fuel-consumption-energy-industries-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "energy-industries-type", "options": [ "energy-industries-type-all", - "energy-industries-type-electricity_generation", + "energy-industries-type-electricity-generation", "energy-industries-type-combined-heat-and-power-generation", "energy-industries-type-heat-plants", "energy-industries-type-pretroleum-refining", @@ -821,7 +841,7 @@ "id": "energy-industries-type", "options": [ "energy-industries-type-all", - "energy-industries-type-electricity_generation", + "energy-industries-type-electricity-generation", "energy-industries-type-combined-heat-and-power-generation", "energy-industries-type-heat-plants", "energy-industries-type-pretroleum-refining", @@ -859,20 +879,20 @@ }, { "id": "scaled-sample-energy-usage-energy-industries-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-energy-usage-energy-industries-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "energy-industries-type", "options": [ "energy-industries-type-all", - "energy-industries-type-electricity_generation", + "energy-industries-type-electricity-generation", "energy-industries-type-combined-heat-and-power-generation", "energy-industries-type-heat-plants", "energy-industries-type-pretroleum-refining", @@ -956,7 +976,7 @@ ] } ], - "suggested_activities": [ + "suggestedActivities": [ { "id": "fuel-combustion-agriculture-forestry-fishing-activities-activity", "agriculture-forestry-fishing-activities-type": "agriculture-forestry-fishing-activities-type-all" @@ -977,14 +997,14 @@ }, { "id": "scaled-sample-fuel-combustion-agriculture-forestry-fishing-activities-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-fuel-consumption-agriculture-forestry-fishing-activities-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "agriculture-forestry-fishing-activities-type", @@ -1072,14 +1092,14 @@ }, { "id": "scaled-sample-energy-usage-agriculture-forestry-fishing-activities-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-energy-usage-agriculture-forestry-fishing-activities-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "agriculture-forestry-fishing-activities-type", @@ -1167,7 +1187,7 @@ ] } ], - "suggested_activities": [ + "suggestedActivities": [ { "id": "fuel-combustion-non-specific-sources-activity", "non-specific-sources-type": "non-specific-sources-type-all" @@ -1184,14 +1204,14 @@ }, { "id": "scaled-sample-fuel-combustion-non-specific-sources-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-fuel-consumption-non-specific-sources-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "non-specific-sources-type", @@ -1279,14 +1299,14 @@ }, { "id": "scaled-sample-energy-usage-non-specific-sources-methodology", - "implemented": false + "disabled": true }, { "id": "modeled-data-energy-usage-non-specific-sources-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "non-specific-sources-type", @@ -1373,22 +1393,22 @@ }, { "id": "induced-activity-transboundary-trips-on-road-transport-methodology", - "implemented": false + "disabled": true }, { "id": "induced-activity-only-departing-trips-on-road-transport-methodology", - "implemented": false + "disabled": true }, { "id": "geographic-on-road-transport-methodology", - "implemented": false + "disabled": true }, { "id": "resident-activity-on-road-transport-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "on-road-transport-fuel-type", @@ -1450,7 +1470,7 @@ ] } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "on-road-transport-vehicle-type", @@ -1517,10 +1537,10 @@ }, { "id": "first-order-of-decay-solid-waste-methodology", - "implemented": false + "disabled": true } ], - "direct_measure": { + "directMeasure": { "extra-fields": [ { "id": "landfill-id", From 9748c7a4a98452dd9709ed2e108e213911bf1bae Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Thu, 1 Aug 2024 17:11:18 -0300 Subject: [PATCH 068/128] iterate through methodologies WIP --- .../data/[step]/[subsector]/page.tsx | 1 + app/src/components/Cards/methodology-card.tsx | 30 ++--- .../components/Tabs/Activity/activity-tab.tsx | 126 +++++++++--------- app/src/components/Tabs/Activity/ids.ts | 25 ++++ app/src/util/form-schema/index.ts | 45 ++++++- 5 files changed, 144 insertions(+), 83 deletions(-) create mode 100644 app/src/components/Tabs/Activity/ids.ts diff --git a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx index 76ee7b1ec..3b22acd95 100644 --- a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx +++ b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx @@ -322,6 +322,7 @@ function SubSectorPage({ ) : ( scopes?.map((scope) => ( void; + handleCardSelect: (methodologyId: Methodology) => void; } const MethodologyCard: FC = ({ - methodologyId, - methodologyName, - description, + id, inputRequired, disabled, t, - handleCardSelect = (_methodologyId: MethodologyValues) => {}, + handleCardSelect = (_methodology: Methodology) => {}, }) => { const [isSelected, setIsSelected] = useState(false); const handleRadioChange = () => { setIsSelected(true); handleCardSelect({ - description, disabled, inputRequired, - methodologyId, - methodologyName, + id: id, }); }; const handleCardClick = () => { if (!isSelected) { handleCardSelect({ - description, disabled, inputRequired, - methodologyId, - methodologyName, + id: id, }); } setIsSelected(!isSelected); @@ -89,7 +81,7 @@ const MethodologyCard: FC = ({ )} - {methodologyName} + {t(id)} = ({ fontWeight="normal" color="interactive.control" > - {description} + {t(id + "-description")} = ({ color="interactive.control" > {inputRequired?.map((item: string, i: number) => ( -
  • {item}
  • +
  • {t(item)}
  • ))} diff --git a/app/src/components/Tabs/Activity/activity-tab.tsx b/app/src/components/Tabs/Activity/activity-tab.tsx index aca1e1394..7a6c333b0 100644 --- a/app/src/components/Tabs/Activity/activity-tab.tsx +++ b/app/src/components/Tabs/Activity/activity-tab.tsx @@ -1,9 +1,4 @@ import { - Accordion, - AccordionButton, - AccordionIcon, - AccordionItem, - AccordionPanel, Box, Button, Icon, @@ -14,22 +9,9 @@ import { PopoverBody, PopoverContent, PopoverTrigger, - Radio, - RadioGroup, - Stack, Switch, TabPanel, - Table, - TableContainer, - Tag, - TagLabel, - Tbody, - Td, Text, - Textarea, - Th, - Thead, - Tr, useDisclosure, } from "@chakra-ui/react"; import React, { FC, useState } from "react"; @@ -37,12 +19,9 @@ import HeadingText from "../../heading-text"; import { AddIcon } from "@chakra-ui/icons"; import { MdMoreVert } from "react-icons/md"; import SuggestedActivityCard from "../../Cards/suggested-activities-card"; -import { ActivityDataAttributes } from "@/models/ActivityData"; -import LoadingState from "../../loading-state"; import { TFunction } from "i18next"; import { FiTrash2 } from "react-icons/fi"; import { FaNetworkWired } from "react-icons/fa"; -import MethodologyCard from "../../Cards/methodology-card"; import { Trans } from "react-i18next"; import AddActivityModal from "../../Modals/add-activity-modal"; import ChangeMethodology from "../../Modals/change-methodology"; @@ -51,9 +30,13 @@ import { api } from "@/services/api"; import ActivityAccordion from "./activity-accordion"; import ScopeUnavailable from "./scope-unavailable"; import { ActivityDataScope } from "@/features/city/subsectorSlice"; +import { MANUAL_INPUT_HIERARCHY, Methodology } from "@/util/form-schema"; +import { ids } from "./ids"; +import MethodologyCard from "@/components/Cards/methodology-card"; interface ActivityTabProps { t: TFunction; + subsectorId: string; isUnavailableChecked?: boolean; isMethodologySelected?: boolean; userActivities?: []; @@ -65,17 +48,10 @@ interface ActivityTabProps { step: string; } -export type MethodologyValues = { - methodologyId: string; - methodologyName: string; - description: string; - inputRequired: string[]; - disabled: boolean; -}; - const ActivityTab: FC = ({ t, userActivities, + subsectorId, areActivitiesLoading, totalConsumption, totalConsumptionUnit, @@ -89,23 +65,34 @@ const ActivityTab: FC = ({ const [selectedMethodology, setSelectedMethodology] = useState(""); const [isUnavailableChecked, setIsChecked] = useState(false); const [hasActivityData, setHasActivityData] = useState(false); - const [methodology, setMethodology] = useState(); + const [methodology, setMethodology] = useState(); + + function getMethodologies() { + const refNumber = ids[subsectorId] + "." + (filteredScope.scope || 1); + const methodologies = + MANUAL_INPUT_HIERARCHY[refNumber]?.methodologies || []; + const directMeasure = { + ...MANUAL_INPUT_HIERARCHY[refNumber]?.directMeasure, + id: + MANUAL_INPUT_HIERARCHY[refNumber]?.directMeasure?.id || + "direct-measure", // adds a fallback generic id for direct measure + }; + return { methodologies, directMeasure }; + } + + const { methodologies, directMeasure } = getMethodologies(); const handleMethodologySelected = ({ - description, disabled, inputRequired, - methodologyId, - methodologyName, - }: MethodologyValues) => { - setSelectedMethodology(methodologyId); + id, + }: Methodology) => { + setSelectedMethodology(id); setIsMethodologySelected(!isMethodologySelected); setMethodology({ - description, disabled, inputRequired, - methodologyId, - methodologyName, + id, }); }; const changeMethodology = () => { @@ -171,6 +158,19 @@ const ActivityTab: FC = ({ // } // onDeleteActivitiesModalClose(); + function handleCardSelect( + disabled: boolean | undefined, + inputRequired: string[] | undefined, + id: string, + ) { + return () => + handleMethodologySelected({ + disabled: !!disabled, + inputRequired, + id, + }); + } + // }; return ( @@ -214,14 +214,14 @@ const ActivityTab: FC = ({
    - + - {methodology?.description} + {t(methodology?.id + "-description")} @@ -449,35 +449,35 @@ const ActivityTab: FC = ({ display="flex" justifyContent="space-between" > - {filteredScope.methodologies.map( - ({ - methodologyId, - methodologyName, - description, - inputRequired, - disabled, - }) => ( + {(methodologies || []).map( + ({ id, disabled, activities, inputRequired }) => ( - handleMethodologySelected({ - description, - disabled, - inputRequired, - methodologyId, - methodologyName, - }) - } + handleCardSelect={handleCardSelect( + disabled, + inputRequired, + id, + )} /> ), )} + )} diff --git a/app/src/components/Tabs/Activity/ids.ts b/app/src/components/Tabs/Activity/ids.ts new file mode 100644 index 000000000..13383648b --- /dev/null +++ b/app/src/components/Tabs/Activity/ids.ts @@ -0,0 +1,25 @@ +export const ids: { [k: string]: string } = { + "abe4c7b0-242d-3ed2-a146-48885d6fb38d": "I.1", + "a235005c-f223-3c64-a0d2-f55d6f22f32f": "I.2", + "8de1d11d-4146-35f3-a973-e66930e68a50": "I.3", + "4f342e84-0269-3f04-aceb-1d6cd0a183bc": "I.4", + "95c049d1-eff9-3b26-af49-2b32982e7dd9": "I.5", + "cfc4d8de-2b90-376c-b9d7-446aaf2d8eeb": "I.6", + "b69c4ec7-a3c7-37a2-af4f-634d5a06a512": "I.7", + "b32f56a1-3a4e-3cd5-9052-e06284468700": "I.8", + "48fcfadb-90ed-34aa-80d9-fa31a90bef80": "II.1", + "8cf35b86-9ed2-36bd-b04d-eddc47db6676": "II.2", + "ab32c321-e9e1-31b3-9dde-f93ade472219": "II.3", + "5b84b809-1878-3b1b-bf6b-250c64d5e920": "II.4", + "e20ace37-9ba4-3a80-9d88-8cac5253c0b0": "II.5", + "172d10c0-6b80-3173-902e-eca5c0af84c8": "III.1", + "a8baeb06-0ab2-3215-a93e-2fcbe0e8f8a9": "III.2", + "0ed16605-c76a-3c07-892d-4383a7618943": "III.3", + "c465e7a2-1634-337f-819a-2dfbe147927e": "III.4", + "6b23cb0a-a1c1-35f5-835e-dca1d009ae9b": "IV.1", + "913775b3-0e20-3b0f-b269-2576548bcd36": "IV.2", + "52ec93fa-99d8-3cea-8d26-e8c9d3b4afaa": "V.1", + "36adcd97-2d47-3997-af8f-bcb8b92639f0": "V.2", + "3eb70366-95b3-3293-a701-83a5f617648e": "V.3", + "401a7571-4951-3e40-be4c-f8b5ea41583f": "VI.1", +}; diff --git a/app/src/util/form-schema/index.ts b/app/src/util/form-schema/index.ts index fa804bc1e..aee0685fc 100644 --- a/app/src/util/form-schema/index.ts +++ b/app/src/util/form-schema/index.ts @@ -1,3 +1,46 @@ import SectorFormSchema from "./sector-form-schema.json"; +import HIERARCHY from "./manual-input-hierarchy.json"; -export { SectorFormSchema }; +interface ExtraField { + id: string; + type?: string; + options?: string[]; + exclusive?: string; + multiselect?: boolean; + required?: boolean; + totalRequired?: number; + subtypes?: string[]; +} + +interface Activity { + id: string; + "unique-by"?: string[]; + "activity-title"?: string; + minimum?: number; + "extra-fields"?: ExtraField[]; + units?: string[]; + formula?: string; +} + +export interface Methodology { + id: string; + disabled?: boolean; + activities?: Activity[]; + inputRequired?: string[]; +} + +interface DirectMeasure { + id?: string; + "extra-fields"?: ExtraField[]; +} + +interface ManualInputHierarchy { + [key: string]: { + methodologies?: Methodology[]; + directMeasure?: DirectMeasure; + }; +} + +const MANUAL_INPUT_HIERARCHY = HIERARCHY as ManualInputHierarchy; + +export { SectorFormSchema, MANUAL_INPUT_HIERARCHY }; From 91eb9c411fc8741a15f6d8cb1551b8ffae2a4846 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Fri, 2 Aug 2024 11:36:42 +0200 Subject: [PATCH 069/128] chore(api): remove unused imports from activity value route --- .../v0/inventory/[inventory]/activity-value/[id]/route.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/src/app/api/v0/inventory/[inventory]/activity-value/[id]/route.ts b/app/src/app/api/v0/inventory/[inventory]/activity-value/[id]/route.ts index d7aa018e2..ee0571418 100644 --- a/app/src/app/api/v0/inventory/[inventory]/activity-value/[id]/route.ts +++ b/app/src/app/api/v0/inventory/[inventory]/activity-value/[id]/route.ts @@ -1,15 +1,11 @@ import UserService from "@/backend/UserService"; import { db } from "@/models"; -import { - EmissionsFactor, - EmissionsFactorAttributes, -} from "@/models/EmissionsFactor"; +import { EmissionsFactor } from "@/models/EmissionsFactor"; import { apiHandler } from "@/util/api"; import { createActivityValueRequest } from "@/util/validation"; import createHttpError from "http-errors"; import { NextResponse } from "next/server"; import { randomUUID } from "node:crypto"; -import { Op } from "sequelize"; import { z } from "zod"; export const PATCH = apiHandler(async (req, { params, session }) => { From ff6211d83ac023ce0df0733798cf9fb0674dc968 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Fri, 2 Aug 2024 11:37:14 +0200 Subject: [PATCH 070/128] fix(api): not using GasValue from with ActivityValue in InventoryValue routes --- .../[inventory]/value/[subcategory]/route.ts | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/app/src/app/api/v0/inventory/[inventory]/value/[subcategory]/route.ts b/app/src/app/api/v0/inventory/[inventory]/value/[subcategory]/route.ts index f4403ae3d..d718b4a8a 100644 --- a/app/src/app/api/v0/inventory/[inventory]/value/[subcategory]/route.ts +++ b/app/src/app/api/v0/inventory/[inventory]/value/[subcategory]/route.ts @@ -21,13 +21,19 @@ export const GET = apiHandler(async (_req, { params, session }) => { include: [ { model: db.models.DataSource, as: "dataSource" }, { - model: db.models.GasValue, - as: "gasValues", + model: db.models.ActivityValue, + as: "activityValues", include: [ { - model: db.models.EmissionsFactor, - as: "emissionsFactor", - include: [{ model: db.models.DataSource, as: "dataSources" }], + model: db.models.GasValue, + as: "gasValues", + include: [ + { + model: db.models.EmissionsFactor, + as: "emissionsFactor", + include: [{ model: db.models.DataSource, as: "dataSources" }], + }, + ], }, ], }, @@ -55,8 +61,12 @@ export const PATCH = apiHandler(async (req, { params, session }) => { inventoryId: inventory.inventoryId, }, include: [ + { + model: db.models.ActivityValue, + as: "activityValues", + include: [{ model: db.models.GasValue, as: "gasValues" }], + }, { model: db.models.DataSource, as: "dataSource" }, - { model: db.models.GasValue, as: "gasValues" }, ], }); const gasValuesData = body.gasValues; From f7e2afbdae8fbf726227eda7d4a7061953b8112c Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Fri, 2 Aug 2024 11:39:31 +0200 Subject: [PATCH 071/128] fix(test): skip xls download test since it's very slow --- app/tests/api/inventory.test.ts | 38 ++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/app/tests/api/inventory.test.ts b/app/tests/api/inventory.test.ts index d4152ee39..3cf7b9b8c 100644 --- a/app/tests/api/inventory.test.ts +++ b/app/tests/api/inventory.test.ts @@ -5,9 +5,7 @@ import { } from "@/app/api/v0/inventory/[inventory]/route"; import { GET as calculateProgress } from "@/app/api/v0/inventory/[inventory]/progress/route"; import { POST as createInventory } from "@/app/api/v0/city/[city]/inventory/route"; -import { - POST as submitInventory -} from "@/app/api/v0/inventory/[inventory]/cdp/route"; +import { POST as submitInventory } from "@/app/api/v0/inventory/[inventory]/cdp/route"; import { db } from "@/models"; import { CreateInventoryRequest } from "@/util/validation"; import assert from "node:assert"; @@ -93,7 +91,12 @@ describe("Inventory API", () => { await db.models.Sector.destroy({ where: { sectorName: { [Op.like]: "XX_INVENTORY_PROGRESS_TEST%" } }, }); - city = await db.models.City.create({ cityId: randomUUID(), name: cityName, country: cityCountry, locode }); + city = await db.models.City.create({ + cityId: randomUUID(), + name: cityName, + country: cityCountry, + locode, + }); await db.models.User.upsert({ userId: testUserID, name: "TEST_USER" }); await city.addUser(testUserID); sector = await db.models.Sector.create({ @@ -185,7 +188,7 @@ describe("Inventory API", () => { assert.equal(data.totalEmissions, inventory.totalEmissions); }); - it("should download an inventory in csv format", async () => { + it.skip("should download an inventory in csv format", async () => { const url = `http://localhost:3000/api/v0/inventory/${inventory.inventoryId}?format=csv`; const req = createRequest(url); const res = await findInventory(req, { @@ -213,7 +216,8 @@ describe("Inventory API", () => { assert.ok(lines.slice(1).every((line) => line.split(",").length == 6)); }); - it("should download an inventory in xls format", async () => { + // TODO this test is very slow. use "CIRIS Light" spreadsheet instead (for download as well anyways) + it.skip("should download an inventory in xls format", async () => { const url = `http://localhost:3000/api/v0/inventory/${inventory.inventoryId}?format=xls`; const req = createRequest(url); const res = await findInventory(req, { @@ -375,13 +379,17 @@ describe("Inventory API", () => { // assert.equal(totalProgress.total, 27); }); - it("should submit an inventory to the CDP test API", { skip: true }, async () => { - const req = mockRequest({}); - const res = await submitInventory(req, { - params: { inventory: inventory.inventoryId }, - }); - assert.equal(res.status, 200); - const json = await res.json(); - assert.equal(json.success, true); - }) + it( + "should submit an inventory to the CDP test API", + { skip: true }, + async () => { + const req = mockRequest({}); + const res = await submitInventory(req, { + params: { inventory: inventory.inventoryId }, + }); + assert.equal(res.status, 200); + const json = await res.json(); + assert.equal(json.success, true); + }, + ); }); From 232626667b5cf02ceb090e5f93ec7c46f9f5b592 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Fri, 2 Aug 2024 12:16:04 +0200 Subject: [PATCH 072/128] WIP: reworked the assistant api to have more flexibility --- .../api/v0/assistants/files/[fileId]/route.ts | 14 + .../v0/assistants/threads/actions/route.ts | 22 ++ .../v0/assistants/threads/messages/route.ts | 99 +----- app/src/components/ChatBot/chat-bot.tsx | 291 ++++++++++++++++-- 4 files changed, 304 insertions(+), 122 deletions(-) create mode 100644 app/src/app/api/v0/assistants/files/[fileId]/route.ts create mode 100644 app/src/app/api/v0/assistants/threads/actions/route.ts diff --git a/app/src/app/api/v0/assistants/files/[fileId]/route.ts b/app/src/app/api/v0/assistants/files/[fileId]/route.ts new file mode 100644 index 000000000..3f32abfc7 --- /dev/null +++ b/app/src/app/api/v0/assistants/files/[fileId]/route.ts @@ -0,0 +1,14 @@ +import { apiHandler } from "@/util/api"; +import { openai } from "@/util/openai"; +import { NextResponse } from "next/server"; + +export const GET = apiHandler(async (req, { params }) => { + //const { fileId } = await req.json(); + console.log("get file!"); + console.log(params.fileId); + + const file = await openai.files.retrieve(params.fileId); + console.log("file name: ", file.filename); + + return NextResponse.json({ file: file }); +}); diff --git a/app/src/app/api/v0/assistants/threads/actions/route.ts b/app/src/app/api/v0/assistants/threads/actions/route.ts new file mode 100644 index 000000000..638863e14 --- /dev/null +++ b/app/src/app/api/v0/assistants/threads/actions/route.ts @@ -0,0 +1,22 @@ +import { apiHandler } from "@/util/api"; +import { openai } from "@/util/openai"; +import { NextResponse } from "next/server"; + +// Send a new message to a thread +export const POST = apiHandler(async (req) => { + const { threadId, runId, toolCallOutputs } = await req.json(); + //const { toolCallOutputs, runId } = await req.json(); + console.log("server api call"); + console.log(threadId); + console.log(runId); + console.log(toolCallOutputs); + + const stream = openai.beta.threads.runs.submitToolOutputsStream( + threadId, + runId, + // { tool_outputs: [{ output: result, tool_call_id: toolCallId }] }, + { tool_outputs: toolCallOutputs }, + ); + + return new NextResponse(stream.toReadableStream()); +}); diff --git a/app/src/app/api/v0/assistants/threads/messages/route.ts b/app/src/app/api/v0/assistants/threads/messages/route.ts index b48ba4dc4..f7d119b1e 100644 --- a/app/src/app/api/v0/assistants/threads/messages/route.ts +++ b/app/src/app/api/v0/assistants/threads/messages/route.ts @@ -1,7 +1,7 @@ import { apiHandler } from "@/util/api"; import { openai } from "@/util/openai"; import { AssistantStream } from "openai/lib/AssistantStream"; -import { AssistantResponse } from "ai"; +import { NextResponse } from "next/server"; const assistantId = process.env.OPENAI_ASSISTANT_ID as string; @@ -28,7 +28,7 @@ const handleReadableStream = (stream: AssistantStream): AssistantStream => { export const POST = apiHandler(async (req) => { const input: { threadId: string; - message: string; + content: string; } = await req.json(); const threadId = input.threadId; @@ -36,104 +36,13 @@ export const POST = apiHandler(async (req) => { // Add a user message on the thread const createdMessage = await openai.beta.threads.messages.create(threadId, { role: "user", - content: input.message, + content: input.content, }); - // Run the thread with streaming output - // const stream = openai.beta.threads.runs.stream(threadId, { - // assistant_id: assistantId, - // }); - - // maybe create the run object first, do all the changes on the run object, - // THEN call openai.beta.threads.runs.stream and pass back the streaming object? - - const run = await openai.beta.threads.runs.create(threadId, { - assistant_id: assistantId, - }); - // console.log(run); - - let runStatus; - do { - //await new Promise((resolve) => setTimeout(resolve, 5000)); - const updatedRun = await openai.beta.threads.runs.retrieve( - threadId, - run.id, - ); - runStatus = updatedRun.status; - // console.log("updatedRun"); - // console.log(updatedRun); - // console.log(updatedRun.status); - - if ( - runStatus === "requires_action" && - updatedRun.required_action?.type === "submit_tool_outputs" - ) { - const toolCallId = - updatedRun.required_action?.submit_tool_outputs.tool_calls[0].id; - //const toolOutputs = await handleToolCalls(updatedRun.required_action.submit_tool_outputs.tool_calls, sessionId); - // Get tool outputs - here mocked - const toolOutputs = [ - { - tool_call_id: toolCallId, - output: "SF6, SF8 gases, COmonter Gas and rabbits", - }, - ]; - - // Submit tool outputs to complete the run - await openai.beta.threads.runs.submitToolOutputs(threadId, run.id, { - tool_outputs: toolOutputs, - }); - // re-fetch the run status after submitting tool outputs - const recheckedRun = await openai.beta.threads.runs.retrieve( - threadId, - run.id, - ); - } - } while (runStatus !== "completed"); - // Run the thread with streaming output const stream = openai.beta.threads.runs.stream(threadId, { assistant_id: assistantId, }); - return AssistantResponse( - { threadId, messageId: createdMessage.id }, - async ({ forwardStream, sendDataMessage }) => { - const finishedRun = await forwardStream(stream); - }, - ); - - //return Response.json({}); - // return AssistantResponse( - // { threadId, messageId: createdMessage.id }, - // async ({ forwardStream, sendDataMessage }) => { - // const run = await forwardStream(stream); - - // // TODO: Implement visiualization on client side - // if (run?.required_action?.type === "submit_tool_outputs") { - // console.log("tool calls"); - - // const runId = run?.id; - // const toolCallId = - // run.required_action.submit_tool_outputs.tool_calls[0].id; - - // // Get tool outputs - here mocked - // const toolOutputs = [ - // { - // tool_call_id: toolCallId, - // output: "Mock ooutput", - // }, - // ]; - - // // Submit result of tool outputs here - // const modifiedRun = await openai.beta.threads.runs.submitToolOutputs( - // threadId, - // runId, - // { - // tool_outputs: toolOutputs, - // }, - // ); - // } - // }, - // ); + return new NextResponse(stream.toReadableStream()); }); diff --git a/app/src/components/ChatBot/chat-bot.tsx b/app/src/components/ChatBot/chat-bot.tsx index 82397b4ae..dde8d8c21 100644 --- a/app/src/components/ChatBot/chat-bot.tsx +++ b/app/src/components/ChatBot/chat-bot.tsx @@ -26,7 +26,40 @@ import { } from "react-icons/md"; import { ScrollAnchor } from "./scroll-anchor"; import { RefObject, useRef } from "react"; -import { api, useCreateThreadIdMutation } from "@/services/api"; +import { + api, + useCreateThreadIdMutation, + useGetFileQuery, +} from "@/services/api"; + +import { AssistantStream } from "openai/lib/AssistantStream"; +import { AssistantStreamEvent } from "openai/resources/beta/assistants/assistants"; + +type MessageProps = { + role: "user" | "assistant" | "code"; + text: string; +}; + +const UserMessage = ({ text }: { text: string }) => { + return
    {text}
    ; +}; + +const AssistantMessage = ({ text }: { text: string }) => { + return
    {text}
    ; +}; + +const Message = ({ role, text }: MessageProps) => { + switch (role) { + case "user": + return ; + case "assistant": + return ; + case "code": + //return ; + default: + return null; + } +}; function useEnterSubmit(): { formRef: RefObject; @@ -49,6 +82,19 @@ function useEnterSubmit(): { return { formRef, onKeyDown: handleKeyDown }; } +///////////////////////////////// +// Function caller functions +///////////////////////////////// + +const functionCallHandler = async (call) => { + if (call?.function?.name !== "query_global_api") return; + const args = JSON.parse(call.function.arguments); + //const data = getWeather(args.location); + //setWeatherData(data); + const data = "CO2, SF6, SF8, and Methane of doom"; + return JSON.stringify(data); +}; + export default function ChatBot({ inputRef, t, @@ -60,10 +106,136 @@ export default function ChatBot({ inventoryId: string; }) { const [threadId, setThreadId] = useState(""); + const [userInput, setUserInput] = useState(""); + const [messages, setMessages] = useState([]); + const [inputDisabled, setInputDisabled] = useState(false); const [createThreadId, { data: threadData }] = useCreateThreadIdMutation(); + //const [getFile, { data: file }] = useGetFileQuery(); + + // TODO: Convert to Redux + const sendMessage = async (text: string) => { + const response = await fetch(`/api/v0/assistants/threads/messages`, { + method: "POST", + body: JSON.stringify({ + threadId: threadId, + content: text, + }), + }); + const stream = AssistantStream.fromReadableStream(response.body); + handleReadableStream(stream); + }; + + const submitActionResult = async ( + threadId: string, + runId: string, + toolCallOutputs: object, + ) => { + const response = await fetch(`/api/v0/assistants/threads/actions`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + threadId: threadId, + runId: runId, + toolCallOutputs: toolCallOutputs, + }), + }); + const stream = AssistantStream.fromReadableStream(response.body); + handleReadableStream(stream); + }; + + const handleSubmit = (e) => { + console.log("handle submit"); + e.preventDefault(); + if (!userInput.trim()) return; + sendMessage(userInput); + setMessages((prevMessages) => [ + ...prevMessages, + { role: "user", text: userInput }, + ]); + setUserInput(""); + setInputDisabled(true); + // scrollToBottom(); + }; + + //////////////////////////////// + // Stream Event Handlers + //////////////////////////////// + + // textCreated - create new assistant message + const handleTextCreated = () => { + appendMessage("assistant", ""); + }; + + // textDelta - append text to last assistant message + const handleTextDelta = (delta) => { + if (delta.value != null) { + appendToLastMessage(delta.value); + } + if (delta.annotations != null) { + annotateLastMessage(delta.annotations); + console.log(messages); + } + }; + + // handleRunCompleted - re-enable the input form + const handleRunCompleted = () => { + console.log("run completed"); + setInputDisabled(false); + }; + + const handleRequiresAction = async ( + event: AssistantStreamEvent.ThreadRunRequiresAction, + ) => { + const runId = event.data.id; + const toolCalls = event.data.required_action.submit_tool_outputs.tool_calls; + + console.log(toolCalls); + // loop over tool calls and call function handler + + // Mock tool call output + // const toolCallOutputs = [ + // { + // output: "CO2, SF6, SF8, and Methane of doom", + // tool_call_id: toolCalls[0].id, + // }, + // ]; + + const toolCallOutputs = await Promise.all( + toolCalls.map(async (toolCall) => { + const result = await functionCallHandler(toolCall); + return { output: result, tool_call_id: toolCall.id }; + }), + ); + setInputDisabled(true); + submitActionResult(threadId, runId, toolCallOutputs); + }; + + const handleReadableStream = (stream: AssistantStream) => { + // messages + //console.log("Stream Handler"); + //console.log(stream); + stream.on("textCreated", handleTextCreated); + stream.on("textDelta", handleTextDelta); + + // // image + // stream.on("imageFileDone", handleImageFileDone); + + // // code interpreter + // stream.on("toolCallCreated", toolCallCreated); + // stream.on("toolCallDelta", toolCallDelta); + + // events without helpers yet (e.g. requires_action and run.done) + stream.on("event", (event) => { + if (event.event === "thread.run.requires_action") + handleRequiresAction(event); + if (event.event === "thread.run.completed") handleRunCompleted(); + }); + }; // Function to create the threadId with initial message - const handleSubmit = async () => { + const createThread = async () => { try { await createThreadId({ inventoryId: inventoryId, @@ -76,7 +248,7 @@ export default function ChatBot({ // Creating the thread id for the given inventory on initial render useEffect(() => { - handleSubmit(); + createThread(); }, []); // Empty dependency array means this effect runs only once, // HOWEVER currently it always runs twice @@ -87,18 +259,18 @@ export default function ChatBot({ } }, [threadData]); - const { - status, - input, - messages, - submitMessage, - setMessages, - handleInputChange, - append, - } = useAssistant({ - api: `/api/v0/assistants/threads/messages`, - threadId: threadId, - }); + // const { + // status, + // input, + // messages, + // submitMessage, + // setMessages, + // handleInputChange, + // append, + // } = useAssistant({ + // api: `/api/v0/assistants/threads/messages`, + // threadId: threadId, + // }); // Setting the initial message to display for the user // This message will not be passed to the assistant api @@ -107,7 +279,6 @@ export default function ChatBot({ useEffect(() => { setMessages([ { - id: "-1", role: "assistant", content: t("initial-message"), }, @@ -135,12 +306,77 @@ export default function ChatBot({ }, ]; + ////////////////////// + // Utility Helpers + ////////////////////// + + const appendMessage = (role, text: string) => { + console.log("role, text"); + console.log(role); + console.log(text); + setMessages((prevMessages) => [...prevMessages, { role, text }]); + }; + + const appendToLastMessage = (text: string) => { + setMessages((prevMessages) => { + const lastMessage = prevMessages[prevMessages.length - 1]; + const updatedLastMessage = { + ...lastMessage, + text: lastMessage.text + text, + }; + return [...prevMessages.slice(0, -1), updatedLastMessage]; + }); + }; + + const annotateLastMessage = async (annotations) => { + setMessages((prevMessages) => { + const lastMessage = prevMessages[prevMessages.length - 1]; + const updatedLastMessage = { + ...lastMessage, + }; + annotations.forEach(async (annotation) => { + console.log("annotations"); + console.log(annotation); + if (annotation.type === "file_citation") { + const fileId = annotation.file_citation.file_id; + + try { + const response = await fetch(`/api/v0/assistants/files/${fileId}`, { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + }); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data = await response.json(); + console.log("File data:", data); + + updatedLastMessage.text = updatedLastMessage.text.replaceAll( + annotation.text, + `【${data.file.filename}】`, + ); + } catch (error) { + console.error("Error fetching file:", error); + } + } + }); + console.log(updatedLastMessage); + return [...prevMessages.slice(0, -1), updatedLastMessage]; + }); + }; + return (
    + {messages.map((msg, index) => ( + + ))} {messages.map((m, i) => { const isUser = m.role === "user"; return ( @@ -237,12 +473,12 @@ export default function ChatBot({ {suggestions.map((suggestion, i) => ( ))}
    -
    + {/* */} + {/* setUserInput(e.target.value)} //{handleInputChange} onKeyDown={onKeyDown} /> } color="content.tertiary" aria-label="Send message" - isDisabled={status === "in_progress"} + isDisabled={inputDisabled} />
    From 9a16b7d872d4c404a7159fa1f5740e1258a6a179 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Fri, 2 Aug 2024 12:25:29 +0200 Subject: [PATCH 073/128] feat(api): implement direct measure CO2e calculation in CalculationService --- .../[inventory]/activity-value/route.ts | 18 +++++ app/src/backend/CalculationService.ts | 67 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 app/src/backend/CalculationService.ts diff --git a/app/src/app/api/v0/inventory/[inventory]/activity-value/route.ts b/app/src/app/api/v0/inventory/[inventory]/activity-value/route.ts index 16b48a2a7..fcb33e6b0 100644 --- a/app/src/app/api/v0/inventory/[inventory]/activity-value/route.ts +++ b/app/src/app/api/v0/inventory/[inventory]/activity-value/route.ts @@ -1,3 +1,4 @@ +import CalculationService from "@/backend/CalculationService"; import UserService from "@/backend/UserService"; import { db } from "@/models"; import type { ActivityValue } from "@/models/ActivityValue"; @@ -29,10 +30,19 @@ export const POST = apiHandler(async (req, { params, session }) => { }, { transaction }, ); + let inventoryValueId: string | undefined = body.inventoryValueId; + if (!inventoryValueId) { + // TODO create inventory value here + throw new createHttpError.NotImplemented( + "Creating InventoryValue from ActivityValue not yet implemented, so inventoryValueId is required currently", + ); + } + const activityValue = await db.models.ActivityValue.create( { ...body, datasourceId: dataSource.datasourceId, + inventoryValueId, id: randomUUID(), }, { transaction }, @@ -64,6 +74,14 @@ export const POST = apiHandler(async (req, { params, session }) => { } delete gasValue.emissionsFactor; + + if (gasValue.gasAmount == null) { + gasValue.gasAmount = CalculationService.calculateGasAmount( + inventoryValue, + activityValue, + ); + } + await db.models.GasValue.upsert( { ...gasValue, diff --git a/app/src/backend/CalculationService.ts b/app/src/backend/CalculationService.ts new file mode 100644 index 000000000..72f11aaba --- /dev/null +++ b/app/src/backend/CalculationService.ts @@ -0,0 +1,67 @@ +import { db } from "@/models"; +import type { ActivityValue } from "@/models/ActivityValue"; +import type { InventoryValue } from "@/models/InventoryValue"; +import { logger } from "@/services/logger"; +import { multiplyBigIntFloat } from "@/util/big_int"; +import createHttpError from "http-errors"; + +export type GasAmountResult = { + totalCO2e: bigint; + gases: { gas: string; amount: bigint }[]; +}; + +const GAS_NAMES = ["CO2", "N2O", "CH4"]; + +export default class CalculationService { + public static async calculateGasAmount( + inventoryValue: InventoryValue, + activityValue: ActivityValue, + formula: string, + ): Promise { + // TODO cache + const gasToCO2Eqs = await db.models.GasToCO2Eq.findAll(); + let totalCO2e = 0n; + let gases: { gas: string; amount: bigint }[] = []; + + switch (formula) { + case "direct-measure": + gases = GAS_NAMES.map((gasName) => { + const data = activityValue.activityData as Record; + const key = gasName.toLowerCase() + "_amount"; + if (!data || !data[key]) { + throw new createHttpError.BadRequest( + "Missing direct measure form entry " + key, + ); + } + // TODO save amount to GasValue entry? + const amount = BigInt(data[key]); + + // TODO the rest of this could be shared for all formulas? + const globalWarmingPotential = gasToCO2Eqs.find( + (entry) => entry.gas === gasName, + ); + if (!globalWarmingPotential) { + throw new createHttpError.NotFound( + `Could not find gas ${gasName} in GasToCO2Eq table`, + ); + } + + const co2eq = multiplyBigIntFloat( + amount, + globalWarmingPotential.co2eqPerKg || 0, + ); + totalCO2e += co2eq; + return { gas: gasName, amount }; + }); + break; + default: + throw new createHttpError.NotImplemented( + `Formula ${formula} not yet implemented for input methodology ${inventoryValue.inputMethodology}`, + ); + } + return { + totalCO2e, + gases, + }; + } +} From 197992121a573ca7d659f2429ab140b3b3ee206d Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Fri, 2 Aug 2024 12:43:49 +0200 Subject: [PATCH 074/128] feat(api): implement activity times emissions factor formula in CalculationService --- app/src/backend/CalculationService.ts | 64 +++++++++++++++++++++------ 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/app/src/backend/CalculationService.ts b/app/src/backend/CalculationService.ts index 72f11aaba..32e9ac920 100644 --- a/app/src/backend/CalculationService.ts +++ b/app/src/backend/CalculationService.ts @@ -1,5 +1,6 @@ import { db } from "@/models"; import type { ActivityValue } from "@/models/ActivityValue"; +import type { GasToCO2Eq } from "@/models/GasToCO2Eq"; import type { InventoryValue } from "@/models/InventoryValue"; import { logger } from "@/services/logger"; import { multiplyBigIntFloat } from "@/util/big_int"; @@ -13,6 +14,28 @@ export type GasAmountResult = { const GAS_NAMES = ["CO2", "N2O", "CH4"]; export default class CalculationService { + private static calculateCO2eq( + gasToCO2Eqs: GasToCO2Eq[], + gasName: string, + amount: bigint, + ): bigint { + // TODO the rest of this could be shared for all formulas? + const globalWarmingPotential = gasToCO2Eqs.find( + (entry) => entry.gas === gasName, + ); + if (!globalWarmingPotential) { + throw new createHttpError.NotFound( + `Could not find gas ${gasName} in GasToCO2Eq table`, + ); + } + + const co2eq = multiplyBigIntFloat( + amount, + globalWarmingPotential.co2eqPerKg || 0, + ); + return co2eq; + } + public static async calculateGasAmount( inventoryValue: InventoryValue, activityValue: ActivityValue, @@ -35,23 +58,36 @@ export default class CalculationService { } // TODO save amount to GasValue entry? const amount = BigInt(data[key]); - - // TODO the rest of this could be shared for all formulas? - const globalWarmingPotential = gasToCO2Eqs.find( - (entry) => entry.gas === gasName, - ); - if (!globalWarmingPotential) { - throw new createHttpError.NotFound( - `Could not find gas ${gasName} in GasToCO2Eq table`, + totalCO2e += this.calculateCO2eq(gasToCO2Eqs, gasName, amount); + return { gas: gasName, amount }; + }); + break; + case "activity-amount-times-emissions-factor": + // TODO add actvityAmount column to ActivityValue + // const activityAmount = activityValue.activityAmount || 0; + const activityAmount = activityValue.activityData + ? activityValue.activityData["activity_amount"] || 0 + : 0; + gases = activityValue.gasValues.map((gasValue) => { + const emissionsFactor = gasValue.emissionsFactor; + if (emissionsFactor == null) { + throw new createHttpError.BadRequest( + "Missing emissions factor for activity", ); } - - const co2eq = multiplyBigIntFloat( - amount, - globalWarmingPotential.co2eqPerKg || 0, + if (emissionsFactor.emissionsPerActivity == null) { + throw new createHttpError.BadRequest( + `Emissions factor ${emissionsFactor.id} has no emissions per activity`, + ); + } + const amount = activityAmount * emissionsFactor.emissionsPerActivity; + totalCO2e += this.calculateCO2eq( + gasToCO2Eqs, + gasValue.gas!, + BigInt(amount), // this rounds/ truncates! ); - totalCO2e += co2eq; - return { gas: gasName, amount }; + + return { gas: gasValue.gas, amount }; }); break; default: From 05873db8512427ac5454b14cce8d22c6b0558c0c Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Fri, 2 Aug 2024 12:44:08 +0200 Subject: [PATCH 075/128] fix(db): change types of jsonb columns in ActivityValue to Record --- app/src/models/ActivityValue.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/models/ActivityValue.ts b/app/src/models/ActivityValue.ts index ded85797f..0300e4609 100644 --- a/app/src/models/ActivityValue.ts +++ b/app/src/models/ActivityValue.ts @@ -6,10 +6,10 @@ import { DataSource, DataSourceId } from "./DataSource"; export interface ActivityValueAttributes { id: string; - activityData?: object; + activityData?: Record; inventoryValueId?: string; datasourceId?: string; - metadata?: object; + metadata?: Record; created?: Date; lastUpdated?: Date; } @@ -32,10 +32,10 @@ export class ActivityValue implements ActivityValueAttributes { id!: string; - activityData?: object; + activityData?: Record; inventoryValueId?: string; datasourceId?: string; - metadata?: object; + metadata?: Record; created?: Date; lastUpdated?: Date; From 799a7ce067aa9bf86d1dcf6a8669540f9bc3cc35 Mon Sep 17 00:00:00 2001 From: Milan Gruner Date: Fri, 2 Aug 2024 12:45:37 +0200 Subject: [PATCH 076/128] fix(api): type error in CalculationService --- app/src/backend/CalculationService.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/backend/CalculationService.ts b/app/src/backend/CalculationService.ts index 32e9ac920..e15f0b114 100644 --- a/app/src/backend/CalculationService.ts +++ b/app/src/backend/CalculationService.ts @@ -80,14 +80,13 @@ export default class CalculationService { `Emissions factor ${emissionsFactor.id} has no emissions per activity`, ); } - const amount = activityAmount * emissionsFactor.emissionsPerActivity; - totalCO2e += this.calculateCO2eq( - gasToCO2Eqs, - gasValue.gas!, - BigInt(amount), // this rounds/ truncates! + // this rounds/ truncates! + const amount = BigInt( + activityAmount * emissionsFactor.emissionsPerActivity, ); + totalCO2e += this.calculateCO2eq(gasToCO2Eqs, gasValue.gas!, amount); - return { gas: gasValue.gas, amount }; + return { gas: gasValue.gas!, amount }; }); break; default: From 5601915774ce53df136dfc60389e76e7a8e695ae Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Fri, 2 Aug 2024 07:59:31 -0300 Subject: [PATCH 077/128] get reference number from DB --- .../data/[step]/[subsector]/page.tsx | 19 +++++++++++--- .../api/v0/subsector/[subsectorId]/route.ts | 13 ++++++++++ .../components/Tabs/Activity/activity-tab.tsx | 13 +++++----- app/src/components/Tabs/Activity/ids.ts | 25 ------------------- 4 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 app/src/app/api/v0/subsector/[subsectorId]/route.ts delete mode 100644 app/src/components/Tabs/Activity/ids.ts diff --git a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx index 3b22acd95..01909750f 100644 --- a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx +++ b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx @@ -47,7 +47,7 @@ function SubSectorPage({ const [selectedTab, setSelectedTab] = useState(1); // sector ID (1/2/3) const [selectedScope, setSelectedScope] = useState(1); - + const [refNumber, setRefNumber] = useState(); const { data: userInfo, isLoading: isUserInfoLoading } = api.useGetUserInfoQuery(); const defaultInventoryId = userInfo?.defaultInventoryId; @@ -117,6 +117,19 @@ function SubSectorPage({ }; }, []); + useEffect(() => { + const fetchData = async () => { + const res = await fetch(`/api/v0/subsector/${subsector}`); + if (!res.ok) { + throw new Error("Failed to fetch data"); + } + const data = await res.json(); + setRefNumber(data.data.referenceNumber); + }; + + fetchData(); + }, []); + const MotionBox = motion(Box); const MotionTabList = motion(TabList); @@ -317,12 +330,12 @@ function SubSectorPage({ - {isLoading ? ( + {isLoading || !refNumber ? ( ) : ( scopes?.map((scope) => ( { + const subsector = await db.models.SubSector.findByPk(params.subsectorId); + if (!subsector) { + throw new createHttpError.NotFound("Subsector not found"); + } + + return NextResponse.json({ data: subsector }); +}); diff --git a/app/src/components/Tabs/Activity/activity-tab.tsx b/app/src/components/Tabs/Activity/activity-tab.tsx index 7a6c333b0..698d1cbd6 100644 --- a/app/src/components/Tabs/Activity/activity-tab.tsx +++ b/app/src/components/Tabs/Activity/activity-tab.tsx @@ -31,12 +31,11 @@ import ActivityAccordion from "./activity-accordion"; import ScopeUnavailable from "./scope-unavailable"; import { ActivityDataScope } from "@/features/city/subsectorSlice"; import { MANUAL_INPUT_HIERARCHY, Methodology } from "@/util/form-schema"; -import { ids } from "./ids"; import MethodologyCard from "@/components/Cards/methodology-card"; interface ActivityTabProps { t: TFunction; - subsectorId: string; + refNumber: string; isUnavailableChecked?: boolean; isMethodologySelected?: boolean; userActivities?: []; @@ -51,7 +50,7 @@ interface ActivityTabProps { const ActivityTab: FC = ({ t, userActivities, - subsectorId, + refNumber, areActivitiesLoading, totalConsumption, totalConsumptionUnit, @@ -68,13 +67,13 @@ const ActivityTab: FC = ({ const [methodology, setMethodology] = useState(); function getMethodologies() { - const refNumber = ids[subsectorId] + "." + (filteredScope.scope || 1); + const refNumberWithScope = refNumber + "." + (filteredScope.scope || 1); const methodologies = - MANUAL_INPUT_HIERARCHY[refNumber]?.methodologies || []; + MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.methodologies || []; const directMeasure = { - ...MANUAL_INPUT_HIERARCHY[refNumber]?.directMeasure, + ...MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure, id: - MANUAL_INPUT_HIERARCHY[refNumber]?.directMeasure?.id || + MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure?.id || "direct-measure", // adds a fallback generic id for direct measure }; return { methodologies, directMeasure }; diff --git a/app/src/components/Tabs/Activity/ids.ts b/app/src/components/Tabs/Activity/ids.ts deleted file mode 100644 index 13383648b..000000000 --- a/app/src/components/Tabs/Activity/ids.ts +++ /dev/null @@ -1,25 +0,0 @@ -export const ids: { [k: string]: string } = { - "abe4c7b0-242d-3ed2-a146-48885d6fb38d": "I.1", - "a235005c-f223-3c64-a0d2-f55d6f22f32f": "I.2", - "8de1d11d-4146-35f3-a973-e66930e68a50": "I.3", - "4f342e84-0269-3f04-aceb-1d6cd0a183bc": "I.4", - "95c049d1-eff9-3b26-af49-2b32982e7dd9": "I.5", - "cfc4d8de-2b90-376c-b9d7-446aaf2d8eeb": "I.6", - "b69c4ec7-a3c7-37a2-af4f-634d5a06a512": "I.7", - "b32f56a1-3a4e-3cd5-9052-e06284468700": "I.8", - "48fcfadb-90ed-34aa-80d9-fa31a90bef80": "II.1", - "8cf35b86-9ed2-36bd-b04d-eddc47db6676": "II.2", - "ab32c321-e9e1-31b3-9dde-f93ade472219": "II.3", - "5b84b809-1878-3b1b-bf6b-250c64d5e920": "II.4", - "e20ace37-9ba4-3a80-9d88-8cac5253c0b0": "II.5", - "172d10c0-6b80-3173-902e-eca5c0af84c8": "III.1", - "a8baeb06-0ab2-3215-a93e-2fcbe0e8f8a9": "III.2", - "0ed16605-c76a-3c07-892d-4383a7618943": "III.3", - "c465e7a2-1634-337f-819a-2dfbe147927e": "III.4", - "6b23cb0a-a1c1-35f5-835e-dca1d009ae9b": "IV.1", - "913775b3-0e20-3b0f-b269-2576548bcd36": "IV.2", - "52ec93fa-99d8-3cea-8d26-e8c9d3b4afaa": "V.1", - "36adcd97-2d47-3997-af8f-bcb8b92639f0": "V.2", - "3eb70366-95b3-3293-a701-83a5f617648e": "V.3", - "401a7571-4951-3e40-be4c-f8b5ea41583f": "VI.1", -}; From ff1493ba71fc89546423094433fc8b33b69d63c0 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Fri, 2 Aug 2024 13:46:31 +0200 Subject: [PATCH 078/128] Fixed TypeScript type issues --- app/src/components/ChatBot/chat-bot.tsx | 105 +++++++++++++++--------- 1 file changed, 66 insertions(+), 39 deletions(-) diff --git a/app/src/components/ChatBot/chat-bot.tsx b/app/src/components/ChatBot/chat-bot.tsx index dde8d8c21..04cc3a56e 100644 --- a/app/src/components/ChatBot/chat-bot.tsx +++ b/app/src/components/ChatBot/chat-bot.tsx @@ -26,19 +26,21 @@ import { } from "react-icons/md"; import { ScrollAnchor } from "./scroll-anchor"; import { RefObject, useRef } from "react"; -import { - api, - useCreateThreadIdMutation, - useGetFileQuery, -} from "@/services/api"; +import { api, useCreateThreadIdMutation } from "@/services/api"; import { AssistantStream } from "openai/lib/AssistantStream"; +// @ts-expect-error - no types for this yet import { AssistantStreamEvent } from "openai/resources/beta/assistants/assistants"; -type MessageProps = { +interface Message { role: "user" | "assistant" | "code"; text: string; -}; +} + +// type MessageProps = { +// role: "user" | "assistant" | "code"; +// text: string; +// }; const UserMessage = ({ text }: { text: string }) => { return
    {text}
    ; @@ -48,7 +50,7 @@ const AssistantMessage = ({ text }: { text: string }) => { return
    {text}
    ; }; -const Message = ({ role, text }: MessageProps) => { +const Message = ({ role, text }: Message) => { switch (role) { case "user": return ; @@ -86,7 +88,7 @@ function useEnterSubmit(): { // Function caller functions ///////////////////////////////// -const functionCallHandler = async (call) => { +const functionCallHandler = async (call: any) => { if (call?.function?.name !== "query_global_api") return; const args = JSON.parse(call.function.arguments); //const data = getWeather(args.location); @@ -107,22 +109,35 @@ export default function ChatBot({ }) { const [threadId, setThreadId] = useState(""); const [userInput, setUserInput] = useState(""); - const [messages, setMessages] = useState([]); + //const [messages, setMessages] = useState([]); + const [messages, setMessages] = useState([]); const [inputDisabled, setInputDisabled] = useState(false); const [createThreadId, { data: threadData }] = useCreateThreadIdMutation(); //const [getFile, { data: file }] = useGetFileQuery(); // TODO: Convert to Redux const sendMessage = async (text: string) => { - const response = await fetch(`/api/v0/assistants/threads/messages`, { - method: "POST", - body: JSON.stringify({ - threadId: threadId, - content: text, - }), - }); - const stream = AssistantStream.fromReadableStream(response.body); - handleReadableStream(stream); + try { + const response = await fetch(`/api/v0/assistants/threads/messages`, { + method: "POST", + body: JSON.stringify({ + threadId: threadId, + content: text, + }), + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + if (response.body == null) { + throw new Error("Response body is null"); + } + + const stream = AssistantStream.fromReadableStream(response.body); + handleReadableStream(stream); + } catch (err) { + console.error("Failed to send message:", err); + } }; const submitActionResult = async ( @@ -130,22 +145,34 @@ export default function ChatBot({ runId: string, toolCallOutputs: object, ) => { - const response = await fetch(`/api/v0/assistants/threads/actions`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - threadId: threadId, - runId: runId, - toolCallOutputs: toolCallOutputs, - }), - }); - const stream = AssistantStream.fromReadableStream(response.body); - handleReadableStream(stream); + try { + const response = await fetch(`/api/v0/assistants/threads/actions`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + threadId: threadId, + runId: runId, + toolCallOutputs: toolCallOutputs, + }), + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + if (response.body == null) { + throw new Error("Response body is null"); + } + + const stream = AssistantStream.fromReadableStream(response.body); + handleReadableStream(stream); + } catch (err) { + console.error("Failed to submit tool output:", err); + } }; - const handleSubmit = (e) => { + const handleSubmit = (e: React.FormEvent) => { console.log("handle submit"); e.preventDefault(); if (!userInput.trim()) return; @@ -169,7 +196,7 @@ export default function ChatBot({ }; // textDelta - append text to last assistant message - const handleTextDelta = (delta) => { + const handleTextDelta = (delta: any) => { if (delta.value != null) { appendToLastMessage(delta.value); } @@ -203,7 +230,7 @@ export default function ChatBot({ // ]; const toolCallOutputs = await Promise.all( - toolCalls.map(async (toolCall) => { + toolCalls.map(async (toolCall: any) => { const result = await functionCallHandler(toolCall); return { output: result, tool_call_id: toolCall.id }; }), @@ -280,7 +307,7 @@ export default function ChatBot({ setMessages([ { role: "assistant", - content: t("initial-message"), + text: t("initial-message"), }, ]); }, []); @@ -310,7 +337,7 @@ export default function ChatBot({ // Utility Helpers ////////////////////// - const appendMessage = (role, text: string) => { + const appendMessage = (role: Message["role"], text: string) => { console.log("role, text"); console.log(role); console.log(text); @@ -328,13 +355,13 @@ export default function ChatBot({ }); }; - const annotateLastMessage = async (annotations) => { + const annotateLastMessage = async (annotations: any) => { setMessages((prevMessages) => { const lastMessage = prevMessages[prevMessages.length - 1]; const updatedLastMessage = { ...lastMessage, }; - annotations.forEach(async (annotation) => { + annotations.forEach(async (annotation: any) => { console.log("annotations"); console.log(annotation); if (annotation.type === "file_citation") { From cc06c52664ed177b5928d6bc168804dd55178e6d Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Fri, 2 Aug 2024 14:46:53 +0200 Subject: [PATCH 079/128] Added auto scroll to end of message, cleaned up code --- app/src/components/ChatBot/chat-bot.tsx | 160 ++++++++++-------------- 1 file changed, 65 insertions(+), 95 deletions(-) diff --git a/app/src/components/ChatBot/chat-bot.tsx b/app/src/components/ChatBot/chat-bot.tsx index 04cc3a56e..9390b8469 100644 --- a/app/src/components/ChatBot/chat-bot.tsx +++ b/app/src/components/ChatBot/chat-bot.tsx @@ -13,7 +13,6 @@ import { Text, Textarea, } from "@chakra-ui/react"; -import { useAssistant } from "ai/react"; import { TFunction } from "i18next"; import { BsStars } from "react-icons/bs"; import { @@ -24,10 +23,8 @@ import { MdOutlineThumbUp, MdRefresh, } from "react-icons/md"; -import { ScrollAnchor } from "./scroll-anchor"; import { RefObject, useRef } from "react"; -import { api, useCreateThreadIdMutation } from "@/services/api"; - +import { useCreateThreadIdMutation } from "@/services/api"; import { AssistantStream } from "openai/lib/AssistantStream"; // @ts-expect-error - no types for this yet import { AssistantStreamEvent } from "openai/resources/beta/assistants/assistants"; @@ -37,31 +34,26 @@ interface Message { text: string; } -// type MessageProps = { -// role: "user" | "assistant" | "code"; -// text: string; +// const UserMessage = ({ text }: { text: string }) => { +// return
    {text}
    ; // }; -const UserMessage = ({ text }: { text: string }) => { - return
    {text}
    ; -}; - -const AssistantMessage = ({ text }: { text: string }) => { - return
    {text}
    ; -}; +// const AssistantMessage = ({ text }: { text: string }) => { +// return
    {text}
    ; +// }; -const Message = ({ role, text }: Message) => { - switch (role) { - case "user": - return ; - case "assistant": - return ; - case "code": - //return ; - default: - return null; - } -}; +// const Message = ({ role, text }: Message) => { +// switch (role) { +// case "user": +// return ; +// case "assistant": +// return ; +// case "code": +// //return ; +// default: +// return null; +// } +// }; function useEnterSubmit(): { formRef: RefObject; @@ -84,15 +76,17 @@ function useEnterSubmit(): { return { formRef, onKeyDown: handleKeyDown }; } -///////////////////////////////// -// Function caller functions -///////////////////////////////// +//////////////////// +// Function calls // +//////////////////// const functionCallHandler = async (call: any) => { if (call?.function?.name !== "query_global_api") return; const args = JSON.parse(call.function.arguments); + // TODO: Add proper function response //const data = getWeather(args.location); //setWeatherData(data); + // Moch data const data = "CO2, SF6, SF8, and Methane of doom"; return JSON.stringify(data); }; @@ -109,11 +103,18 @@ export default function ChatBot({ }) { const [threadId, setThreadId] = useState(""); const [userInput, setUserInput] = useState(""); - //const [messages, setMessages] = useState([]); const [messages, setMessages] = useState([]); const [inputDisabled, setInputDisabled] = useState(false); const [createThreadId, { data: threadData }] = useCreateThreadIdMutation(); - //const [getFile, { data: file }] = useGetFileQuery(); + + // Automatically scroll to bottom of chat + const messagesEndRef = useRef(null); + const scrollToBottom = () => { + messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); + }; + useEffect(() => { + scrollToBottom(); + }, [messages]); // TODO: Convert to Redux const sendMessage = async (text: string) => { @@ -173,7 +174,6 @@ export default function ChatBot({ }; const handleSubmit = (e: React.FormEvent) => { - console.log("handle submit"); e.preventDefault(); if (!userInput.trim()) return; sendMessage(userInput); @@ -183,32 +183,40 @@ export default function ChatBot({ ]); setUserInput(""); setInputDisabled(true); - // scrollToBottom(); + scrollToBottom(); }; - //////////////////////////////// - // Stream Event Handlers - //////////////////////////////// + const handleSuggestionClick = (message: string) => { + sendMessage(message); + setMessages((prevMessages) => [ + ...prevMessages, + { role: "user", text: message }, + ]); + setInputDisabled(true); + }; + + //////////////////////////// + // Stream Event Handlers // + /////////////////////////// - // textCreated - create new assistant message + // Create new assistant message const handleTextCreated = () => { appendMessage("assistant", ""); }; - // textDelta - append text to last assistant message + // Append text to last assistant message const handleTextDelta = (delta: any) => { if (delta.value != null) { appendToLastMessage(delta.value); } - if (delta.annotations != null) { - annotateLastMessage(delta.annotations); - console.log(messages); - } + // TODO: Currently not working properly + // if (delta.annotations != null) { + // annotateLastMessage(delta.annotations); + // } }; // handleRunCompleted - re-enable the input form const handleRunCompleted = () => { - console.log("run completed"); setInputDisabled(false); }; @@ -218,17 +226,6 @@ export default function ChatBot({ const runId = event.data.id; const toolCalls = event.data.required_action.submit_tool_outputs.tool_calls; - console.log(toolCalls); - // loop over tool calls and call function handler - - // Mock tool call output - // const toolCallOutputs = [ - // { - // output: "CO2, SF6, SF8, and Methane of doom", - // tool_call_id: toolCalls[0].id, - // }, - // ]; - const toolCallOutputs = await Promise.all( toolCalls.map(async (toolCall: any) => { const result = await functionCallHandler(toolCall); @@ -241,8 +238,6 @@ export default function ChatBot({ const handleReadableStream = (stream: AssistantStream) => { // messages - //console.log("Stream Handler"); - //console.log(stream); stream.on("textCreated", handleTextCreated); stream.on("textDelta", handleTextDelta); @@ -286,19 +281,6 @@ export default function ChatBot({ } }, [threadData]); - // const { - // status, - // input, - // messages, - // submitMessage, - // setMessages, - // handleInputChange, - // append, - // } = useAssistant({ - // api: `/api/v0/assistants/threads/messages`, - // threadId: threadId, - // }); - // Setting the initial message to display for the user // This message will not be passed to the assistant api // It will be set additionally when creating the threadId @@ -333,14 +315,11 @@ export default function ChatBot({ }, ]; - ////////////////////// - // Utility Helpers - ////////////////////// + ///////////////////// + // Utility Helpers // + ///////////////////// const appendMessage = (role: Message["role"], text: string) => { - console.log("role, text"); - console.log(role); - console.log(text); setMessages((prevMessages) => [...prevMessages, { role, text }]); }; @@ -355,6 +334,7 @@ export default function ChatBot({ }); }; + // TODO: Fix annotations const annotateLastMessage = async (annotations: any) => { setMessages((prevMessages) => { const lastMessage = prevMessages[prevMessages.length - 1]; @@ -362,8 +342,6 @@ export default function ChatBot({ ...lastMessage, }; annotations.forEach(async (annotation: any) => { - console.log("annotations"); - console.log(annotation); if (annotation.type === "file_citation") { const fileId = annotation.file_citation.file_id; @@ -379,7 +357,6 @@ export default function ChatBot({ } const data = await response.json(); - console.log("File data:", data); updatedLastMessage.text = updatedLastMessage.text.replaceAll( annotation.text, @@ -390,7 +367,6 @@ export default function ChatBot({ } } }); - console.log(updatedLastMessage); return [...prevMessages.slice(0, -1), updatedLastMessage]; }); }; @@ -401,13 +377,10 @@ export default function ChatBot({ className="overflow-y-auto max-h-96 space-y-4" ref={messagesWrapperRef} > - {messages.map((msg, index) => ( - - ))} {messages.map((m, i) => { const isUser = m.role === "user"; return ( - + - {m.content} + {m.text} {!isUser && i === messages.length - 1 && @@ -451,7 +424,7 @@ export default function ChatBot({ color="content.tertiary" /> */} copyToClipboard(m.content)} + onClick={() => copyToClipboard(m.text)} variant="ghost" icon={ ); })} - + /> */} +
    @@ -500,12 +474,9 @@ export default function ChatBot({ {suggestions.map((suggestion, i) => (
    - {/*
    */} {/* setUserInput(e.target.value)} //{handleInputChange} + onChange={(e) => setUserInput(e.target.value)} onKeyDown={onKeyDown} /> Date: Fri, 2 Aug 2024 16:03:05 +0200 Subject: [PATCH 080/128] removed debugging code --- app/src/app/api/v0/assistants/threads/actions/route.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/src/app/api/v0/assistants/threads/actions/route.ts b/app/src/app/api/v0/assistants/threads/actions/route.ts index 638863e14..0fb104ac0 100644 --- a/app/src/app/api/v0/assistants/threads/actions/route.ts +++ b/app/src/app/api/v0/assistants/threads/actions/route.ts @@ -5,16 +5,10 @@ import { NextResponse } from "next/server"; // Send a new message to a thread export const POST = apiHandler(async (req) => { const { threadId, runId, toolCallOutputs } = await req.json(); - //const { toolCallOutputs, runId } = await req.json(); - console.log("server api call"); - console.log(threadId); - console.log(runId); - console.log(toolCallOutputs); const stream = openai.beta.threads.runs.submitToolOutputsStream( threadId, runId, - // { tool_outputs: [{ output: result, tool_call_id: toolCallId }] }, { tool_outputs: toolCallOutputs }, ); From 9520d9411885cb7e90dda65769613eac089c27e2 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Fri, 2 Aug 2024 19:57:30 +0200 Subject: [PATCH 081/128] Implemented some further function calling, general code improvements --- app/src/components/ChatBot/chat-bot.tsx | 56 +++++++++++++++---------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/app/src/components/ChatBot/chat-bot.tsx b/app/src/components/ChatBot/chat-bot.tsx index 9390b8469..ed74cba9b 100644 --- a/app/src/components/ChatBot/chat-bot.tsx +++ b/app/src/components/ChatBot/chat-bot.tsx @@ -24,7 +24,7 @@ import { MdRefresh, } from "react-icons/md"; import { RefObject, useRef } from "react"; -import { useCreateThreadIdMutation } from "@/services/api"; +import { api, useCreateThreadIdMutation } from "@/services/api"; import { AssistantStream } from "openai/lib/AssistantStream"; // @ts-expect-error - no types for this yet import { AssistantStreamEvent } from "openai/resources/beta/assistants/assistants"; @@ -76,21 +76,6 @@ function useEnterSubmit(): { return { formRef, onKeyDown: handleKeyDown }; } -//////////////////// -// Function calls // -//////////////////// - -const functionCallHandler = async (call: any) => { - if (call?.function?.name !== "query_global_api") return; - const args = JSON.parse(call.function.arguments); - // TODO: Add proper function response - //const data = getWeather(args.location); - //setWeatherData(data); - // Moch data - const data = "CO2, SF6, SF8, and Methane of doom"; - return JSON.stringify(data); -}; - export default function ChatBot({ inputRef, t, @@ -105,7 +90,9 @@ export default function ChatBot({ const [userInput, setUserInput] = useState(""); const [messages, setMessages] = useState([]); const [inputDisabled, setInputDisabled] = useState(false); - const [createThreadId, { data: threadData }] = useCreateThreadIdMutation(); + const [createThreadId, { data: threadIdData }] = useCreateThreadIdMutation(); + const [getAllDataSources, { data, error, isLoading }] = + api.useLazyGetAllDataSourcesQuery(); // Automatically scroll to bottom of chat const messagesEndRef = useRef(null); @@ -141,6 +128,29 @@ export default function ChatBot({ } }; + //////////////////// + // Function calls // + //////////////////// + + const functionCallHandler = async (call: any) => { + if (call?.function?.name === "get_all_datasources") { + console.log("function call get data sources"); + + const { data, error, isLoading } = await getAllDataSources({ + inventoryId, + }); + + console.log(data); + return JSON.stringify(data); + } else if (call?.function?.name === "query_global_api") { + console.log("function call generic"); + const mockData = "CO2, SF6, SF8, and Methane of doom"; + return mockData; // no stringify needed since its a string already + } else { + return JSON.stringify({ status: "no function identified to call" }); + } + }; + const submitActionResult = async ( threadId: string, runId: string, @@ -215,7 +225,7 @@ export default function ChatBot({ // } }; - // handleRunCompleted - re-enable the input form + // Re-enable the input form const handleRunCompleted = () => { setInputDisabled(false); }; @@ -229,13 +239,17 @@ export default function ChatBot({ const toolCallOutputs = await Promise.all( toolCalls.map(async (toolCall: any) => { const result = await functionCallHandler(toolCall); + + console.log(result); return { output: result, tool_call_id: toolCall.id }; }), ); + console.log(toolCallOutputs); setInputDisabled(true); submitActionResult(threadId, runId, toolCallOutputs); }; + // Here all the streaming events get processed const handleReadableStream = (stream: AssistantStream) => { // messages stream.on("textCreated", handleTextCreated); @@ -276,10 +290,10 @@ export default function ChatBot({ // Set threadId once the value from API call is returned to threadData useEffect(() => { - if (threadData) { - setThreadId(threadData); + if (threadIdData) { + setThreadId(threadIdData); } - }, [threadData]); + }, [threadIdData]); // Setting the initial message to display for the user // This message will not be passed to the assistant api From bbd930e3c55812d13f85503e2e5cba79619dbc87 Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Fri, 2 Aug 2024 16:03:17 -0300 Subject: [PATCH 082/128] PR review --- .../data/[step]/[subsector]/page.tsx | 20 ++------- app/src/components/Cards/methodology-card.tsx | 2 +- .../components/Tabs/Activity/activity-tab.tsx | 43 ++++++++++--------- 3 files changed, 26 insertions(+), 39 deletions(-) diff --git a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx index 01909750f..5924f02d0 100644 --- a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx +++ b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx @@ -82,7 +82,6 @@ function SubSectorPage({ const subSectorData = sectorData?.subSectors.find( (subsectorItem) => subsectorItem.subsectorId === subsector, ); - const getSectorName = (currentStep: string) => { switch (currentStep) { case "1": @@ -117,19 +116,6 @@ function SubSectorPage({ }; }, []); - useEffect(() => { - const fetchData = async () => { - const res = await fetch(`/api/v0/subsector/${subsector}`); - if (!res.ok) { - throw new Error("Failed to fetch data"); - } - const data = await res.json(); - setRefNumber(data.data.referenceNumber); - }; - - fetchData(); - }, []); - const MotionBox = motion(Box); const MotionTabList = motion(TabList); @@ -330,13 +316,13 @@ function SubSectorPage({ - {isLoading || !refNumber ? ( + {isLoading ? ( ) : ( scopes?.map((scope) => ( = ({ t, userActivities, - refNumber, + referenceNumber, areActivitiesLoading, totalConsumption, totalConsumptionUnit, @@ -67,14 +67,13 @@ const ActivityTab: FC = ({ const [methodology, setMethodology] = useState(); function getMethodologies() { - const refNumberWithScope = refNumber + "." + (filteredScope.scope || 1); - const methodologies = - MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.methodologies || []; + const refNumberWithScope = + referenceNumber + "." + (filteredScope.scope || 1); + const hierarchy = MANUAL_INPUT_HIERARCHY[refNumberWithScope] || {}; + const methodologies = hierarchy?.methodologies || []; const directMeasure = { - ...MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure, - id: - MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure?.id || - "direct-measure", // adds a fallback generic id for direct measure + ...hierarchy.directMeasure, + id: hierarchy.directMeasure?.id || "direct-measure", // adds a fallback generic id for direct measure }; return { methodologies, directMeasure }; } @@ -465,18 +464,20 @@ const ActivityTab: FC = ({ /> ), )} - + {methodologies.length > 0 ? ( // hide this card until other methodologies can also load + + ) : null} )} From 1dc5827016eea7b6e3601306c4007cc5dc127521 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 2 Aug 2024 17:56:25 -0400 Subject: [PATCH 083/128] feat: add manual input definitions for sector II Signed-off-by: Evan Prodromou --- .../form-schema/manual-input-hierarchy.json | 1005 ++++++++++++++++- 1 file changed, 952 insertions(+), 53 deletions(-) diff --git a/app/src/util/form-schema/manual-input-hierarchy.json b/app/src/util/form-schema/manual-input-hierarchy.json index 7465c5e35..54b154532 100644 --- a/app/src/util/form-schema/manual-input-hierarchy.json +++ b/app/src/util/form-schema/manual-input-hierarchy.json @@ -16,9 +16,7 @@ "extra-fields": [ { "id": "residential-building-type", - "options": [ - "residential-building-type-all" - ] + "options": ["residential-building-type-all"] }, { "id": "residential-building-fuel-type", @@ -67,9 +65,7 @@ "extra-fields": [ { "id": "residential-building-type", - "options": [ - "residential-building-type-all" - ] + "options": ["residential-building-type-all"] }, { "id": "residential-building-fuel-type", @@ -109,9 +105,7 @@ "extra-fields": [ { "id": "residential-building-type", - "options": [ - "residential-building-type-all" - ] + "options": ["residential-building-type-all"] }, { "id": "residential-building-energy-usage", @@ -132,10 +126,7 @@ "type": "text" } ], - "units": [ - "units-kilowatt-hours", - "units-terajoules" - ] + "units": ["units-kilowatt-hours", "units-terajoules"] } ] }, @@ -152,9 +143,7 @@ "extra-fields": [ { "id": "residential-building-type", - "options": [ - "residential-building-type-all" - ], + "options": ["residential-building-type-all"], "exclusive": "residential-building-type-all" }, { @@ -182,9 +171,7 @@ "methodologies": [ { "id": "fuel-combustion-commercial-buildings-methodology", - "inputRequired": [ - "total-fuel-consumption" - ], + "inputRequired": ["total-fuel-consumption"], "activities": [ { "id": "fuel-combustion-commercial-buildings-activity", @@ -250,18 +237,12 @@ }, { "id": "scaled-sample-fuel-combustion-commercial-buildings-methodology", - "inputRequired": [ - "sample-fuel", - "scaling-data" - ], + "inputRequired": ["sample-fuel", "scaling-data"], "disabled": true }, { "id": "modeled-data-fuel-consumption-commercial-buildings-methodology", - "inputRequired": [ - "modeled-fuel", - "built-area" - ], + "inputRequired": ["modeled-fuel", "built-area"], "disabled": true } ], @@ -303,9 +284,7 @@ "methodologies": [ { "id": "energy-consumption-commercial-buildings-methodology", - "inputRequired": [ - "total-grid-consumption" - ], + "inputRequired": ["total-grid-consumption"], "activities": [ { "id": "energy-consumption-commercial-buildings-activity", @@ -353,10 +332,7 @@ }, { "id": "scaled-sample-energy-usage-commercial-buildings-methodology", - "inputRequired": [ - "sample-grid-supplied-energy", - "scaling-data" - ], + "inputRequired": ["sample-grid-supplied-energy", "scaling-data"], "disabled": true }, { @@ -625,10 +601,7 @@ "type": "text" } ], - "units": [ - "units-kilowatt-hours", - "units-terajoules" - ] + "units": ["units-kilowatt-hours", "units-terajoules"] } ] }, @@ -870,10 +843,7 @@ "type": "text" } ], - "units": [ - "units-kilowatt-hours", - "units-terajoules" - ] + "units": ["units-kilowatt-hours", "units-terajoules"] } ] }, @@ -1083,10 +1053,7 @@ "type": "text" } ], - "units": [ - "units-kilowatt-hours", - "units-terajoules" - ] + "units": ["units-kilowatt-hours", "units-terajoules"] } ] }, @@ -1290,10 +1257,7 @@ "type": "text" } ], - "units": [ - "units-kilowatt-hours", - "units-terajoules" - ] + "units": ["units-kilowatt-hours", "units-terajoules"] } ] }, @@ -1343,6 +1307,8 @@ "methodologies": [ { "id": "fuel-sales-on-road-transport-methodology", + "mostUsed": true, + "inputRequired": ["total-fuel-sold-in-gas-stations"], "activities": [ { "id": "fuel-sales-on-road-transport-activity", @@ -1389,26 +1355,114 @@ "units-kilowatt-hours" ] } + ], + "suggestedActivities": [ + { + "id": "fuel-sales-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-all" + }, + { + "id": "fuel-sales-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-passenger-vehicles" + }, + { + "id": "fuel-sales-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-public-transport-vehicles" + } ] }, { "id": "induced-activity-transboundary-trips-on-road-transport-methodology", + "inputRequired": [ + "total-distance-travelled-in-in-boundary-trips", + "total-distance-travelled-in-transboundary", + "fuel-intensity" + ], "disabled": true }, { "id": "induced-activity-only-departing-trips-on-road-transport-methodology", - "disabled": true + "disabled": true, + "inputRequired": [ + "total-distance-travelled-in-in-boundary-trips", + "distnace-travelled-within-city-transboundary-departing-only", + "fuel-intensity" + ] }, { "id": "geographic-on-road-transport-methodology", - "disabled": true + "inputRequired": [ + "total-distance-travelled-in-in-boundary-trips", + "fuel-intensity" + ], + "activities": [ + { + "id": "geographic-on-road-transport-activity", + "unique-by": [ + "on-road-transport-vehicle-type", + "on-road-transport-fuel-source" + ], + "activity-title": "total-distance-travelled-in-boundary", + "units": ["units-kilometers", "units-miles"], + "extra-fields": [ + { + "id": "on-road-transport-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-vehicles", + "vehicle-type-commercial-vehicles", + "vehicle-type-public-transport-vehicles", + "vehicle-type-emergency-vehicles", + "vehicle-type-service-vehicles" + ] + }, + { + "id": "on-road-transport-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "on-road-transport-fuel-intensity", + "type": "number", + "units": [ + "units-grams-per-kilometer", + "units-kilograms-per-kilometer" + ] + } + ] + } + ], + "suggestedActivities": [ + { + "id": "geographic-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-all" + }, + { + "id": "geographic-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-passenger-vehicles" + }, + { + "id": "geographic-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-public-transport-vehicles" + } + ] }, { "id": "resident-activity-on-road-transport-methodology", - "disabled": true + "disabled": true, + "inputRequired": [ + "total-distance-travelled-in-in-boundary-trips-residents", + "fuel-intensity" + ] } ], "directMeasure": { + "id": "on-road-transport-direct-measure-methodology", "extra-fields": [ { "id": "on-road-transport-fuel-type", @@ -1442,6 +1496,7 @@ "methodologies": [ { "id": "electricity-consumption-on-road-transport-methodology", + "inputRequired": ["total-electricity-consumed-in-charging-stations"], "activities": [ { "id": "electricity-consumption-on-road-transport-activity", @@ -1467,10 +1522,25 @@ } ] } + ], + "suggestedActivities": [ + { + "id": "electricity-consumption-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-all" + }, + { + "id": "electricity-consumption-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-passenger-vehicles" + }, + { + "id": "electricity-consumption-on-road-transport-activity", + "on-road-transport-vehicle-type": "vehicle-type-public-transport-vehicles" + } ] } ], "directMeasure": { + "id": "on-road-transport-direct-measure-energy-consumption-methodology", "extra-fields": [ { "id": "on-road-transport-vehicle-type", @@ -1490,6 +1560,835 @@ ] } }, + "II.2.1": { + "methodologies": [ + { + "id": "fuel-sales-railways-methodology", + "mostUsed": true, + "inputRequired": ["total-fuel-consumed"], + "activities": [ + { + "id": "fuel-sales-railways-activity", + "unique-by": [ + "railways-vehicle-type", + "railways-fuel-type", + "railways-fuel-source" + ], + "activity-title": "activity-total-fuel-sales", + "minimum": 1, + "extra-fields": [ + { + "id": "railways-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "railways-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-trains", + "vehicle-type-freight-trains", + "vehicle-type-high-speed-trains", + "vehicle-type-tourist-trains" + ] + }, + { + "id": "railways-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-terajoules", + "units-kilowatt-hours" + ] + } + ], + "suggestedActivities": [ + { + "id": "fuel-sales-railways-activity", + "railways-vehicle-type": "vehicle-type-all" + }, + { + "id": "fuel-sales-railways-activity", + "railways-vehicle-type": "vehicle-type-passenger-trains" + }, + { + "id": "fuel-sales-railways-activity", + "railways-vehicle-type": "vehicle-type-freight-trains" + } + ] + }, + { + "id": "geographic-railways-methodology", + "inputRequired": [ + "total-distance-travelled-in-in-boundary-trips", + "fuel-intensity" + ], + "activities": [ + { + "id": "geographic-railways-activity", + "unique-by": ["railways-vehicle-type", "railways-fuel-type"], + "activity-title": "total-distance-travelled-in-boundary", + "units": ["units-kilometers", "units-miles"], + "extra-fields": [ + { + "id": "railways-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-trains", + "vehicle-type-freight-trains", + "vehicle-type-high-speed-trains", + "vehicle-type-tourist-trains" + ] + }, + { + "id": "railways-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "railways-fuel-intensity", + "type": "number", + "units": [ + "units-grams-per-kilometer", + "units-kilograms-per-kilometer" + ] + } + ] + } + ], + "suggestedActivities": [ + { + "id": "geographic-railways-activity", + "railways-vehicle-type": "vehicle-type-all" + }, + { + "id": "geographic-railways-activity", + "railways-vehicle-type": "vehicle-type-passenger-trains" + }, + { + "id": "geographic-railways-activity", + "railways-vehicle-type": "vehicle-type-freight-trains" + } + ] + }, + { + "id": "movement-driver-railways-methodology", + "implemented": false + } + ], + "directMeasure": { + "id": "railways-direct-measure-methodology", + "extra-fields": [ + { + "id": "railways-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "railways-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-trains", + "vehicle-type-freight-trains", + "vehicle-type-high-speed-trains", + "vehicle-type-tourist-trains" + ], + "multiselect": true + }, + { + "id": "railways-fuel-source", + "type": "text" + } + ] + } + }, + "II.2.2": { + "methodologies": [ + { + "id": "electricity-consumption-railways-methodology", + "activities": [ + { + "id": "electricity-consumption-railways-activity", + "unique-by": [ + "railways-vehicle-type", + "railways-electricity-source" + ], + "extra-fields": [ + { + "id": "railways-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-trains", + "vehicle-type-freight-trains", + "vehicle-type-high-speed-trains", + "vehicle-type-tourist-trains" + ] + }, + { + "id": "railways-electricity-source", + "type": "text" + } + ] + } + ], + "suggestedActivities": [ + { + "id": "electricity-consumption-railways-activity", + "railways-vehicle-type": "vehicle-type-all" + }, + { + "id": "electricity-consumption-railways-activity", + "railways-vehicle-type": "vehicle-type-passenger-trains" + }, + { + "id": "electricity-consumption-railways-activity", + "railways-vehicle-type": "vehicle-type-freight-trains" + } + ] + } + ], + "directMeasure": { + "id": "railways-direct-measure-energy-consumption-methodology", + "extra-fields": [ + { + "id": "railways-vehicle-type", + "options": [ + "vehicle-type-passenger-trains", + "vehicle-type-freight-trains", + "vehicle-type-high-speed-trains", + "vehicle-type-tourist-trains" + ], + "multiselect": true + }, + { + "id": "railways-electricity-source", + "type": "text" + } + ] + } + }, + "II.3.1": { + "methodologies": [ + { + "id": "fuel-sales-waterborne-navigation-methodology", + "inputRequired": ["total-fuel-sold-in-gas-stations"], + "activities": [ + { + "id": "fuel-sales-waterborne-navigation-activity", + "unique-by": [ + "waterborne-navigation-vehicle-type", + "waterborne-navigation-fuel-type", + "waterborne-navigation-fuel-source" + ], + "activity-title": "activity-total-fuel-sales", + "minimum": 1, + "extra-fields": [ + { + "id": "waterborne-navigation-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "waterborne-navigation-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-ferries", + "vehicle-type-boats", + "vehicle-type-marine-vessels" + ] + }, + { + "id": "waterborne-navigation-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-terajoules", + "units-kilowatt-hours" + ] + } + ], + "suggestedActivities": [ + { + "id": "fuel-sales-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-all" + }, + { + "id": "fuel-sales-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-ferries" + }, + { + "id": "fuel-sales-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-boats" + } + ] + }, + { + "id": "geographic-waterborne-navigation-methodology", + "inputRequired": [ + "total-distance-travelled-in-in-boundary-trips", + "fuel-intensity" + ], + "activities": [ + { + "id": "geographic-waterborne-navigation-activity", + "unique-by": [ + "waterborne-navigation-vehicle-type", + "waterborne-navigation-fuel-type" + ], + "activity-title": "total-distance-travelled-in-boundary", + "units": ["units-kilometers", "units-miles"], + "extra-fields": [ + { + "id": "waterborne-navigation-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-ferries", + "vehicle-type-boats", + "vehicle-type-marine-vessels" + ] + }, + { + "id": "waterborne-navigation-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "waterborne-navigation-fuel-intensity", + "type": "number", + "units": [ + "units-grams-per-kilometer", + "units-kilograms-per-kilometer" + ] + } + ] + } + ], + "suggestedActivities": [ + { + "id": "geographic-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-all" + }, + { + "id": "geographic-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-ferries" + }, + { + "id": "geographic-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-boats" + } + ] + } + ], + "directMeasure": { + "id": "waterborne-navigation-direct-measure-methodology", + "extra-fields": [ + { + "id": "waterborne-navigation-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "waterborne-navigation-vehicle-type", + "options": [ + "vehicle-type-ferries", + "vehicle-type-boats", + "vehicle-type-marine-vessels" + ], + "multiselect": true + }, + { + "id": "waterborne-navigation-fuel-source", + "type": "text" + } + ] + } + }, + "II.3.2": { + "methodologies": [ + { + "id": "electricity-consumption-waterborne-navigation-methodology", + "activities": [ + { + "id": "electricity-consumption-waterborne-navigation-activity", + "unique-by": [ + "waterborne-navigation-vehicle-type", + "waterborne-navigation-electricity-source" + ], + "extra-fields": [ + { + "id": "waterborne-navigation-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-ferries", + "vehicle-type-boats", + "vehicle-type-marine-vessels" + ] + }, + { + "id": "waterborne-navigation-electricity-source", + "type": "text" + } + ] + } + ], + "suggestedActivities": [ + { + "id": "electricity-consumption-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-all" + }, + { + "id": "electricity-consumption-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-ferries" + }, + { + "id": "electricity-consumption-waterborne-navigation-activity", + "waterborne-navigation-vehicle-type": "vehicle-type-boats" + } + ] + } + ], + "directMeasure": { + "id": "waterborne-navigation-direct-measure-energy-consumption-methodology", + "extra-fields": [ + { + "id": "waterborne-navigation-vehicle-type", + "options": [ + "vehicle-type-ferries", + "vehicle-type-boats", + "vehicle-type-marine-vessels" + ], + "multiselect": true + }, + { + "id": "waterborne-navigation-electricity-source", + "type": "text" + } + ] + } + }, + "II.4.1": { + "methodologies": [ + { + "id": "fuel-sales-aviation-methodology", + "inputRequired": ["total-fuel-sold-in-gas-stations"], + "activities": [ + { + "id": "fuel-sales-aviation-activity", + "unique-by": [ + "aviation-vehicle-type", + "aviation-fuel-type", + "aviation-fuel-source" + ], + "activity-title": "activity-total-fuel-sales", + "minimum": 1, + "extra-fields": [ + { + "id": "aviation-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "aviation-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-aircraft", + "vehicle-type-cargo-aircraft", + "vehicle-type-private-and-business-aircraft", + "vehicle-type-helicopters" + ] + }, + { + "id": "aviation-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-terajoules", + "units-kilowatt-hours" + ] + } + ], + "suggestedActivities": [ + { + "id": "fuel-sales-aviation-activity", + "aviation-vehicle-type": "vehicle-type-all" + }, + { + "id": "fuel-sales-aviation-activity", + "aviation-vehicle-type": "vehicle-type-passenger-aircraft" + }, + { + "id": "fuel-sales-aviation-activity", + "aviation-vehicle-type": "vehicle-type-cargo-aircraft" + } + ] + }, + { + "id": "geographic-aviation-methodology", + "inputRequired": [ + "total-distance-travelled-in-in-boundary-trips", + "fuel-intensity" + ], + "activities": [ + { + "id": "geographic-aviation-activity", + "unique-by": ["aviation-vehicle-type", "aviation-fuel-type"], + "activity-title": "total-distance-travelled-in-boundary", + "units": ["units-kilometers", "units-miles"], + "extra-fields": [ + { + "id": "aviation-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-aircraft", + "vehicle-type-cargo-aircraft", + "vehicle-type-private-and-business-aircraft", + "vehicle-type-helicopters" + ] + }, + { + "id": "aviation-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "aviation-fuel-intensity", + "type": "number", + "units": [ + "units-grams-per-kilometer", + "units-kilograms-per-kilometer" + ] + } + ] + } + ], + "suggestedActivities": [ + { + "id": "geographic-aviation-activity", + "aviation-vehicle-type": "vehicle-type-all" + }, + { + "id": "geographic-aviation-activity", + "aviation-vehicle-type": "vehicle-type-passenger-aircraft" + }, + { + "id": "geographic-aviation-activity", + "aviation-vehicle-type": "vehicle-type-cargo-aircraft" + } + ] + } + ], + "directMeasure": { + "id": "aviation-direct-measure-methodology", + "extra-fields": [ + { + "id": "aviation-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "aviation-vehicle-type", + "options": [ + "vehicle-type-passenger-aircraft", + "vehicle-type-cargo-aircraft", + "vehicle-type-private-and-business-aircraft", + "vehicle-type-helicopters" + ], + "multiselect": true + }, + { + "id": "aviation-fuel-source", + "type": "text" + } + ] + } + }, + "II.4.2": { + "methodologies": [ + { + "id": "electricity-consumption-aviation-methodology", + "inputRequired": ["total-electricity-consumed-in-charging-stations"], + "activities": [ + { + "id": "electricity-consumption-aviation-activity", + "unique-by": [ + "aviation-vehicle-type", + "aviation-electricity-source" + ], + "extra-fields": [ + { + "id": "aviation-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-passenger-aircraft", + "vehicle-type-cargo-aircraft", + "vehicle-type-private-and-business-aircraft", + "vehicle-type-helicopters" + ] + }, + { + "id": "aviation-electricity-source", + "type": "text" + } + ] + } + ], + "suggestedActivities": [ + { + "id": "electricity-consumption-aviation-activity", + "aviation-vehicle-type": "vehicle-type-all" + }, + { + "id": "electricity-consumption-aviation-activity", + "aviation-vehicle-type": "vehicle-type-passenger-aircraft" + }, + { + "id": "electricity-consumption-aviation-activity", + "aviation-vehicle-type": "vehicle-type-cargo-aircraft" + } + ] + } + ], + "directMeasure": { + "id": "aviation-direct-measure-energy-consumption-methodology", + "extra-fields": [ + { + "id": "aviation-vehicle-type", + "options": [ + "vehicle-type-passenger-aircraft", + "vehicle-type-cargo-aircraft", + "vehicle-type-private-and-business-aircraft", + "vehicle-type-helicopters" + ], + "multiselect": true + }, + { + "id": "aviation-electricity-source", + "type": "text" + } + ] + } + }, + "II.5.1": { + "methodologies": [ + { + "id": "fuel-sales-off-road-transport-methodology", + "inputRequired": ["total-fuel-sold-in-gas-stations"], + "activities": [ + { + "id": "fuel-sales-off-road-transport-activity", + "unique-by": [ + "off-road-transport-vehicle-type", + "off-road-transport-fuel-type", + "off-road-transport-fuel-source" + ], + "activity-title": "activity-total-fuel-sales", + "minimum": 1, + "extra-fields": [ + { + "id": "off-road-transport-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "off-road-transport-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-construction-machinery", + "vehicle-type-agricultural-machinery", + "vehicle-type-mining-equipment", + "vehicle-type-forestry-equipment" + ] + }, + { + "id": "off-road-transport-fuel-source", + "type": "text" + } + ], + "units": [ + "units-gallons", + "units-liters", + "units-cubic-meters", + "units-kilograms", + "units-terajoules", + "units-kilowatt-hours" + ] + } + ], + "suggestedActivities": [ + { + "id": "fuel-sales-off-road-transport-activity", + "off-road-transport-vehicle-type": "vehicle-type-all" + }, + { + "id": "fuel-sales-off-road-transport-activity", + "off-road-transport-vehicle-type": "vehicle-type-construction-machinery" + }, + { + "id": "fuel-sales-off-road-transport-activity", + "off-road-transport-vehicle-type": "vehicle-type-agricultural-machinery" + } + ] + } + ], + "directMeasure": { + "extra-fields": [ + { + "id": "off-road-transport-fuel-type", + "options": [ + "fuel-type-gasoline", + "fuel-type-diesel", + "fuel-type-lpg", + "fuel-type-cng", + "fuel-type-biofuel" + ] + }, + { + "id": "off-road-transport-vehicle-type", + "options": [ + "vehicle-type-construction-machinery", + "vehicle-type-agricultural-machinery", + "vehicle-type-mining-equipment", + "vehicle-type-forestry-equipment" + ], + "multiselect": true + }, + { + "id": "off-road-transport-fuel-source", + "type": "text" + } + ] + } + }, + "II.5.2": { + "methodologies": [ + { + "id": "electricity-consumption-off-road-transport-methodology", + "inputRequired": ["total-electricity-consumed-in-charging-stations"], + "activities": [ + { + "id": "electricity-consumption-off-road-transport-activity", + "unique-by": [ + "off-road-transport-vehicle-type", + "off-road-transport-electricity-source" + ], + "extra-fields": [ + { + "id": "off-road-transport-vehicle-type", + "options": [ + "vehicle-type-all", + "vehicle-type-construction-machinery", + "vehicle-type-agricultural-machinery", + "vehicle-type-mining-equipment", + "vehicle-type-forestry-equipment" + ] + }, + { + "id": "off-road-transport-electricity-source", + "type": "text" + } + ] + } + ], + "suggestedActivities": [ + { + "id": "electricity-consumption-off-road-transport-activity", + "off-road-transport-vehicle-type": "vehicle-type-all" + }, + { + "id": "electricity-consumption-off-road-transport-activity", + "off-road-transport-vehicle-type": "vehicle-type-construction-machinery" + }, + { + "id": "electricity-consumption-off-road-transport-activity", + "off-road-transport-vehicle-type": "vehicle-type-agricultural-machinery" + } + ] + } + ], + "directMeasure": { + "extra-fields": [ + { + "id": "off-road-transport-vehicle-type", + "options": [ + "vehicle-type-construction-machinery", + "vehicle-type-agricultural-machinery", + "vehicle-type-mining-equipment", + "vehicle-type-forestry-equipment" + ], + "multiselect": true + }, + { + "id": "off-road-transport-electricity-source", + "type": "text" + } + ] + } + }, "III.1.1": { "methodologies": [ { From 668945333eddd2cfd2b41182f509710c726af528 Mon Sep 17 00:00:00 2001 From: Cephas Chapa Date: Sun, 4 Aug 2024 19:22:04 +0200 Subject: [PATCH 084/128] fix: show correct methodologies for each scope --- .../data/[step]/[subsector]/page.tsx | 36 +++++-- .../components/Modals/add-activity-modal.tsx | 96 ++++++------------- .../components/Tabs/Activity/activity-tab.tsx | 13 +-- 3 files changed, 66 insertions(+), 79 deletions(-) diff --git a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx index 5924f02d0..e06d34568 100644 --- a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx +++ b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx @@ -4,7 +4,9 @@ import ActivityTab from "@/components/Tabs/Activity/activity-tab"; import LoadingState from "@/components/loading-state"; import { useTranslation } from "@/i18n/client"; import { RootState } from "@/lib/store"; +import { SubSectorAttributes } from "@/models/SubSector"; import { api } from "@/services/api"; +import { MANUAL_INPUT_HIERARCHY } from "@/util/form-schema"; import { ArrowBackIcon, ChevronRightIcon } from "@chakra-ui/icons"; import { Box, @@ -79,7 +81,7 @@ function SubSectorPage({ (sector) => sector.sector.referenceNumber === getSectorRefNo(step), ); - const subSectorData = sectorData?.subSectors.find( + const subSectorData: SubSectorAttributes = sectorData?.subSectors.find( (subsectorItem) => subsectorItem.subsectorId === subsector, ); const getSectorName = (currentStep: string) => { @@ -95,9 +97,31 @@ function SubSectorPage({ } }; - const { subsector: subsectorData, scopes } = useSelector( - (state: RootState) => state.subsector, - ); + console.log(MANUAL_INPUT_HIERARCHY); + // console.log(console.log(subSectorData)); + + const filteredSubsectorScopes = () => { + const scopes = []; + const getRefNo = getSectorRefNo(step); + const romanNumeralPattern = new RegExp(`^${getRefNo}\\.`); + console.log(romanNumeralPattern); + + for (const key in MANUAL_INPUT_HIERARCHY) { + if (key.startsWith(subSectorData.referenceNumber!)) { + const scopeNumber = key.split(".").pop(); + const result = { + ...MANUAL_INPUT_HIERARCHY[key], + scope: Number(scopeNumber), + }; + scopes.push(result); + } + } + return scopes; + }; + + const scopes = filteredSubsectorScopes(); + + console.log(scopes); // calculate total consumption and emissions @@ -321,9 +345,9 @@ function SubSectorPage({ ) : ( scopes?.map((scope) => ( = ({ const defaultScope = 1; - const formInputs = formStruct?.formInputs[step][scope ?? defaultScope]; + const formInputs = []; const [isEmissionFactorInputDisabled, setIsEmissionFactorInputDisabled] = useState(true); @@ -254,21 +254,21 @@ const AddActivityModal: FC = ({ > @@ -281,7 +281,7 @@ const AddActivityModal: FC = ({ - {formInputs?.fields[2].label} + {""} = ({ shadow: "none", borderColor: "content.link", }} - {...register( - ("activity." + - formInputs?.fields[2].name) as ActivityKey, - { - required: t("value-required"), - }, - )} + {...register("activity." as ActivityKey, { + required: t("value-required"), + })} /> = ({ > @@ -360,7 +349,7 @@ const AddActivityModal: FC = ({ )} - {formInputs?.fields[3].label} + {""} + {units?.map((item: string) => ( + + ))} + + + + + {errors.activity?.totalFuelConsumption ? ( + + + Please enter amount + + ) : ( + "" + )} + + + {t("emission-factor-type")} + + {errors.activity?.emissionFactorType ? ( + + + + Please select an emission factor type + + + ) : ( + "" + )} + + + ) : null} + + {methodology?.id !== "direct-measure" ? ( + <> + + + {t("emissions-factor-values")} + + + + + + {t("co2-emission-factor")} + + + {/* TODO translate values and use internal value for checking */} + + + + + {formInputs?.fields[4].addon.unit} + + + + + + {t("n2o-emission-factor")} + + + + + + + {formInputs?.fields[5].addon.unit} + + + + + + {t("ch4-emission-factor")} + + + + + + + {formInputs?.fields[6].addon.unit} + + + + {" "} + + ) : ( + + + + {t("emissions-value-co2")} + + + {/* TODO translate values and use internal value for checking */} + + - + tCO2 - - {errors.activity?.totalFuelConsumption ? ( - - - Please enter amount - - ) : ( - "" - )} - - {""} - - {errors.activity?.emissionFactorType ? ( - - - - Please select an emission factor type - - - ) : ( - "" - )} - - - - - - {t("emissions-factor-values")} - - - - - {""} - - {/* TODO translate values and use internal value for checking */} - - - - - {""} - - - - - {""} - - - + + {t("emissions-value-n2o")} + + + {/* TODO translate values and use internal value for checking */} + + + + - - - {""} - - - - - {""} - - - + tN2O + + + + + + {t("emissions-value-ch4")} + + + {/* TODO translate values and use internal value for checking */} + + + + - - - {""} - - - - + zIndex={10} + {...register( + ("activity." + + formInputs?.fields[4]?.addon.name) as ActivityKey, + )} + > + tCH4 + + + + + )} = ({ const [isUnavailableChecked, setIsChecked] = useState(false); const [hasActivityData, setHasActivityData] = useState(false); const [methodology, setMethodology] = useState(); + const [directMeasureFields, setDirectMeasureFields] = + useState(); function getMethodologies() { const refNumberWithScope = referenceNumber + "." + (filteredScope || 1); const hierarchy = MANUAL_INPUT_HIERARCHY[refNumberWithScope] || {}; - // console.log(refNumberWithScope, hierarchy.directMeasure); const methodologies = hierarchy?.methodologies || []; const directMeasure = { ...hierarchy.directMeasure, @@ -84,6 +89,7 @@ const ActivityTab: FC = ({ disabled, inputRequired, id, + fields, activities, }: Methodology) => { setSelectedMethodology(id); @@ -92,17 +98,28 @@ const ActivityTab: FC = ({ disabled, inputRequired, id, - activities, + fields, + }); + }; + + const handleDirectMeasureSelected = ({ + id, + "extra-fields": extraFields, + }: DirectMeasure) => { + setSelectedMethodology(id!); + setIsMethodologySelected(!isMethodologySelected); + setDirectMeasureFields({ + id, + "extra-fields": extraFields, }); }; + const changeMethodology = () => { setSelectedMethodology(""); setIsMethodologySelected(false); onChangeMethodologyClose(); }; - // console.log(directMeasure); - const { isOpen: isAddActivityModalOpen, onOpen: onAddActivityModalOpen, @@ -164,12 +181,14 @@ const ActivityTab: FC = ({ disabled: boolean | undefined, inputRequired: string[] | undefined, id: string, + fields: any, ) { return () => handleMethodologySelected({ disabled: !!disabled, inputRequired, id, + fields, }); } return ( @@ -461,6 +480,7 @@ const ActivityTab: FC = ({ disabled, inputRequired, id, + activities, )} /> ), @@ -475,6 +495,7 @@ const ActivityTab: FC = ({ false, ["emissions-data"], directMeasure.id, + directMeasure["extra-fields"], )} disabled={false} /> @@ -489,15 +510,14 @@ const ActivityTab: FC = ({ Date: Thu, 1 Aug 2024 17:11:18 -0300 Subject: [PATCH 098/128] iterate through methodologies WIP --- .../data/[step]/[subsector]/page.tsx | 1 + app/src/components/Cards/methodology-card.tsx | 30 ++--- .../components/Tabs/Activity/activity-tab.tsx | 126 +++++++++--------- app/src/components/Tabs/Activity/ids.ts | 25 ++++ app/src/util/form-schema/index.ts | 45 ++++++- 5 files changed, 144 insertions(+), 83 deletions(-) create mode 100644 app/src/components/Tabs/Activity/ids.ts diff --git a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx index 76ee7b1ec..3b22acd95 100644 --- a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx +++ b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx @@ -322,6 +322,7 @@ function SubSectorPage({ ) : ( scopes?.map((scope) => ( void; + handleCardSelect: (methodologyId: Methodology) => void; } const MethodologyCard: FC = ({ - methodologyId, - methodologyName, - description, + id, inputRequired, disabled, t, - handleCardSelect = (_methodologyId: MethodologyValues) => {}, + handleCardSelect = (_methodology: Methodology) => {}, }) => { const [isSelected, setIsSelected] = useState(false); const handleRadioChange = () => { setIsSelected(true); handleCardSelect({ - description, disabled, inputRequired, - methodologyId, - methodologyName, + id: id, }); }; const handleCardClick = () => { if (!isSelected) { handleCardSelect({ - description, disabled, inputRequired, - methodologyId, - methodologyName, + id: id, }); } setIsSelected(!isSelected); @@ -89,7 +81,7 @@ const MethodologyCard: FC = ({ )} - {methodologyName} + {t(id)} = ({ fontWeight="normal" color="interactive.control" > - {description} + {t(id + "-description")} = ({ color="interactive.control" > {inputRequired?.map((item: string, i: number) => ( -
  • {item}
  • +
  • {t(item)}
  • ))} diff --git a/app/src/components/Tabs/Activity/activity-tab.tsx b/app/src/components/Tabs/Activity/activity-tab.tsx index aca1e1394..7a6c333b0 100644 --- a/app/src/components/Tabs/Activity/activity-tab.tsx +++ b/app/src/components/Tabs/Activity/activity-tab.tsx @@ -1,9 +1,4 @@ import { - Accordion, - AccordionButton, - AccordionIcon, - AccordionItem, - AccordionPanel, Box, Button, Icon, @@ -14,22 +9,9 @@ import { PopoverBody, PopoverContent, PopoverTrigger, - Radio, - RadioGroup, - Stack, Switch, TabPanel, - Table, - TableContainer, - Tag, - TagLabel, - Tbody, - Td, Text, - Textarea, - Th, - Thead, - Tr, useDisclosure, } from "@chakra-ui/react"; import React, { FC, useState } from "react"; @@ -37,12 +19,9 @@ import HeadingText from "../../heading-text"; import { AddIcon } from "@chakra-ui/icons"; import { MdMoreVert } from "react-icons/md"; import SuggestedActivityCard from "../../Cards/suggested-activities-card"; -import { ActivityDataAttributes } from "@/models/ActivityData"; -import LoadingState from "../../loading-state"; import { TFunction } from "i18next"; import { FiTrash2 } from "react-icons/fi"; import { FaNetworkWired } from "react-icons/fa"; -import MethodologyCard from "../../Cards/methodology-card"; import { Trans } from "react-i18next"; import AddActivityModal from "../../Modals/add-activity-modal"; import ChangeMethodology from "../../Modals/change-methodology"; @@ -51,9 +30,13 @@ import { api } from "@/services/api"; import ActivityAccordion from "./activity-accordion"; import ScopeUnavailable from "./scope-unavailable"; import { ActivityDataScope } from "@/features/city/subsectorSlice"; +import { MANUAL_INPUT_HIERARCHY, Methodology } from "@/util/form-schema"; +import { ids } from "./ids"; +import MethodologyCard from "@/components/Cards/methodology-card"; interface ActivityTabProps { t: TFunction; + subsectorId: string; isUnavailableChecked?: boolean; isMethodologySelected?: boolean; userActivities?: []; @@ -65,17 +48,10 @@ interface ActivityTabProps { step: string; } -export type MethodologyValues = { - methodologyId: string; - methodologyName: string; - description: string; - inputRequired: string[]; - disabled: boolean; -}; - const ActivityTab: FC = ({ t, userActivities, + subsectorId, areActivitiesLoading, totalConsumption, totalConsumptionUnit, @@ -89,23 +65,34 @@ const ActivityTab: FC = ({ const [selectedMethodology, setSelectedMethodology] = useState(""); const [isUnavailableChecked, setIsChecked] = useState(false); const [hasActivityData, setHasActivityData] = useState(false); - const [methodology, setMethodology] = useState(); + const [methodology, setMethodology] = useState(); + + function getMethodologies() { + const refNumber = ids[subsectorId] + "." + (filteredScope.scope || 1); + const methodologies = + MANUAL_INPUT_HIERARCHY[refNumber]?.methodologies || []; + const directMeasure = { + ...MANUAL_INPUT_HIERARCHY[refNumber]?.directMeasure, + id: + MANUAL_INPUT_HIERARCHY[refNumber]?.directMeasure?.id || + "direct-measure", // adds a fallback generic id for direct measure + }; + return { methodologies, directMeasure }; + } + + const { methodologies, directMeasure } = getMethodologies(); const handleMethodologySelected = ({ - description, disabled, inputRequired, - methodologyId, - methodologyName, - }: MethodologyValues) => { - setSelectedMethodology(methodologyId); + id, + }: Methodology) => { + setSelectedMethodology(id); setIsMethodologySelected(!isMethodologySelected); setMethodology({ - description, disabled, inputRequired, - methodologyId, - methodologyName, + id, }); }; const changeMethodology = () => { @@ -171,6 +158,19 @@ const ActivityTab: FC = ({ // } // onDeleteActivitiesModalClose(); + function handleCardSelect( + disabled: boolean | undefined, + inputRequired: string[] | undefined, + id: string, + ) { + return () => + handleMethodologySelected({ + disabled: !!disabled, + inputRequired, + id, + }); + } + // }; return ( @@ -214,14 +214,14 @@ const ActivityTab: FC = ({
    - + - {methodology?.description} + {t(methodology?.id + "-description")} @@ -449,35 +449,35 @@ const ActivityTab: FC = ({ display="flex" justifyContent="space-between" > - {filteredScope.methodologies.map( - ({ - methodologyId, - methodologyName, - description, - inputRequired, - disabled, - }) => ( + {(methodologies || []).map( + ({ id, disabled, activities, inputRequired }) => ( - handleMethodologySelected({ - description, - disabled, - inputRequired, - methodologyId, - methodologyName, - }) - } + handleCardSelect={handleCardSelect( + disabled, + inputRequired, + id, + )} /> ), )} + )} diff --git a/app/src/components/Tabs/Activity/ids.ts b/app/src/components/Tabs/Activity/ids.ts new file mode 100644 index 000000000..13383648b --- /dev/null +++ b/app/src/components/Tabs/Activity/ids.ts @@ -0,0 +1,25 @@ +export const ids: { [k: string]: string } = { + "abe4c7b0-242d-3ed2-a146-48885d6fb38d": "I.1", + "a235005c-f223-3c64-a0d2-f55d6f22f32f": "I.2", + "8de1d11d-4146-35f3-a973-e66930e68a50": "I.3", + "4f342e84-0269-3f04-aceb-1d6cd0a183bc": "I.4", + "95c049d1-eff9-3b26-af49-2b32982e7dd9": "I.5", + "cfc4d8de-2b90-376c-b9d7-446aaf2d8eeb": "I.6", + "b69c4ec7-a3c7-37a2-af4f-634d5a06a512": "I.7", + "b32f56a1-3a4e-3cd5-9052-e06284468700": "I.8", + "48fcfadb-90ed-34aa-80d9-fa31a90bef80": "II.1", + "8cf35b86-9ed2-36bd-b04d-eddc47db6676": "II.2", + "ab32c321-e9e1-31b3-9dde-f93ade472219": "II.3", + "5b84b809-1878-3b1b-bf6b-250c64d5e920": "II.4", + "e20ace37-9ba4-3a80-9d88-8cac5253c0b0": "II.5", + "172d10c0-6b80-3173-902e-eca5c0af84c8": "III.1", + "a8baeb06-0ab2-3215-a93e-2fcbe0e8f8a9": "III.2", + "0ed16605-c76a-3c07-892d-4383a7618943": "III.3", + "c465e7a2-1634-337f-819a-2dfbe147927e": "III.4", + "6b23cb0a-a1c1-35f5-835e-dca1d009ae9b": "IV.1", + "913775b3-0e20-3b0f-b269-2576548bcd36": "IV.2", + "52ec93fa-99d8-3cea-8d26-e8c9d3b4afaa": "V.1", + "36adcd97-2d47-3997-af8f-bcb8b92639f0": "V.2", + "3eb70366-95b3-3293-a701-83a5f617648e": "V.3", + "401a7571-4951-3e40-be4c-f8b5ea41583f": "VI.1", +}; diff --git a/app/src/util/form-schema/index.ts b/app/src/util/form-schema/index.ts index fa804bc1e..aee0685fc 100644 --- a/app/src/util/form-schema/index.ts +++ b/app/src/util/form-schema/index.ts @@ -1,3 +1,46 @@ import SectorFormSchema from "./sector-form-schema.json"; +import HIERARCHY from "./manual-input-hierarchy.json"; -export { SectorFormSchema }; +interface ExtraField { + id: string; + type?: string; + options?: string[]; + exclusive?: string; + multiselect?: boolean; + required?: boolean; + totalRequired?: number; + subtypes?: string[]; +} + +interface Activity { + id: string; + "unique-by"?: string[]; + "activity-title"?: string; + minimum?: number; + "extra-fields"?: ExtraField[]; + units?: string[]; + formula?: string; +} + +export interface Methodology { + id: string; + disabled?: boolean; + activities?: Activity[]; + inputRequired?: string[]; +} + +interface DirectMeasure { + id?: string; + "extra-fields"?: ExtraField[]; +} + +interface ManualInputHierarchy { + [key: string]: { + methodologies?: Methodology[]; + directMeasure?: DirectMeasure; + }; +} + +const MANUAL_INPUT_HIERARCHY = HIERARCHY as ManualInputHierarchy; + +export { SectorFormSchema, MANUAL_INPUT_HIERARCHY }; From 6a3b53b7cfc195373d8a84ad7451f4ec3c227be6 Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Fri, 2 Aug 2024 07:59:31 -0300 Subject: [PATCH 099/128] get reference number from DB --- .../data/[step]/[subsector]/page.tsx | 19 +++++++++++--- .../api/v0/subsector/[subsectorId]/route.ts | 13 ++++++++++ .../components/Tabs/Activity/activity-tab.tsx | 13 +++++----- app/src/components/Tabs/Activity/ids.ts | 25 ------------------- 4 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 app/src/app/api/v0/subsector/[subsectorId]/route.ts delete mode 100644 app/src/components/Tabs/Activity/ids.ts diff --git a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx index 3b22acd95..01909750f 100644 --- a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx +++ b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx @@ -47,7 +47,7 @@ function SubSectorPage({ const [selectedTab, setSelectedTab] = useState(1); // sector ID (1/2/3) const [selectedScope, setSelectedScope] = useState(1); - + const [refNumber, setRefNumber] = useState(); const { data: userInfo, isLoading: isUserInfoLoading } = api.useGetUserInfoQuery(); const defaultInventoryId = userInfo?.defaultInventoryId; @@ -117,6 +117,19 @@ function SubSectorPage({ }; }, []); + useEffect(() => { + const fetchData = async () => { + const res = await fetch(`/api/v0/subsector/${subsector}`); + if (!res.ok) { + throw new Error("Failed to fetch data"); + } + const data = await res.json(); + setRefNumber(data.data.referenceNumber); + }; + + fetchData(); + }, []); + const MotionBox = motion(Box); const MotionTabList = motion(TabList); @@ -317,12 +330,12 @@ function SubSectorPage({ - {isLoading ? ( + {isLoading || !refNumber ? ( ) : ( scopes?.map((scope) => ( { + const subsector = await db.models.SubSector.findByPk(params.subsectorId); + if (!subsector) { + throw new createHttpError.NotFound("Subsector not found"); + } + + return NextResponse.json({ data: subsector }); +}); diff --git a/app/src/components/Tabs/Activity/activity-tab.tsx b/app/src/components/Tabs/Activity/activity-tab.tsx index 7a6c333b0..698d1cbd6 100644 --- a/app/src/components/Tabs/Activity/activity-tab.tsx +++ b/app/src/components/Tabs/Activity/activity-tab.tsx @@ -31,12 +31,11 @@ import ActivityAccordion from "./activity-accordion"; import ScopeUnavailable from "./scope-unavailable"; import { ActivityDataScope } from "@/features/city/subsectorSlice"; import { MANUAL_INPUT_HIERARCHY, Methodology } from "@/util/form-schema"; -import { ids } from "./ids"; import MethodologyCard from "@/components/Cards/methodology-card"; interface ActivityTabProps { t: TFunction; - subsectorId: string; + refNumber: string; isUnavailableChecked?: boolean; isMethodologySelected?: boolean; userActivities?: []; @@ -51,7 +50,7 @@ interface ActivityTabProps { const ActivityTab: FC = ({ t, userActivities, - subsectorId, + refNumber, areActivitiesLoading, totalConsumption, totalConsumptionUnit, @@ -68,13 +67,13 @@ const ActivityTab: FC = ({ const [methodology, setMethodology] = useState(); function getMethodologies() { - const refNumber = ids[subsectorId] + "." + (filteredScope.scope || 1); + const refNumberWithScope = refNumber + "." + (filteredScope.scope || 1); const methodologies = - MANUAL_INPUT_HIERARCHY[refNumber]?.methodologies || []; + MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.methodologies || []; const directMeasure = { - ...MANUAL_INPUT_HIERARCHY[refNumber]?.directMeasure, + ...MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure, id: - MANUAL_INPUT_HIERARCHY[refNumber]?.directMeasure?.id || + MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure?.id || "direct-measure", // adds a fallback generic id for direct measure }; return { methodologies, directMeasure }; diff --git a/app/src/components/Tabs/Activity/ids.ts b/app/src/components/Tabs/Activity/ids.ts deleted file mode 100644 index 13383648b..000000000 --- a/app/src/components/Tabs/Activity/ids.ts +++ /dev/null @@ -1,25 +0,0 @@ -export const ids: { [k: string]: string } = { - "abe4c7b0-242d-3ed2-a146-48885d6fb38d": "I.1", - "a235005c-f223-3c64-a0d2-f55d6f22f32f": "I.2", - "8de1d11d-4146-35f3-a973-e66930e68a50": "I.3", - "4f342e84-0269-3f04-aceb-1d6cd0a183bc": "I.4", - "95c049d1-eff9-3b26-af49-2b32982e7dd9": "I.5", - "cfc4d8de-2b90-376c-b9d7-446aaf2d8eeb": "I.6", - "b69c4ec7-a3c7-37a2-af4f-634d5a06a512": "I.7", - "b32f56a1-3a4e-3cd5-9052-e06284468700": "I.8", - "48fcfadb-90ed-34aa-80d9-fa31a90bef80": "II.1", - "8cf35b86-9ed2-36bd-b04d-eddc47db6676": "II.2", - "ab32c321-e9e1-31b3-9dde-f93ade472219": "II.3", - "5b84b809-1878-3b1b-bf6b-250c64d5e920": "II.4", - "e20ace37-9ba4-3a80-9d88-8cac5253c0b0": "II.5", - "172d10c0-6b80-3173-902e-eca5c0af84c8": "III.1", - "a8baeb06-0ab2-3215-a93e-2fcbe0e8f8a9": "III.2", - "0ed16605-c76a-3c07-892d-4383a7618943": "III.3", - "c465e7a2-1634-337f-819a-2dfbe147927e": "III.4", - "6b23cb0a-a1c1-35f5-835e-dca1d009ae9b": "IV.1", - "913775b3-0e20-3b0f-b269-2576548bcd36": "IV.2", - "52ec93fa-99d8-3cea-8d26-e8c9d3b4afaa": "V.1", - "36adcd97-2d47-3997-af8f-bcb8b92639f0": "V.2", - "3eb70366-95b3-3293-a701-83a5f617648e": "V.3", - "401a7571-4951-3e40-be4c-f8b5ea41583f": "VI.1", -}; From c3af0eda8187045a55b95958a6fba17e527d2366 Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Fri, 2 Aug 2024 16:03:17 -0300 Subject: [PATCH 100/128] PR review --- .../data/[step]/[subsector]/page.tsx | 20 ++------- app/src/components/Cards/methodology-card.tsx | 2 +- .../components/Tabs/Activity/activity-tab.tsx | 43 ++++++++++--------- 3 files changed, 26 insertions(+), 39 deletions(-) diff --git a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx index 01909750f..5924f02d0 100644 --- a/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx +++ b/app/src/app/[lng]/[inventory]/data/[step]/[subsector]/page.tsx @@ -82,7 +82,6 @@ function SubSectorPage({ const subSectorData = sectorData?.subSectors.find( (subsectorItem) => subsectorItem.subsectorId === subsector, ); - const getSectorName = (currentStep: string) => { switch (currentStep) { case "1": @@ -117,19 +116,6 @@ function SubSectorPage({ }; }, []); - useEffect(() => { - const fetchData = async () => { - const res = await fetch(`/api/v0/subsector/${subsector}`); - if (!res.ok) { - throw new Error("Failed to fetch data"); - } - const data = await res.json(); - setRefNumber(data.data.referenceNumber); - }; - - fetchData(); - }, []); - const MotionBox = motion(Box); const MotionTabList = motion(TabList); @@ -330,13 +316,13 @@ function SubSectorPage({ - {isLoading || !refNumber ? ( + {isLoading ? ( ) : ( scopes?.map((scope) => ( = ({ t, userActivities, - refNumber, + referenceNumber, areActivitiesLoading, totalConsumption, totalConsumptionUnit, @@ -67,14 +67,13 @@ const ActivityTab: FC = ({ const [methodology, setMethodology] = useState(); function getMethodologies() { - const refNumberWithScope = refNumber + "." + (filteredScope.scope || 1); - const methodologies = - MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.methodologies || []; + const refNumberWithScope = + referenceNumber + "." + (filteredScope.scope || 1); + const hierarchy = MANUAL_INPUT_HIERARCHY[refNumberWithScope] || {}; + const methodologies = hierarchy?.methodologies || []; const directMeasure = { - ...MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure, - id: - MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure?.id || - "direct-measure", // adds a fallback generic id for direct measure + ...hierarchy.directMeasure, + id: hierarchy.directMeasure?.id || "direct-measure", // adds a fallback generic id for direct measure }; return { methodologies, directMeasure }; } @@ -465,18 +464,20 @@ const ActivityTab: FC = ({ /> ), )} - + {methodologies.length > 0 ? ( // hide this card until other methodologies can also load + + ) : null} )} From 66d40470c7b0f21d63f6872c24c8a6db0f76bf7c Mon Sep 17 00:00:00 2001 From: thehighestprimenumber Date: Sat, 3 Aug 2024 17:39:45 -0300 Subject: [PATCH 101/128] show activities from json --- app/src/components/Cards/methodology-card.tsx | 37 +++---- .../Cards/suggested-activities-card.tsx | 13 ++- .../components/Tabs/Activity/activity-tab.tsx | 104 ++++++------------ app/src/util/form-schema/index.ts | 2 + 4 files changed, 58 insertions(+), 98 deletions(-) diff --git a/app/src/components/Cards/methodology-card.tsx b/app/src/components/Cards/methodology-card.tsx index a871337c8..b843b4e21 100644 --- a/app/src/components/Cards/methodology-card.tsx +++ b/app/src/components/Cards/methodology-card.tsx @@ -4,41 +4,30 @@ import React, { FC, useState } from "react"; import type { Methodology } from "@/util/form-schema"; interface MethodologyCardProps { - id: string; - inputRequired?: string[]; + methodology: Methodology; isSelected: boolean; - disabled: boolean; t: TFunction; handleCardSelect: (methodologyId: Methodology) => void; } const MethodologyCard: FC = ({ - id, - inputRequired, - disabled, + methodology, t, handleCardSelect = (_methodology: Methodology) => {}, }) => { const [isSelected, setIsSelected] = useState(false); const handleRadioChange = () => { setIsSelected(true); - handleCardSelect({ - disabled, - inputRequired, - id: id, - }); + handleCardSelect(methodology); }; const handleCardClick = () => { if (!isSelected) { - handleCardSelect({ - disabled, - inputRequired, - id: id, - }); + handleCardSelect(methodology); } setIsSelected(!isSelected); }; + const isMethodologyDisabled = methodology.disabled; return ( = ({ gap="16px" shadow="none" display="flex" - opacity={disabled ? ".7" : ""} + opacity={isMethodologyDisabled ? ".7" : ""} h="auto" w="248px" onClick={handleCardClick} _hover={{ - shadow: disabled ? "none" : "md", - cursor: disabled ? "not-allowed" : "pointer", + shadow: isMethodologyDisabled ? "none" : "md", + cursor: isMethodologyDisabled ? "not-allowed" : "pointer", }} backgroundColor={isSelected ? "gray.200" : "white"} > {" "} - {disabled ? ( + {isMethodologyDisabled ? ( = ({ )} - {t(id)} + {t(methodology.id)} = ({ fontWeight="normal" color="interactive.control" > - {t(id + "-description")} + {t(methodology.id + "-description")} = ({ fontWeight="normal" color="interactive.control" > - {inputRequired?.map((item: string, i: number) => ( + {methodology.inputRequired?.map((item: string, i: number) => (
  • {t(item)}
  • ))} diff --git a/app/src/components/Cards/suggested-activities-card.tsx b/app/src/components/Cards/suggested-activities-card.tsx index a095b9eef..4dde42f65 100644 --- a/app/src/components/Cards/suggested-activities-card.tsx +++ b/app/src/components/Cards/suggested-activities-card.tsx @@ -4,20 +4,21 @@ import { TFunction } from "i18next"; import React, { FC } from "react"; interface SuggestedActivityCardProps { - name: string; t: TFunction; + id: string; + description: string; isSelected: boolean; onActivityAdded?: () => void; } const SuggestedActivityCard: FC = ({ - name, t, isSelected, + description, + id, onActivityAdded, }) => { const themeColors = useTheme().colors; - return ( = ({ borderWidth="1px" borderColor="border.overlay" cursor="pointer" - _hover={{ shadow: "md", borderWidth: '1px', borderColor: "content.link" }} + _hover={{ shadow: "md", borderWidth: "1px", borderColor: "content.link" }} onClick={onActivityAdded} > @@ -73,7 +74,7 @@ const SuggestedActivityCard: FC = ({ fontWeight="normal" color="interactive.control" > - {t("type-of-building")} + {t(description)}
    = ({ fontWeight="medium" fontFamily="heading" > - {name} + {t(id)} diff --git a/app/src/components/Tabs/Activity/activity-tab.tsx b/app/src/components/Tabs/Activity/activity-tab.tsx index 8c18f8190..e3fe59f10 100644 --- a/app/src/components/Tabs/Activity/activity-tab.tsx +++ b/app/src/components/Tabs/Activity/activity-tab.tsx @@ -66,32 +66,34 @@ const ActivityTab: FC = ({ const [hasActivityData, setHasActivityData] = useState(false); const [methodology, setMethodology] = useState(); + const refNumberWithScope = referenceNumber + "." + (filteredScope.scope || 1); + function getMethodologies() { - const refNumberWithScope = - referenceNumber + "." + (filteredScope.scope || 1); - const hierarchy = MANUAL_INPUT_HIERARCHY[refNumberWithScope] || {}; - const methodologies = hierarchy?.methodologies || []; + const methodologies = + MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.methodologies || []; const directMeasure = { - ...hierarchy.directMeasure, - id: hierarchy.directMeasure?.id || "direct-measure", // adds a fallback generic id for direct measure + ...MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure, + id: + MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.directMeasure?.id || + "direct-measure", // adds a fallback generic id for direct measure }; return { methodologies, directMeasure }; } const { methodologies, directMeasure } = getMethodologies(); - const handleMethodologySelected = ({ - disabled, - inputRequired, - id, - }: Methodology) => { - setSelectedMethodology(id); + const getSuggestedActivities = () => { + if (!selectedMethodology) return []; + const methodology = ( + MANUAL_INPUT_HIERARCHY[refNumberWithScope]?.methodologies || [] + ).find((m) => m.id === selectedMethodology); + return methodology?.suggestedActivities || []; + }; + + const handleMethodologySelected = (methodology: Methodology) => { + setSelectedMethodology(methodology.id); setIsMethodologySelected(!isMethodologySelected); - setMethodology({ - disabled, - inputRequired, - id, - }); + setMethodology(methodology); }; const changeMethodology = () => { setSelectedMethodology(""); @@ -123,20 +125,7 @@ const ActivityTab: FC = ({ onClose: onDeleteActivityModalClose, } = useDisclosure(); - const suggestedActivities = [ - { - id: "1", - name: t("commercial-buildings"), - }, - { - id: "2", - name: t("institutional-buildings"), - }, - { - id: "3", - name: t("street-lighting"), - }, - ]; + const suggestedActivities = getSuggestedActivities(); const handleSwitch = (e: any) => { setIsChecked(!isUnavailableChecked); @@ -156,17 +145,8 @@ const ActivityTab: FC = ({ // } // onDeleteActivitiesModalClose(); - function handleCardSelect( - disabled: boolean | undefined, - inputRequired: string[] | undefined, - id: string, - ) { - return () => - handleMethodologySelected({ - disabled: !!disabled, - inputRequired, - id, - }); + function handleCardSelect(methodology: Methodology) { + return () => handleMethodologySelected(methodology); } // }; @@ -357,11 +337,12 @@ const ActivityTab: FC = ({ {t("activity-suggestion")} - {suggestedActivities.map(({ id, name }) => ( + {suggestedActivities.map(({ id }) => ( @@ -447,35 +428,22 @@ const ActivityTab: FC = ({ display="flex" justifyContent="space-between" > - {(methodologies || []).map( - ({ id, disabled, activities, inputRequired }) => ( - - ), - )} + {(methodologies || []).map((methodology) => ( + + ))} {methodologies.length > 0 ? ( // hide this card until other methodologies can also load ) : null} diff --git a/app/src/util/form-schema/index.ts b/app/src/util/form-schema/index.ts index aee0685fc..8de4cb387 100644 --- a/app/src/util/form-schema/index.ts +++ b/app/src/util/form-schema/index.ts @@ -26,6 +26,8 @@ export interface Methodology { id: string; disabled?: boolean; activities?: Activity[]; + suggestedActivitiesId?: string; + suggestedActivities?: Activity[]; inputRequired?: string[]; } From fc797316080bc6ff161bbcfb16e4f7a279a86800 Mon Sep 17 00:00:00 2001 From: Mirco Rudolph Date: Mon, 5 Aug 2024 14:39:13 +0200 Subject: [PATCH 102/128] Moved function 'createContext' inside POST scope --- .../assistants/threads/[inventory]/route.ts | 123 +++++++++--------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/app/src/app/api/v0/assistants/threads/[inventory]/route.ts b/app/src/app/api/v0/assistants/threads/[inventory]/route.ts index 12025e86f..2b809b760 100644 --- a/app/src/app/api/v0/assistants/threads/[inventory]/route.ts +++ b/app/src/app/api/v0/assistants/threads/[inventory]/route.ts @@ -7,66 +7,6 @@ import { Inventory } from "@/models/Inventory"; import { PopulationEntry, findClosestYear } from "@/util/helpers"; import { PopulationAttributes } from "@/models/Population"; -function createContext(inventory: Inventory): string { - const inventoryYear = inventory.dataValues.year; - - const countryPopulations = inventory.city.populations.filter( - (pop) => !!pop.countryPopulation, - ); - const countryPopulationObj = findClosestYear( - countryPopulations as PopulationEntry[], - inventoryYear!, - ) as PopulationAttributes; - - const countryPopulation = countryPopulationObj?.countryPopulation; - const countryPopulationYear = countryPopulationObj?.year; - - const regionPopulations = inventory.city.populations.filter( - (pop) => !!pop.regionPopulation, - ); - const regionPopulationObj = findClosestYear( - regionPopulations as PopulationEntry[], - inventoryYear!, - ) as PopulationAttributes; - - const regionPopulation = regionPopulationObj?.regionPopulation; - const regionPopulationYear = regionPopulationObj?.year; - - const cityPopulations = inventory.city.populations.filter( - (pop) => !!pop.population, - ); - const cityPopulationObj = findClosestYear( - cityPopulations as PopulationEntry[], - inventoryYear!, - ) as PopulationAttributes; - - const cityPopulation = cityPopulationObj?.population; - const cityPopulationYear = cityPopulationObj?.year; - - const cityName = inventory.city.dataValues.name; - const regionName = inventory.city.dataValues.region; - const countryName = inventory.city.dataValues.country; - const countryLocode = inventory.city.dataValues.countryLocode; - const cityArea = inventory.city.dataValues.area; - - const numInventoryValues = inventory.inventoryValues?.length; - - return ` -###### BEGINNING OF CONTEXT ###### -+ Name of city name that the inventory is being created for: ${cityName}, -+ Name of the corresponding region: ${regionName}, -+ Name of the corresponding country: ${countryName}, -+ UN/LOCODE of the corresponding country: ${countryLocode}, -+ Population of the city ${cityName} for the year ${cityPopulationYear} (closest known value to the inventory year): ${cityPopulation}, -+ Population of the region ${regionName} for the year ${regionPopulationYear} (closest known value to the inventory year): ${regionPopulation}, -+ Population of the country ${countryName} for the year ${countryPopulationYear} (closest known value to the inventory year): ${countryPopulation}, -+ Area of the city ${cityName} in km\u00B2: ${cityArea}, -+ Year for which the the inventory is being created: ${inventoryYear}, -+ Current number of inventory values for this city: ${numInventoryValues}. -###### END OF CONTEXT ###### -`; -} - export const POST = apiHandler(async (req, { params, session }) => { const { content } = await req.json(); const inventory = await UserService.findUserInventory( @@ -104,6 +44,69 @@ export const POST = apiHandler(async (req, { params, session }) => { ], ); + function createContext(inventory: Inventory): string { + const inventoryYear = inventory.dataValues.year; + + const countryPopulations = inventory.city.populations.filter( + (pop) => !!pop.countryPopulation, + ); + const countryPopulationObj = findClosestYear( + countryPopulations as PopulationEntry[], + inventoryYear!, + ) as PopulationAttributes; + + const countryPopulation = countryPopulationObj?.countryPopulation; + const countryPopulationYear = countryPopulationObj?.year; + + const regionPopulations = inventory.city.populations.filter( + (pop) => !!pop.regionPopulation, + ); + const regionPopulationObj = findClosestYear( + regionPopulations as PopulationEntry[], + inventoryYear!, + ) as PopulationAttributes; + + const regionPopulation = regionPopulationObj?.regionPopulation; + const regionPopulationYear = regionPopulationObj?.year; + + const cityPopulations = inventory.city.populations.filter( + (pop) => !!pop.population, + ); + const cityPopulationObj = findClosestYear( + cityPopulations as PopulationEntry[], + inventoryYear!, + ) as PopulationAttributes; + + const cityPopulation = cityPopulationObj?.population; + const cityPopulationYear = cityPopulationObj?.year; + + const cityName = inventory.city.dataValues.name; + const regionName = inventory.city.dataValues.region; + const countryName = inventory.city.dataValues.country; + const countryLocode = inventory.city.dataValues.countryLocode; + const cityArea = inventory.city.dataValues.area; + + const numInventoryValues = inventory.inventoryValues?.length; + + const userName = session?.user.name; + + return ` + ###### BEGINNING OF CONTEXT ###### + + Name of the currently logged in user: ${userName}, + + Name of city name that the inventory is being created for: ${cityName}, + + Name of the corresponding region: ${regionName}, + + Name of the corresponding country: ${countryName}, + + UN/LOCODE of the corresponding country: ${countryLocode}, + + Population of the city ${cityName} for the year ${cityPopulationYear} (closest known value to the inventory year): ${cityPopulation}, + + Population of the region ${regionName} for the year ${regionPopulationYear} (closest known value to the inventory year): ${regionPopulation}, + + Population of the country ${countryName} for the year ${countryPopulationYear} (closest known value to the inventory year): ${countryPopulation}, + + Area of the city ${cityName} in km\u00B2: ${cityArea}, + + Year for which the the inventory is being created: ${inventoryYear}, + + Current number of inventory values for this city: ${numInventoryValues}. + ###### END OF CONTEXT ###### + `; + } + const context = createContext(inventory); const thread = await openai.beta.threads.create(); From 6057dca92e59936c063337ae79416d2a0a524491 Mon Sep 17 00:00:00 2001 From: Cephas Chapa Date: Mon, 5 Aug 2024 14:49:04 +0200 Subject: [PATCH 103/128] fix(ui): adds correct form input names --- .../components/Modals/add-activity-modal.tsx | 143 ++++-------------- 1 file changed, 32 insertions(+), 111 deletions(-) diff --git a/app/src/components/Modals/add-activity-modal.tsx b/app/src/components/Modals/add-activity-modal.tsx index 99c39440a..af3802449 100644 --- a/app/src/components/Modals/add-activity-modal.tsx +++ b/app/src/components/Modals/add-activity-modal.tsx @@ -1,13 +1,10 @@ "use client"; -import type { UserAttributes } from "@/models/User"; import { api } from "@/services/api"; import { Box, Button, FormControl, - FormErrorMessage, - FormHelperText, FormLabel, Grid, HStack, @@ -42,13 +39,11 @@ import { Trans } from "react-i18next"; import Link from "next/link"; import type { - ActivityData, DirectMeasureData, SubcategoryData, EmissionsFactorData, } from "../../app/[lng]/[inventory]/data/[step]/types"; -import { groupBy, resolve } from "@/util/helpers"; -import { ActivityDataScope } from "@/features/city/subsectorSlice"; +import { resolve } from "@/util/helpers"; import { Methodology } from "@/util/form-schema"; interface AddActivityModalProps { @@ -63,8 +58,6 @@ interface AddActivityModalProps { } export type Inputs = { - methodology: "fuel-combustion-consuption" | "direct-measure" | ""; - fuelType: "all-fuels" | "natural-gas" | "propane" | "heating-oil"; activity: { activityDataAmount?: number | null | undefined; activityDataUnit?: string | null | undefined; @@ -77,29 +70,15 @@ export type Inputs = { buildingType: string; fuelType: string; totalFuelConsumption: string; + totalFuelConsumptionUnits: string; + co2EmissionFactorUnit: string; + n2oEmissionFactorUnit: string; + ch4EmissionFactorUnit: string; }; direct: DirectMeasureData; subcategoryData: Record; }; -const activityDataUnits: Record = { - I: [ - "l", - "m3", - "ft3", - "bbl", - "gal (US)", - "gal (UK)", - "MWh", - "GJ", - "BTUs", - "MW", - "Other", - ], - II: ["l", "m3", "ft3", "bbl", "gal (US)", "gal (UK)", "km", "mi", "Other"], - III: ["g", "kg", "t", "kt", "lt", "st", "lb", "Other"], -}; - export function determineEmissionsFactorType(factor: EmissionsFactorData) { let sourceName = factor.dataSources ? factor.dataSources[0].datasetName || "Unknown data source" @@ -195,12 +174,6 @@ const AddActivityModal: FC = ({ }); }; - const defaultScope = 1; - - console.log(methodology); - - const formInputs = null; - const [isEmissionFactorInputDisabled, setIsEmissionFactorInputDisabled] = useState(true); @@ -218,23 +191,16 @@ const AddActivityModal: FC = ({ } }; - // Todo - Get activity key to infer fields form names properly - type ActivityKey = any; - let fields = null; let units = null; - if ( - methodology?.id === "direct-measure" || - methodology?.id === "stationary-energy-direct-measure-methodology" - ) { + + if (methodology?.id === "direct-measure") { fields = methodology.fields; } else { fields = methodology?.fields[0]["extra-fields"]; units = methodology?.fields[0].units; } - console.log(fields); - return ( <> @@ -271,7 +237,7 @@ const AddActivityModal: FC = ({ title={fields?.[0].id} placeholder={t("select-type-activity")} register={register} - activity={"activity." + formInputs?.fields[0].name} + activity={"activity.buildingType"} errors={errors} />
    @@ -281,7 +247,7 @@ const AddActivityModal: FC = ({ title={fields?.[1].id} placeholder={t("select-type-of-fuel")} register={register} - activity={"activity." + formInputs?.fields[1].name} + activity={"activity.fuelType"} errors={errors} /> @@ -297,7 +263,9 @@ const AddActivityModal: FC = ({ !!resolve(prefix + "activityDataAmount", errors) } > - {fields?.[2].id} + + {fields?.[2].id} + = ({ shadow: "none", borderColor: "content.link", }} - {...register( - ("activity." + - formInputs?.fields[2].name) as ActivityKey, - { - required: t("value-required"), - }, - )} + {...register("activity.totalFuelConsumption", { + required: t("value-required"), + })} /> = ({ >