update endpoint
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ from datetime import datetime
|
||||
def get_data(emeis:list[str],scraper:DataScraper) -> list[pd.DataFrame]:
|
||||
dataframes = []
|
||||
for imei in tqdm(emeis,ascii=True,desc="gather_data"):
|
||||
resp = json.loads(scraper.get_data(imei,history_length=90)["response"].decode("utf-8"))["data"]
|
||||
resp = json.loads(scraper.get_data(imei,history_length=90)["response"].decode("utf-8"))
|
||||
df = pd.DataFrame(resp)
|
||||
df['MeasurementTime'] = pd.to_datetime(df['MeasurementTime']) #fix time date
|
||||
dataframes.append(df)
|
||||
@@ -51,7 +51,7 @@ def fill_column(elements:list[str],column_index:int,img):
|
||||
"""
|
||||
column_shift = [900,1100,1330,1900]
|
||||
dist = 37
|
||||
row_shift = [720,760,925,1120,1295,1470,1510,1650,1650+dist,1650+dist*2,1650+dist*3,1650+dist*4,1650+dist*5,1650+dist*6,1650+dist*7,1650+dist*8,1650+dist*9,2135,2315,2315+dist*1,2315+dist*2,2315+dist*3,2560,2750,2750+dist]
|
||||
row_shift = [720,760,925,1120,1295,1470,1510,1650,1650+dist,1650+dist*2,1650+dist*3,1650+dist*4,1650+dist*5,1650+dist*6,1650+dist*7,1650+dist*8,1650+dist*9,2135,2315,2315+dist*1,2315+dist*2,2315+dist*3,2560,2560+dist,2750,2750+dist]
|
||||
|
||||
for row_index,elem in enumerate(elements):
|
||||
add_elem(elem,column_shift[column_index],row_shift[row_index],img)
|
||||
@@ -77,7 +77,7 @@ if __name__ == "__main__":
|
||||
week_number = date.isocalendar(current_date)[1]
|
||||
|
||||
scraper = DataScraper(USERNAME,PASSWORD,BASE_URL)
|
||||
imeis = OrderedDict([("KW1100-0070","86620705863754"),("KW1100-0071","86620705863410"),("KW1100-0080", "86620705863765"),("KW1100-0069","86620705863772"),("KW1100-0065","86620705864160"),("KW1100-0078","86620705863735"),("KW1100-0061","86620705863782"),("KW1100-0059","86620705863392"),("KW1100-0062","86620705863715"),("KW1100-0075","86620705863575"),("KW1100-0073","86620705864180"),("KW1100-0064","86620705863719"),("KW1100-0063","86620705863729"),("KW1100-0066","86620705863736"),("KW1100-0052","86366306494384"),("KW1100-0054","86366306494401"),("KW1100-0074","86620705864162"),("KW1100-0060","86620705863639"),("KW1100-0055","86620705863526"),("KW1100-0058","86620705864178"),("KW1100-0057","86620705864123") , ("KW1100-0056","86620705864099"),("KW1100-0051","86366306494409"),("KW1100-0079","86620705864105"),("KW1100-0049","86366306491069")])
|
||||
imeis = OrderedDict([("KW1100-0070","86620705863754"),("KW1100-0071","86620705863410"),("KW1100-0080", "86620705863765"),("KW1100-0069","86620705863772"),("KW1100-0065","86620705864160"),("KW1100-0078","86620705863735"),("KW1100-0061","86620705863782"),("KW1100-0059","86620705863392"),("KW1100-0062","86620705863715"),("KW1100-0075","86620705863575"),("KW1100-0073","86620705864180"),("KW1100-0064","86620705863719"),("KW1100-0063","86620705863729"),("KW1100-0066","86620705863736"),("KW1100-0053","86366306494398"),("KW1100-0054","86366306494401"),("KW1100-0074","86620705864162"),("KW1100-0060","86620705863639"),("KW1100-0055","86620705863526"),("KW1100-0058","86620705864178"),("KW1100-0057","86620705864123") , ("KW1100-0056","86620705864099"),("KW1100-0051","86366306494409"),("KW1100-0082", "86620705863403"),("KW1100-0079","86620705864105"),("KW1100-0049","86366306491069")])
|
||||
img = Image.open("template.png")
|
||||
img = add_elem(str(current_date),400,160,img,font_size=40)
|
||||
img = add_elem(str(week_number),400,110,img,font_size=40)
|
||||
@@ -101,7 +101,7 @@ if __name__ == "__main__":
|
||||
#static delta 7 daags
|
||||
deltas = []
|
||||
for df in dfs:
|
||||
x = get_data_within_n_days(df,7,current_date)["Sv4"]
|
||||
x = get_data_within_n_days(df,7,current_date)["Sv5"]
|
||||
deltas.append(str(round(x.max()-x.min(),1)))
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 468 KiB After Width: | Height: | Size: 471 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 613 KiB After Width: | Height: | Size: 615 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,7 +15,7 @@ from datetime import datetime, timedelta
|
||||
def get_data(emeis:list[str],scraper:DataScraper) -> list[pd.DataFrame]:
|
||||
dataframes = []
|
||||
for imei in tqdm(emeis,ascii=True,desc="gather_data"):
|
||||
resp = json.loads(scraper.get_data(imei,history_length=90)["response"].decode("utf-8"))["data"]
|
||||
resp = json.loads(scraper.get_data(imei,history_length=90)["response"].decode("utf-8"))
|
||||
df = pd.DataFrame(resp)
|
||||
df['MeasurementTime'] = pd.to_datetime(df['MeasurementTime']) #fix time date
|
||||
dataframes.append(df)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user