-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·44 lines (34 loc) · 1013 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 22nd 2022
Standalone program to create an activity log
without the rest of the Nansen Legacy logging system
@author: Luke Marsden
"""
import xlsxwriter
import requests
import json
import numpy as np
from datetime import datetime as dt
import make_xlsx as mx
import toktlogger_json_to_df as tl
import pandas as pd
import os.path
filename = 'activity_log'
i = 1
while os.path.exists(f"{filename}_{i}.xlsx"):
print(i)
i += 1
path = f"{filename}_{i}.xlsx"
toktlogger = 'toktlogger-bonnevie.hi.no' # My laptop VM toktlogger
print('\nPulling data from toktlogger')
data = tl.json_to_df(toktlogger)
metadata_df = tl.pull_metadata(toktlogger)
print('\nWriting XLSX file')
terms = list(data.columns)
field_dict = mx.make_dict_of_fields()
metadata = True
conversions = True # Include metadata sheet and conversions sheet
mx.write_file(path,terms,field_dict,metadata,conversions,data, metadata_df)
print('\nGenerated file:', path,'\n')