diff --git a/CS_499_backend.py b/CS_499_backend.py
index 53f623f272712d43f963e0064003e4c0214fd315..8bc535ca63f6e7483ba458df7816c73ccd5064d4 100644
--- a/CS_499_backend.py
+++ b/CS_499_backend.py
@@ -1,8 +1,11 @@
 ## Data base generation code by Group 3 CS 499 ##
 # Morning data,afternoon ,night data for temp
-
 import random
 import math
+import requests
+import json
+import numpy as np
+
 
 class Door_Window:
 
@@ -15,10 +18,10 @@ class Door_Window:
     
 
 WORKWEEK=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
-NUM_WEEKS=4
+NUM_WEEKS=11
 Door_Window_History=dict()
 
-time_stamp=1
+time_stamp=0
 for i in range(0,NUM_WEEKS):
     for j in range(0,7):
         #door_opens = 0
@@ -80,31 +83,51 @@ for i in range(0,NUM_WEEKS):
         #Watts Ussage
         Watts_micro=(Microwave/60)*1100
         Watts_stove=(Stove/60)*3500
-        Watts_oven=(Oven/60)*4000
+        Watts_oven=(Oven/60)*4000/60
         Watts_Lrtv=(Living_roomTV/60)*636
         Watts_Brtv=(BedroomTV/60)*100
         Watts_Fridge=(Fridge/60)*150
-        Watts_Lights=(lights*random.randint(4,8))*60
+        Watts_Lights=(lights*random.randint(4,8))
         #Cost Calculations
-        Cost_micro=(Watts_micro/1000)*0.12
-        Cost_stove=(Watts_stove/1000)*0.12
-        Cost_oven=(Watts_oven/1000)*0.12
-        Cost_Lrtv=(Watts_Lrtv/1000)*0.12
-        Cost_Brtv=(Watts_Brtv/1000)*0.12
-        Cost_Fridge=(Watts_Fridge/1000)*0.12   
-        Cost_lights=(Watts_Lights/1000)*0.12   
+        Cost_micro=((Watts_micro/1000)*0.12)/100
+        Cost_stove=((Watts_stove/1000)*0.12)/100
+        Cost_oven=((Watts_oven/1000)*0.12)/100
+        Cost_Lrtv=((Watts_Lrtv/1000)*0.12)/100
+        Cost_Brtv=((Watts_Brtv/1000)*0.12)/100
+        Cost_Fridge=((Watts_Fridge/1000)*0.12)/100   
+        Cost_lights=((Watts_Lights/1000)*0.12 )/100  
         App1_History[time_stamp2] = Appliance_1(WORKWEEK[j],Watts_micro,Watts_stove,Watts_oven,Watts_Lrtv,Watts_Brtv,Watts_Fridge,Watts_Lights,Cost_micro,Cost_stove,Cost_oven,Cost_Lrtv,Cost_Brtv,Cost_Fridge,Cost_lights)
         time_stamp2 += 1
 
-monthly_cost1=0
-monthly_power1=0
+monthly_cost1_JAN=0
+monthly_power1_JAN=0
+monthly_cost1_FEB=0
+monthly_power1_FEB=0
+monthly_cost1_MAR=0
+monthly_power1_MAR=0
 
+print("######################################################  TOTAL APP1 HISTORY FOR 77  DAYS  ###################################################### \n")
 for i in App1_History:
-    monthly_power1 += App1_History[i].micro_pwr + App1_History[i].stove_pwr + App1_History[i].oven_pwr + App1_History[i].Lrtv_pwr + App1_History[i].Brtv_pwr + App1_History[i].fridge_pwr +App1_History[i].lights_pwr
-    monthly_cost1 += App1_History[i].micro_ct + App1_History[i].stove_ct + App1_History[i].oven_ct + App1_History[i].Lrtv_ct + App1_History[i].Brtv_ct + App1_History[i].fridge_ct + App1_History[i].lights_ct
-    print(i,App1_History[i].day,App1_History[i].micro_pwr,App1_History[i].stove_pwr,App1_History[i].oven_pwr,App1_History[i].Lrtv_pwr,App1_History[i].Brtv_pwr,App1_History[i].micro_ct,App1_History[i].stove_ct,App1_History[i].oven_ct,App1_History[i].Lrtv_ct,App1_History[i].Brtv_ct)
-print(monthly_power1)
-print(monthly_cost1)
+    if i<=31:
+        monthly_power1_JAN += App1_History[i].micro_pwr + App1_History[i].stove_pwr + App1_History[i].oven_pwr + App1_History[i].Lrtv_pwr + App1_History[i].Brtv_pwr + App1_History[i].fridge_pwr +App1_History[i].lights_pwr
+        monthly_cost1_JAN += App1_History[i].micro_ct + App1_History[i].stove_ct + App1_History[i].oven_ct + App1_History[i].Lrtv_ct + App1_History[i].Brtv_ct + App1_History[i].fridge_ct + App1_History[i].lights_ct
+    if i>32 and i<=60:
+        monthly_power1_FEB += App1_History[i].micro_pwr + App1_History[i].stove_pwr + App1_History[i].oven_pwr + App1_History[i].Lrtv_pwr + App1_History[i].Brtv_pwr + App1_History[i].fridge_pwr +App1_History[i].lights_pwr
+        monthly_cost1_FEB += App1_History[i].micro_ct + App1_History[i].stove_ct + App1_History[i].oven_ct + App1_History[i].Lrtv_ct + App1_History[i].Brtv_ct + App1_History[i].fridge_ct + App1_History[i].lights_ct
+    if i>61:
+        monthly_power1_MAR += App1_History[i].micro_pwr + App1_History[i].stove_pwr + App1_History[i].oven_pwr + App1_History[i].Lrtv_pwr + App1_History[i].Brtv_pwr + App1_History[i].fridge_pwr +App1_History[i].lights_pwr
+        monthly_cost1_MAR += App1_History[i].micro_ct + App1_History[i].stove_ct + App1_History[i].oven_ct + App1_History[i].Lrtv_ct + App1_History[i].Brtv_ct + App1_History[i].fridge_ct + App1_History[i].lights_ct
+    #print(i,App1_History[i].day,App1_History[i].micro_pwr,App1_History[i].stove_pwr,App1_History[i].oven_pwr,App1_History[i].Lrtv_pwr,App1_History[i].Brtv_pwr,App1_History[i].micro_ct,App1_History[i].stove_ct,App1_History[i].oven_ct,App1_History[i].Lrtv_ct,App1_History[i].Brtv_ct)
+print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 watts used : ",monthly_power1_JAN )
+print( "FEB APP1 watts used : ",monthly_power1_FEB )
+print( "MAR APP1 watts used : ",monthly_power1_MAR )
+print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 cost used : ",monthly_cost1_JAN )
+print( "FEB APP1 cost used : ",monthly_cost1_FEB )
+print( "MAR APP1 cost used : ",monthly_cost1_MAR )
+#print( "################################################################################################################################################################# \n")
+
 
 
 
@@ -132,7 +155,7 @@ class Appliance_with_Water:
         self.shower=shower
 
 App2_History=dict()
-time_stamp3=1
+time_stamp3=0
 for i in range(0,NUM_WEEKS):
     Dish_washer_run=random.randint(3,5)
     Clths_wash_dry_run=random.randint(3,5)
@@ -166,11 +189,11 @@ for i in range(0,NUM_WEEKS):
         Bath_Fans_pwr=((Bath*45)/60)*30
 
         # Cost
-        Hot_water_ct=(Hot_water_pwr/1000)*0.12
-        Dish_washer_ct=(Dish_washer_pwr/1000)*0.12
-        Clothes_wash_ct=(Clothes_wash_pwr/1000)*0.12
-        Clothes_dry_ct=(Clothes_dry_pwr/1000)*0.12
-        Bath_Fans_ct=(Bath_Fans_pwr/1000)*0.12
+        Hot_water_ct=((Hot_water_pwr/1000)*0.12)/100
+        Dish_washer_ct=((Dish_washer_pwr/1000)*0.12)/100
+        Clothes_wash_ct=((Clothes_wash_pwr/1000)*0.12)/100
+        Clothes_dry_ct=((Clothes_dry_pwr/1000)*0.12)/100
+        Bath_Fans_ct=((Bath_Fans_pwr/1000)*0.12)/100
 
         # Water Used / Cost
         Water_Total=Bath_water+Shower_water+Clths_water+Dish_washer_water
@@ -178,36 +201,136 @@ for i in range(0,NUM_WEEKS):
         Water_cost=Water_Feet*(2.52/100)
         #Water_Heat_pwr,DishWasher_pwr,Clothes_Wash_pwr,Clothes_dry_pwr,bath_fan_pwr,Water_Heat_ug,DishWasher_ug,Clothes_Wash_ug,Water_Heat_ct,DishWasher_ct,Clothes_Wash_ct,Clothes_dry_ct,bath_fan_ct,bath,shower
         App2_History[time_stamp3] = Appliance_with_Water(WORKWEEK[j],Hot_water_pwr,Dish_washer_pwr,Clothes_wash_pwr,Clothes_dry_pwr,Bath_Fans_pwr,Hot_water,Bath_water,Shower_water,Dish_washer_water,Clths_water,Hot_water_ct,Dish_washer_ct,Clothes_wash_ct,Clothes_dry_ct,Bath_Fans_ct,Water_cost,Bath,Shower)
-    
-monthly_cost2=0
-monthly_power2=0
-monthly_water_usg=0
+        time_stamp3+=1
+
+monthly_cost2_JAN=0
+monthly_power2_JAN=0
+monthly_water_usg_JAN=0
+monthly_cost2_FEB=0
+monthly_power2_FEB=0
+monthly_water_usg_FEB=0
+monthly_cost2_MAR=0
+monthly_power2_MAR=0
+monthly_water_usg_MAR=0
+print("######################################################  TOTAL APP2 HISTORY FOR 77 DAYS  ###################################################### \n")
 for i in App2_History:
-    monthly_cost2+= App2_History[i].Water_Heat_ct + App2_History[i].DishWasher_ct + App2_History[i].Clothes_Wash_ct + App2_History[i].Clothes_dry_ct +App2_History[i].Water_ct + App2_History[i].bath_fans_ct
-    monthly_power2+= App2_History[i].Water_Heat_pwr+ App2_History[i].DishWasher_pwr + App2_History[i].Clothes_Wash_pwr + App2_History[i].Clothes_dry_pwr + App2_History[i].bath_fans_pwr
-    monthly_water_usg+= App2_History[i].Bath_water_ug + App2_History[i].Shower_water_ug + App2_History[i].DishWasher_ug+ App2_History[i].Clothes_Wash_ug
+    if i>=31:
+        monthly_cost2_JAN+= App2_History[i].Water_Heat_ct + App2_History[i].DishWasher_ct + App2_History[i].Clothes_Wash_ct + App2_History[i].Clothes_dry_ct +App2_History[i].Water_ct + App2_History[i].bath_fans_ct
+        monthly_power2_JAN+= App2_History[i].Water_Heat_pwr+ App2_History[i].DishWasher_pwr + App2_History[i].Clothes_Wash_pwr + App2_History[i].Clothes_dry_pwr + App2_History[i].bath_fans_pwr
+        monthly_water_usg_JAN+= App2_History[i].Bath_water_ug + App2_History[i].Shower_water_ug + App2_History[i].DishWasher_ug+ App2_History[i].Clothes_Wash_ug
+    if i>32 and i<=60:
+        monthly_cost2_FEB+= App2_History[i].Water_Heat_ct + App2_History[i].DishWasher_ct + App2_History[i].Clothes_Wash_ct + App2_History[i].Clothes_dry_ct +App2_History[i].Water_ct + App2_History[i].bath_fans_ct
+        monthly_power2_FEB+= App2_History[i].Water_Heat_pwr+ App2_History[i].DishWasher_pwr + App2_History[i].Clothes_Wash_pwr + App2_History[i].Clothes_dry_pwr + App2_History[i].bath_fans_pwr
+        monthly_water_usg_FEB+= App2_History[i].Bath_water_ug + App2_History[i].Shower_water_ug + App2_History[i].DishWasher_ug+ App2_History[i].Clothes_Wash_ug
+    if i>61:
+        monthly_cost2_MAR+= App2_History[i].Water_Heat_ct + App2_History[i].DishWasher_ct + App2_History[i].Clothes_Wash_ct + App2_History[i].Clothes_dry_ct +App2_History[i].Water_ct + App2_History[i].bath_fans_ct
+        monthly_power2_MAR+= App2_History[i].Water_Heat_pwr+ App2_History[i].DishWasher_pwr + App2_History[i].Clothes_Wash_pwr + App2_History[i].Clothes_dry_pwr + App2_History[i].bath_fans_pwr
+        monthly_water_usg_MAR+= App2_History[i].Bath_water_ug + App2_History[i].Shower_water_ug + App2_History[i].DishWasher_ug+ App2_History[i].Clothes_Wash_ug
+    #print(i,App2_History[i].day,App2_History[i].Water_Heat_pwr,App2_History[i].DishWasher_pwr,App2_History[i].Clothes_Wash_pwr,App2_History[i].Clothes_dry_pwr,App2_History[i].bath_fans_pwr,App2_History[i].Water_Heat_ug,App2_History[i].Bath_water_ug,App2_History[i].Shower_water_ug,App2_History[i].DishWasher_ug,App2_History[i].Clothes_Wash_ug,App2_History[i].Water_Heat_ct,App2_History[i].DishWasher_ct,App2_History[i].Clothes_Wash_ct,App2_History[i].Clothes_dry_ct,App2_History[i].bath_fans_ct,App2_History[i].Water_ct,App2_History[i].bath,App2_History[i].shower)
+print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 watts used : ",monthly_power2_JAN )
+print( "FEB APP1 watts used : ",monthly_power2_FEB )
+print( "MAR APP1 watts used : ",monthly_power2_MAR )
+print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 cost used : ",monthly_cost2_JAN )
+print( "FEB APP1 cost used : ",monthly_cost2_FEB )
+print( "MAR APP1 cost used : ",monthly_cost2_MAR )
+print( "_ - _ - _ - _  Gallons used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 water used : ",monthly_water_usg_JAN )
+print( "FEB APP1 water used : ",monthly_water_usg_FEB )
+print( "MAR APP1 water used : ",monthly_water_usg_MAR )
+#print( "################################################################################################################################################################# \n")
 
-print("Water app pwr" ,monthly_power2)
-print("Water app cost", monthly_cost2)
-print("Water used ", monthly_water_usg) 
 
-print("total cost" ,monthly_cost1+ monthly_cost2)
-
-# Pick random outdoor temp then activte hvac event
-# Pick random 
 # weather api to get temp from history
-
+# Used this to help me understand and gather API.data: https://pypi.org/project/requests/ and https://realpython.com/api-integration-in-python/
 class Temprature_data:
-    def __init__(self,day,hsy_temp,temp_power,temp_cost):
-        self.day=day
-        self.hsy_temp=hsy_temp
+    def __init__(self,temp_power,temp_cost):
         self.temp_power=temp_power
         self.temp_cost=temp_cost
 
-time_stamp4=1
-#for i in range(0,NUM_WEEKS):
-#    for j in range(0,7):
-        
+
+
+response_API = requests.get("https://archive-api.open-meteo.com/v1/archive?latitude=33.52&longitude=-86.80&start_date=2023-01-01&end_date=2023-03-12&hourly=temperature_2m&timezone=America%2FChicago&temperature_unit=fahrenheit")
+data = response_API.text
+parse_temp=json.loads(data)
+hourly_pull = parse_temp['hourly']
+dict_pull=hourly_pull["temperature_2m"]
+
+
+
+App3_History=dict()
+time_stamp4=0
+daily_arr=np.array_split(dict_pull,77)
+
+
+
+for i in range(0,len(daily_arr)):
+    daily_arr[i]
+    d_t=Door_Window_History[i].Door_time
+    w_t=Door_Window_History[i].Window_time
+    diff_inc = 0
+    diff_dec = 0        
+    for j in range(0,len(daily_arr[i])-1):
+        num_nxt=daily_arr[i][j+1]
+        num=daily_arr[i][j]
+        if num > num_nxt :
+            diff_inc= num - num_nxt
+        if num < num_nxt :
+            diff_dec= num_nxt - num
+    # print(diff_inc)
+    # print(diff_dec)
+    sum=(diff_inc+diff_dec)*random.randint(2,17)
+    #Total number of minutes ac runs
+    min_op=sum*60+(d_t+w_t)
+    watts_per_day=(min_op)*3500
+    ct_per_day=((watts_per_day/1000)*0.12)/100
+    App3_History[time_stamp4]=Temprature_data(watts_per_day,ct_per_day)
+    time_stamp4+=1
+    #print(ct_per_day)
+    #print(watts_per_day)
+    # print("what i is",i)
+    # print("timestamp",i)
+
+
+
+monthly_temp_ct_JAN=0
+monthly_temp_watts_JAN=0
+monthly_temp_ct_FEB=0
+monthly_temp_watts_FEB=0
+monthly_temp_ct_MAR=0
+monthly_temp_watts_MAR=0
+print("######################################################  TOTAL TEMP HISTORY FOR 77 DAYS  ###################################################### \n")
+for i in App3_History:
+    if i<=31:
+        monthly_temp_watts_JAN+=App3_History[i].temp_power
+        monthly_temp_ct_JAN+=App3_History[i].temp_cost
+    if i>31 and i<=59:
+        monthly_temp_watts_FEB+=App3_History[i].temp_power
+        monthly_temp_ct_FEB+=App3_History[i].temp_cost
+    if i>59:
+        monthly_temp_ct_MAR+=App3_History[i].temp_cost
+        monthly_temp_watts_MAR+=App3_History[i].temp_power
+print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 watts used : ",monthly_temp_watts_JAN )
+print( "FEB APP1 watts used : ",monthly_temp_watts_FEB )
+print( "MAR APP1 watts used : ",monthly_temp_watts_MAR )
+print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 cost used : ",monthly_temp_ct_JAN )
+print( "FEB APP1 cost used : ",monthly_temp_ct_FEB )
+print( "MAR APP1 cost used : ",monthly_temp_ct_MAR )
+print( "################################################################################################################################################################# \n")
+print("January Total cost",monthly_temp_ct_JAN+monthly_cost2_JAN+monthly_cost1_JAN)
+print("Febuary Total cost",monthly_temp_ct_FEB+monthly_cost2_FEB+monthly_cost1_FEB)
+print("March Total cost",monthly_temp_ct_MAR+monthly_cost2_FEB+monthly_cost1_MAR)
+print("January Total Watts",monthly_temp_watts_JAN+monthly_power2_JAN+monthly_power1_JAN)
+print("Febuary Total Watts",monthly_temp_watts_FEB+monthly_power2_FEB+monthly_power1_FEB)
+print("March Total Watts",monthly_temp_watts_MAR+monthly_power2_MAR+monthly_power1_MAR)
+
+
+
+
+