timeki commited on
Commit
1492023
·
1 Parent(s): 79ae6c7

added to the app

Browse files
.gitignore CHANGED
@@ -17,3 +17,4 @@ climateqa/talk_to_data/database/
17
 
18
  data_ingestion/
19
  .vscode
 
 
17
 
18
  data_ingestion/
19
  .vscode
20
+ *old/
app.py CHANGED
@@ -152,6 +152,7 @@ def cqa_tab(tab_name):
152
  elem_id="graphs-container"
153
  )
154
  with gr.Tab("DRIAS", elem_id="tab-vanna", id=6) as tab_vanna:
 
155
  vanna_table = gr.DataFrame([], elem_id="vanna-display")
156
  vanna_display = gr.Plot()
157
 
@@ -176,6 +177,7 @@ def cqa_tab(tab_name):
176
  "tab_graphs": tab_graphs,
177
  "tab_papers": tab_papers,
178
  "graph_container": graphs_container,
 
179
  "vanna_table" : vanna_table,
180
  "vanna_display": vanna_display
181
  }
@@ -207,6 +209,7 @@ def event_handling(
207
  tab_graphs = main_tab_components["tab_graphs"]
208
  tab_papers = main_tab_components["tab_papers"]
209
  graphs_container = main_tab_components["graph_container"]
 
210
  vanna_table = main_tab_components["vanna_table"]
211
  vanna_display = main_tab_components["vanna_display"]
212
 
@@ -280,9 +283,9 @@ def event_handling(
280
 
281
 
282
 
283
-
284
- # Drias search
285
- textbox.submit(ask_vanna, [textbox], [vanna_table, vanna_display])
286
 
287
  def main_ui():
288
  # config_open = gr.State(True)
 
152
  elem_id="graphs-container"
153
  )
154
  with gr.Tab("DRIAS", elem_id="tab-vanna", id=6) as tab_vanna:
155
+ vanna_sql_query = gr.Textbox(label="SQL Query", elem_id="sql-query", lines=1, interactive=False)
156
  vanna_table = gr.DataFrame([], elem_id="vanna-display")
157
  vanna_display = gr.Plot()
158
 
 
177
  "tab_graphs": tab_graphs,
178
  "tab_papers": tab_papers,
179
  "graph_container": graphs_container,
180
+ "vanna_sql_query": vanna_sql_query,
181
  "vanna_table" : vanna_table,
182
  "vanna_display": vanna_display
183
  }
 
209
  tab_graphs = main_tab_components["tab_graphs"]
210
  tab_papers = main_tab_components["tab_papers"]
211
  graphs_container = main_tab_components["graph_container"]
212
+ vanna_sql_query = main_tab_components["vanna_sql_query"]
213
  vanna_table = main_tab_components["vanna_table"]
214
  vanna_display = main_tab_components["vanna_display"]
215
 
 
283
 
284
 
285
 
286
+ if tab_name == "Beta - POC Adapt'Action":
287
+ # Drias search
288
+ textbox.submit(ask_vanna, [textbox], [vanna_sql_query ,vanna_table, vanna_display])
289
 
290
  def main_ui():
291
  # config_open = gr.State(True)
climateqa/engine/chains/drias_retriever.py CHANGED
@@ -8,7 +8,7 @@ def make_drias_retriever_node(llm):
8
  def retrieve_drias_data(state):
9
  print("---- Retrieving data from DRIAS ----")
10
  query = state["query"]
11
- sql_query, df = ask_vanna(query)
12
  state["drias_data"] = df
13
  state["drias_sql_query"] = sql_query
14
  return state
 
8
  def retrieve_drias_data(state):
9
  print("---- Retrieving data from DRIAS ----")
10
  query = state["query"]
11
+ sql_query, df, fig = ask_vanna(query)
12
  state["drias_data"] = df
13
  state["drias_sql_query"] = sql_query
14
  return state
climateqa/engine/graph.py CHANGED
@@ -227,7 +227,7 @@ def make_graph_agent_poc(llm, vectorstore_ipcc, vectorstore_graphs, vectorstore_
227
  answer_rag = make_rag_node(llm, with_docs=True)
228
  answer_rag_no_docs = make_rag_node(llm, with_docs=False)
229
  chitchat_categorize_intent = make_chitchat_intent_categorization_node(llm)
230
- retrieve_drias_data = make_drias_retriever_node(llm)
231
 
232
  # Define the nodes
233
  # workflow.add_node("set_defaults", set_defaults)
@@ -246,7 +246,7 @@ def make_graph_agent_poc(llm, vectorstore_ipcc, vectorstore_graphs, vectorstore_
246
  workflow.add_node("retrieve_documents", retrieve_documents)
247
  workflow.add_node("answer_rag", answer_rag)
248
  workflow.add_node("answer_rag_no_docs", answer_rag_no_docs)
249
- workflow.add_node("retrieve_drias_data", retrieve_drias_data)
250
 
251
  # Entry point
252
  workflow.set_entry_point("categorize_intent")
@@ -296,8 +296,8 @@ def make_graph_agent_poc(llm, vectorstore_ipcc, vectorstore_graphs, vectorstore_
296
  workflow.add_edge("retrieve_local_data", "answer_search")
297
  workflow.add_edge("retrieve_documents", "answer_search")
298
 
299
- workflow.add_edge("transform_query", "retrieve_drias_data")
300
- workflow.add_edge("retrieve_drias_data", END)
301
 
302
 
303
  # Compile
 
227
  answer_rag = make_rag_node(llm, with_docs=True)
228
  answer_rag_no_docs = make_rag_node(llm, with_docs=False)
229
  chitchat_categorize_intent = make_chitchat_intent_categorization_node(llm)
230
+ # retrieve_drias_data = make_drias_retriever_node(llm) # WIP
231
 
232
  # Define the nodes
233
  # workflow.add_node("set_defaults", set_defaults)
 
246
  workflow.add_node("retrieve_documents", retrieve_documents)
247
  workflow.add_node("answer_rag", answer_rag)
248
  workflow.add_node("answer_rag_no_docs", answer_rag_no_docs)
249
+ # workflow.add_node("retrieve_drias_data", retrieve_drias_data)# WIP
250
 
251
  # Entry point
252
  workflow.set_entry_point("categorize_intent")
 
296
  workflow.add_edge("retrieve_local_data", "answer_search")
297
  workflow.add_edge("retrieve_documents", "answer_search")
298
 
299
+ # workflow.add_edge("transform_query", "retrieve_drias_data")
300
+ # workflow.add_edge("retrieve_drias_data", END)
301
 
302
 
303
  # Compile
climateqa/engine/talk_to_data/drias_metadata.json DELETED
@@ -1,58 +0,0 @@
1
- {
2
- "Frequency of rainy days index": {
3
- "description": "Frequency_of_rainy_days_index table contains the frequency index of rainy days for each latitude longitude couple for each date in the past and the future.\nThe columns include:\n- `time`: Timestamp representing the date of the data.\n- `x`: Coordinate in the Lambert II projection for the location.\n- `y`: Coordinate in the Lambert II projection for the location.\n- `IFM40D`: Frequency index of rainy days.\n- `Lon`: Geographic longitude of the location.\n- `lat`: Geographic latitude of the location.",
4
- "sql_query": "CREATE TABLE Frequency_of_rainy_days_index (\n time TIMESTAMP,\n x FLOAT,\n y FLOAT,\n IFM40D FLOAT,\n Lon FLOAT,\n lat FLOAT\n);"
5
- },
6
- "Remarkable daily precipitation total (Q99)": {
7
- "description": "Remarkable_daily_precipitation_total_ total table contains the daily cumulative exceptional rainfall (Q99) for each latitude longitude couple for each date in the past and the future.\nThe columns include:\n- `time`: Timestamp representing the date of the data.\n- `x`: Coordinate in the Lambert II projection for the location.\n- `y`: Coordinate in the Lambert II projection for the location.\n- `LambertParisII`: Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- `RRq99`: Cumulative exceptional rainfall.\n- `lat`: Geographic latitude of the location.\n- `lon`: Geographic longitude of the location.",
8
- "sql_query": "CREATE TABLE Remarkable_daily_precipitation_total_(Q99) (\n time TIMESTAMP,\n x FLOAT,\n y FLOAT,\n LambertParisII VARCHAR(255),\n RRq99 FLOAT,\n lat FLOAT,\n lon FLOAT\n);"
9
- },
10
- "Frequency of remarkable daily precipitation": {
11
- "description": "The Frequency of remarkable daily precipitation table contains the frequency of daily exceptional rainfall in the past and the future.\nThe columns include:\n- `time`: Timestamp representing the date of the data.\n- `x`: Coordinate in the Lambert II projection for the location.\n- `y`: Coordinate in the Lambert II projection for the location.\n- `LambertParisII`: Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- `RRq99refD`: Frequency of exceptional rainfall.\n- `lat`: Geographic latitude of the location.\n- `lon`: Geographic longitude of the location.",
12
- "sql_query": "CREATE TABLE Frequency_of_remarkable_daily_precipitation (\n time TIMESTAMP,\n x FLOAT,\n y FLOAT,\n LambertParisII VARCHAR(255),\n RRq99refD FLOAT,\n lat FLOAT,\n lon FLOAT\n);"
13
- },
14
- "Winter precipitation total": {
15
- "description": "The Winter precipitation total table contains the cumulative winter precipitation in the past and the future.\nThe columns include:\n- `time`: Timestamp representing the date of the data.\n- `x`: Coordinate in the Lambert II projection for the location.\n- `y`: Coordinate in the Lambert II projection for the location.\n- `LambertParisII`: Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- `RR`: Cumulative winter precipitation.\n- `lat`: Geographic latitude of the location.\n- `lon`: Geographic longitude of the location.",
16
- "sql_query": "CREATE TABLE Winter_precipitation_total (\n time TIMESTAMP,\n x FLOAT,\n y FLOAT,\n LambertParisII VARCHAR(255),\n RR FLOAT,\n lat FLOAT,\n lon FLOAT\n);"
17
- },
18
- "Summer precipitation total": {
19
- "description": "The Summer precipitation total table contains the cumulative summer precipitation in the past and the future.\nThe columns include:\n- `time`: Timestamp representing the date of the data.\n- `x`: Coordinate in the Lambert II projection for the location.\n- `y`: Coordinate in the Lambert II projection for the location.\n- `LambertParisII`: Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- `RR`: Cumulative summer precipitation.\n- `lat`: Geographic latitude of the location.\n- `lon`: Geographic longitude of the location.",
20
- "sql_query": "CREATE TABLE Summer_precipitation_total (\n time TIMESTAMP,\n x FLOAT,\n y FLOAT,\n LambertParisII VARCHAR(255),\n RR FLOAT,\n lat FLOAT,\n lon FLOAT\n);"
21
- },
22
- "Annual precipitation total": {
23
- "description": "The Annual precipitation total table contains information on the cumulative annual precipitation in the past and the future.\nbased on Lambert Paris II projections.\nThe variables are as follows:\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'time': Timestamp indicating the observation period.\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'RR': Cumulative annual precipitation.",
24
- "sql_query": "CREATE TABLE Annual_precipitation_total (\n y FLOAT,\n x FLOAT,\n time TIMESTAMP,\n LambertParisII VARCHAR(255),\n lat FLOAT,\n lon FLOAT,\n RR FLOAT\n);"
25
- },
26
- "Extreme precipitation intensity": {
27
- "description": "The Extreme precipitation intensity table contains information on the intensity of extreme precipitation in the past and the future,\nwhich represents the maximum value of total annual precipitation.\nThe variables are as follows:\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'time': Timestamp indicating the observation period.\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'RX1d': Intensity of extreme precipitation (maximum annual total precipitation).",
28
- "sql_query": "CREATE TABLE Extreme_precipitation_intensity (\n y FLOAT,\n x FLOAT,\n time TIMESTAMP,\n LambertParisII VARCHAR(255),\n lat FLOAT,\n lon FLOAT,\n RX1d FLOAT\n);"
29
- },
30
- "Drought index": {
31
- "description": "The Drought index table contains information on the drought index based on observations over the past and the future.\nThe variables are as follows:\n- 'time': Timestamp indicating the observation period.\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'SWI04D': Drought index based on the analysis of precipitation and temperatures.",
32
- "sql_query": "CREATE TABLE Drought_index (\n time TIMESTAMP,\n y FLOAT,\n x FLOAT,\n lat FLOAT,\n lon FLOAT,\n LambertParisII VARCHAR(255),\n SWI04D FLOAT\n);"
33
- },
34
- "Mean winter temperature": {
35
- "description": "The Mean winter temperature table contains information on the average (mean) winter temperature in the past and the future.\nThe variables are as follows:\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'time': Timestamp indicating the observation period.\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'TMm': Average winter temperature.",
36
- "sql_query": "CREATE TABLE Mean_winter_temperature (\n y FLOAT,\n x FLOAT,\n time TIMESTAMP,\n LambertParisII VARCHAR(255),\n lat FLOAT,\n lon FLOAT,\n TMm FLOAT\n);"
37
- },
38
- "Mean summer temperature": {
39
- "description": "The Mean summer temperature table contains information on the average summer temperature in the past and the future.\nThe variables are as follows:\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'time': Timestamp indicating the observation period.\n- 'LambertParisII': Indicates that the x and y coordinates are in Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'TMm': Average summer temperature.",
40
- "sql_query": "CREATE TABLE Mean_summer_temperature (\n y FLOAT,\n x FLOAT,\n time TIMESTAMP,\n LambertParisII VARCHAR(255),\n lat FLOAT,\n lon FLOAT,\n TMm FLOAT\n);"
41
- },
42
- "Number of tropical nights": {
43
- "description": "The Number of tropical nights table contains information on the average summer temperature in the past and the future.\nThe variables are as follows:\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'time': Timestamp indicating the observation period.\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'TMm': Average summer temperature.",
44
- "sql_query": "CREATE TABLE Number_of_tropical_nights (\n y FLOAT,\n x FLOAT,\n time TIMESTAMP,\n LambertParisII VARCHAR(255),\n lat FLOAT,\n lon FLOAT,\n TR FLOAT\n);"
45
- },
46
- "Number of days with Tx above 30C": {
47
- "description": "The Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the future\nis greater than or equal to 30°C.\nThe variables are as follows:\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'time': Timestamp indicating the observation period.\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'TX30D': Number of days with Tx ≥ 30°C.",
48
- "sql_query": "CREATE TABLE Number_of_days_with_Tx_above_30C (\n y FLOAT,\n x FLOAT,\n time TIMESTAMP,\n LambertParisII VARCHAR(255),\n lat FLOAT,\n lon FLOAT,\n TX30D FLOAT\n);"
49
- },
50
- "Number of days with Tx above 35C": {
51
- "description": "The Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the future\nis greater than or equal to 35°C.\nThe variables are as follows:\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'time': Timestamp indicating the observation period.\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'TX35D': Number of days with Tx ≥ 35°C.",
52
- "sql_query": "CREATE TABLE Number_of_days_with_Tx_above_35C (\n y FLOAT,\n x FLOAT,\n time TIMESTAMP,\n LambertParisII VARCHAR(255),\n lat FLOAT,\n lon FLOAT,\n TX35D FLOAT\n);"
53
- },
54
- "Maximum summer temperature": {
55
- "description": "The Maximum summer temperature table contains information on the maximum temperature in summer in the past and the future,\nwhich is the highest temperature recorded during the summer period.\nThe variables are as follows:\n- 'y' and 'x': Lambert Paris II coordinates for the location.\n- 'time': Timestamp indicating the observation period.\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\n- 'lat' and 'lon': Latitude and longitude of the location.\n- 'TXm': Maximum temperature recorded in summer.",
56
- "sql_query": "CREATE TABLE Maximum_summer_temperature (\n y FLOAT,\n x FLOAT,\n time TIMESTAMP,\n LambertParisII VARCHAR(255),\n lat FLOAT,\n lon FLOAT,\n TXm FLOAT\n);"
57
- }
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
climateqa/engine/talk_to_data/how_to_use_main.ipynb DELETED
@@ -1,150 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "metadata": {},
6
- "source": [
7
- "## Import the function in main.py"
8
- ]
9
- },
10
- {
11
- "cell_type": "code",
12
- "execution_count": 3,
13
- "metadata": {},
14
- "outputs": [
15
- {
16
- "name": "stdout",
17
- "output_type": "stream",
18
- "text": [
19
- "The autoreload extension is already loaded. To reload it, use:\n",
20
- " %reload_ext autoreload\n"
21
- ]
22
- }
23
- ],
24
- "source": [
25
- "import sys\n",
26
- "import os\n",
27
- "sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))\n",
28
- "\n",
29
- "%load_ext autoreload\n",
30
- "%autoreload 2\n",
31
- "\n",
32
- "from main import ask_vanna\n"
33
- ]
34
- },
35
- {
36
- "cell_type": "markdown",
37
- "metadata": {},
38
- "source": [
39
- "## Create a human query"
40
- ]
41
- },
42
- {
43
- "cell_type": "code",
44
- "execution_count": 4,
45
- "metadata": {},
46
- "outputs": [],
47
- "source": [
48
- "query = \"what is the number of days where the temperature above 35 in 2050 in Marseille\"\n",
49
- "# query = \"Compare the winter and summer precipitation in 2050 in Marseille\"\n",
50
- "# query = \"What is the impact of climate in Bordeaux?\"\n",
51
- "query = \"Quelle sera la température à Marseille sur les prochaines années ?\""
52
- ]
53
- },
54
- {
55
- "cell_type": "markdown",
56
- "metadata": {},
57
- "source": [
58
- "## Call the function ask vanna, it gives an output of a the sql query and the dataframe of the result (tuple)"
59
- ]
60
- },
61
- {
62
- "cell_type": "code",
63
- "execution_count": 5,
64
- "metadata": {},
65
- "outputs": [
66
- {
67
- "name": "stdout",
68
- "output_type": "stream",
69
- "text": [
70
- "SQL Prompt: [{'role': 'system', 'content': \"You are a SQLite expert. Please help to generate a SQL query to answer the question. Your response should ONLY be based on the given context and follow the response guidelines and format instructions. \\n===Tables \\n\\n CREATE TABLE Mean_winter_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT, -- Température moyenne en hiver\\n );\\n \\n\\n\\n CREATE TABLE Mean_summer_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT, -- Température moyenne en été\\n );\\n \\n\\n\\n===Additional Context \\n\\n\\n The Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the future\\n is greater than or equal to 35°C.\\n The variables are as follows:\\n - 'y' and 'x': Lambert Paris II coordinates for the location.\\n - year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n - 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n - 'lat' and 'lon': Latitude and longitude of the location.\\n - 'TX35D': Number of days with Tx ≥ 35°C.\\n \\n\\n\\n The Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the future\\n is greater than or equal to 30°C.\\n The variables are as follows:\\n - 'y' and 'x': Lambert Paris II coordinates for the location.\\n - year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n - 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n - 'lat' and 'lon': Latitude and longitude of the location.\\n - 'TX30D': Number of days with Tx ≥ 30°C.\\n \\n\\n===Response Guidelines \\n1. If the provided context is sufficient, please generate a valid SQL query without any explanations for the question. \\n2. If the provided context is almost sufficient but requires knowledge of a specific string in a particular column, please generate an intermediate SQL query to find the distinct strings in that column. Prepend the query with a comment saying intermediate_sql \\n3. If the provided context is insufficient, please explain why it can't be generated. \\n4. Please use the most relevant table(s). \\n5. If the question has been asked and answered before, please repeat the answer exactly as it was given before. \\n6. Ensure that the output SQL is SQLite-compliant and executable, and free of syntax errors. \\n\"}, {'role': 'user', 'content': 'Quelle sera la température à lat, long : (43.2961743, 5.3699525) sur les prochaines années ?'}]\n",
71
- "Using model gpt-4o-mini for 828.0 tokens (approx)\n",
72
- "LLM Response: ```sql\n",
73
- "SELECT year, TMm \n",
74
- "FROM Mean_winter_temperature \n",
75
- "WHERE lat = 43.2961743 AND lon = 5.3699525\n",
76
- "UNION ALL\n",
77
- "SELECT year, TMm \n",
78
- "FROM Mean_summer_temperature \n",
79
- "WHERE lat = 43.2961743 AND lon = 5.3699525;\n",
80
- "```\n",
81
- "Extracted SQL: SELECT year, TMm \n",
82
- "FROM Mean_winter_temperature \n",
83
- "WHERE lat = 43.2961743 AND lon = 5.3699525\n",
84
- "UNION ALL\n",
85
- "SELECT year, TMm \n",
86
- "FROM Mean_summer_temperature \n",
87
- "WHERE lat = 43.2961743 AND lon = 5.3699525;\n",
88
- "Using model gpt-4o-mini for 218.5 tokens (approx)\n",
89
- "[(2031, 9.952474117647114), (2031, 9.952474117647114), (2032, 10.142322941176474), (2032, 10.142322941176474), (2033, 9.907942941176486), (2033, 9.907942941176486), (2034, 9.548873529411765), (2034, 9.548873529411765), (2035, 10.284758235294191), (2035, 10.284758235294191), (2036, 10.372100000000046), (2036, 10.372100000000046), (2037, 9.98571000000004), (2037, 9.98571000000004), (2038, 10.221372352941216), (2038, 10.221372352941216), (2039, 10.222609411764722), (2039, 10.222609411764722), (2040, 10.473662941176485), (2040, 10.473662941176485), (2041, 10.427640588235306), (2041, 10.427640588235306), (2042, 10.364736470588241), (2042, 10.364736470588241), (2043, 10.112910588235309), (2043, 10.112910588235309), (2044, 10.250792352941176), (2044, 10.250792352941176), (2045, 10.166119411764669), (2045, 10.166119411764669), (2046, 10.728997647058861), (2046, 10.728997647058861), (2047, 10.347248823529412), (2047, 10.347248823529412), (2048, 10.706604117647089), (2048, 10.706604117647089), (2049, 10.59243764705883), (2049, 10.59243764705883), (2050, 10.63225529411767), (2050, 10.63225529411767), (2031, 24.061035294117687), (2031, 24.061035294117687), (2032, 24.530692941176483), (2032, 24.530692941176483), (2033, 24.722234705882386), (2033, 24.722234705882386), (2034, 23.84629176470588), (2034, 23.84629176470588), (2035, 24.231422352941195), (2035, 24.231422352941195), (2036, 24.488941764705885), (2036, 24.488941764705885), (2037, 24.79424117647062), (2037, 24.79424117647062), (2038, 24.730553529411793), (2038, 24.730553529411793), (2039, 24.44979882352942), (2039, 24.44979882352942), (2040, 24.40726882352942), (2040, 24.40726882352942), (2041, 24.768547647058824), (2041, 24.768547647058824), (2042, 24.53479647058822), (2042, 24.53479647058822), (2043, 24.769181176470624), (2043, 24.769181176470624), (2044, 24.489877058823538), (2044, 24.489877058823538), (2045, 24.448076470588262), (2045, 24.448076470588262), (2046, 25.111282352941203), (2046, 25.111282352941203), (2047, 24.72313823529413), (2047, 24.72313823529413), (2048, 25.187577058823535), (2048, 25.187577058823535), (2049, 24.829653529411814), (2049, 24.829653529411814), (2050, 25.053394117647144), (2050, 25.053394117647144)]\n"
90
- ]
91
- },
92
- {
93
- "data": {
94
- "text/plain": [
95
- "('SELECT year, TMm \\nFROM Mean_winter_temperature \\nWHERE lat = 43.166954040527344 AND lon = 5.430534839630127\\nUNION ALL\\nSELECT year, TMm \\nFROM Mean_summer_temperature \\nWHERE lat = 43.166954040527344 AND lon = 5.430534839630127;',\n",
96
- " year TMm\n",
97
- " 0 2031 9.952474\n",
98
- " 1 2031 9.952474\n",
99
- " 2 2032 10.142323\n",
100
- " 3 2032 10.142323\n",
101
- " 4 2033 9.907943\n",
102
- " .. ... ...\n",
103
- " 75 2048 25.187577\n",
104
- " 76 2049 24.829654\n",
105
- " 77 2049 24.829654\n",
106
- " 78 2050 25.053394\n",
107
- " 79 2050 25.053394\n",
108
- " \n",
109
- " [80 rows x 2 columns])"
110
- ]
111
- },
112
- "execution_count": 5,
113
- "metadata": {},
114
- "output_type": "execute_result"
115
- }
116
- ],
117
- "source": [
118
- "ask_vanna(query)"
119
- ]
120
- },
121
- {
122
- "cell_type": "code",
123
- "execution_count": null,
124
- "metadata": {},
125
- "outputs": [],
126
- "source": []
127
- }
128
- ],
129
- "metadata": {
130
- "kernelspec": {
131
- "display_name": "climateqa",
132
- "language": "python",
133
- "name": "python3"
134
- },
135
- "language_info": {
136
- "codemirror_mode": {
137
- "name": "ipython",
138
- "version": 3
139
- },
140
- "file_extension": ".py",
141
- "mimetype": "text/x-python",
142
- "name": "python",
143
- "nbconvert_exporter": "python",
144
- "pygments_lexer": "ipython3",
145
- "version": "3.11.9"
146
- }
147
- },
148
- "nbformat": 4,
149
- "nbformat_minor": 2
150
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
climateqa/engine/talk_to_data/main.py CHANGED
@@ -1,12 +1,12 @@
1
  from climateqa.engine.talk_to_data.myVanna import MyVanna
2
- from climateqa.engine.talk_to_data.utils import loc2coords, detect_location_with_openai, detectTable, nearestNeighbourSQL
3
  import sqlite3
4
  import os
5
  import pandas as pd
6
  from climateqa.engine.llm import get_llm
7
- import ast
8
 
9
  from dotenv import load_dotenv
 
10
 
11
  load_dotenv()
12
 
@@ -24,15 +24,14 @@ vn.connect_to_sqlite(db_vanna_path)
24
 
25
  llm = get_llm(provider="openai")
26
 
 
 
 
27
 
28
- def replace_coordonates(coords, sql_query, coords_tables):
29
- n = sql_query.count(str(coords[0]))
30
- sql_query_new_coords = sql_query
31
-
32
- for i in range(n):
33
- sql_query_new_coords = sql_query_new_coords.replace(str(coords[0]), str(coords_tables[i][0]),1)
34
- sql_query_new_coords = sql_query_new_coords.replace(str(coords[1]), str(coords_tables[i][1]),1)
35
- return sql_query_new_coords
36
 
37
  def ask_vanna(query):
38
  try :
@@ -40,35 +39,22 @@ def ask_vanna(query):
40
  if location:
41
 
42
  coords = loc2coords(location)
43
- user_input = query.replace(location, f"lat, long : {coords}")
44
- sql_query, result_dataframe, figure = vn.ask(user_input, print_results=False, allow_llm_to_see_data=True)
45
- table = detectTable(sql_query)
46
- coords_tables = [nearestNeighbourSQL(db_vanna_path, coords, table[i]) for i in range(len(table))]
47
- sql_query_new_coords = replace_coordonates(coords, sql_query, coords_tables)
48
- sql_with_table_names = llm.invoke(f"Make the following sql query display the source table in the rows {sql_query_new_coords}. Just answer the query. The answer should not include ```sql\n").content
49
- print("execute sql query : ", sql_with_table_names)
50
- db = sqlite3.connect(db_vanna_path)
51
- result = db.cursor().execute(sql_query_new_coords).fetchall()
52
- columns = llm.invoke(f"From the given sql query, list the columns that are being selected. The answer should only be a python list. Just answer the list. The SQL query : {sql_query_new_coords}").content
53
- columns_list = ast.literal_eval(columns.strip("```python\n").strip())
54
- print("column list : ",columns_list)
55
- df = pd.DataFrame(result, columns=columns_list)
56
 
57
- plotly_code = vn.generate_plotly_code(
58
- question="query",
59
- sql="sql_with_table_names",
60
- df_metadata=f"Running df.dtypes gives:\n {df.dtypes}",
61
- )
62
 
63
- fig = vn.get_plotly_figure(plotly_code=plotly_code, df=df)
64
 
65
- return df, fig
66
  else :
67
  empty_df = pd.DataFrame()
68
  empty_fig = {}
69
- return empty_df, empty_fig
70
  except Exception as e:
71
  print(f"Error: {e}")
72
  empty_df = pd.DataFrame()
73
  empty_fig = {}
74
- return empty_df, empty_fig
 
1
  from climateqa.engine.talk_to_data.myVanna import MyVanna
2
+ from climateqa.engine.talk_to_data.utils import loc2coords, detect_location_with_openai, detectTable, nearestNeighbourSQL, detect_relevant_tables, replace_coordonates
3
  import sqlite3
4
  import os
5
  import pandas as pd
6
  from climateqa.engine.llm import get_llm
 
7
 
8
  from dotenv import load_dotenv
9
+ import ast
10
 
11
  load_dotenv()
12
 
 
24
 
25
  llm = get_llm(provider="openai")
26
 
27
+ def ask_llm_to_add_table_names(sql_query, llm):
28
+ sql_with_table_names = llm.invoke(f"Make the following sql query display the source table in the rows {sql_query}. Just answer the query. The answer should not include ```sql\n").content
29
+ return sql_with_table_names
30
 
31
+ def ask_llm_column_names(sql_query, llm):
32
+ columns = llm.invoke(f"From the given sql query, list the columns that are being selected. The answer should only be a python list. Just answer the list. The SQL query : {sql_query}").content
33
+ columns_list = ast.literal_eval(columns.strip("```python\n").strip())
34
+ return columns_list
 
 
 
 
35
 
36
  def ask_vanna(query):
37
  try :
 
39
  if location:
40
 
41
  coords = loc2coords(location)
42
+ user_input = query.lower().replace(location.lower(), f"lat, long : {coords}")
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
+ relevant_tables = detect_relevant_tables(user_input, llm)
45
+ coords_tables = [nearestNeighbourSQL(db_vanna_path, coords, relevant_tables[i]) for i in range(len(relevant_tables))]
46
+ user_input_with_coords = replace_coordonates(coords, user_input, coords_tables)
47
+
48
+ sql_query, result_dataframe, figure = vn.ask(user_input_with_coords, print_results=False, allow_llm_to_see_data=True, auto_train=False)
49
 
50
+ return sql_query, result_dataframe, figure
51
 
 
52
  else :
53
  empty_df = pd.DataFrame()
54
  empty_fig = {}
55
+ return "", empty_df, empty_fig
56
  except Exception as e:
57
  print(f"Error: {e}")
58
  empty_df = pd.DataFrame()
59
  empty_fig = {}
60
+ return "", empty_df, empty_fig
climateqa/engine/talk_to_data/old_step_by_step_vanna copy.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
climateqa/engine/talk_to_data/pinecone_vanna_training.ipynb DELETED
@@ -1,592 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 37,
6
- "metadata": {},
7
- "outputs": [
8
- {
9
- "name": "stdout",
10
- "output_type": "stream",
11
- "text": [
12
- "The autoreload extension is already loaded. To reload it, use:\n",
13
- " %reload_ext autoreload\n",
14
- "{'temperature': 0.2, 'api_key': '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', 'model': 'gpt-4o-mini', 'pc_api_key': 'pcsk_5pEfJ8_GqSCikBaVhK3V6wehh4YHCegspQeshyWVesKeqmqzcmfLgkQRpWaUVJvSyTcdG', 'index_name': 'cqa-vanna'}\n",
15
- "Loading embeddings model: BAAI/bge-base-en-v1.5\n"
16
- ]
17
- }
18
- ],
19
- "source": [
20
- "from vanna_class import MyCustomVectorDB\n",
21
- "from vanna.openai import OpenAI_Chat\n",
22
- "import os\n",
23
- "from dotenv import load_dotenv\n",
24
- "\n",
25
- "%load_ext autoreload\n",
26
- "%autoreload 2\n",
27
- "\n",
28
- "load_dotenv()\n",
29
- "\n",
30
- "OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')\n",
31
- "OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')\n",
32
- "PC_API_KEY = os.getenv('VANNA_PINECONE_API_KEY')\n",
33
- "INDEX_NAME = os.getenv('VANNA_INDEX_NAME')\n",
34
- "VANNA_MODEL = os.getenv('VANNA_MODEL')\n",
35
- "\n",
36
- "INDEX_NAME = \"cqa-vanna\"\n",
37
- "PC_API_KEY = \"pcsk_5pEfJ8_GqSCikBaVhK3V6wehh4YHCegspQeshyWVesKeqmqzcmfLgkQRpWaUVJvSyTcdG\"\n",
38
- "\n",
39
- "class MyVanna(MyCustomVectorDB, OpenAI_Chat):\n",
40
- " def __init__(self, config=None):\n",
41
- " print(config)\n",
42
- " MyCustomVectorDB.__init__(self, config=config)\n",
43
- " OpenAI_Chat.__init__(self, config=config)\n",
44
- "\n",
45
- "vn = MyVanna(\n",
46
- " config={\n",
47
- " 'temperature': 0.2,\n",
48
- " 'api_key': OPENAI_API_KEY,\n",
49
- " 'model': 'gpt-4o-mini',\n",
50
- " 'pc_api_key': PC_API_KEY,\n",
51
- " 'index_name': INDEX_NAME\n",
52
- " }\n",
53
- ")"
54
- ]
55
- },
56
- {
57
- "cell_type": "code",
58
- "execution_count": 49,
59
- "metadata": {},
60
- "outputs": [],
61
- "source": [
62
- "import json\n",
63
- "\n",
64
- "with open('drias_metadata.json', 'r') as file:\n",
65
- " tables_info = json.load(file)\n"
66
- ]
67
- },
68
- {
69
- "cell_type": "code",
70
- "execution_count": 50,
71
- "metadata": {},
72
- "outputs": [],
73
- "source": [
74
- "def convert(tables_info):\n",
75
- " text = \"\"\"- year: Year of the observation.\\n\n",
76
- " - month : Month of the observation.\\n\n",
77
- " - day: Day of the observation.\\n\"\"\"\n",
78
- " for table_name in tables_info:\n",
79
- " tables_info[table_name]['description'] = tables_info[table_name]['description'].replace(\"- 'time': Timestamp indicating the observation period.\", text)\n",
80
- " tables_info[table_name]['description'] = tables_info[table_name]['description'].replace(\"- `time`: Timestamp representing the date of the data.\", text)\n",
81
- " tables_info[table_name]['sql_query'] = tables_info[table_name]['sql_query'].replace(\"time TIMESTAMP\", \"year INT, \\n month INT, \\n day INT \\n\")\n",
82
- " \n",
83
- " return tables_info"
84
- ]
85
- },
86
- {
87
- "cell_type": "code",
88
- "execution_count": 51,
89
- "metadata": {},
90
- "outputs": [
91
- {
92
- "data": {
93
- "text/plain": [
94
- "{'Frequency of rainy days index': {'description': 'The Frequency of rainy days index table contains the frequency index of rainy days for each latitude longitude couple for each date in the past and the future.\\nThe columns include:\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- `x`: Coordinate in the Lambert II projection for the location.\\n- `y`: Coordinate in the Lambert II projection for the location.\\n- `IFM40D`: Frequency index of rainy days.\\n- `Lon`: Geographic longitude of the location.\\n- `lat`: Geographic latitude of the location.',\n",
95
- " 'sql_query': 'CREATE TABLE Frequency_of_rainy_days_index (\\n year INT, \\n month INT, \\n day INT \\n,\\n x FLOAT,\\n y FLOAT,\\n IFM40D FLOAT,\\n Lon FLOAT,\\n lat FLOAT\\n);'},\n",
96
- " 'Remarkable daily precipitation total (Q99)': {'description': 'The Remarkable daily precipitation total table contains the daily cumulative exceptional rainfall (Q99) for each latitude longitude couple for each date in the past and the future.\\nThe columns include:\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- `x`: Coordinate in the Lambert II projection for the location.\\n- `y`: Coordinate in the Lambert II projection for the location.\\n- `LambertParisII`: Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- `RRq99`: Cumulative exceptional rainfall.\\n- `lat`: Geographic latitude of the location.\\n- `lon`: Geographic longitude of the location.',\n",
97
- " 'sql_query': 'CREATE TABLE Remarkable_daily_precipitation_total_(Q99) (\\n year INT, \\n month INT, \\n day INT \\n,\\n x FLOAT,\\n y FLOAT,\\n LambertParisII VARCHAR(255),\\n RRq99 FLOAT,\\n lat FLOAT,\\n lon FLOAT\\n);'},\n",
98
- " 'Frequency of remarkable daily precipitation': {'description': 'The Frequency of remarkable daily precipitation table contains the frequency of daily exceptional rainfall in the past and the future.\\nThe columns include:\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- `x`: Coordinate in the Lambert II projection for the location.\\n- `y`: Coordinate in the Lambert II projection for the location.\\n- `LambertParisII`: Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- `RRq99refD`: Frequency of exceptional rainfall.\\n- `lat`: Geographic latitude of the location.\\n- `lon`: Geographic longitude of the location.',\n",
99
- " 'sql_query': 'CREATE TABLE Frequency_of_remarkable_daily_precipitation (\\n year INT, \\n month INT, \\n day INT \\n,\\n x FLOAT,\\n y FLOAT,\\n LambertParisII VARCHAR(255),\\n RRq99refD FLOAT,\\n lat FLOAT,\\n lon FLOAT\\n);'},\n",
100
- " 'Winter precipitation total': {'description': 'The Winter precipitation total table contains the cumulative winter precipitation in the past and the future.\\nThe columns include:\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- `x`: Coordinate in the Lambert II projection for the location.\\n- `y`: Coordinate in the Lambert II projection for the location.\\n- `LambertParisII`: Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- `RR`: Cumulative winter precipitation.\\n- `lat`: Geographic latitude of the location.\\n- `lon`: Geographic longitude of the location.',\n",
101
- " 'sql_query': 'CREATE TABLE Winter_precipitation_total (\\n year INT, \\n month INT, \\n day INT \\n,\\n x FLOAT,\\n y FLOAT,\\n LambertParisII VARCHAR(255),\\n RR FLOAT,\\n lat FLOAT,\\n lon FLOAT\\n);'},\n",
102
- " 'Summer precipitation total': {'description': 'The Summer precipitation total table contains the cumulative summer precipitation in the past and the future.\\nThe columns include:\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- `x`: Coordinate in the Lambert II projection for the location.\\n- `y`: Coordinate in the Lambert II projection for the location.\\n- `LambertParisII`: Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- `RR`: Cumulative summer precipitation.\\n- `lat`: Geographic latitude of the location.\\n- `lon`: Geographic longitude of the location.',\n",
103
- " 'sql_query': 'CREATE TABLE Summer_precipitation_total (\\n year INT, \\n month INT, \\n day INT \\n,\\n x FLOAT,\\n y FLOAT,\\n LambertParisII VARCHAR(255),\\n RR FLOAT,\\n lat FLOAT,\\n lon FLOAT\\n);'},\n",
104
- " 'Annual precipitation total': {'description': \"The Annual precipitation total table contains information on the cumulative annual precipitation in the past and the future.\\nbased on Lambert Paris II projections.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'RR': Cumulative annual precipitation.\",\n",
105
- " 'sql_query': 'CREATE TABLE Annual_precipitation_total (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n RR FLOAT\\n);'},\n",
106
- " 'Extreme precipitation intensity': {'description': \"The Extreme precipitation intensity table contains information on the intensity of extreme precipitation in the past and the future,\\nwhich represents the maximum value of total annual precipitation.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'RX1d': Intensity of extreme precipitation (maximum annual total precipitation).\",\n",
107
- " 'sql_query': 'CREATE TABLE Extreme_precipitation_intensity (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n RX1d FLOAT\\n);'},\n",
108
- " 'Drought index': {'description': \"The Drought index table contains information on the drought index based on observations over the past and the future.\\nThe variables are as follows:\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'SWI04D': Drought index based on the analysis of precipitation and temperatures.\",\n",
109
- " 'sql_query': 'CREATE TABLE Drought_index (\\n year INT, \\n month INT, \\n day INT \\n,\\n y FLOAT,\\n x FLOAT,\\n lat FLOAT,\\n lon FLOAT,\\n LambertParisII VARCHAR(255),\\n SWI04D FLOAT\\n);'},\n",
110
- " 'Mean winter temperature': {'description': \"The Mean winter temperature table contains information on the average (mean) winter temperature in the past and the future.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TMm': Average winter temperature.\",\n",
111
- " 'sql_query': 'CREATE TABLE Mean_winter_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT\\n);'},\n",
112
- " 'Mean summer temperature': {'description': \"The Mean summer temperature table contains information on the average summer temperature in the past and the future.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x and y coordinates are in Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TMm': Average summer temperature.\",\n",
113
- " 'sql_query': 'CREATE TABLE Mean_summer_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT\\n);'},\n",
114
- " 'Number of tropical nights': {'description': \"The Number of tropical nights table contains information on the average summer temperature in the past and the future.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TMm': Average summer temperature.\",\n",
115
- " 'sql_query': 'CREATE TABLE Number_of_tropical_nights (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TR FLOAT\\n);'},\n",
116
- " 'Number of days with Tx above 30C': {'description': \"The Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the future\\nis greater than or equal to 30°C.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TX30D': Number of days with Tx ≥ 30°C.\",\n",
117
- " 'sql_query': 'CREATE TABLE Number_of_days_with_Tx_above_30C (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TX30D FLOAT\\n);'},\n",
118
- " 'Number of days with Tx above 35C': {'description': \"The Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the future\\nis greater than or equal to 35°C.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TX35D': Number of days with Tx ≥ 35°C.\",\n",
119
- " 'sql_query': 'CREATE TABLE Number_of_days_with_Tx_above_35C (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TX35D FLOAT\\n);'},\n",
120
- " 'Maximum summer temperature': {'description': \"The Maximum summer temperature table contains information on the maximum temperature in summer in the past and the future,\\nwhich is the highest temperature recorded during the summer period.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TXm': Maximum temperature recorded in summer.\",\n",
121
- " 'sql_query': 'CREATE TABLE Maximum_summer_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TXm FLOAT\\n);'}}"
122
- ]
123
- },
124
- "execution_count": 51,
125
- "metadata": {},
126
- "output_type": "execute_result"
127
- }
128
- ],
129
- "source": [
130
- "new_tables_info = convert(tables_info)\n",
131
- "new_tables_info\n"
132
- ]
133
- },
134
- {
135
- "cell_type": "code",
136
- "execution_count": 52,
137
- "metadata": {},
138
- "outputs": [
139
- {
140
- "name": "stdout",
141
- "output_type": "stream",
142
- "text": [
143
- "Adding ddl: CREATE TABLE Frequency_of_rainy_days_index (\n",
144
- " year INT, \n",
145
- " month INT, \n",
146
- " day INT \n",
147
- ",\n",
148
- " x FLOAT,\n",
149
- " y FLOAT,\n",
150
- " IFM40D FLOAT,\n",
151
- " Lon FLOAT,\n",
152
- " lat FLOAT\n",
153
- ");\n"
154
- ]
155
- },
156
- {
157
- "name": "stdout",
158
- "output_type": "stream",
159
- "text": [
160
- "Adding documentation....\n",
161
- "Adding ddl: CREATE TABLE Remarkable_daily_precipitation_total_(Q99) (\n",
162
- " year INT, \n",
163
- " month INT, \n",
164
- " day INT \n",
165
- ",\n",
166
- " x FLOAT,\n",
167
- " y FLOAT,\n",
168
- " LambertParisII VARCHAR(255),\n",
169
- " RRq99 FLOAT,\n",
170
- " lat FLOAT,\n",
171
- " lon FLOAT\n",
172
- ");\n",
173
- "Adding documentation....\n",
174
- "Adding ddl: CREATE TABLE Frequency_of_remarkable_daily_precipitation (\n",
175
- " year INT, \n",
176
- " month INT, \n",
177
- " day INT \n",
178
- ",\n",
179
- " x FLOAT,\n",
180
- " y FLOAT,\n",
181
- " LambertParisII VARCHAR(255),\n",
182
- " RRq99refD FLOAT,\n",
183
- " lat FLOAT,\n",
184
- " lon FLOAT\n",
185
- ");\n",
186
- "Adding documentation....\n",
187
- "Adding ddl: CREATE TABLE Winter_precipitation_total (\n",
188
- " year INT, \n",
189
- " month INT, \n",
190
- " day INT \n",
191
- ",\n",
192
- " x FLOAT,\n",
193
- " y FLOAT,\n",
194
- " LambertParisII VARCHAR(255),\n",
195
- " RR FLOAT,\n",
196
- " lat FLOAT,\n",
197
- " lon FLOAT\n",
198
- ");\n",
199
- "Adding documentation....\n",
200
- "Adding ddl: CREATE TABLE Summer_precipitation_total (\n",
201
- " year INT, \n",
202
- " month INT, \n",
203
- " day INT \n",
204
- ",\n",
205
- " x FLOAT,\n",
206
- " y FLOAT,\n",
207
- " LambertParisII VARCHAR(255),\n",
208
- " RR FLOAT,\n",
209
- " lat FLOAT,\n",
210
- " lon FLOAT\n",
211
- ");\n",
212
- "Adding documentation....\n",
213
- "Adding ddl: CREATE TABLE Annual_precipitation_total (\n",
214
- " y FLOAT,\n",
215
- " x FLOAT,\n",
216
- " year INT, \n",
217
- " month INT, \n",
218
- " day INT \n",
219
- ",\n",
220
- " LambertParisII VARCHAR(255),\n",
221
- " lat FLOAT,\n",
222
- " lon FLOAT,\n",
223
- " RR FLOAT\n",
224
- ");\n",
225
- "Adding documentation....\n",
226
- "Adding ddl: CREATE TABLE Extreme_precipitation_intensity (\n",
227
- " y FLOAT,\n",
228
- " x FLOAT,\n",
229
- " year INT, \n",
230
- " month INT, \n",
231
- " day INT \n",
232
- ",\n",
233
- " LambertParisII VARCHAR(255),\n",
234
- " lat FLOAT,\n",
235
- " lon FLOAT,\n",
236
- " RX1d FLOAT\n",
237
- ");\n",
238
- "Adding documentation....\n",
239
- "Adding ddl: CREATE TABLE Drought_index (\n",
240
- " year INT, \n",
241
- " month INT, \n",
242
- " day INT \n",
243
- ",\n",
244
- " y FLOAT,\n",
245
- " x FLOAT,\n",
246
- " lat FLOAT,\n",
247
- " lon FLOAT,\n",
248
- " LambertParisII VARCHAR(255),\n",
249
- " SWI04D FLOAT\n",
250
- ");\n",
251
- "Adding documentation....\n",
252
- "Adding ddl: CREATE TABLE Mean_winter_temperature (\n",
253
- " y FLOAT,\n",
254
- " x FLOAT,\n",
255
- " year INT, \n",
256
- " month INT, \n",
257
- " day INT \n",
258
- ",\n",
259
- " LambertParisII VARCHAR(255),\n",
260
- " lat FLOAT,\n",
261
- " lon FLOAT,\n",
262
- " TMm FLOAT\n",
263
- ");\n",
264
- "Adding documentation....\n",
265
- "Adding ddl: CREATE TABLE Mean_summer_temperature (\n",
266
- " y FLOAT,\n",
267
- " x FLOAT,\n",
268
- " year INT, \n",
269
- " month INT, \n",
270
- " day INT \n",
271
- ",\n",
272
- " LambertParisII VARCHAR(255),\n",
273
- " lat FLOAT,\n",
274
- " lon FLOAT,\n",
275
- " TMm FLOAT\n",
276
- ");\n",
277
- "Adding documentation....\n",
278
- "Adding ddl: CREATE TABLE Number_of_tropical_nights (\n",
279
- " y FLOAT,\n",
280
- " x FLOAT,\n",
281
- " year INT, \n",
282
- " month INT, \n",
283
- " day INT \n",
284
- ",\n",
285
- " LambertParisII VARCHAR(255),\n",
286
- " lat FLOAT,\n",
287
- " lon FLOAT,\n",
288
- " TR FLOAT\n",
289
- ");\n",
290
- "Adding documentation....\n",
291
- "Adding ddl: CREATE TABLE Number_of_days_with_Tx_above_30C (\n",
292
- " y FLOAT,\n",
293
- " x FLOAT,\n",
294
- " year INT, \n",
295
- " month INT, \n",
296
- " day INT \n",
297
- ",\n",
298
- " LambertParisII VARCHAR(255),\n",
299
- " lat FLOAT,\n",
300
- " lon FLOAT,\n",
301
- " TX30D FLOAT\n",
302
- ");\n",
303
- "Adding documentation....\n",
304
- "Adding ddl: CREATE TABLE Number_of_days_with_Tx_above_35C (\n",
305
- " y FLOAT,\n",
306
- " x FLOAT,\n",
307
- " year INT, \n",
308
- " month INT, \n",
309
- " day INT \n",
310
- ",\n",
311
- " LambertParisII VARCHAR(255),\n",
312
- " lat FLOAT,\n",
313
- " lon FLOAT,\n",
314
- " TX35D FLOAT\n",
315
- ");\n",
316
- "Adding documentation....\n",
317
- "Adding ddl: CREATE TABLE Maximum_summer_temperature (\n",
318
- " y FLOAT,\n",
319
- " x FLOAT,\n",
320
- " year INT, \n",
321
- " month INT, \n",
322
- " day INT \n",
323
- ",\n",
324
- " LambertParisII VARCHAR(255),\n",
325
- " lat FLOAT,\n",
326
- " lon FLOAT,\n",
327
- " TXm FLOAT\n",
328
- ");\n",
329
- "Adding documentation....\n"
330
- ]
331
- }
332
- ],
333
- "source": [
334
- "for table in new_tables_info:\n",
335
- " vn.train(ddl = new_tables_info[table]['sql_query'])\n",
336
- " vn.train(documentation = new_tables_info[table]['description'])"
337
- ]
338
- },
339
- {
340
- "cell_type": "markdown",
341
- "metadata": {},
342
- "source": [
343
- "# Requests"
344
- ]
345
- },
346
- {
347
- "cell_type": "code",
348
- "execution_count": null,
349
- "metadata": {},
350
- "outputs": [],
351
- "source": []
352
- },
353
- {
354
- "cell_type": "markdown",
355
- "metadata": {},
356
- "source": [
357
- "# examples"
358
- ]
359
- },
360
- {
361
- "cell_type": "code",
362
- "execution_count": 56,
363
- "metadata": {},
364
- "outputs": [
365
- {
366
- "name": "stdout",
367
- "output_type": "stream",
368
- "text": [
369
- "Loading embeddings model: BAAI/bge-base-en-v1.5\n"
370
- ]
371
- }
372
- ],
373
- "source": [
374
- "question_sql = [\n",
375
- " # ['How will the precipitations change in the coming years', \n",
376
- " # 'SELECT * FROM Annual_precipitation_total WHERE year > 2024;'],\n",
377
- " # ['What is the number of days where the temperature above 35 in year 2050 in (lat, lon) = (48.82337188720703, 2.390951633453369)', \n",
378
- " # 'SELECT TX35D FROM Number_of_days_with_Tx_above_35C WHERE year = 2050 AND lat = 48.82337188720703 AND lon = 2.390951633453369;'],\n",
379
- " # ['How will change the mean winter temperature in the coming years in lat = 43.2961743 lon = 5.3699525', \n",
380
- " # 'SELECT * FROM Mean_winter_temperature WHERE year > 2023 AND lat = 43.2961743 AND lon = 5.3699525'],\n",
381
- " # ['How will change the mean summer temperature in the coming years in lat = 43.2961743, lon = 5.3699525', \n",
382
- " # 'SELECT * FROM Mean_summer_temperature WHERE year > 2023 AND lat = 43.2961743 AND lon = 5.3699525'],\n",
383
- " # ['How will change the temperature in the coming years', \n",
384
- " # 'SELECT * FROM Mean_summer_temperature JOIN Mean_winter_temperature WHERE year > 2024']\n",
385
- " [\"Quelle sera la température à lat, long : (43.2961743, 5.3699525) sur les prochaines années ?\",\n",
386
- " 'SELECT Mean_winter_temperature AS table_name, lat, lon, year, TMm \\nFROM Mean_winter_temperature \\nWHERE lat = 43.2961743 AND lon = 5.3699525\\nUNION ALL\\nSELECT \"Mean_summer_temperature\" AS table_name, lat, lon, year, TMm \\nFROM Mean_summer_temperature \\nWHERE lat = 43.2961743 AND lon = 5.3699525;']\n",
387
- "]"
388
- ]
389
- },
390
- {
391
- "cell_type": "code",
392
- "execution_count": 58,
393
- "metadata": {},
394
- "outputs": [
395
- {
396
- "name": "stdout",
397
- "output_type": "stream",
398
- "text": [
399
- "de6738cb3a67eaec29a04119ad160b27acd64f2d87cf83782c5b2bdc84be445b_sql\n"
400
- ]
401
- }
402
- ],
403
- "source": [
404
- "for question in question_sql:\n",
405
- " print(vn.train(question = question[0], sql = question[1]))"
406
- ]
407
- },
408
- {
409
- "cell_type": "markdown",
410
- "metadata": {},
411
- "source": [
412
- "# Delete"
413
- ]
414
- },
415
- {
416
- "cell_type": "code",
417
- "execution_count": 31,
418
- "metadata": {},
419
- "outputs": [
420
- {
421
- "data": {
422
- "text/plain": [
423
- "'cqa-vanna'"
424
- ]
425
- },
426
- "execution_count": 31,
427
- "metadata": {},
428
- "output_type": "execute_result"
429
- }
430
- ],
431
- "source": [
432
- "INDEX_NAME"
433
- ]
434
- },
435
- {
436
- "cell_type": "code",
437
- "execution_count": 36,
438
- "metadata": {},
439
- "outputs": [
440
- {
441
- "data": {
442
- "text/plain": []
443
- },
444
- "execution_count": 36,
445
- "metadata": {},
446
- "output_type": "execute_result"
447
- }
448
- ],
449
- "source": [
450
- "from pinecone.grpc import PineconeGRPC as Pinecone\n",
451
- "\n",
452
- "pc = Pinecone(api_key=PC_API_KEY)\n",
453
- "\n",
454
- "# To get the unique host for an index, \n",
455
- "# see https://docs.pinecone.io/guides/data/target-an-index\n",
456
- "index = pc.Index(INDEX_NAME)\n",
457
- "# index\n",
458
- "index.delete(delete_all=True, namespace='ddl')\n",
459
- "index.delete(delete_all=True, namespace='documentation')\n"
460
- ]
461
- },
462
- {
463
- "cell_type": "markdown",
464
- "metadata": {},
465
- "source": [
466
- "# OLD"
467
- ]
468
- },
469
- {
470
- "cell_type": "code",
471
- "execution_count": 32,
472
- "metadata": {},
473
- "outputs": [],
474
- "source": [
475
- "import vanna\n",
476
- "from vanna.remote import VannaDefault"
477
- ]
478
- },
479
- {
480
- "cell_type": "code",
481
- "execution_count": 33,
482
- "metadata": {},
483
- "outputs": [],
484
- "source": [
485
- "# PC_API_KEY = os.getenv('VANNA_PINECONE_API_KEY')\n"
486
- ]
487
- },
488
- {
489
- "cell_type": "code",
490
- "execution_count": 34,
491
- "metadata": {},
492
- "outputs": [
493
- {
494
- "data": {
495
- "text/plain": [
496
- "[\n",
497
- " {\n",
498
- " \"name\": \"cqa-vanna\",\n",
499
- " \"dimension\": 768,\n",
500
- " \"metric\": \"cosine\",\n",
501
- " \"host\": \"cqa-vanna-9xlylwt.svc.aped-4627-b74a.pinecone.io\",\n",
502
- " \"spec\": {\n",
503
- " \"serverless\": {\n",
504
- " \"cloud\": \"aws\",\n",
505
- " \"region\": \"us-east-1\"\n",
506
- " }\n",
507
- " },\n",
508
- " \"status\": {\n",
509
- " \"ready\": true,\n",
510
- " \"state\": \"Ready\"\n",
511
- " },\n",
512
- " \"deletion_protection\": \"disabled\"\n",
513
- " },\n",
514
- " {\n",
515
- " \"name\": \"unepqa\",\n",
516
- " \"dimension\": 768,\n",
517
- " \"metric\": \"cosine\",\n",
518
- " \"host\": \"unepqa-9xlylwt.svc.aped-4627-b74a.pinecone.io\",\n",
519
- " \"spec\": {\n",
520
- " \"serverless\": {\n",
521
- " \"cloud\": \"aws\",\n",
522
- " \"region\": \"us-east-1\"\n",
523
- " }\n",
524
- " },\n",
525
- " \"status\": {\n",
526
- " \"ready\": true,\n",
527
- " \"state\": \"Ready\"\n",
528
- " },\n",
529
- " \"deletion_protection\": \"disabled\"\n",
530
- " }\n",
531
- "]"
532
- ]
533
- },
534
- "execution_count": 34,
535
- "metadata": {},
536
- "output_type": "execute_result"
537
- }
538
- ],
539
- "source": [
540
- "from pinecone.grpc import PineconeGRPC as Pinecone\n",
541
- "\n",
542
- "pc = Pinecone(api_key=PC_API_KEY)\n",
543
- "pc.list_indexes()"
544
- ]
545
- },
546
- {
547
- "cell_type": "code",
548
- "execution_count": 35,
549
- "metadata": {},
550
- "outputs": [
551
- {
552
- "data": {
553
- "text/plain": [
554
- "{'dimension': 768,\n",
555
- " 'index_fullness': 0.0,\n",
556
- " 'namespaces': {'ddl': {'vector_count': 14},\n",
557
- " 'documentation': {'vector_count': 14}},\n",
558
- " 'total_vector_count': 28}"
559
- ]
560
- },
561
- "execution_count": 35,
562
- "metadata": {},
563
- "output_type": "execute_result"
564
- }
565
- ],
566
- "source": [
567
- "pc.Index(\"cqa-vanna\").describe_index_stats()"
568
- ]
569
- }
570
- ],
571
- "metadata": {
572
- "kernelspec": {
573
- "display_name": "climateqa",
574
- "language": "python",
575
- "name": "python3"
576
- },
577
- "language_info": {
578
- "codemirror_mode": {
579
- "name": "ipython",
580
- "version": 3
581
- },
582
- "file_extension": ".py",
583
- "mimetype": "text/x-python",
584
- "name": "python",
585
- "nbconvert_exporter": "python",
586
- "pygments_lexer": "ipython3",
587
- "version": "3.11.9"
588
- }
589
- },
590
- "nbformat": 4,
591
- "nbformat_minor": 2
592
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
climateqa/engine/talk_to_data/step_by_step_vanna.ipynb DELETED
@@ -1,385 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {},
7
- "outputs": [],
8
- "source": [
9
- "import sys\n",
10
- "import os\n",
11
- "sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.getcwd()))))\n",
12
- "\n",
13
- "%load_ext autoreload\n",
14
- "%autoreload 2\n",
15
- "\n",
16
- "from main import ask_vanna\n",
17
- "import sqlite3\n",
18
- "import os\n",
19
- "import pandas as pd"
20
- ]
21
- },
22
- {
23
- "cell_type": "markdown",
24
- "metadata": {},
25
- "source": [
26
- "# Vanna Ask\n"
27
- ]
28
- },
29
- {
30
- "cell_type": "code",
31
- "execution_count": null,
32
- "metadata": {},
33
- "outputs": [],
34
- "source": [
35
- "df, fig = ask_vanna(\"Quelle sera la température à Marseille sur les prochaines années ?\")\n"
36
- ]
37
- },
38
- {
39
- "cell_type": "code",
40
- "execution_count": null,
41
- "metadata": {},
42
- "outputs": [],
43
- "source": [
44
- "from climateqa.engine.talk_to_data.myVanna import MyVanna\n",
45
- "from climateqa.engine.talk_to_data.utils import loc2coords, detect_location_with_openai, detectTable, nearestNeighbourSQL\n",
46
- "\n",
47
- "from climateqa.engine.llm import get_llm\n",
48
- "\n",
49
- "from dotenv import load_dotenv\n",
50
- "\n",
51
- "load_dotenv()\n",
52
- "\n",
53
- "llm = get_llm(provider=\"openai\")\n",
54
- "\n",
55
- "OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')\n",
56
- "PC_API_KEY = os.getenv('VANNA_PINECONE_API_KEY')\n",
57
- "INDEX_NAME = os.getenv('VANNA_INDEX_NAME')\n",
58
- "VANNA_MODEL = os.getenv('VANNA_MODEL')\n",
59
- "\n",
60
- "\n",
61
- "#Vanna object\n",
62
- "vn = MyVanna(config = {\"temperature\": 0, \"api_key\": OPENAI_API_KEY, 'model': VANNA_MODEL, 'pc_api_key': PC_API_KEY, 'index_name': INDEX_NAME, \"top_k\" : 5})\n",
63
- "db_vanna_path = \"database/drias.db\"\n",
64
- "vn.connect_to_sqlite(db_vanna_path)\n"
65
- ]
66
- },
67
- {
68
- "cell_type": "code",
69
- "execution_count": null,
70
- "metadata": {},
71
- "outputs": [],
72
- "source": [
73
- "query = \"Quelle sera la température à Marseille sur les prochaines années ?\""
74
- ]
75
- },
76
- {
77
- "cell_type": "markdown",
78
- "metadata": {},
79
- "source": [
80
- "## Detect location"
81
- ]
82
- },
83
- {
84
- "cell_type": "code",
85
- "execution_count": null,
86
- "metadata": {},
87
- "outputs": [],
88
- "source": [
89
- "location = detect_location_with_openai(OPENAI_API_KEY, query)\n",
90
- "print(location)"
91
- ]
92
- },
93
- {
94
- "cell_type": "markdown",
95
- "metadata": {},
96
- "source": [
97
- "## Convert location to longitude, latitude coordonate"
98
- ]
99
- },
100
- {
101
- "cell_type": "code",
102
- "execution_count": null,
103
- "metadata": {},
104
- "outputs": [],
105
- "source": [
106
- "coords = loc2coords(location)\n",
107
- "user_input = query.replace(location, f\"lat, long : {coords}\")\n",
108
- "print(user_input)"
109
- ]
110
- },
111
- {
112
- "cell_type": "markdown",
113
- "metadata": {},
114
- "source": [
115
- "## Query DRIAS on this location"
116
- ]
117
- },
118
- {
119
- "cell_type": "code",
120
- "execution_count": null,
121
- "metadata": {},
122
- "outputs": [],
123
- "source": [
124
- "user_input"
125
- ]
126
- },
127
- {
128
- "cell_type": "code",
129
- "execution_count": null,
130
- "metadata": {},
131
- "outputs": [],
132
- "source": [
133
- "sql_query, result_dataframe, figure = vn.ask(user_input, print_results=False, allow_llm_to_see_data=True)\n",
134
- "print(\"\\nSQL QUERY :\", sql_query)"
135
- ]
136
- },
137
- {
138
- "cell_type": "markdown",
139
- "metadata": {},
140
- "source": [
141
- "# Replace coordinate to existing coordinate in the table"
142
- ]
143
- },
144
- {
145
- "cell_type": "code",
146
- "execution_count": null,
147
- "metadata": {},
148
- "outputs": [],
149
- "source": [
150
- "table = detectTable(sql_query)\n",
151
- "print(table)"
152
- ]
153
- },
154
- {
155
- "cell_type": "code",
156
- "execution_count": null,
157
- "metadata": {},
158
- "outputs": [],
159
- "source": [
160
- "coords_tables = [nearestNeighbourSQL(db_vanna_path, coords, table[i]) for i in range(len(table))]\n",
161
- "coords_tables"
162
- ]
163
- },
164
- {
165
- "cell_type": "code",
166
- "execution_count": null,
167
- "metadata": {},
168
- "outputs": [],
169
- "source": [
170
- "n = sql_query.count(str(coords[0]))\n",
171
- "sql_query_new_coords = sql_query\n",
172
- "\n",
173
- "for i in range(n):\n",
174
- " sql_query_new_coords = sql_query_new_coords.replace(str(coords[0]), str(coords_tables[i][0]),1)\n",
175
- " sql_query_new_coords = sql_query_new_coords.replace(str(coords[1]), str(coords_tables[i][1]),1)\n",
176
- "sql_query_new_coords"
177
- ]
178
- },
179
- {
180
- "cell_type": "markdown",
181
- "metadata": {},
182
- "source": [
183
- "## Query back the DB"
184
- ]
185
- },
186
- {
187
- "cell_type": "code",
188
- "execution_count": null,
189
- "metadata": {},
190
- "outputs": [],
191
- "source": [
192
- "sql_query"
193
- ]
194
- },
195
- {
196
- "cell_type": "code",
197
- "execution_count": null,
198
- "metadata": {},
199
- "outputs": [],
200
- "source": [
201
- "sql_query_new_coords.split(\"SELECT\")[1].split(\"FROM\")[0].strip()"
202
- ]
203
- },
204
- {
205
- "cell_type": "code",
206
- "execution_count": null,
207
- "metadata": {},
208
- "outputs": [],
209
- "source": [
210
- "db = sqlite3.connect(db_vanna_path)\n",
211
- "# result = db.cursor().execute(sql_with_table_names).fetchall()\n",
212
- "result = db.cursor().execute(sql_query_new_coords.replace(\"SELECT\", \"SELECT lat, lon,\")).fetchall()\n",
213
- "column_names = [\"lat\",\"lon\"] + sql_query_new_coords.split(\"SELECT\")[1].split(\"FROM\")[0].strip().split(\",\")\n",
214
- "df = pd.DataFrame(result, columns=column_names)\n"
215
- ]
216
- },
217
- {
218
- "cell_type": "code",
219
- "execution_count": null,
220
- "metadata": {},
221
- "outputs": [],
222
- "source": [
223
- "sql_query_new_coords = 'SELECT \"Mean_winter_temperature\" AS table_name, lat, lon, year, TMm \\nFROM Mean_winter_temperature \\nWHERE lat = 43.166954040527344 AND lon = 5.430534839630127\\nUNION ALL\\nSELECT \"Mean_summer_temperature\" AS table_name, lat, lon, year, TMm \\nFROM Mean_summer_temperature \\nWHERE lat = 43.166954040527344 AND lon = 5.430534839630127;'\n",
224
- "\n",
225
- "db = sqlite3.connect(db_vanna_path)\n",
226
- "result = db.cursor().execute(sql_query_new_coords).fetchall()\n",
227
- "df = pd.DataFrame(result, columns = [\"Data\",\"lat\",\"lon\",\"year\",\"TMm\"])\n",
228
- "\n",
229
- "\n",
230
- "df"
231
- ]
232
- },
233
- {
234
- "cell_type": "code",
235
- "execution_count": null,
236
- "metadata": {},
237
- "outputs": [],
238
- "source": [
239
- "plotly_code = vn.generate_plotly_code(\n",
240
- " question=query,\n",
241
- " sql=sql_query_new_coords,\n",
242
- " df_metadata=f\"Running df.dtypes gives:\\n {df.dtypes}\",\n",
243
- " )\n",
244
- "\n",
245
- "fig = vn.get_plotly_figure(plotly_code=plotly_code, df=df)\n"
246
- ]
247
- },
248
- {
249
- "cell_type": "code",
250
- "execution_count": null,
251
- "metadata": {},
252
- "outputs": [],
253
- "source": [
254
- "df"
255
- ]
256
- },
257
- {
258
- "cell_type": "code",
259
- "execution_count": null,
260
- "metadata": {},
261
- "outputs": [],
262
- "source": [
263
- "fig"
264
- ]
265
- },
266
- {
267
- "cell_type": "markdown",
268
- "metadata": {},
269
- "source": [
270
- "# Whole Vanna workflow"
271
- ]
272
- },
273
- {
274
- "cell_type": "code",
275
- "execution_count": null,
276
- "metadata": {},
277
- "outputs": [],
278
- "source": [
279
- "def replace_coordonates(coords, sql_query, coords_tables):\n",
280
- " n = sql_query.count(str(coords[0]))\n",
281
- " sql_query_new_coords = sql_query\n",
282
- "\n",
283
- " for i in range(n):\n",
284
- " sql_query_new_coords = sql_query_new_coords.replace(str(coords[0]), str(coords_tables[i][0]),1)\n",
285
- " sql_query_new_coords = sql_query_new_coords.replace(str(coords[1]), str(coords_tables[i][1]),1)\n",
286
- " return sql_query_new_coords"
287
- ]
288
- },
289
- {
290
- "cell_type": "code",
291
- "execution_count": null,
292
- "metadata": {},
293
- "outputs": [],
294
- "source": [
295
- "def ask_vanna(query):\n",
296
- " location = detect_location_with_openai(OPENAI_API_KEY, query)\n",
297
- " coords = loc2coords(location)\n",
298
- " user_input = query.replace(location, f\"lat, long : {coords}\")\n",
299
- " sql_query, result_dataframe, figure = vn.ask(user_input, print_results=False, allow_llm_to_see_data=True)\n",
300
- " table = detectTable(sql_query)\n",
301
- " coords_tables = [nearestNeighbourSQL(db_vanna_path, coords, table[i]) for i in range(len(table))]\n",
302
- " sql_query_new_coords = replace_coordonates(coords, sql_query, coords_tables)\n",
303
- " sql_with_table_names = llm.invoke(f\"Make the following sql query display the source table in the rows {sql_query_new_coords}. Just answer the query. The answer should not include ```sql\\n\").content\n",
304
- " db = sqlite3.connect(db_vanna_path)\n",
305
- " result = db.cursor().execute(sql_with_table_names).fetchall()\n",
306
- " df = pd.DataFrame(result, columns=[\"data_name\"] + list(result_dataframe.columns))\n",
307
- " \n",
308
- " plotly_code = vn.generate_plotly_code(\n",
309
- " question=\"query\",\n",
310
- " sql=\"sql_with_table_names\",\n",
311
- " df_metadata=f\"Running df.dtypes gives:\\n {df.dtypes}\",\n",
312
- " )\n",
313
- "\n",
314
- " fig = vn.get_plotly_figure(plotly_code=plotly_code, df=df)\n",
315
- "\n",
316
- " return df, fig\n",
317
- "\n",
318
- "query = \"Quelle sera la température à Marseille sur les prochaines années ?\"\n"
319
- ]
320
- },
321
- {
322
- "cell_type": "code",
323
- "execution_count": null,
324
- "metadata": {},
325
- "outputs": [],
326
- "source": [
327
- "df, fig = ask_vanna(query)\n",
328
- "print(df)\n",
329
- "fig"
330
- ]
331
- },
332
- {
333
- "cell_type": "code",
334
- "execution_count": null,
335
- "metadata": {},
336
- "outputs": [],
337
- "source": [
338
- "location = detect_location_with_openai(OPENAI_API_KEY, query)\n",
339
- "if location:\n",
340
- " coords = loc2coords(location)\n",
341
- " user_input = query.replace(location, f\"lat, long : {coords}\")\n",
342
- " \n",
343
- " answer = vn.ask(user_input, print_results=False, allow_llm_to_see_data=True)\n",
344
- " table = detectTable(answer[0])\n",
345
- " \n",
346
- " coords2 = nearestNeighbourSQL(db_vanna_path, coords, table[0])\n",
347
- "\n",
348
- " query = answer[0].replace(f\"{coords[0]}\", f\"{coords2[0]}\")\n",
349
- " sql_query = query.replace(f\"{coords[1]}\", f\"{coords2[1]}\")\n",
350
- "\n",
351
- " db = sqlite3.connect(db_vanna_path)\n",
352
- " result = db.cursor().execute(sql_query).fetchall()\n",
353
- " print(result)\n",
354
- " df = pd.DataFrame(result, columns=answer[1].columns)\n",
355
- " \n",
356
- "else: \n",
357
- " answer = vn.ask(query, visualize=True, print_results=False, allow_llm_to_see_data=True)\n",
358
- " sql_query = answer[0]\n",
359
- " df = answer[1]\n",
360
- " "
361
- ]
362
- }
363
- ],
364
- "metadata": {
365
- "kernelspec": {
366
- "display_name": "climateqa",
367
- "language": "python",
368
- "name": "python3"
369
- },
370
- "language_info": {
371
- "codemirror_mode": {
372
- "name": "ipython",
373
- "version": 3
374
- },
375
- "file_extension": ".py",
376
- "mimetype": "text/x-python",
377
- "name": "python",
378
- "nbconvert_exporter": "python",
379
- "pygments_lexer": "ipython3",
380
- "version": "3.11.9"
381
- }
382
- },
383
- "nbformat": 4,
384
- "nbformat_minor": 2
385
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
climateqa/engine/talk_to_data/test_vanna.ipynb DELETED
@@ -1,174 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {},
7
- "outputs": [],
8
- "source": [
9
- "import sys\n",
10
- "import os\n",
11
- "sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.getcwd()))))\n",
12
- "\n",
13
- "%load_ext autoreload\n",
14
- "%autoreload 2\n",
15
- "\n",
16
- "from main import ask_vanna\n",
17
- "import sqlite3\n",
18
- "import os\n",
19
- "import pandas as pd"
20
- ]
21
- },
22
- {
23
- "cell_type": "code",
24
- "execution_count": null,
25
- "metadata": {},
26
- "outputs": [],
27
- "source": [
28
- "table_names_list = [\n",
29
- " \"Frequency_of_rainy_days_index\",\n",
30
- " \"Winter_precipitation_total\",\n",
31
- " \"Summer_precipitation_total\",\n",
32
- " \"Annual_precipitation_total\",\n",
33
- " \"Remarkable_daily_precipitation_total_(Q99)\",\n",
34
- " \"Frequency_of_remarkable_daily_precipitation\",\n",
35
- " \"Extreme_precipitation_intensity\",\n",
36
- " \"Mean_winter_temperature\",\n",
37
- " \"Mean_summer_temperature\",\n",
38
- " \"Number_of_tropical_nights\",\n",
39
- " \"Maximum_summer_temperature\",\n",
40
- " \"Number_of_days_with_Tx_above_30C\",\n",
41
- " \"Number_of_days_with_Tx_above_35C\",\n",
42
- " \"Drought_index\"\n",
43
- "]"
44
- ]
45
- },
46
- {
47
- "cell_type": "code",
48
- "execution_count": null,
49
- "metadata": {},
50
- "outputs": [],
51
- "source": [
52
- "from climateqa.engine.llm import get_llm\n",
53
- "\n",
54
- "llm = get_llm(provider=\"openai\")\n",
55
- "user_question = \"Quel sera la température à Marseille dans les prochaines années ?\"\n",
56
- "prompt = f\"You are helping to build a sql query to retrieve relevant data for a user question. The different tables are {table_names_list}. The user question is {user_question}. Write the relevant table to query. Answer only the table name.\"\n",
57
- "table_name = llm.invoke(prompt).content\n",
58
- "# llm.invoke(f\"Make the following sql query display the source table in the rows {sql_query_new_coords}. Just answer the query. The answer should not include ```sql\\n\").content\n"
59
- ]
60
- },
61
- {
62
- "cell_type": "code",
63
- "execution_count": null,
64
- "metadata": {},
65
- "outputs": [],
66
- "source": [
67
- "docs = {\"Mean_summer_temperature\": {\n",
68
- " \"description\": (\n",
69
- " \"The Mean summer temperature table contains information on the average summer temperature in the past and the future. \"\n",
70
- " \"The variables are as follows:\\n\"\n",
71
- " \"- 'y' and 'x': Lambert Paris II coordinates for the location.\\n\"\n",
72
- " \"- year: Year of the observation.\\n\"\n",
73
- " \"- month : Month of the observation.\\n\"\n",
74
- " \"- day: Day of the observation.\\n\"\n",
75
- " \"- 'LambertParisII': Indicates that the x and y coordinates are in Lambert Paris II projection.\\n\"\n",
76
- " \"- 'lat' and 'lon': Latitude and longitude of the location.\\n\"\n",
77
- " \"- 'TMm': Average summer temperature.\\n\"\n",
78
- " ),\n",
79
- " \"sql_query\": \"\"\"\n",
80
- " CREATE TABLE Mean_summer_temperature (\n",
81
- " y FLOAT,\n",
82
- " x FLOAT,\n",
83
- " year INT,\n",
84
- " month INT, \n",
85
- " day INT,\n",
86
- " LambertParisII VARCHAR(255),\n",
87
- " lat FLOAT,\n",
88
- " lon FLOAT,\n",
89
- " TMm FLOAT, -- Température moyenne en été\n",
90
- " );\n",
91
- " \"\"\"}\n",
92
- "}"
93
- ]
94
- },
95
- {
96
- "cell_type": "code",
97
- "execution_count": null,
98
- "metadata": {},
99
- "outputs": [],
100
- "source": [
101
- "from climateqa.engine.talk_to_data.utils import loc2coords\n",
102
- "location = \"Marseille\"\n",
103
- "coords = loc2coords(location)\n",
104
- "user_input = user_question.replace(location, f\"lat, long : {coords}\")\n"
105
- ]
106
- },
107
- {
108
- "cell_type": "code",
109
- "execution_count": null,
110
- "metadata": {},
111
- "outputs": [],
112
- "source": [
113
- "initial_prompt = f\"You are a mysql expert. \" + \\\n",
114
- " \"Please help to generate a SQL query to answer the question. Your response should ONLY be based on the given context and follow the response guidelines and format instructions. \"\n",
115
- "initial_prompt += f\"\\n===Tables \\n + {docs[table_name]['sql_query']}\"\n",
116
- "initial_prompt += f\"\\n===Additional Context \\n\\n {docs[table_name]['description']}\"\n",
117
- "initial_prompt += (\n",
118
- " \"===Response Guidelines \\n\"\n",
119
- " \"1. If the provided context is sufficient, please generate a valid SQL query without any explanations for the question. \\n\"\n",
120
- " \"2. If the provided context is almost sufficient but requires knowledge of a specific string in a particular column, please generate an intermediate SQL query to find the distinct strings in that column. Prepend the query with a comment saying intermediate_sql \\n\"\n",
121
- " \"3. If the provided context is insufficient, please give a sql query based on your knowledge and the context provided. \\n\"\n",
122
- " \"4. Please use the most relevant table(s). \\n\"\n",
123
- " \"5. If the question has been asked and answered before, please repeat the answer exactly as it was given before. \\n\"\n",
124
- " f\"6. Ensure that the output SQL is mysql-compliant and executable, and free of syntax errors. \\n\"\n",
125
- " )\n",
126
- "initial_prompt += f\"\\n===Question \\n\\n {user_input}\"\n"
127
- ]
128
- },
129
- {
130
- "cell_type": "code",
131
- "execution_count": null,
132
- "metadata": {},
133
- "outputs": [],
134
- "source": [
135
- "sql_query = llm.invoke(initial_prompt).content\n",
136
- "sql_query"
137
- ]
138
- },
139
- {
140
- "cell_type": "markdown",
141
- "metadata": {},
142
- "source": [
143
- "# Vanna ask"
144
- ]
145
- },
146
- {
147
- "cell_type": "code",
148
- "execution_count": null,
149
- "metadata": {},
150
- "outputs": [],
151
- "source": [
152
- "from climateqa.engine.llm import get_llm\n",
153
- "import ast\n",
154
- "\n",
155
- "llm = get_llm(provider=\"openai\")\n",
156
- "columns = llm.invoke(f\"From the given sql query, list the columns that are being selected. The answer should only be a python list. Just answer the list. The SQL query SELECT 'Mean_winter_temperature' AS source_table, year, month, day, TMm FROM Mean_winter_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127;\").content\n",
157
- "columns_list = ast.literal_eval(columns.strip(\"```python\\n\").strip())\n"
158
- ]
159
- }
160
- ],
161
- "metadata": {
162
- "kernelspec": {
163
- "display_name": "climateqa",
164
- "language": "python",
165
- "name": "python3"
166
- },
167
- "language_info": {
168
- "name": "python",
169
- "version": "3.11.9"
170
- }
171
- },
172
- "nbformat": 4,
173
- "nbformat_minor": 2
174
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
climateqa/engine/talk_to_data/utils.py CHANGED
@@ -3,6 +3,7 @@ import openai
3
  import pandas as pd
4
  from geopy.geocoders import Nominatim
5
  import sqlite3
 
6
 
7
 
8
  def detect_location_with_openai(api_key, sentence):
@@ -61,4 +62,37 @@ def nearestNeighbourSQL(db: str, location: tuple, table : str):
61
  cursor = conn.cursor()
62
  cursor.execute(f"SELECT lat, lon FROM {table} WHERE lat BETWEEN {lat - 0.3} AND {lat + 0.3} AND lon BETWEEN {long - 0.3} AND {long + 0.3}")
63
  results = cursor.fetchall()
64
- return results[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  import pandas as pd
4
  from geopy.geocoders import Nominatim
5
  import sqlite3
6
+ import ast
7
 
8
 
9
  def detect_location_with_openai(api_key, sentence):
 
62
  cursor = conn.cursor()
63
  cursor.execute(f"SELECT lat, lon FROM {table} WHERE lat BETWEEN {lat - 0.3} AND {lat + 0.3} AND lon BETWEEN {long - 0.3} AND {long + 0.3}")
64
  results = cursor.fetchall()
65
+ return results[0]
66
+
67
+ def detect_relevant_tables(user_question, llm):
68
+ table_names_list = [
69
+ "Frequency_of_rainy_days_index",
70
+ "Winter_precipitation_total",
71
+ "Summer_precipitation_total",
72
+ "Annual_precipitation_total",
73
+ # "Remarkable_daily_precipitation_total_(Q99)",
74
+ "Frequency_of_remarkable_daily_precipitation",
75
+ "Extreme_precipitation_intensity",
76
+ "Mean_winter_temperature",
77
+ "Mean_summer_temperature",
78
+ "Number_of_tropical_nights",
79
+ "Maximum_summer_temperature",
80
+ "Number_of_days_with_Tx_above_30C",
81
+ "Number_of_days_with_Tx_above_35C",
82
+ "Drought_index"
83
+ ]
84
+ prompt = (
85
+ f"You are helping to build a sql query to retrieve relevant data for a user question."
86
+ f"The different tables are {table_names_list}."
87
+ f"The user question is {user_question}. Write the relevant tables to use. Answer only a python list of table name."
88
+ )
89
+ table_names = ast.literal_eval(llm.invoke(prompt).content.strip("```python\n").strip())
90
+ return table_names
91
+
92
+ def replace_coordonates(coords, query, coords_tables):
93
+ n = query.count(str(coords[0]))
94
+
95
+ for i in range(n):
96
+ query = query.replace(str(coords[0]), str(coords_tables[i][0]),1)
97
+ query = query.replace(str(coords[1]), str(coords_tables[i][1]),1)
98
+ return query
climateqa/engine/talk_to_data/vanna_class.py CHANGED
@@ -228,7 +228,9 @@ class MyCustomVectorDB(VannaBase):
228
  "4. Please use the most relevant table(s). \n"
229
  "5. If the question has been asked and answered before, please repeat the answer exactly as it was given before. \n"
230
  f"6. Ensure that the output SQL is {self.dialect}-compliant and executable, and free of syntax errors. \n"
231
- f"7. Add a description of the table in the result of the sql query, and latitude, logitude if relevant. \n"
 
 
232
  # "7. Add a description of the table in the result of the sql query."
233
  # "7. If the question is about a specific latitude, longitude, query an interval of 0.3 and keep only the first set of coordinate. \n"
234
  # "7. Table names should be included in the result of the sql query. Use for example Mean_winter_temperature AS table_name in the query \n"
 
228
  "4. Please use the most relevant table(s). \n"
229
  "5. If the question has been asked and answered before, please repeat the answer exactly as it was given before. \n"
230
  f"6. Ensure that the output SQL is {self.dialect}-compliant and executable, and free of syntax errors. \n"
231
+ f"7. Add a description of the table in the result of the sql query, if relevant. \n"
232
+ "8 Make sure to include the relevant KPI in the SQL query. The query should return impactfull data \n"
233
+ # f"8. If a set of latitude,longitude is provided, make a intermediate query to find the nearest value in the table and replace the coordinates in the sql query. \n"
234
  # "7. Add a description of the table in the result of the sql query."
235
  # "7. If the question is about a specific latitude, longitude, query an interval of 0.3 and keep only the first set of coordinate. \n"
236
  # "7. Table names should be included in the result of the sql query. Use for example Mean_winter_temperature AS table_name in the query \n"
sandbox/talk_to_data/20250306 - CQA - Drias.ipynb ADDED
@@ -0,0 +1,1184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "## Import the function in main.py"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [
15
+ {
16
+ "name": "stdout",
17
+ "output_type": "stream",
18
+ "text": [
19
+ "The autoreload extension is already loaded. To reload it, use:\n",
20
+ " %reload_ext autoreload\n",
21
+ "Loading embeddings model: BAAI/bge-base-en-v1.5\n"
22
+ ]
23
+ }
24
+ ],
25
+ "source": [
26
+ "import sys\n",
27
+ "import os\n",
28
+ "sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))\n",
29
+ "\n",
30
+ "%load_ext autoreload\n",
31
+ "%autoreload 2\n",
32
+ "\n",
33
+ "from climateqa.engine.talk_to_data.main import ask_vanna\n"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "markdown",
38
+ "metadata": {},
39
+ "source": [
40
+ "## Create a human query"
41
+ ]
42
+ },
43
+ {
44
+ "cell_type": "code",
45
+ "execution_count": null,
46
+ "metadata": {},
47
+ "outputs": [],
48
+ "source": [
49
+ "# query = \"Compare the winter and summer precipitation in 2050 in Marseille\"\n",
50
+ "# query = \"What is the impact of climate in Bordeaux?\"\n",
51
+ "# query = \"what is the number of days where the temperature above 35 in 2050 in Marseille\"\n",
52
+ "# query = \"Quelle sera la température à Marseille sur les prochaines années ?\"\n",
53
+ "query = \"Comment vont évoluer les températures à Marseille ?\""
54
+ ]
55
+ },
56
+ {
57
+ "cell_type": "markdown",
58
+ "metadata": {},
59
+ "source": [
60
+ "## Call the function ask vanna, it gives an output of a the sql query and the dataframe of the result (tuple)"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "code",
65
+ "execution_count": null,
66
+ "metadata": {},
67
+ "outputs": [
68
+ {
69
+ "name": "stdout",
70
+ "output_type": "stream",
71
+ "text": [
72
+ "SQL Prompt: [{'role': 'system', 'content': \"You are a SQLite expert. Please help to generate a SQL query to answer the question. Your response should ONLY be based on the given context and follow the response guidelines and format instructions. \\n===Tables \\nCREATE TABLE Mean_winter_temperature ( y FLOAT, x FLOAT, year INT, \\n month INT, \\n day INT \\n, LambertParisII VARCHAR(255), lat FLOAT, lon FLOAT, TMm FLOAT);\\n\\nCREATE TABLE Mean_winter_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT\\n);\\n\\nCREATE TABLE Mean_summer_temperature ( y FLOAT, x FLOAT, year INT, \\n month INT, \\n day INT \\n, LambertParisII VARCHAR(255), lat FLOAT, lon FLOAT, TMm FLOAT);\\n\\nCREATE TABLE Mean_summer_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT\\n);\\n\\n\\n===Additional Context \\n\\nThe Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the future\\nis greater than or equal to 35°C.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TX35D': Number of days with Tx ≥ 35°C.\\n\\nThe Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the futureis greater than or equal to 35°C.The variables are as follows:- 'y' and 'x': Lambert Paris II coordinates for the location.- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.- 'lat' and 'lon': Latitude and longitude of the location.- 'TX35D': Number of days with Tx ≥ 35°C.\\n\\nThe Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the futureis greater than or equal to 30°C.The variables are as follows:- 'y' and 'x': Lambert Paris II coordinates for the location.- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.- 'lat' and 'lon': Latitude and longitude of the location.- 'TX30D': Number of days with Tx ≥ 30°C.\\n\\nThe Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the future\\nis greater than or equal to 30°C.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TX30D': Number of days with Tx ≥ 30°C.\\n\\n===Response Guidelines \\n1. If the provided context is sufficient, please generate a valid SQL query without any explanations for the question. \\n2. If the provided context is almost sufficient but requires knowledge of a specific string in a particular column, please generate an intermediate SQL query to find the distinct strings in that column. Prepend the query with a comment saying intermediate_sql \\n3. If the provided context is insufficient, please give a sql query based on your knowledge and the context provided. \\n4. Please use the most relevant table(s). \\n5. If the question has been asked and answered before, please repeat the answer exactly as it was given before. \\n6. Ensure that the output SQL is SQLite-compliant and executable, and free of syntax errors. \\n7. Add a description of the table in the result of the sql query, if relevant. \\n8 Make sure to include the relevant KPI in the SQL query. The query should return impactfull data \\n\"}, {'role': 'user', 'content': 'Comment vont évoluer les températures à lat, long : (43.166954040527344, 5.430534839630127) ?'}]\n",
73
+ "Using model gpt-4o-mini for 1097.5 tokens (approx)\n",
74
+ "LLM Response: ```sql\n",
75
+ "-- intermediate_sql\n",
76
+ "SELECT DISTINCT year FROM Mean_winter_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
77
+ "UNION\n",
78
+ "SELECT DISTINCT year FROM Mean_summer_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127;\n",
79
+ "```\n",
80
+ "LLM Response: ```sql\n",
81
+ "-- intermediate_sql\n",
82
+ "SELECT DISTINCT year FROM Mean_winter_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
83
+ "UNION\n",
84
+ "SELECT DISTINCT year FROM Mean_summer_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127;\n",
85
+ "```\n",
86
+ "Extracted SQL: SELECT DISTINCT year FROM Mean_winter_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
87
+ "UNION\n",
88
+ "SELECT DISTINCT year FROM Mean_summer_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127;\n",
89
+ "Running Intermediate SQL: SELECT DISTINCT year FROM Mean_winter_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
90
+ "UNION\n",
91
+ "SELECT DISTINCT year FROM Mean_summer_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127;\n",
92
+ "Final SQL Prompt: [{'role': 'system', 'content': \"You are a SQLite expert. Please help to generate a SQL query to answer the question. Your response should ONLY be based on the given context and follow the response guidelines and format instructions. \\n===Tables \\nCREATE TABLE Mean_winter_temperature ( y FLOAT, x FLOAT, year INT, \\n month INT, \\n day INT \\n, LambertParisII VARCHAR(255), lat FLOAT, lon FLOAT, TMm FLOAT);\\n\\nCREATE TABLE Mean_winter_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT\\n);\\n\\nCREATE TABLE Mean_summer_temperature ( y FLOAT, x FLOAT, year INT, \\n month INT, \\n day INT \\n, LambertParisII VARCHAR(255), lat FLOAT, lon FLOAT, TMm FLOAT);\\n\\nCREATE TABLE Mean_summer_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT\\n);\\n\\n\\n===Additional Context \\n\\nThe Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the future\\nis greater than or equal to 35°C.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TX35D': Number of days with Tx ≥ 35°C.\\n\\nThe Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the futureis greater than or equal to 35°C.The variables are as follows:- 'y' and 'x': Lambert Paris II coordinates for the location.- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.- 'lat' and 'lon': Latitude and longitude of the location.- 'TX35D': Number of days with Tx ≥ 35°C.\\n\\nThe Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the futureis greater than or equal to 30°C.The variables are as follows:- 'y' and 'x': Lambert Paris II coordinates for the location.- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.- 'lat' and 'lon': Latitude and longitude of the location.- 'TX30D': Number of days with Tx ≥ 30°C.\\n\\nThe Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the future\\nis greater than or equal to 30°C.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TX30D': Number of days with Tx ≥ 30°C.\\n\\nThe following is a pandas DataFrame with the results of the intermediate SQL query SELECT DISTINCT year FROM Mean_winter_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\\nUNION\\nSELECT DISTINCT year FROM Mean_summer_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127;: \\n| | year |\\n|---:|-------:|\\n| 0 | 2031 |\\n| 1 | 2032 |\\n| 2 | 2033 |\\n| 3 | 2034 |\\n| 4 | 2035 |\\n| 5 | 2036 |\\n| 6 | 2037 |\\n| 7 | 2038 |\\n| 8 | 2039 |\\n| 9 | 2040 |\\n| 10 | 2041 |\\n| 11 | 2042 |\\n| 12 | 2043 |\\n| 13 | 2044 |\\n| 14 | 2045 |\\n| 15 | 2046 |\\n| 16 | 2047 |\\n| 17 | 2048 |\\n| 18 | 2049 |\\n| 19 | 2050 |\\n\\n===Response Guidelines \\n1. If the provided context is sufficient, please generate a valid SQL query without any explanations for the question. \\n2. If the provided context is almost sufficient but requires knowledge of a specific string in a particular column, please generate an intermediate SQL query to find the distinct strings in that column. Prepend the query with a comment saying intermediate_sql \\n3. If the provided context is insufficient, please give a sql query based on your knowledge and the context provided. \\n4. Please use the most relevant table(s). \\n5. If the question has been asked and answered before, please repeat the answer exactly as it was given before. \\n6. Ensure that the output SQL is SQLite-compliant and executable, and free of syntax errors. \\n7. Add a description of the table in the result of the sql query, if relevant. \\n8 Make sure to include the relevant KPI in the SQL query. The query should return impactfull data \\n\"}, {'role': 'user', 'content': 'Comment vont évoluer les températures à lat, long : (43.166954040527344, 5.430534839630127) ?'}]\n",
93
+ "Using model gpt-4o-mini for 1263.25 tokens (approx)\n",
94
+ "LLM Response: ```sql\n",
95
+ "SELECT year, AVG(TMm) AS avg_winter_temp, (SELECT AVG(TMm) FROM Mean_summer_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127 AND year = Mean_winter_temperature.year) AS avg_summer_temp\n",
96
+ "FROM Mean_winter_temperature\n",
97
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
98
+ "GROUP BY year\n",
99
+ "ORDER BY year;\n",
100
+ "```\n",
101
+ "Extracted SQL: SELECT year, AVG(TMm) AS avg_winter_temp, (SELECT AVG(TMm) FROM Mean_summer_temperature WHERE lat = 43.166954040527344 AND lon = 5.430534839630127 AND year = Mean_winter_temperature.year) AS avg_summer_temp\n",
102
+ "FROM Mean_winter_temperature\n",
103
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
104
+ "GROUP BY year\n",
105
+ "ORDER BY year;\n",
106
+ "Using model gpt-4o-mini for 264.25 tokens (approx)\n",
107
+ "execute sql query : SELECT year, AVG(TMm) AS avg_winter_temp, \n",
108
+ " (SELECT AVG(TMm) \n",
109
+ " FROM Mean_summer_temperature \n",
110
+ " WHERE lat = 43.166954040527344 \n",
111
+ " AND lon = 5.430534839630127 \n",
112
+ " AND year = Mean_winter_temperature.year) AS avg_summer_temp,\n",
113
+ " 'Mean_winter_temperature' AS source_table\n",
114
+ "FROM Mean_winter_temperature\n",
115
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
116
+ "GROUP BY year\n",
117
+ "ORDER BY year;\n",
118
+ "column list : ['year', 'avg_winter_temp', 'avg_summer_temp', 'source_table']\n",
119
+ "Using model gpt-4o-mini for 173.25 tokens (approx)\n",
120
+ " year avg_winter_temp avg_summer_temp source_table\n",
121
+ "0 2031 9.952474 24.061035 Mean_winter_temperature\n",
122
+ "1 2032 10.142323 24.530693 Mean_winter_temperature\n",
123
+ "2 2033 9.907943 24.722235 Mean_winter_temperature\n",
124
+ "3 2034 9.548874 23.846292 Mean_winter_temperature\n",
125
+ "4 2035 10.284758 24.231422 Mean_winter_temperature\n"
126
+ ]
127
+ },
128
+ {
129
+ "data": {
130
+ "application/vnd.plotly.v1+json": {
131
+ "config": {
132
+ "plotlyServerURL": "https://plot.ly"
133
+ },
134
+ "data": [
135
+ {
136
+ "hovertemplate": "variable=avg_winter_temp<br>Year=%{x}<br>Temperature=%{y}<extra></extra>",
137
+ "legendgroup": "avg_winter_temp",
138
+ "line": {
139
+ "color": "#636efa",
140
+ "dash": "solid"
141
+ },
142
+ "marker": {
143
+ "symbol": "circle"
144
+ },
145
+ "mode": "lines",
146
+ "name": "avg_winter_temp",
147
+ "orientation": "v",
148
+ "showlegend": true,
149
+ "type": "scatter",
150
+ "x": [
151
+ 2031,
152
+ 2032,
153
+ 2033,
154
+ 2034,
155
+ 2035,
156
+ 2036,
157
+ 2037,
158
+ 2038,
159
+ 2039,
160
+ 2040,
161
+ 2041,
162
+ 2042,
163
+ 2043,
164
+ 2044,
165
+ 2045,
166
+ 2046,
167
+ 2047,
168
+ 2048,
169
+ 2049,
170
+ 2050
171
+ ],
172
+ "xaxis": "x",
173
+ "y": [
174
+ 9.952474117647114,
175
+ 10.142322941176474,
176
+ 9.907942941176486,
177
+ 9.548873529411765,
178
+ 10.284758235294191,
179
+ 10.372100000000046,
180
+ 9.98571000000004,
181
+ 10.221372352941216,
182
+ 10.222609411764722,
183
+ 10.473662941176485,
184
+ 10.427640588235306,
185
+ 10.364736470588241,
186
+ 10.112910588235309,
187
+ 10.250792352941176,
188
+ 10.166119411764669,
189
+ 10.728997647058861,
190
+ 10.347248823529412,
191
+ 10.706604117647089,
192
+ 10.59243764705883,
193
+ 10.63225529411767
194
+ ],
195
+ "yaxis": "y"
196
+ },
197
+ {
198
+ "hovertemplate": "variable=avg_summer_temp<br>Year=%{x}<br>Temperature=%{y}<extra></extra>",
199
+ "legendgroup": "avg_summer_temp",
200
+ "line": {
201
+ "color": "#EF553B",
202
+ "dash": "solid"
203
+ },
204
+ "marker": {
205
+ "symbol": "circle"
206
+ },
207
+ "mode": "lines",
208
+ "name": "avg_summer_temp",
209
+ "orientation": "v",
210
+ "showlegend": true,
211
+ "type": "scatter",
212
+ "x": [
213
+ 2031,
214
+ 2032,
215
+ 2033,
216
+ 2034,
217
+ 2035,
218
+ 2036,
219
+ 2037,
220
+ 2038,
221
+ 2039,
222
+ 2040,
223
+ 2041,
224
+ 2042,
225
+ 2043,
226
+ 2044,
227
+ 2045,
228
+ 2046,
229
+ 2047,
230
+ 2048,
231
+ 2049,
232
+ 2050
233
+ ],
234
+ "xaxis": "x",
235
+ "y": [
236
+ 24.061035294117687,
237
+ 24.530692941176483,
238
+ 24.722234705882386,
239
+ 23.84629176470588,
240
+ 24.231422352941195,
241
+ 24.488941764705885,
242
+ 24.79424117647062,
243
+ 24.730553529411793,
244
+ 24.44979882352942,
245
+ 24.40726882352942,
246
+ 24.768547647058824,
247
+ 24.53479647058822,
248
+ 24.769181176470624,
249
+ 24.489877058823538,
250
+ 24.448076470588262,
251
+ 25.111282352941203,
252
+ 24.72313823529413,
253
+ 25.187577058823535,
254
+ 24.829653529411814,
255
+ 25.053394117647144
256
+ ],
257
+ "yaxis": "y"
258
+ }
259
+ ],
260
+ "layout": {
261
+ "legend": {
262
+ "title": {
263
+ "text": "variable"
264
+ },
265
+ "tracegroupgap": 0
266
+ },
267
+ "template": {
268
+ "data": {
269
+ "bar": [
270
+ {
271
+ "error_x": {
272
+ "color": "#f2f5fa"
273
+ },
274
+ "error_y": {
275
+ "color": "#f2f5fa"
276
+ },
277
+ "marker": {
278
+ "line": {
279
+ "color": "rgb(17,17,17)",
280
+ "width": 0.5
281
+ },
282
+ "pattern": {
283
+ "fillmode": "overlay",
284
+ "size": 10,
285
+ "solidity": 0.2
286
+ }
287
+ },
288
+ "type": "bar"
289
+ }
290
+ ],
291
+ "barpolar": [
292
+ {
293
+ "marker": {
294
+ "line": {
295
+ "color": "rgb(17,17,17)",
296
+ "width": 0.5
297
+ },
298
+ "pattern": {
299
+ "fillmode": "overlay",
300
+ "size": 10,
301
+ "solidity": 0.2
302
+ }
303
+ },
304
+ "type": "barpolar"
305
+ }
306
+ ],
307
+ "carpet": [
308
+ {
309
+ "aaxis": {
310
+ "endlinecolor": "#A2B1C6",
311
+ "gridcolor": "#506784",
312
+ "linecolor": "#506784",
313
+ "minorgridcolor": "#506784",
314
+ "startlinecolor": "#A2B1C6"
315
+ },
316
+ "baxis": {
317
+ "endlinecolor": "#A2B1C6",
318
+ "gridcolor": "#506784",
319
+ "linecolor": "#506784",
320
+ "minorgridcolor": "#506784",
321
+ "startlinecolor": "#A2B1C6"
322
+ },
323
+ "type": "carpet"
324
+ }
325
+ ],
326
+ "choropleth": [
327
+ {
328
+ "colorbar": {
329
+ "outlinewidth": 0,
330
+ "ticks": ""
331
+ },
332
+ "type": "choropleth"
333
+ }
334
+ ],
335
+ "contour": [
336
+ {
337
+ "colorbar": {
338
+ "outlinewidth": 0,
339
+ "ticks": ""
340
+ },
341
+ "colorscale": [
342
+ [
343
+ 0,
344
+ "#0d0887"
345
+ ],
346
+ [
347
+ 0.1111111111111111,
348
+ "#46039f"
349
+ ],
350
+ [
351
+ 0.2222222222222222,
352
+ "#7201a8"
353
+ ],
354
+ [
355
+ 0.3333333333333333,
356
+ "#9c179e"
357
+ ],
358
+ [
359
+ 0.4444444444444444,
360
+ "#bd3786"
361
+ ],
362
+ [
363
+ 0.5555555555555556,
364
+ "#d8576b"
365
+ ],
366
+ [
367
+ 0.6666666666666666,
368
+ "#ed7953"
369
+ ],
370
+ [
371
+ 0.7777777777777778,
372
+ "#fb9f3a"
373
+ ],
374
+ [
375
+ 0.8888888888888888,
376
+ "#fdca26"
377
+ ],
378
+ [
379
+ 1,
380
+ "#f0f921"
381
+ ]
382
+ ],
383
+ "type": "contour"
384
+ }
385
+ ],
386
+ "contourcarpet": [
387
+ {
388
+ "colorbar": {
389
+ "outlinewidth": 0,
390
+ "ticks": ""
391
+ },
392
+ "type": "contourcarpet"
393
+ }
394
+ ],
395
+ "heatmap": [
396
+ {
397
+ "colorbar": {
398
+ "outlinewidth": 0,
399
+ "ticks": ""
400
+ },
401
+ "colorscale": [
402
+ [
403
+ 0,
404
+ "#0d0887"
405
+ ],
406
+ [
407
+ 0.1111111111111111,
408
+ "#46039f"
409
+ ],
410
+ [
411
+ 0.2222222222222222,
412
+ "#7201a8"
413
+ ],
414
+ [
415
+ 0.3333333333333333,
416
+ "#9c179e"
417
+ ],
418
+ [
419
+ 0.4444444444444444,
420
+ "#bd3786"
421
+ ],
422
+ [
423
+ 0.5555555555555556,
424
+ "#d8576b"
425
+ ],
426
+ [
427
+ 0.6666666666666666,
428
+ "#ed7953"
429
+ ],
430
+ [
431
+ 0.7777777777777778,
432
+ "#fb9f3a"
433
+ ],
434
+ [
435
+ 0.8888888888888888,
436
+ "#fdca26"
437
+ ],
438
+ [
439
+ 1,
440
+ "#f0f921"
441
+ ]
442
+ ],
443
+ "type": "heatmap"
444
+ }
445
+ ],
446
+ "heatmapgl": [
447
+ {
448
+ "colorbar": {
449
+ "outlinewidth": 0,
450
+ "ticks": ""
451
+ },
452
+ "colorscale": [
453
+ [
454
+ 0,
455
+ "#0d0887"
456
+ ],
457
+ [
458
+ 0.1111111111111111,
459
+ "#46039f"
460
+ ],
461
+ [
462
+ 0.2222222222222222,
463
+ "#7201a8"
464
+ ],
465
+ [
466
+ 0.3333333333333333,
467
+ "#9c179e"
468
+ ],
469
+ [
470
+ 0.4444444444444444,
471
+ "#bd3786"
472
+ ],
473
+ [
474
+ 0.5555555555555556,
475
+ "#d8576b"
476
+ ],
477
+ [
478
+ 0.6666666666666666,
479
+ "#ed7953"
480
+ ],
481
+ [
482
+ 0.7777777777777778,
483
+ "#fb9f3a"
484
+ ],
485
+ [
486
+ 0.8888888888888888,
487
+ "#fdca26"
488
+ ],
489
+ [
490
+ 1,
491
+ "#f0f921"
492
+ ]
493
+ ],
494
+ "type": "heatmapgl"
495
+ }
496
+ ],
497
+ "histogram": [
498
+ {
499
+ "marker": {
500
+ "pattern": {
501
+ "fillmode": "overlay",
502
+ "size": 10,
503
+ "solidity": 0.2
504
+ }
505
+ },
506
+ "type": "histogram"
507
+ }
508
+ ],
509
+ "histogram2d": [
510
+ {
511
+ "colorbar": {
512
+ "outlinewidth": 0,
513
+ "ticks": ""
514
+ },
515
+ "colorscale": [
516
+ [
517
+ 0,
518
+ "#0d0887"
519
+ ],
520
+ [
521
+ 0.1111111111111111,
522
+ "#46039f"
523
+ ],
524
+ [
525
+ 0.2222222222222222,
526
+ "#7201a8"
527
+ ],
528
+ [
529
+ 0.3333333333333333,
530
+ "#9c179e"
531
+ ],
532
+ [
533
+ 0.4444444444444444,
534
+ "#bd3786"
535
+ ],
536
+ [
537
+ 0.5555555555555556,
538
+ "#d8576b"
539
+ ],
540
+ [
541
+ 0.6666666666666666,
542
+ "#ed7953"
543
+ ],
544
+ [
545
+ 0.7777777777777778,
546
+ "#fb9f3a"
547
+ ],
548
+ [
549
+ 0.8888888888888888,
550
+ "#fdca26"
551
+ ],
552
+ [
553
+ 1,
554
+ "#f0f921"
555
+ ]
556
+ ],
557
+ "type": "histogram2d"
558
+ }
559
+ ],
560
+ "histogram2dcontour": [
561
+ {
562
+ "colorbar": {
563
+ "outlinewidth": 0,
564
+ "ticks": ""
565
+ },
566
+ "colorscale": [
567
+ [
568
+ 0,
569
+ "#0d0887"
570
+ ],
571
+ [
572
+ 0.1111111111111111,
573
+ "#46039f"
574
+ ],
575
+ [
576
+ 0.2222222222222222,
577
+ "#7201a8"
578
+ ],
579
+ [
580
+ 0.3333333333333333,
581
+ "#9c179e"
582
+ ],
583
+ [
584
+ 0.4444444444444444,
585
+ "#bd3786"
586
+ ],
587
+ [
588
+ 0.5555555555555556,
589
+ "#d8576b"
590
+ ],
591
+ [
592
+ 0.6666666666666666,
593
+ "#ed7953"
594
+ ],
595
+ [
596
+ 0.7777777777777778,
597
+ "#fb9f3a"
598
+ ],
599
+ [
600
+ 0.8888888888888888,
601
+ "#fdca26"
602
+ ],
603
+ [
604
+ 1,
605
+ "#f0f921"
606
+ ]
607
+ ],
608
+ "type": "histogram2dcontour"
609
+ }
610
+ ],
611
+ "mesh3d": [
612
+ {
613
+ "colorbar": {
614
+ "outlinewidth": 0,
615
+ "ticks": ""
616
+ },
617
+ "type": "mesh3d"
618
+ }
619
+ ],
620
+ "parcoords": [
621
+ {
622
+ "line": {
623
+ "colorbar": {
624
+ "outlinewidth": 0,
625
+ "ticks": ""
626
+ }
627
+ },
628
+ "type": "parcoords"
629
+ }
630
+ ],
631
+ "pie": [
632
+ {
633
+ "automargin": true,
634
+ "type": "pie"
635
+ }
636
+ ],
637
+ "scatter": [
638
+ {
639
+ "marker": {
640
+ "line": {
641
+ "color": "#283442"
642
+ }
643
+ },
644
+ "type": "scatter"
645
+ }
646
+ ],
647
+ "scatter3d": [
648
+ {
649
+ "line": {
650
+ "colorbar": {
651
+ "outlinewidth": 0,
652
+ "ticks": ""
653
+ }
654
+ },
655
+ "marker": {
656
+ "colorbar": {
657
+ "outlinewidth": 0,
658
+ "ticks": ""
659
+ }
660
+ },
661
+ "type": "scatter3d"
662
+ }
663
+ ],
664
+ "scattercarpet": [
665
+ {
666
+ "marker": {
667
+ "colorbar": {
668
+ "outlinewidth": 0,
669
+ "ticks": ""
670
+ }
671
+ },
672
+ "type": "scattercarpet"
673
+ }
674
+ ],
675
+ "scattergeo": [
676
+ {
677
+ "marker": {
678
+ "colorbar": {
679
+ "outlinewidth": 0,
680
+ "ticks": ""
681
+ }
682
+ },
683
+ "type": "scattergeo"
684
+ }
685
+ ],
686
+ "scattergl": [
687
+ {
688
+ "marker": {
689
+ "line": {
690
+ "color": "#283442"
691
+ }
692
+ },
693
+ "type": "scattergl"
694
+ }
695
+ ],
696
+ "scattermapbox": [
697
+ {
698
+ "marker": {
699
+ "colorbar": {
700
+ "outlinewidth": 0,
701
+ "ticks": ""
702
+ }
703
+ },
704
+ "type": "scattermapbox"
705
+ }
706
+ ],
707
+ "scatterpolar": [
708
+ {
709
+ "marker": {
710
+ "colorbar": {
711
+ "outlinewidth": 0,
712
+ "ticks": ""
713
+ }
714
+ },
715
+ "type": "scatterpolar"
716
+ }
717
+ ],
718
+ "scatterpolargl": [
719
+ {
720
+ "marker": {
721
+ "colorbar": {
722
+ "outlinewidth": 0,
723
+ "ticks": ""
724
+ }
725
+ },
726
+ "type": "scatterpolargl"
727
+ }
728
+ ],
729
+ "scatterternary": [
730
+ {
731
+ "marker": {
732
+ "colorbar": {
733
+ "outlinewidth": 0,
734
+ "ticks": ""
735
+ }
736
+ },
737
+ "type": "scatterternary"
738
+ }
739
+ ],
740
+ "surface": [
741
+ {
742
+ "colorbar": {
743
+ "outlinewidth": 0,
744
+ "ticks": ""
745
+ },
746
+ "colorscale": [
747
+ [
748
+ 0,
749
+ "#0d0887"
750
+ ],
751
+ [
752
+ 0.1111111111111111,
753
+ "#46039f"
754
+ ],
755
+ [
756
+ 0.2222222222222222,
757
+ "#7201a8"
758
+ ],
759
+ [
760
+ 0.3333333333333333,
761
+ "#9c179e"
762
+ ],
763
+ [
764
+ 0.4444444444444444,
765
+ "#bd3786"
766
+ ],
767
+ [
768
+ 0.5555555555555556,
769
+ "#d8576b"
770
+ ],
771
+ [
772
+ 0.6666666666666666,
773
+ "#ed7953"
774
+ ],
775
+ [
776
+ 0.7777777777777778,
777
+ "#fb9f3a"
778
+ ],
779
+ [
780
+ 0.8888888888888888,
781
+ "#fdca26"
782
+ ],
783
+ [
784
+ 1,
785
+ "#f0f921"
786
+ ]
787
+ ],
788
+ "type": "surface"
789
+ }
790
+ ],
791
+ "table": [
792
+ {
793
+ "cells": {
794
+ "fill": {
795
+ "color": "#506784"
796
+ },
797
+ "line": {
798
+ "color": "rgb(17,17,17)"
799
+ }
800
+ },
801
+ "header": {
802
+ "fill": {
803
+ "color": "#2a3f5f"
804
+ },
805
+ "line": {
806
+ "color": "rgb(17,17,17)"
807
+ }
808
+ },
809
+ "type": "table"
810
+ }
811
+ ]
812
+ },
813
+ "layout": {
814
+ "annotationdefaults": {
815
+ "arrowcolor": "#f2f5fa",
816
+ "arrowhead": 0,
817
+ "arrowwidth": 1
818
+ },
819
+ "autotypenumbers": "strict",
820
+ "coloraxis": {
821
+ "colorbar": {
822
+ "outlinewidth": 0,
823
+ "ticks": ""
824
+ }
825
+ },
826
+ "colorscale": {
827
+ "diverging": [
828
+ [
829
+ 0,
830
+ "#8e0152"
831
+ ],
832
+ [
833
+ 0.1,
834
+ "#c51b7d"
835
+ ],
836
+ [
837
+ 0.2,
838
+ "#de77ae"
839
+ ],
840
+ [
841
+ 0.3,
842
+ "#f1b6da"
843
+ ],
844
+ [
845
+ 0.4,
846
+ "#fde0ef"
847
+ ],
848
+ [
849
+ 0.5,
850
+ "#f7f7f7"
851
+ ],
852
+ [
853
+ 0.6,
854
+ "#e6f5d0"
855
+ ],
856
+ [
857
+ 0.7,
858
+ "#b8e186"
859
+ ],
860
+ [
861
+ 0.8,
862
+ "#7fbc41"
863
+ ],
864
+ [
865
+ 0.9,
866
+ "#4d9221"
867
+ ],
868
+ [
869
+ 1,
870
+ "#276419"
871
+ ]
872
+ ],
873
+ "sequential": [
874
+ [
875
+ 0,
876
+ "#0d0887"
877
+ ],
878
+ [
879
+ 0.1111111111111111,
880
+ "#46039f"
881
+ ],
882
+ [
883
+ 0.2222222222222222,
884
+ "#7201a8"
885
+ ],
886
+ [
887
+ 0.3333333333333333,
888
+ "#9c179e"
889
+ ],
890
+ [
891
+ 0.4444444444444444,
892
+ "#bd3786"
893
+ ],
894
+ [
895
+ 0.5555555555555556,
896
+ "#d8576b"
897
+ ],
898
+ [
899
+ 0.6666666666666666,
900
+ "#ed7953"
901
+ ],
902
+ [
903
+ 0.7777777777777778,
904
+ "#fb9f3a"
905
+ ],
906
+ [
907
+ 0.8888888888888888,
908
+ "#fdca26"
909
+ ],
910
+ [
911
+ 1,
912
+ "#f0f921"
913
+ ]
914
+ ],
915
+ "sequentialminus": [
916
+ [
917
+ 0,
918
+ "#0d0887"
919
+ ],
920
+ [
921
+ 0.1111111111111111,
922
+ "#46039f"
923
+ ],
924
+ [
925
+ 0.2222222222222222,
926
+ "#7201a8"
927
+ ],
928
+ [
929
+ 0.3333333333333333,
930
+ "#9c179e"
931
+ ],
932
+ [
933
+ 0.4444444444444444,
934
+ "#bd3786"
935
+ ],
936
+ [
937
+ 0.5555555555555556,
938
+ "#d8576b"
939
+ ],
940
+ [
941
+ 0.6666666666666666,
942
+ "#ed7953"
943
+ ],
944
+ [
945
+ 0.7777777777777778,
946
+ "#fb9f3a"
947
+ ],
948
+ [
949
+ 0.8888888888888888,
950
+ "#fdca26"
951
+ ],
952
+ [
953
+ 1,
954
+ "#f0f921"
955
+ ]
956
+ ]
957
+ },
958
+ "colorway": [
959
+ "#636efa",
960
+ "#EF553B",
961
+ "#00cc96",
962
+ "#ab63fa",
963
+ "#FFA15A",
964
+ "#19d3f3",
965
+ "#FF6692",
966
+ "#B6E880",
967
+ "#FF97FF",
968
+ "#FECB52"
969
+ ],
970
+ "font": {
971
+ "color": "#f2f5fa"
972
+ },
973
+ "geo": {
974
+ "bgcolor": "rgb(17,17,17)",
975
+ "lakecolor": "rgb(17,17,17)",
976
+ "landcolor": "rgb(17,17,17)",
977
+ "showlakes": true,
978
+ "showland": true,
979
+ "subunitcolor": "#506784"
980
+ },
981
+ "hoverlabel": {
982
+ "align": "left"
983
+ },
984
+ "hovermode": "closest",
985
+ "mapbox": {
986
+ "style": "dark"
987
+ },
988
+ "paper_bgcolor": "rgb(17,17,17)",
989
+ "plot_bgcolor": "rgb(17,17,17)",
990
+ "polar": {
991
+ "angularaxis": {
992
+ "gridcolor": "#506784",
993
+ "linecolor": "#506784",
994
+ "ticks": ""
995
+ },
996
+ "bgcolor": "rgb(17,17,17)",
997
+ "radialaxis": {
998
+ "gridcolor": "#506784",
999
+ "linecolor": "#506784",
1000
+ "ticks": ""
1001
+ }
1002
+ },
1003
+ "scene": {
1004
+ "xaxis": {
1005
+ "backgroundcolor": "rgb(17,17,17)",
1006
+ "gridcolor": "#506784",
1007
+ "gridwidth": 2,
1008
+ "linecolor": "#506784",
1009
+ "showbackground": true,
1010
+ "ticks": "",
1011
+ "zerolinecolor": "#C8D4E3"
1012
+ },
1013
+ "yaxis": {
1014
+ "backgroundcolor": "rgb(17,17,17)",
1015
+ "gridcolor": "#506784",
1016
+ "gridwidth": 2,
1017
+ "linecolor": "#506784",
1018
+ "showbackground": true,
1019
+ "ticks": "",
1020
+ "zerolinecolor": "#C8D4E3"
1021
+ },
1022
+ "zaxis": {
1023
+ "backgroundcolor": "rgb(17,17,17)",
1024
+ "gridcolor": "#506784",
1025
+ "gridwidth": 2,
1026
+ "linecolor": "#506784",
1027
+ "showbackground": true,
1028
+ "ticks": "",
1029
+ "zerolinecolor": "#C8D4E3"
1030
+ }
1031
+ },
1032
+ "shapedefaults": {
1033
+ "line": {
1034
+ "color": "#f2f5fa"
1035
+ }
1036
+ },
1037
+ "sliderdefaults": {
1038
+ "bgcolor": "#C8D4E3",
1039
+ "bordercolor": "rgb(17,17,17)",
1040
+ "borderwidth": 1,
1041
+ "tickwidth": 0
1042
+ },
1043
+ "ternary": {
1044
+ "aaxis": {
1045
+ "gridcolor": "#506784",
1046
+ "linecolor": "#506784",
1047
+ "ticks": ""
1048
+ },
1049
+ "baxis": {
1050
+ "gridcolor": "#506784",
1051
+ "linecolor": "#506784",
1052
+ "ticks": ""
1053
+ },
1054
+ "bgcolor": "rgb(17,17,17)",
1055
+ "caxis": {
1056
+ "gridcolor": "#506784",
1057
+ "linecolor": "#506784",
1058
+ "ticks": ""
1059
+ }
1060
+ },
1061
+ "title": {
1062
+ "x": 0.05
1063
+ },
1064
+ "updatemenudefaults": {
1065
+ "bgcolor": "#506784",
1066
+ "borderwidth": 0
1067
+ },
1068
+ "xaxis": {
1069
+ "automargin": true,
1070
+ "gridcolor": "#283442",
1071
+ "linecolor": "#506784",
1072
+ "ticks": "",
1073
+ "title": {
1074
+ "standoff": 15
1075
+ },
1076
+ "zerolinecolor": "#283442",
1077
+ "zerolinewidth": 2
1078
+ },
1079
+ "yaxis": {
1080
+ "automargin": true,
1081
+ "gridcolor": "#283442",
1082
+ "linecolor": "#506784",
1083
+ "ticks": "",
1084
+ "title": {
1085
+ "standoff": 15
1086
+ },
1087
+ "zerolinecolor": "#283442",
1088
+ "zerolinewidth": 2
1089
+ }
1090
+ }
1091
+ },
1092
+ "title": {
1093
+ "text": "Average Winter and Summer Temperatures Over Years"
1094
+ },
1095
+ "xaxis": {
1096
+ "anchor": "y",
1097
+ "domain": [
1098
+ 0,
1099
+ 1
1100
+ ],
1101
+ "title": {
1102
+ "text": "Year"
1103
+ }
1104
+ },
1105
+ "yaxis": {
1106
+ "anchor": "x",
1107
+ "domain": [
1108
+ 0,
1109
+ 1
1110
+ ],
1111
+ "title": {
1112
+ "text": "Temperature"
1113
+ }
1114
+ }
1115
+ }
1116
+ },
1117
+ "text/html": [
1118
+ "<div> <div id=\"23e07085-e6fd-4d41-828f-581a93dd2540\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"23e07085-e6fd-4d41-828f-581a93dd2540\")) { Plotly.newPlot( \"23e07085-e6fd-4d41-828f-581a93dd2540\", [{\"hovertemplate\":\"variable=avg_winter_temp\\u003cbr\\u003eYear=%{x}\\u003cbr\\u003eTemperature=%{y}\\u003cextra\\u003e\\u003c\\u002fextra\\u003e\",\"legendgroup\":\"avg_winter_temp\",\"line\":{\"color\":\"#636efa\",\"dash\":\"solid\"},\"marker\":{\"symbol\":\"circle\"},\"mode\":\"lines\",\"name\":\"avg_winter_temp\",\"orientation\":\"v\",\"showlegend\":true,\"x\":[2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050],\"xaxis\":\"x\",\"y\":[9.952474117647114,10.142322941176474,9.907942941176486,9.548873529411765,10.284758235294191,10.372100000000046,9.98571000000004,10.221372352941216,10.222609411764722,10.473662941176485,10.427640588235306,10.364736470588241,10.112910588235309,10.250792352941176,10.166119411764669,10.728997647058861,10.347248823529412,10.706604117647089,10.59243764705883,10.63225529411767],\"yaxis\":\"y\",\"type\":\"scatter\"},{\"hovertemplate\":\"variable=avg_summer_temp\\u003cbr\\u003eYear=%{x}\\u003cbr\\u003eTemperature=%{y}\\u003cextra\\u003e\\u003c\\u002fextra\\u003e\",\"legendgroup\":\"avg_summer_temp\",\"line\":{\"color\":\"#EF553B\",\"dash\":\"solid\"},\"marker\":{\"symbol\":\"circle\"},\"mode\":\"lines\",\"name\":\"avg_summer_temp\",\"orientation\":\"v\",\"showlegend\":true,\"x\":[2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050],\"xaxis\":\"x\",\"y\":[24.061035294117687,24.530692941176483,24.722234705882386,23.84629176470588,24.231422352941195,24.488941764705885,24.79424117647062,24.730553529411793,24.44979882352942,24.40726882352942,24.768547647058824,24.53479647058822,24.769181176470624,24.489877058823538,24.448076470588262,25.111282352941203,24.72313823529413,25.187577058823535,24.829653529411814,25.053394117647144],\"yaxis\":\"y\",\"type\":\"scatter\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgb(17,17,17)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#f2f5fa\"},\"error_y\":{\"color\":\"#f2f5fa\"},\"marker\":{\"line\":{\"color\":\"rgb(17,17,17)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#A2B1C6\",\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"minorgridcolor\":\"#506784\",\"startlinecolor\":\"#A2B1C6\"},\"baxis\":{\"endlinecolor\":\"#A2B1C6\",\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"minorgridcolor\":\"#506784\",\"startlinecolor\":\"#A2B1C6\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"line\":{\"color\":\"#283442\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattermapbox\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolargl\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolar\"}],\"scatter\":[{\"marker\":{\"line\":{\"color\":\"#283442\"}},\"type\":\"scatter\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#506784\"},\"line\":{\"color\":\"rgb(17,17,17)\"}},\"header\":{\"fill\":{\"color\":\"#2a3f5f\"},\"line\":{\"color\":\"rgb(17,17,17)\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowcolor\":\"#f2f5fa\",\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#f2f5fa\"},\"geo\":{\"bgcolor\":\"rgb(17,17,17)\",\"lakecolor\":\"rgb(17,17,17)\",\"landcolor\":\"rgb(17,17,17)\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"#506784\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"mapbox\":{\"style\":\"dark\"},\"paper_bgcolor\":\"rgb(17,17,17)\",\"plot_bgcolor\":\"rgb(17,17,17)\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"},\"bgcolor\":\"rgb(17,17,17)\",\"radialaxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"rgb(17,17,17)\",\"gridcolor\":\"#506784\",\"gridwidth\":2,\"linecolor\":\"#506784\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"#C8D4E3\"},\"yaxis\":{\"backgroundcolor\":\"rgb(17,17,17)\",\"gridcolor\":\"#506784\",\"gridwidth\":2,\"linecolor\":\"#506784\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"#C8D4E3\"},\"zaxis\":{\"backgroundcolor\":\"rgb(17,17,17)\",\"gridcolor\":\"#506784\",\"gridwidth\":2,\"linecolor\":\"#506784\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"#C8D4E3\"}},\"shapedefaults\":{\"line\":{\"color\":\"#f2f5fa\"}},\"sliderdefaults\":{\"bgcolor\":\"#C8D4E3\",\"bordercolor\":\"rgb(17,17,17)\",\"borderwidth\":1,\"tickwidth\":0},\"ternary\":{\"aaxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"},\"bgcolor\":\"rgb(17,17,17)\",\"caxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"}},\"title\":{\"x\":0.05},\"updatemenudefaults\":{\"bgcolor\":\"#506784\",\"borderwidth\":0},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"#283442\",\"linecolor\":\"#506784\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"#283442\",\"zerolinewidth\":2},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"#283442\",\"linecolor\":\"#506784\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"#283442\",\"zerolinewidth\":2}}},\"xaxis\":{\"anchor\":\"y\",\"domain\":[0.0,1.0],\"title\":{\"text\":\"Year\"}},\"yaxis\":{\"anchor\":\"x\",\"domain\":[0.0,1.0],\"title\":{\"text\":\"Temperature\"}},\"legend\":{\"title\":{\"text\":\"variable\"},\"tracegroupgap\":0},\"title\":{\"text\":\"Average Winter and Summer Temperatures Over Years\"}}, {\"responsive\": true} ).then(function(){\n",
1119
+ " \n",
1120
+ "var gd = document.getElementById('23e07085-e6fd-4d41-828f-581a93dd2540');\n",
1121
+ "var x = new MutationObserver(function (mutations, observer) {{\n",
1122
+ " var display = window.getComputedStyle(gd).display;\n",
1123
+ " if (!display || display === 'none') {{\n",
1124
+ " console.log([gd, 'removed!']);\n",
1125
+ " Plotly.purge(gd);\n",
1126
+ " observer.disconnect();\n",
1127
+ " }}\n",
1128
+ "}});\n",
1129
+ "\n",
1130
+ "// Listen for the removal of the full notebook cells\n",
1131
+ "var notebookContainer = gd.closest('#notebook-container');\n",
1132
+ "if (notebookContainer) {{\n",
1133
+ " x.observe(notebookContainer, {childList: true});\n",
1134
+ "}}\n",
1135
+ "\n",
1136
+ "// Listen for the clearing of the current output cell\n",
1137
+ "var outputEl = gd.closest('.output');\n",
1138
+ "if (outputEl) {{\n",
1139
+ " x.observe(outputEl, {childList: true});\n",
1140
+ "}}\n",
1141
+ "\n",
1142
+ " }) }; }); </script> </div>"
1143
+ ]
1144
+ },
1145
+ "metadata": {},
1146
+ "output_type": "display_data"
1147
+ }
1148
+ ],
1149
+ "source": [
1150
+ "df, fig = ask_vanna(query)\n",
1151
+ "print(df.head())\n",
1152
+ "fig.show()"
1153
+ ]
1154
+ },
1155
+ {
1156
+ "cell_type": "code",
1157
+ "execution_count": null,
1158
+ "metadata": {},
1159
+ "outputs": [],
1160
+ "source": []
1161
+ }
1162
+ ],
1163
+ "metadata": {
1164
+ "kernelspec": {
1165
+ "display_name": "climateqa",
1166
+ "language": "python",
1167
+ "name": "python3"
1168
+ },
1169
+ "language_info": {
1170
+ "codemirror_mode": {
1171
+ "name": "ipython",
1172
+ "version": 3
1173
+ },
1174
+ "file_extension": ".py",
1175
+ "mimetype": "text/x-python",
1176
+ "name": "python",
1177
+ "nbconvert_exporter": "python",
1178
+ "pygments_lexer": "ipython3",
1179
+ "version": "3.11.9"
1180
+ }
1181
+ },
1182
+ "nbformat": 4,
1183
+ "nbformat_minor": 2
1184
+ }
sandbox/talk_to_data/20250306 - CQA - Step_by_step_vanna.ipynb ADDED
@@ -0,0 +1,1505 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 3,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "The autoreload extension is already loaded. To reload it, use:\n",
13
+ " %reload_ext autoreload\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import sys\n",
19
+ "import os\n",
20
+ "sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))\n",
21
+ "\n",
22
+ "%load_ext autoreload\n",
23
+ "%autoreload 2\n",
24
+ "\n",
25
+ "from climateqa.engine.talk_to_data.main import ask_vanna\n",
26
+ "\n",
27
+ "import sqlite3\n",
28
+ "import os\n",
29
+ "import pandas as pd"
30
+ ]
31
+ },
32
+ {
33
+ "cell_type": "markdown",
34
+ "metadata": {},
35
+ "source": [
36
+ "# Imports"
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 13,
42
+ "metadata": {},
43
+ "outputs": [],
44
+ "source": [
45
+ "from climateqa.engine.talk_to_data.myVanna import MyVanna\n",
46
+ "from climateqa.engine.talk_to_data.utils import loc2coords, detect_location_with_openai, detectTable, nearestNeighbourSQL, detect_relevant_tables, replace_coordonates\n",
47
+ "\n",
48
+ "from climateqa.engine.llm import get_llm"
49
+ ]
50
+ },
51
+ {
52
+ "cell_type": "markdown",
53
+ "metadata": {},
54
+ "source": [
55
+ "# Vanna Ask\n"
56
+ ]
57
+ },
58
+ {
59
+ "cell_type": "code",
60
+ "execution_count": null,
61
+ "metadata": {},
62
+ "outputs": [
63
+ {
64
+ "name": "stdout",
65
+ "output_type": "stream",
66
+ "text": [
67
+ "Loading embeddings model: BAAI/bge-base-en-v1.5\n"
68
+ ]
69
+ }
70
+ ],
71
+ "source": [
72
+ "from dotenv import load_dotenv\n",
73
+ "\n",
74
+ "load_dotenv()\n",
75
+ "\n",
76
+ "llm = get_llm(provider=\"openai\")\n",
77
+ "\n",
78
+ "OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')\n",
79
+ "PC_API_KEY = os.getenv('VANNA_PINECONE_API_KEY')\n",
80
+ "INDEX_NAME = os.getenv('VANNA_INDEX_NAME')\n",
81
+ "VANNA_MODEL = os.getenv('VANNA_MODEL')\n",
82
+ "\n",
83
+ "ROOT_PATH = os.path.dirname(os.path.dirname(os.getcwd()))\n",
84
+ "\n",
85
+ "#Vanna object\n",
86
+ "vn = MyVanna(config = {\"temperature\": 0, \"api_key\": OPENAI_API_KEY, 'model': VANNA_MODEL, 'pc_api_key': PC_API_KEY, 'index_name': INDEX_NAME, \"top_k\" : 4})\n",
87
+ "db_vanna_path = ROOT_PATH + \"/data/drias/drias.db\"\n",
88
+ "vn.connect_to_sqlite(db_vanna_path)\n"
89
+ ]
90
+ },
91
+ {
92
+ "cell_type": "markdown",
93
+ "metadata": {},
94
+ "source": [
95
+ "# User query"
96
+ ]
97
+ },
98
+ {
99
+ "cell_type": "code",
100
+ "execution_count": 10,
101
+ "metadata": {},
102
+ "outputs": [],
103
+ "source": [
104
+ "query = \"Quelle sera la température à Marseille sur les prochaines années ?\""
105
+ ]
106
+ },
107
+ {
108
+ "cell_type": "markdown",
109
+ "metadata": {},
110
+ "source": [
111
+ "## Detect location"
112
+ ]
113
+ },
114
+ {
115
+ "cell_type": "code",
116
+ "execution_count": 11,
117
+ "metadata": {},
118
+ "outputs": [
119
+ {
120
+ "name": "stdout",
121
+ "output_type": "stream",
122
+ "text": [
123
+ "Marseille\n"
124
+ ]
125
+ }
126
+ ],
127
+ "source": [
128
+ "location = detect_location_with_openai(OPENAI_API_KEY, query)\n",
129
+ "print(location)"
130
+ ]
131
+ },
132
+ {
133
+ "cell_type": "markdown",
134
+ "metadata": {},
135
+ "source": [
136
+ "## Convert location to longitude, latitude coordonate"
137
+ ]
138
+ },
139
+ {
140
+ "cell_type": "code",
141
+ "execution_count": 12,
142
+ "metadata": {},
143
+ "outputs": [
144
+ {
145
+ "name": "stdout",
146
+ "output_type": "stream",
147
+ "text": [
148
+ "Quelle sera la température à lat, long : (43.2961743, 5.3699525) sur les prochaines années ?\n"
149
+ ]
150
+ }
151
+ ],
152
+ "source": [
153
+ "coords = loc2coords(location)\n",
154
+ "user_input = query.replace(location, f\"lat, long : {coords}\")\n",
155
+ "print(user_input)"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "markdown",
160
+ "metadata": {},
161
+ "source": [
162
+ "# Find closest coordonates and replace lat,lon\n"
163
+ ]
164
+ },
165
+ {
166
+ "cell_type": "code",
167
+ "execution_count": null,
168
+ "metadata": {},
169
+ "outputs": [
170
+ {
171
+ "name": "stderr",
172
+ "output_type": "stream",
173
+ "text": [
174
+ "Failed to multipart ingest runs: langsmith.utils.LangSmithError: Failed to POST https://eu.api.smith.langchain.com/runs/multipart in LangSmith API. HTTPError('403 Client Error: Forbidden for url: https://eu.api.smith.langchain.com/runs/multipart', '{\"error\":\"Forbidden\"}\\n')\n"
175
+ ]
176
+ },
177
+ {
178
+ "name": "stderr",
179
+ "output_type": "stream",
180
+ "text": [
181
+ "Failed to multipart ingest runs: langsmith.utils.LangSmithError: Failed to POST https://eu.api.smith.langchain.com/runs/multipart in LangSmith API. HTTPError('403 Client Error: Forbidden for url: https://eu.api.smith.langchain.com/runs/multipart', '{\"error\":\"Forbidden\"}\\n')\n"
182
+ ]
183
+ }
184
+ ],
185
+ "source": [
186
+ "relevant_tables = detect_relevant_tables(user_input, llm) \n",
187
+ "coords_tables = [nearestNeighbourSQL(db_vanna_path, coords, relevant_tables[i]) for i in range(len(relevant_tables))]\n",
188
+ "user_input_with_coords = replace_coordonates(coords, user_input, coords_tables)"
189
+ ]
190
+ },
191
+ {
192
+ "cell_type": "markdown",
193
+ "metadata": {},
194
+ "source": [
195
+ "# Ask Vanna with correct coordonates"
196
+ ]
197
+ },
198
+ {
199
+ "cell_type": "code",
200
+ "execution_count": 15,
201
+ "metadata": {},
202
+ "outputs": [
203
+ {
204
+ "name": "stdout",
205
+ "output_type": "stream",
206
+ "text": [
207
+ "SQL Prompt: [{'role': 'system', 'content': \"You are a SQLite expert. Please help to generate a SQL query to answer the question. Your response should ONLY be based on the given context and follow the response guidelines and format instructions. \\n===Tables \\nCREATE TABLE Mean_winter_temperature ( y FLOAT, x FLOAT, year INT, \\n month INT, \\n day INT \\n, LambertParisII VARCHAR(255), lat FLOAT, lon FLOAT, TMm FLOAT);\\n\\nCREATE TABLE Mean_winter_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT\\n);\\n\\nCREATE TABLE Mean_summer_temperature ( y FLOAT, x FLOAT, year INT, \\n month INT, \\n day INT \\n, LambertParisII VARCHAR(255), lat FLOAT, lon FLOAT, TMm FLOAT);\\n\\nCREATE TABLE Mean_summer_temperature (\\n y FLOAT,\\n x FLOAT,\\n year INT, \\n month INT, \\n day INT \\n,\\n LambertParisII VARCHAR(255),\\n lat FLOAT,\\n lon FLOAT,\\n TMm FLOAT\\n);\\n\\n\\n===Additional Context \\n\\nThe Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the futureis greater than or equal to 35°C.The variables are as follows:- 'y' and 'x': Lambert Paris II coordinates for the location.- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.- 'lat' and 'lon': Latitude and longitude of the location.- 'TX35D': Number of days with Tx ≥ 35°C.\\n\\nThe Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the futureis greater than or equal to 30°C.The variables are as follows:- 'y' and 'x': Lambert Paris II coordinates for the location.- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.- 'lat' and 'lon': Latitude and longitude of the location.- 'TX30D': Number of days with Tx ≥ 30°C.\\n\\nThe Number of days with Tx above 35C table contains information on the number of days when the maximum temperature in the past and the future\\nis greater than or equal to 35°C.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TX35D': Number of days with Tx ≥ 35°C.\\n\\nThe Number of days with Tx above 30C table contains information on the number of days when the maximum temperature in the past and the future\\nis greater than or equal to 30°C.\\nThe variables are as follows:\\n- 'y' and 'x': Lambert Paris II coordinates for the location.\\n- year: Year of the observation.\\n\\n - month : Month of the observation.\\n\\n - day: Day of the observation.\\n\\n- 'LambertParisII': Indicates that the x, y coordinates are in the Lambert Paris II projection.\\n- 'lat' and 'lon': Latitude and longitude of the location.\\n- 'TX30D': Number of days with Tx ≥ 30°C.\\n\\n===Response Guidelines \\n1. If the provided context is sufficient, please generate a valid SQL query without any explanations for the question. \\n2. If the provided context is almost sufficient but requires knowledge of a specific string in a particular column, please generate an intermediate SQL query to find the distinct strings in that column. Prepend the query with a comment saying intermediate_sql \\n3. If the provided context is insufficient, please give a sql query based on your knowledge and the context provided. \\n4. Please use the most relevant table(s). \\n5. If the question has been asked and answered before, please repeat the answer exactly as it was given before. \\n6. Ensure that the output SQL is SQLite-compliant and executable, and free of syntax errors. \\n7. Add a description of the table in the result of the sql query, if relevant. \\n8 Make sure to include the relevant KPI in the SQL query. The query should return impactfull data \\n\"}, {'role': 'user', 'content': 'Quelle sera la température à lat, long : (43.166954040527344, 5.430534839630127) sur les prochaines années ?'}]\n",
208
+ "Using model gpt-4o-mini for 1101.25 tokens (approx)\n",
209
+ "LLM Response: ```sql\n",
210
+ "SELECT year, month, day, TMm \n",
211
+ "FROM Mean_winter_temperature \n",
212
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
213
+ "UNION ALL\n",
214
+ "SELECT year, month, day, TMm \n",
215
+ "FROM Mean_summer_temperature \n",
216
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
217
+ "ORDER BY year, month, day;\n",
218
+ "```\n",
219
+ "LLM Response: ```sql\n",
220
+ "SELECT year, month, day, TMm \n",
221
+ "FROM Mean_winter_temperature \n",
222
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
223
+ "UNION ALL\n",
224
+ "SELECT year, month, day, TMm \n",
225
+ "FROM Mean_summer_temperature \n",
226
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
227
+ "ORDER BY year, month, day;\n",
228
+ "```\n",
229
+ "Extracted SQL: SELECT year, month, day, TMm \n",
230
+ "FROM Mean_winter_temperature \n",
231
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
232
+ "UNION ALL\n",
233
+ "SELECT year, month, day, TMm \n",
234
+ "FROM Mean_summer_temperature \n",
235
+ "WHERE lat = 43.166954040527344 AND lon = 5.430534839630127\n",
236
+ "ORDER BY year, month, day;\n",
237
+ "Using model gpt-4o-mini for 252.5 tokens (approx)\n"
238
+ ]
239
+ }
240
+ ],
241
+ "source": [
242
+ "sql_query, result_dataframe, figure = vn.ask(user_input_with_coords, print_results=False, allow_llm_to_see_data=True)\n"
243
+ ]
244
+ },
245
+ {
246
+ "cell_type": "code",
247
+ "execution_count": 18,
248
+ "metadata": {},
249
+ "outputs": [
250
+ {
251
+ "data": {
252
+ "text/html": [
253
+ "<div>\n",
254
+ "<style scoped>\n",
255
+ " .dataframe tbody tr th:only-of-type {\n",
256
+ " vertical-align: middle;\n",
257
+ " }\n",
258
+ "\n",
259
+ " .dataframe tbody tr th {\n",
260
+ " vertical-align: top;\n",
261
+ " }\n",
262
+ "\n",
263
+ " .dataframe thead th {\n",
264
+ " text-align: right;\n",
265
+ " }\n",
266
+ "</style>\n",
267
+ "<table border=\"1\" class=\"dataframe\">\n",
268
+ " <thead>\n",
269
+ " <tr style=\"text-align: right;\">\n",
270
+ " <th></th>\n",
271
+ " <th>year</th>\n",
272
+ " <th>month</th>\n",
273
+ " <th>day</th>\n",
274
+ " <th>TMm</th>\n",
275
+ " <th>date</th>\n",
276
+ " </tr>\n",
277
+ " </thead>\n",
278
+ " <tbody>\n",
279
+ " <tr>\n",
280
+ " <th>0</th>\n",
281
+ " <td>2031</td>\n",
282
+ " <td>1</td>\n",
283
+ " <td>14</td>\n",
284
+ " <td>9.952474</td>\n",
285
+ " <td>2031-01-14</td>\n",
286
+ " </tr>\n",
287
+ " <tr>\n",
288
+ " <th>1</th>\n",
289
+ " <td>2031</td>\n",
290
+ " <td>1</td>\n",
291
+ " <td>14</td>\n",
292
+ " <td>9.952474</td>\n",
293
+ " <td>2031-01-14</td>\n",
294
+ " </tr>\n",
295
+ " <tr>\n",
296
+ " <th>2</th>\n",
297
+ " <td>2031</td>\n",
298
+ " <td>7</td>\n",
299
+ " <td>16</td>\n",
300
+ " <td>24.061035</td>\n",
301
+ " <td>2031-07-16</td>\n",
302
+ " </tr>\n",
303
+ " <tr>\n",
304
+ " <th>3</th>\n",
305
+ " <td>2031</td>\n",
306
+ " <td>7</td>\n",
307
+ " <td>16</td>\n",
308
+ " <td>24.061035</td>\n",
309
+ " <td>2031-07-16</td>\n",
310
+ " </tr>\n",
311
+ " <tr>\n",
312
+ " <th>4</th>\n",
313
+ " <td>2032</td>\n",
314
+ " <td>1</td>\n",
315
+ " <td>15</td>\n",
316
+ " <td>10.142323</td>\n",
317
+ " <td>2032-01-15</td>\n",
318
+ " </tr>\n",
319
+ " <tr>\n",
320
+ " <th>...</th>\n",
321
+ " <td>...</td>\n",
322
+ " <td>...</td>\n",
323
+ " <td>...</td>\n",
324
+ " <td>...</td>\n",
325
+ " <td>...</td>\n",
326
+ " </tr>\n",
327
+ " <tr>\n",
328
+ " <th>75</th>\n",
329
+ " <td>2049</td>\n",
330
+ " <td>7</td>\n",
331
+ " <td>16</td>\n",
332
+ " <td>24.829654</td>\n",
333
+ " <td>2049-07-16</td>\n",
334
+ " </tr>\n",
335
+ " <tr>\n",
336
+ " <th>76</th>\n",
337
+ " <td>2050</td>\n",
338
+ " <td>1</td>\n",
339
+ " <td>14</td>\n",
340
+ " <td>10.632255</td>\n",
341
+ " <td>2050-01-14</td>\n",
342
+ " </tr>\n",
343
+ " <tr>\n",
344
+ " <th>77</th>\n",
345
+ " <td>2050</td>\n",
346
+ " <td>1</td>\n",
347
+ " <td>14</td>\n",
348
+ " <td>10.632255</td>\n",
349
+ " <td>2050-01-14</td>\n",
350
+ " </tr>\n",
351
+ " <tr>\n",
352
+ " <th>78</th>\n",
353
+ " <td>2050</td>\n",
354
+ " <td>7</td>\n",
355
+ " <td>16</td>\n",
356
+ " <td>25.053394</td>\n",
357
+ " <td>2050-07-16</td>\n",
358
+ " </tr>\n",
359
+ " <tr>\n",
360
+ " <th>79</th>\n",
361
+ " <td>2050</td>\n",
362
+ " <td>7</td>\n",
363
+ " <td>16</td>\n",
364
+ " <td>25.053394</td>\n",
365
+ " <td>2050-07-16</td>\n",
366
+ " </tr>\n",
367
+ " </tbody>\n",
368
+ "</table>\n",
369
+ "<p>80 rows × 5 columns</p>\n",
370
+ "</div>"
371
+ ],
372
+ "text/plain": [
373
+ " year month day TMm date\n",
374
+ "0 2031 1 14 9.952474 2031-01-14\n",
375
+ "1 2031 1 14 9.952474 2031-01-14\n",
376
+ "2 2031 7 16 24.061035 2031-07-16\n",
377
+ "3 2031 7 16 24.061035 2031-07-16\n",
378
+ "4 2032 1 15 10.142323 2032-01-15\n",
379
+ ".. ... ... ... ... ...\n",
380
+ "75 2049 7 16 24.829654 2049-07-16\n",
381
+ "76 2050 1 14 10.632255 2050-01-14\n",
382
+ "77 2050 1 14 10.632255 2050-01-14\n",
383
+ "78 2050 7 16 25.053394 2050-07-16\n",
384
+ "79 2050 7 16 25.053394 2050-07-16\n",
385
+ "\n",
386
+ "[80 rows x 5 columns]"
387
+ ]
388
+ },
389
+ "execution_count": 18,
390
+ "metadata": {},
391
+ "output_type": "execute_result"
392
+ }
393
+ ],
394
+ "source": [
395
+ "result_dataframe"
396
+ ]
397
+ },
398
+ {
399
+ "cell_type": "code",
400
+ "execution_count": 19,
401
+ "metadata": {},
402
+ "outputs": [
403
+ {
404
+ "data": {
405
+ "application/vnd.plotly.v1+json": {
406
+ "config": {
407
+ "plotlyServerURL": "https://plot.ly"
408
+ },
409
+ "data": [
410
+ {
411
+ "hovertemplate": "Date=%{x}<br>Temperature (°C)=%{y}<extra></extra>",
412
+ "legendgroup": "",
413
+ "line": {
414
+ "color": "#636efa",
415
+ "dash": "solid"
416
+ },
417
+ "marker": {
418
+ "symbol": "circle"
419
+ },
420
+ "mode": "lines",
421
+ "name": "",
422
+ "orientation": "v",
423
+ "showlegend": false,
424
+ "type": "scatter",
425
+ "x": [
426
+ "2031-01-14T00:00:00",
427
+ "2031-01-14T00:00:00",
428
+ "2031-07-16T00:00:00",
429
+ "2031-07-16T00:00:00",
430
+ "2032-01-15T00:00:00",
431
+ "2032-01-15T00:00:00",
432
+ "2032-07-16T00:00:00",
433
+ "2032-07-16T00:00:00",
434
+ "2033-01-14T00:00:00",
435
+ "2033-01-14T00:00:00",
436
+ "2033-07-16T00:00:00",
437
+ "2033-07-16T00:00:00",
438
+ "2034-01-14T00:00:00",
439
+ "2034-01-14T00:00:00",
440
+ "2034-07-16T00:00:00",
441
+ "2034-07-16T00:00:00",
442
+ "2035-01-14T00:00:00",
443
+ "2035-01-14T00:00:00",
444
+ "2035-07-16T00:00:00",
445
+ "2035-07-16T00:00:00",
446
+ "2036-01-15T00:00:00",
447
+ "2036-01-15T00:00:00",
448
+ "2036-07-16T00:00:00",
449
+ "2036-07-16T00:00:00",
450
+ "2037-01-14T00:00:00",
451
+ "2037-01-14T00:00:00",
452
+ "2037-07-16T00:00:00",
453
+ "2037-07-16T00:00:00",
454
+ "2038-01-14T00:00:00",
455
+ "2038-01-14T00:00:00",
456
+ "2038-07-16T00:00:00",
457
+ "2038-07-16T00:00:00",
458
+ "2039-01-14T00:00:00",
459
+ "2039-01-14T00:00:00",
460
+ "2039-07-16T00:00:00",
461
+ "2039-07-16T00:00:00",
462
+ "2040-01-15T00:00:00",
463
+ "2040-01-15T00:00:00",
464
+ "2040-07-16T00:00:00",
465
+ "2040-07-16T00:00:00",
466
+ "2041-01-14T00:00:00",
467
+ "2041-01-14T00:00:00",
468
+ "2041-07-16T00:00:00",
469
+ "2041-07-16T00:00:00",
470
+ "2042-01-14T00:00:00",
471
+ "2042-01-14T00:00:00",
472
+ "2042-07-16T00:00:00",
473
+ "2042-07-16T00:00:00",
474
+ "2043-01-14T00:00:00",
475
+ "2043-01-14T00:00:00",
476
+ "2043-07-16T00:00:00",
477
+ "2043-07-16T00:00:00",
478
+ "2044-01-15T00:00:00",
479
+ "2044-01-15T00:00:00",
480
+ "2044-07-16T00:00:00",
481
+ "2044-07-16T00:00:00",
482
+ "2045-01-14T00:00:00",
483
+ "2045-01-14T00:00:00",
484
+ "2045-07-16T00:00:00",
485
+ "2045-07-16T00:00:00",
486
+ "2046-01-14T00:00:00",
487
+ "2046-01-14T00:00:00",
488
+ "2046-07-16T00:00:00",
489
+ "2046-07-16T00:00:00",
490
+ "2047-01-14T00:00:00",
491
+ "2047-01-14T00:00:00",
492
+ "2047-07-16T00:00:00",
493
+ "2047-07-16T00:00:00",
494
+ "2048-01-15T00:00:00",
495
+ "2048-01-15T00:00:00",
496
+ "2048-07-16T00:00:00",
497
+ "2048-07-16T00:00:00",
498
+ "2049-01-14T00:00:00",
499
+ "2049-01-14T00:00:00",
500
+ "2049-07-16T00:00:00",
501
+ "2049-07-16T00:00:00",
502
+ "2050-01-14T00:00:00",
503
+ "2050-01-14T00:00:00",
504
+ "2050-07-16T00:00:00",
505
+ "2050-07-16T00:00:00"
506
+ ],
507
+ "xaxis": "x",
508
+ "y": [
509
+ 9.952474117647114,
510
+ 9.952474117647114,
511
+ 24.061035294117687,
512
+ 24.061035294117687,
513
+ 10.142322941176474,
514
+ 10.142322941176474,
515
+ 24.530692941176483,
516
+ 24.530692941176483,
517
+ 9.907942941176486,
518
+ 9.907942941176486,
519
+ 24.722234705882386,
520
+ 24.722234705882386,
521
+ 9.548873529411765,
522
+ 9.548873529411765,
523
+ 23.84629176470588,
524
+ 23.84629176470588,
525
+ 10.284758235294191,
526
+ 10.284758235294191,
527
+ 24.231422352941195,
528
+ 24.231422352941195,
529
+ 10.372100000000046,
530
+ 10.372100000000046,
531
+ 24.488941764705885,
532
+ 24.488941764705885,
533
+ 9.98571000000004,
534
+ 9.98571000000004,
535
+ 24.79424117647062,
536
+ 24.79424117647062,
537
+ 10.221372352941216,
538
+ 10.221372352941216,
539
+ 24.730553529411793,
540
+ 24.730553529411793,
541
+ 10.222609411764722,
542
+ 10.222609411764722,
543
+ 24.44979882352942,
544
+ 24.44979882352942,
545
+ 10.473662941176485,
546
+ 10.473662941176485,
547
+ 24.40726882352942,
548
+ 24.40726882352942,
549
+ 10.427640588235306,
550
+ 10.427640588235306,
551
+ 24.768547647058824,
552
+ 24.768547647058824,
553
+ 10.364736470588241,
554
+ 10.364736470588241,
555
+ 24.53479647058822,
556
+ 24.53479647058822,
557
+ 10.112910588235309,
558
+ 10.112910588235309,
559
+ 24.769181176470624,
560
+ 24.769181176470624,
561
+ 10.250792352941176,
562
+ 10.250792352941176,
563
+ 24.489877058823538,
564
+ 24.489877058823538,
565
+ 10.166119411764669,
566
+ 10.166119411764669,
567
+ 24.448076470588262,
568
+ 24.448076470588262,
569
+ 10.728997647058861,
570
+ 10.728997647058861,
571
+ 25.111282352941203,
572
+ 25.111282352941203,
573
+ 10.347248823529412,
574
+ 10.347248823529412,
575
+ 24.72313823529413,
576
+ 24.72313823529413,
577
+ 10.706604117647089,
578
+ 10.706604117647089,
579
+ 25.187577058823535,
580
+ 25.187577058823535,
581
+ 10.59243764705883,
582
+ 10.59243764705883,
583
+ 24.829653529411814,
584
+ 24.829653529411814,
585
+ 10.63225529411767,
586
+ 10.63225529411767,
587
+ 25.053394117647144,
588
+ 25.053394117647144
589
+ ],
590
+ "yaxis": "y"
591
+ }
592
+ ],
593
+ "layout": {
594
+ "legend": {
595
+ "tracegroupgap": 0
596
+ },
597
+ "template": {
598
+ "data": {
599
+ "bar": [
600
+ {
601
+ "error_x": {
602
+ "color": "#f2f5fa"
603
+ },
604
+ "error_y": {
605
+ "color": "#f2f5fa"
606
+ },
607
+ "marker": {
608
+ "line": {
609
+ "color": "rgb(17,17,17)",
610
+ "width": 0.5
611
+ },
612
+ "pattern": {
613
+ "fillmode": "overlay",
614
+ "size": 10,
615
+ "solidity": 0.2
616
+ }
617
+ },
618
+ "type": "bar"
619
+ }
620
+ ],
621
+ "barpolar": [
622
+ {
623
+ "marker": {
624
+ "line": {
625
+ "color": "rgb(17,17,17)",
626
+ "width": 0.5
627
+ },
628
+ "pattern": {
629
+ "fillmode": "overlay",
630
+ "size": 10,
631
+ "solidity": 0.2
632
+ }
633
+ },
634
+ "type": "barpolar"
635
+ }
636
+ ],
637
+ "carpet": [
638
+ {
639
+ "aaxis": {
640
+ "endlinecolor": "#A2B1C6",
641
+ "gridcolor": "#506784",
642
+ "linecolor": "#506784",
643
+ "minorgridcolor": "#506784",
644
+ "startlinecolor": "#A2B1C6"
645
+ },
646
+ "baxis": {
647
+ "endlinecolor": "#A2B1C6",
648
+ "gridcolor": "#506784",
649
+ "linecolor": "#506784",
650
+ "minorgridcolor": "#506784",
651
+ "startlinecolor": "#A2B1C6"
652
+ },
653
+ "type": "carpet"
654
+ }
655
+ ],
656
+ "choropleth": [
657
+ {
658
+ "colorbar": {
659
+ "outlinewidth": 0,
660
+ "ticks": ""
661
+ },
662
+ "type": "choropleth"
663
+ }
664
+ ],
665
+ "contour": [
666
+ {
667
+ "colorbar": {
668
+ "outlinewidth": 0,
669
+ "ticks": ""
670
+ },
671
+ "colorscale": [
672
+ [
673
+ 0,
674
+ "#0d0887"
675
+ ],
676
+ [
677
+ 0.1111111111111111,
678
+ "#46039f"
679
+ ],
680
+ [
681
+ 0.2222222222222222,
682
+ "#7201a8"
683
+ ],
684
+ [
685
+ 0.3333333333333333,
686
+ "#9c179e"
687
+ ],
688
+ [
689
+ 0.4444444444444444,
690
+ "#bd3786"
691
+ ],
692
+ [
693
+ 0.5555555555555556,
694
+ "#d8576b"
695
+ ],
696
+ [
697
+ 0.6666666666666666,
698
+ "#ed7953"
699
+ ],
700
+ [
701
+ 0.7777777777777778,
702
+ "#fb9f3a"
703
+ ],
704
+ [
705
+ 0.8888888888888888,
706
+ "#fdca26"
707
+ ],
708
+ [
709
+ 1,
710
+ "#f0f921"
711
+ ]
712
+ ],
713
+ "type": "contour"
714
+ }
715
+ ],
716
+ "contourcarpet": [
717
+ {
718
+ "colorbar": {
719
+ "outlinewidth": 0,
720
+ "ticks": ""
721
+ },
722
+ "type": "contourcarpet"
723
+ }
724
+ ],
725
+ "heatmap": [
726
+ {
727
+ "colorbar": {
728
+ "outlinewidth": 0,
729
+ "ticks": ""
730
+ },
731
+ "colorscale": [
732
+ [
733
+ 0,
734
+ "#0d0887"
735
+ ],
736
+ [
737
+ 0.1111111111111111,
738
+ "#46039f"
739
+ ],
740
+ [
741
+ 0.2222222222222222,
742
+ "#7201a8"
743
+ ],
744
+ [
745
+ 0.3333333333333333,
746
+ "#9c179e"
747
+ ],
748
+ [
749
+ 0.4444444444444444,
750
+ "#bd3786"
751
+ ],
752
+ [
753
+ 0.5555555555555556,
754
+ "#d8576b"
755
+ ],
756
+ [
757
+ 0.6666666666666666,
758
+ "#ed7953"
759
+ ],
760
+ [
761
+ 0.7777777777777778,
762
+ "#fb9f3a"
763
+ ],
764
+ [
765
+ 0.8888888888888888,
766
+ "#fdca26"
767
+ ],
768
+ [
769
+ 1,
770
+ "#f0f921"
771
+ ]
772
+ ],
773
+ "type": "heatmap"
774
+ }
775
+ ],
776
+ "heatmapgl": [
777
+ {
778
+ "colorbar": {
779
+ "outlinewidth": 0,
780
+ "ticks": ""
781
+ },
782
+ "colorscale": [
783
+ [
784
+ 0,
785
+ "#0d0887"
786
+ ],
787
+ [
788
+ 0.1111111111111111,
789
+ "#46039f"
790
+ ],
791
+ [
792
+ 0.2222222222222222,
793
+ "#7201a8"
794
+ ],
795
+ [
796
+ 0.3333333333333333,
797
+ "#9c179e"
798
+ ],
799
+ [
800
+ 0.4444444444444444,
801
+ "#bd3786"
802
+ ],
803
+ [
804
+ 0.5555555555555556,
805
+ "#d8576b"
806
+ ],
807
+ [
808
+ 0.6666666666666666,
809
+ "#ed7953"
810
+ ],
811
+ [
812
+ 0.7777777777777778,
813
+ "#fb9f3a"
814
+ ],
815
+ [
816
+ 0.8888888888888888,
817
+ "#fdca26"
818
+ ],
819
+ [
820
+ 1,
821
+ "#f0f921"
822
+ ]
823
+ ],
824
+ "type": "heatmapgl"
825
+ }
826
+ ],
827
+ "histogram": [
828
+ {
829
+ "marker": {
830
+ "pattern": {
831
+ "fillmode": "overlay",
832
+ "size": 10,
833
+ "solidity": 0.2
834
+ }
835
+ },
836
+ "type": "histogram"
837
+ }
838
+ ],
839
+ "histogram2d": [
840
+ {
841
+ "colorbar": {
842
+ "outlinewidth": 0,
843
+ "ticks": ""
844
+ },
845
+ "colorscale": [
846
+ [
847
+ 0,
848
+ "#0d0887"
849
+ ],
850
+ [
851
+ 0.1111111111111111,
852
+ "#46039f"
853
+ ],
854
+ [
855
+ 0.2222222222222222,
856
+ "#7201a8"
857
+ ],
858
+ [
859
+ 0.3333333333333333,
860
+ "#9c179e"
861
+ ],
862
+ [
863
+ 0.4444444444444444,
864
+ "#bd3786"
865
+ ],
866
+ [
867
+ 0.5555555555555556,
868
+ "#d8576b"
869
+ ],
870
+ [
871
+ 0.6666666666666666,
872
+ "#ed7953"
873
+ ],
874
+ [
875
+ 0.7777777777777778,
876
+ "#fb9f3a"
877
+ ],
878
+ [
879
+ 0.8888888888888888,
880
+ "#fdca26"
881
+ ],
882
+ [
883
+ 1,
884
+ "#f0f921"
885
+ ]
886
+ ],
887
+ "type": "histogram2d"
888
+ }
889
+ ],
890
+ "histogram2dcontour": [
891
+ {
892
+ "colorbar": {
893
+ "outlinewidth": 0,
894
+ "ticks": ""
895
+ },
896
+ "colorscale": [
897
+ [
898
+ 0,
899
+ "#0d0887"
900
+ ],
901
+ [
902
+ 0.1111111111111111,
903
+ "#46039f"
904
+ ],
905
+ [
906
+ 0.2222222222222222,
907
+ "#7201a8"
908
+ ],
909
+ [
910
+ 0.3333333333333333,
911
+ "#9c179e"
912
+ ],
913
+ [
914
+ 0.4444444444444444,
915
+ "#bd3786"
916
+ ],
917
+ [
918
+ 0.5555555555555556,
919
+ "#d8576b"
920
+ ],
921
+ [
922
+ 0.6666666666666666,
923
+ "#ed7953"
924
+ ],
925
+ [
926
+ 0.7777777777777778,
927
+ "#fb9f3a"
928
+ ],
929
+ [
930
+ 0.8888888888888888,
931
+ "#fdca26"
932
+ ],
933
+ [
934
+ 1,
935
+ "#f0f921"
936
+ ]
937
+ ],
938
+ "type": "histogram2dcontour"
939
+ }
940
+ ],
941
+ "mesh3d": [
942
+ {
943
+ "colorbar": {
944
+ "outlinewidth": 0,
945
+ "ticks": ""
946
+ },
947
+ "type": "mesh3d"
948
+ }
949
+ ],
950
+ "parcoords": [
951
+ {
952
+ "line": {
953
+ "colorbar": {
954
+ "outlinewidth": 0,
955
+ "ticks": ""
956
+ }
957
+ },
958
+ "type": "parcoords"
959
+ }
960
+ ],
961
+ "pie": [
962
+ {
963
+ "automargin": true,
964
+ "type": "pie"
965
+ }
966
+ ],
967
+ "scatter": [
968
+ {
969
+ "marker": {
970
+ "line": {
971
+ "color": "#283442"
972
+ }
973
+ },
974
+ "type": "scatter"
975
+ }
976
+ ],
977
+ "scatter3d": [
978
+ {
979
+ "line": {
980
+ "colorbar": {
981
+ "outlinewidth": 0,
982
+ "ticks": ""
983
+ }
984
+ },
985
+ "marker": {
986
+ "colorbar": {
987
+ "outlinewidth": 0,
988
+ "ticks": ""
989
+ }
990
+ },
991
+ "type": "scatter3d"
992
+ }
993
+ ],
994
+ "scattercarpet": [
995
+ {
996
+ "marker": {
997
+ "colorbar": {
998
+ "outlinewidth": 0,
999
+ "ticks": ""
1000
+ }
1001
+ },
1002
+ "type": "scattercarpet"
1003
+ }
1004
+ ],
1005
+ "scattergeo": [
1006
+ {
1007
+ "marker": {
1008
+ "colorbar": {
1009
+ "outlinewidth": 0,
1010
+ "ticks": ""
1011
+ }
1012
+ },
1013
+ "type": "scattergeo"
1014
+ }
1015
+ ],
1016
+ "scattergl": [
1017
+ {
1018
+ "marker": {
1019
+ "line": {
1020
+ "color": "#283442"
1021
+ }
1022
+ },
1023
+ "type": "scattergl"
1024
+ }
1025
+ ],
1026
+ "scattermapbox": [
1027
+ {
1028
+ "marker": {
1029
+ "colorbar": {
1030
+ "outlinewidth": 0,
1031
+ "ticks": ""
1032
+ }
1033
+ },
1034
+ "type": "scattermapbox"
1035
+ }
1036
+ ],
1037
+ "scatterpolar": [
1038
+ {
1039
+ "marker": {
1040
+ "colorbar": {
1041
+ "outlinewidth": 0,
1042
+ "ticks": ""
1043
+ }
1044
+ },
1045
+ "type": "scatterpolar"
1046
+ }
1047
+ ],
1048
+ "scatterpolargl": [
1049
+ {
1050
+ "marker": {
1051
+ "colorbar": {
1052
+ "outlinewidth": 0,
1053
+ "ticks": ""
1054
+ }
1055
+ },
1056
+ "type": "scatterpolargl"
1057
+ }
1058
+ ],
1059
+ "scatterternary": [
1060
+ {
1061
+ "marker": {
1062
+ "colorbar": {
1063
+ "outlinewidth": 0,
1064
+ "ticks": ""
1065
+ }
1066
+ },
1067
+ "type": "scatterternary"
1068
+ }
1069
+ ],
1070
+ "surface": [
1071
+ {
1072
+ "colorbar": {
1073
+ "outlinewidth": 0,
1074
+ "ticks": ""
1075
+ },
1076
+ "colorscale": [
1077
+ [
1078
+ 0,
1079
+ "#0d0887"
1080
+ ],
1081
+ [
1082
+ 0.1111111111111111,
1083
+ "#46039f"
1084
+ ],
1085
+ [
1086
+ 0.2222222222222222,
1087
+ "#7201a8"
1088
+ ],
1089
+ [
1090
+ 0.3333333333333333,
1091
+ "#9c179e"
1092
+ ],
1093
+ [
1094
+ 0.4444444444444444,
1095
+ "#bd3786"
1096
+ ],
1097
+ [
1098
+ 0.5555555555555556,
1099
+ "#d8576b"
1100
+ ],
1101
+ [
1102
+ 0.6666666666666666,
1103
+ "#ed7953"
1104
+ ],
1105
+ [
1106
+ 0.7777777777777778,
1107
+ "#fb9f3a"
1108
+ ],
1109
+ [
1110
+ 0.8888888888888888,
1111
+ "#fdca26"
1112
+ ],
1113
+ [
1114
+ 1,
1115
+ "#f0f921"
1116
+ ]
1117
+ ],
1118
+ "type": "surface"
1119
+ }
1120
+ ],
1121
+ "table": [
1122
+ {
1123
+ "cells": {
1124
+ "fill": {
1125
+ "color": "#506784"
1126
+ },
1127
+ "line": {
1128
+ "color": "rgb(17,17,17)"
1129
+ }
1130
+ },
1131
+ "header": {
1132
+ "fill": {
1133
+ "color": "#2a3f5f"
1134
+ },
1135
+ "line": {
1136
+ "color": "rgb(17,17,17)"
1137
+ }
1138
+ },
1139
+ "type": "table"
1140
+ }
1141
+ ]
1142
+ },
1143
+ "layout": {
1144
+ "annotationdefaults": {
1145
+ "arrowcolor": "#f2f5fa",
1146
+ "arrowhead": 0,
1147
+ "arrowwidth": 1
1148
+ },
1149
+ "autotypenumbers": "strict",
1150
+ "coloraxis": {
1151
+ "colorbar": {
1152
+ "outlinewidth": 0,
1153
+ "ticks": ""
1154
+ }
1155
+ },
1156
+ "colorscale": {
1157
+ "diverging": [
1158
+ [
1159
+ 0,
1160
+ "#8e0152"
1161
+ ],
1162
+ [
1163
+ 0.1,
1164
+ "#c51b7d"
1165
+ ],
1166
+ [
1167
+ 0.2,
1168
+ "#de77ae"
1169
+ ],
1170
+ [
1171
+ 0.3,
1172
+ "#f1b6da"
1173
+ ],
1174
+ [
1175
+ 0.4,
1176
+ "#fde0ef"
1177
+ ],
1178
+ [
1179
+ 0.5,
1180
+ "#f7f7f7"
1181
+ ],
1182
+ [
1183
+ 0.6,
1184
+ "#e6f5d0"
1185
+ ],
1186
+ [
1187
+ 0.7,
1188
+ "#b8e186"
1189
+ ],
1190
+ [
1191
+ 0.8,
1192
+ "#7fbc41"
1193
+ ],
1194
+ [
1195
+ 0.9,
1196
+ "#4d9221"
1197
+ ],
1198
+ [
1199
+ 1,
1200
+ "#276419"
1201
+ ]
1202
+ ],
1203
+ "sequential": [
1204
+ [
1205
+ 0,
1206
+ "#0d0887"
1207
+ ],
1208
+ [
1209
+ 0.1111111111111111,
1210
+ "#46039f"
1211
+ ],
1212
+ [
1213
+ 0.2222222222222222,
1214
+ "#7201a8"
1215
+ ],
1216
+ [
1217
+ 0.3333333333333333,
1218
+ "#9c179e"
1219
+ ],
1220
+ [
1221
+ 0.4444444444444444,
1222
+ "#bd3786"
1223
+ ],
1224
+ [
1225
+ 0.5555555555555556,
1226
+ "#d8576b"
1227
+ ],
1228
+ [
1229
+ 0.6666666666666666,
1230
+ "#ed7953"
1231
+ ],
1232
+ [
1233
+ 0.7777777777777778,
1234
+ "#fb9f3a"
1235
+ ],
1236
+ [
1237
+ 0.8888888888888888,
1238
+ "#fdca26"
1239
+ ],
1240
+ [
1241
+ 1,
1242
+ "#f0f921"
1243
+ ]
1244
+ ],
1245
+ "sequentialminus": [
1246
+ [
1247
+ 0,
1248
+ "#0d0887"
1249
+ ],
1250
+ [
1251
+ 0.1111111111111111,
1252
+ "#46039f"
1253
+ ],
1254
+ [
1255
+ 0.2222222222222222,
1256
+ "#7201a8"
1257
+ ],
1258
+ [
1259
+ 0.3333333333333333,
1260
+ "#9c179e"
1261
+ ],
1262
+ [
1263
+ 0.4444444444444444,
1264
+ "#bd3786"
1265
+ ],
1266
+ [
1267
+ 0.5555555555555556,
1268
+ "#d8576b"
1269
+ ],
1270
+ [
1271
+ 0.6666666666666666,
1272
+ "#ed7953"
1273
+ ],
1274
+ [
1275
+ 0.7777777777777778,
1276
+ "#fb9f3a"
1277
+ ],
1278
+ [
1279
+ 0.8888888888888888,
1280
+ "#fdca26"
1281
+ ],
1282
+ [
1283
+ 1,
1284
+ "#f0f921"
1285
+ ]
1286
+ ]
1287
+ },
1288
+ "colorway": [
1289
+ "#636efa",
1290
+ "#EF553B",
1291
+ "#00cc96",
1292
+ "#ab63fa",
1293
+ "#FFA15A",
1294
+ "#19d3f3",
1295
+ "#FF6692",
1296
+ "#B6E880",
1297
+ "#FF97FF",
1298
+ "#FECB52"
1299
+ ],
1300
+ "font": {
1301
+ "color": "#f2f5fa"
1302
+ },
1303
+ "geo": {
1304
+ "bgcolor": "rgb(17,17,17)",
1305
+ "lakecolor": "rgb(17,17,17)",
1306
+ "landcolor": "rgb(17,17,17)",
1307
+ "showlakes": true,
1308
+ "showland": true,
1309
+ "subunitcolor": "#506784"
1310
+ },
1311
+ "hoverlabel": {
1312
+ "align": "left"
1313
+ },
1314
+ "hovermode": "closest",
1315
+ "mapbox": {
1316
+ "style": "dark"
1317
+ },
1318
+ "paper_bgcolor": "rgb(17,17,17)",
1319
+ "plot_bgcolor": "rgb(17,17,17)",
1320
+ "polar": {
1321
+ "angularaxis": {
1322
+ "gridcolor": "#506784",
1323
+ "linecolor": "#506784",
1324
+ "ticks": ""
1325
+ },
1326
+ "bgcolor": "rgb(17,17,17)",
1327
+ "radialaxis": {
1328
+ "gridcolor": "#506784",
1329
+ "linecolor": "#506784",
1330
+ "ticks": ""
1331
+ }
1332
+ },
1333
+ "scene": {
1334
+ "xaxis": {
1335
+ "backgroundcolor": "rgb(17,17,17)",
1336
+ "gridcolor": "#506784",
1337
+ "gridwidth": 2,
1338
+ "linecolor": "#506784",
1339
+ "showbackground": true,
1340
+ "ticks": "",
1341
+ "zerolinecolor": "#C8D4E3"
1342
+ },
1343
+ "yaxis": {
1344
+ "backgroundcolor": "rgb(17,17,17)",
1345
+ "gridcolor": "#506784",
1346
+ "gridwidth": 2,
1347
+ "linecolor": "#506784",
1348
+ "showbackground": true,
1349
+ "ticks": "",
1350
+ "zerolinecolor": "#C8D4E3"
1351
+ },
1352
+ "zaxis": {
1353
+ "backgroundcolor": "rgb(17,17,17)",
1354
+ "gridcolor": "#506784",
1355
+ "gridwidth": 2,
1356
+ "linecolor": "#506784",
1357
+ "showbackground": true,
1358
+ "ticks": "",
1359
+ "zerolinecolor": "#C8D4E3"
1360
+ }
1361
+ },
1362
+ "shapedefaults": {
1363
+ "line": {
1364
+ "color": "#f2f5fa"
1365
+ }
1366
+ },
1367
+ "sliderdefaults": {
1368
+ "bgcolor": "#C8D4E3",
1369
+ "bordercolor": "rgb(17,17,17)",
1370
+ "borderwidth": 1,
1371
+ "tickwidth": 0
1372
+ },
1373
+ "ternary": {
1374
+ "aaxis": {
1375
+ "gridcolor": "#506784",
1376
+ "linecolor": "#506784",
1377
+ "ticks": ""
1378
+ },
1379
+ "baxis": {
1380
+ "gridcolor": "#506784",
1381
+ "linecolor": "#506784",
1382
+ "ticks": ""
1383
+ },
1384
+ "bgcolor": "rgb(17,17,17)",
1385
+ "caxis": {
1386
+ "gridcolor": "#506784",
1387
+ "linecolor": "#506784",
1388
+ "ticks": ""
1389
+ }
1390
+ },
1391
+ "title": {
1392
+ "x": 0.05
1393
+ },
1394
+ "updatemenudefaults": {
1395
+ "bgcolor": "#506784",
1396
+ "borderwidth": 0
1397
+ },
1398
+ "xaxis": {
1399
+ "automargin": true,
1400
+ "gridcolor": "#283442",
1401
+ "linecolor": "#506784",
1402
+ "ticks": "",
1403
+ "title": {
1404
+ "standoff": 15
1405
+ },
1406
+ "zerolinecolor": "#283442",
1407
+ "zerolinewidth": 2
1408
+ },
1409
+ "yaxis": {
1410
+ "automargin": true,
1411
+ "gridcolor": "#283442",
1412
+ "linecolor": "#506784",
1413
+ "ticks": "",
1414
+ "title": {
1415
+ "standoff": 15
1416
+ },
1417
+ "zerolinecolor": "#283442",
1418
+ "zerolinewidth": 2
1419
+ }
1420
+ }
1421
+ },
1422
+ "title": {
1423
+ "text": "Mean Temperature Over Time"
1424
+ },
1425
+ "xaxis": {
1426
+ "anchor": "y",
1427
+ "domain": [
1428
+ 0,
1429
+ 1
1430
+ ],
1431
+ "title": {
1432
+ "text": "Date"
1433
+ }
1434
+ },
1435
+ "yaxis": {
1436
+ "anchor": "x",
1437
+ "domain": [
1438
+ 0,
1439
+ 1
1440
+ ],
1441
+ "title": {
1442
+ "text": "Temperature (°C)"
1443
+ }
1444
+ }
1445
+ }
1446
+ },
1447
+ "text/html": [
1448
+ "<div> <div id=\"0ca9e356-0087-49c5-9366-b7197b98f96f\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"0ca9e356-0087-49c5-9366-b7197b98f96f\")) { Plotly.newPlot( \"0ca9e356-0087-49c5-9366-b7197b98f96f\", [{\"hovertemplate\":\"Date=%{x}\\u003cbr\\u003eTemperature (°C)=%{y}\\u003cextra\\u003e\\u003c\\u002fextra\\u003e\",\"legendgroup\":\"\",\"line\":{\"color\":\"#636efa\",\"dash\":\"solid\"},\"marker\":{\"symbol\":\"circle\"},\"mode\":\"lines\",\"name\":\"\",\"orientation\":\"v\",\"showlegend\":false,\"x\":[\"2031-01-14T00:00:00\",\"2031-01-14T00:00:00\",\"2031-07-16T00:00:00\",\"2031-07-16T00:00:00\",\"2032-01-15T00:00:00\",\"2032-01-15T00:00:00\",\"2032-07-16T00:00:00\",\"2032-07-16T00:00:00\",\"2033-01-14T00:00:00\",\"2033-01-14T00:00:00\",\"2033-07-16T00:00:00\",\"2033-07-16T00:00:00\",\"2034-01-14T00:00:00\",\"2034-01-14T00:00:00\",\"2034-07-16T00:00:00\",\"2034-07-16T00:00:00\",\"2035-01-14T00:00:00\",\"2035-01-14T00:00:00\",\"2035-07-16T00:00:00\",\"2035-07-16T00:00:00\",\"2036-01-15T00:00:00\",\"2036-01-15T00:00:00\",\"2036-07-16T00:00:00\",\"2036-07-16T00:00:00\",\"2037-01-14T00:00:00\",\"2037-01-14T00:00:00\",\"2037-07-16T00:00:00\",\"2037-07-16T00:00:00\",\"2038-01-14T00:00:00\",\"2038-01-14T00:00:00\",\"2038-07-16T00:00:00\",\"2038-07-16T00:00:00\",\"2039-01-14T00:00:00\",\"2039-01-14T00:00:00\",\"2039-07-16T00:00:00\",\"2039-07-16T00:00:00\",\"2040-01-15T00:00:00\",\"2040-01-15T00:00:00\",\"2040-07-16T00:00:00\",\"2040-07-16T00:00:00\",\"2041-01-14T00:00:00\",\"2041-01-14T00:00:00\",\"2041-07-16T00:00:00\",\"2041-07-16T00:00:00\",\"2042-01-14T00:00:00\",\"2042-01-14T00:00:00\",\"2042-07-16T00:00:00\",\"2042-07-16T00:00:00\",\"2043-01-14T00:00:00\",\"2043-01-14T00:00:00\",\"2043-07-16T00:00:00\",\"2043-07-16T00:00:00\",\"2044-01-15T00:00:00\",\"2044-01-15T00:00:00\",\"2044-07-16T00:00:00\",\"2044-07-16T00:00:00\",\"2045-01-14T00:00:00\",\"2045-01-14T00:00:00\",\"2045-07-16T00:00:00\",\"2045-07-16T00:00:00\",\"2046-01-14T00:00:00\",\"2046-01-14T00:00:00\",\"2046-07-16T00:00:00\",\"2046-07-16T00:00:00\",\"2047-01-14T00:00:00\",\"2047-01-14T00:00:00\",\"2047-07-16T00:00:00\",\"2047-07-16T00:00:00\",\"2048-01-15T00:00:00\",\"2048-01-15T00:00:00\",\"2048-07-16T00:00:00\",\"2048-07-16T00:00:00\",\"2049-01-14T00:00:00\",\"2049-01-14T00:00:00\",\"2049-07-16T00:00:00\",\"2049-07-16T00:00:00\",\"2050-01-14T00:00:00\",\"2050-01-14T00:00:00\",\"2050-07-16T00:00:00\",\"2050-07-16T00:00:00\"],\"xaxis\":\"x\",\"y\":[9.952474117647114,9.952474117647114,24.061035294117687,24.061035294117687,10.142322941176474,10.142322941176474,24.530692941176483,24.530692941176483,9.907942941176486,9.907942941176486,24.722234705882386,24.722234705882386,9.548873529411765,9.548873529411765,23.84629176470588,23.84629176470588,10.284758235294191,10.284758235294191,24.231422352941195,24.231422352941195,10.372100000000046,10.372100000000046,24.488941764705885,24.488941764705885,9.98571000000004,9.98571000000004,24.79424117647062,24.79424117647062,10.221372352941216,10.221372352941216,24.730553529411793,24.730553529411793,10.222609411764722,10.222609411764722,24.44979882352942,24.44979882352942,10.473662941176485,10.473662941176485,24.40726882352942,24.40726882352942,10.427640588235306,10.427640588235306,24.768547647058824,24.768547647058824,10.364736470588241,10.364736470588241,24.53479647058822,24.53479647058822,10.112910588235309,10.112910588235309,24.769181176470624,24.769181176470624,10.250792352941176,10.250792352941176,24.489877058823538,24.489877058823538,10.166119411764669,10.166119411764669,24.448076470588262,24.448076470588262,10.728997647058861,10.728997647058861,25.111282352941203,25.111282352941203,10.347248823529412,10.347248823529412,24.72313823529413,24.72313823529413,10.706604117647089,10.706604117647089,25.187577058823535,25.187577058823535,10.59243764705883,10.59243764705883,24.829653529411814,24.829653529411814,10.63225529411767,10.63225529411767,25.053394117647144,25.053394117647144],\"yaxis\":\"y\",\"type\":\"scatter\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgb(17,17,17)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#f2f5fa\"},\"error_y\":{\"color\":\"#f2f5fa\"},\"marker\":{\"line\":{\"color\":\"rgb(17,17,17)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#A2B1C6\",\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"minorgridcolor\":\"#506784\",\"startlinecolor\":\"#A2B1C6\"},\"baxis\":{\"endlinecolor\":\"#A2B1C6\",\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"minorgridcolor\":\"#506784\",\"startlinecolor\":\"#A2B1C6\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"line\":{\"color\":\"#283442\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattermapbox\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolargl\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolar\"}],\"scatter\":[{\"marker\":{\"line\":{\"color\":\"#283442\"}},\"type\":\"scatter\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#506784\"},\"line\":{\"color\":\"rgb(17,17,17)\"}},\"header\":{\"fill\":{\"color\":\"#2a3f5f\"},\"line\":{\"color\":\"rgb(17,17,17)\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowcolor\":\"#f2f5fa\",\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#f2f5fa\"},\"geo\":{\"bgcolor\":\"rgb(17,17,17)\",\"lakecolor\":\"rgb(17,17,17)\",\"landcolor\":\"rgb(17,17,17)\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"#506784\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"mapbox\":{\"style\":\"dark\"},\"paper_bgcolor\":\"rgb(17,17,17)\",\"plot_bgcolor\":\"rgb(17,17,17)\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"},\"bgcolor\":\"rgb(17,17,17)\",\"radialaxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"rgb(17,17,17)\",\"gridcolor\":\"#506784\",\"gridwidth\":2,\"linecolor\":\"#506784\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"#C8D4E3\"},\"yaxis\":{\"backgroundcolor\":\"rgb(17,17,17)\",\"gridcolor\":\"#506784\",\"gridwidth\":2,\"linecolor\":\"#506784\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"#C8D4E3\"},\"zaxis\":{\"backgroundcolor\":\"rgb(17,17,17)\",\"gridcolor\":\"#506784\",\"gridwidth\":2,\"linecolor\":\"#506784\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"#C8D4E3\"}},\"shapedefaults\":{\"line\":{\"color\":\"#f2f5fa\"}},\"sliderdefaults\":{\"bgcolor\":\"#C8D4E3\",\"bordercolor\":\"rgb(17,17,17)\",\"borderwidth\":1,\"tickwidth\":0},\"ternary\":{\"aaxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"},\"bgcolor\":\"rgb(17,17,17)\",\"caxis\":{\"gridcolor\":\"#506784\",\"linecolor\":\"#506784\",\"ticks\":\"\"}},\"title\":{\"x\":0.05},\"updatemenudefaults\":{\"bgcolor\":\"#506784\",\"borderwidth\":0},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"#283442\",\"linecolor\":\"#506784\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"#283442\",\"zerolinewidth\":2},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"#283442\",\"linecolor\":\"#506784\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"#283442\",\"zerolinewidth\":2}}},\"xaxis\":{\"anchor\":\"y\",\"domain\":[0.0,1.0],\"title\":{\"text\":\"Date\"}},\"yaxis\":{\"anchor\":\"x\",\"domain\":[0.0,1.0],\"title\":{\"text\":\"Temperature (°C)\"}},\"legend\":{\"tracegroupgap\":0},\"title\":{\"text\":\"Mean Temperature Over Time\"}}, {\"responsive\": true} ).then(function(){\n",
1449
+ " \n",
1450
+ "var gd = document.getElementById('0ca9e356-0087-49c5-9366-b7197b98f96f');\n",
1451
+ "var x = new MutationObserver(function (mutations, observer) {{\n",
1452
+ " var display = window.getComputedStyle(gd).display;\n",
1453
+ " if (!display || display === 'none') {{\n",
1454
+ " console.log([gd, 'removed!']);\n",
1455
+ " Plotly.purge(gd);\n",
1456
+ " observer.disconnect();\n",
1457
+ " }}\n",
1458
+ "}});\n",
1459
+ "\n",
1460
+ "// Listen for the removal of the full notebook cells\n",
1461
+ "var notebookContainer = gd.closest('#notebook-container');\n",
1462
+ "if (notebookContainer) {{\n",
1463
+ " x.observe(notebookContainer, {childList: true});\n",
1464
+ "}}\n",
1465
+ "\n",
1466
+ "// Listen for the clearing of the current output cell\n",
1467
+ "var outputEl = gd.closest('.output');\n",
1468
+ "if (outputEl) {{\n",
1469
+ " x.observe(outputEl, {childList: true});\n",
1470
+ "}}\n",
1471
+ "\n",
1472
+ " }) }; }); </script> </div>"
1473
+ ]
1474
+ },
1475
+ "metadata": {},
1476
+ "output_type": "display_data"
1477
+ }
1478
+ ],
1479
+ "source": [
1480
+ "figure"
1481
+ ]
1482
+ }
1483
+ ],
1484
+ "metadata": {
1485
+ "kernelspec": {
1486
+ "display_name": "climateqa",
1487
+ "language": "python",
1488
+ "name": "python3"
1489
+ },
1490
+ "language_info": {
1491
+ "codemirror_mode": {
1492
+ "name": "ipython",
1493
+ "version": 3
1494
+ },
1495
+ "file_extension": ".py",
1496
+ "mimetype": "text/x-python",
1497
+ "name": "python",
1498
+ "nbconvert_exporter": "python",
1499
+ "pygments_lexer": "ipython3",
1500
+ "version": "3.11.9"
1501
+ }
1502
+ },
1503
+ "nbformat": 4,
1504
+ "nbformat_minor": 2
1505
+ }
style.css CHANGED
@@ -481,14 +481,13 @@ a {
481
  max-height: calc(100vh - 190px) !important;
482
  overflow: hidden;
483
  }
484
-
485
  div#tab-examples,
486
  div#sources-textbox,
487
  div#tab-config {
488
  height: calc(100vh - 190px) !important;
489
  overflow-y: scroll !important;
490
  }
491
-
492
  div#sources-figures,
493
  div#graphs-container,
494
  div#tab-citations {
@@ -608,6 +607,10 @@ a {
608
  }
609
 
610
  #vanna-display {
611
- height: 400px;
612
  overflow-y: auto;
613
  }
 
 
 
 
 
481
  max-height: calc(100vh - 190px) !important;
482
  overflow: hidden;
483
  }
 
484
  div#tab-examples,
485
  div#sources-textbox,
486
  div#tab-config {
487
  height: calc(100vh - 190px) !important;
488
  overflow-y: scroll !important;
489
  }
490
+ div#tab-vanna,
491
  div#sources-figures,
492
  div#graphs-container,
493
  div#tab-citations {
 
607
  }
608
 
609
  #vanna-display {
610
+ max-height: 300px;
611
  overflow-y: auto;
612
  }
613
+ #sql-query{
614
+ max-height: 100px;
615
+ overflow-y:scroll;
616
+ }