first tsv commit

This commit is contained in:
quoije
2024-04-01 12:52:27 -04:00
parent c4c10972a1
commit 792c170fd6
4 changed files with 27 additions and 2 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ from pymongo import MongoClient
from dotenv import load_dotenv
import os
load_dotenv("./creds.env")
load_dotenv("../db/creds.env")
mUser = os.getenv()
mPass = os.getenv()
+25
View File
@@ -0,0 +1,25 @@
import csv, os
import app_obd, app_car, app_account, app_gps
from datetime import datetime
currentday = datetime.today().strftime("%d%m%Y")
currenttime = datetime.now().strftime("%H_%M_%S")
account = app_account.Account
car = app_car.Car
sCarModel = ''.join(letter for letter in car.model if letter.isalnum())
tsv_name = account.name + "_" + sCarModel + "_" + currentday + "_" + currenttime + ".tsv"
tsv_path = "../db/tsv/" + tsv_name
def tsv_writer(bExist):
with open(tsv_path, 'w') as o_file:
## VN, NAME, DATE, TIME, GPS_X, GPS_Y, SPEED, ODOMETER
writer = csv.writer(o_file, delimiter='\t')
if bExist == False:
writer.writerow(["VN", "NAME", "DATE", "TIME", "GX", "GY", "SPEED", "ODO"])
else:
writer.writerow([car.model, account.name, currentday, currenttime])
if os.path.exists(tsv_path):
tsv_writer(True)
else:
tsv_writer(False)
-7
View File
@@ -1,7 +0,0 @@
##
## MangoDB server connection details
##
mangosrv_user = ""
mangosrv_pass = ""
mangosrv_db = ""
+1 -1
View File
@@ -1,4 +1,4 @@
## TSV File to MangoDB
## VN_20240401_00_00_00.TSV
## ACCOUNT_VN_20240401_00_00_00.TSV
##
## VN NAME, DATE, TIME, GPS_X, GPS_Y, SPEED, ODOMETER
1 ## TSV File to MangoDB
2 ## VN_20240401_00_00_00.TSV ## ACCOUNT_VN_20240401_00_00_00.TSV
3 ##
4 ## VN NAME, DATE, TIME, GPS_X, GPS_Y, SPEED, ODOMETER