diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..9f2fa72 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,23 @@ +{ + "version": "0.2.0", + "configurations": [ + + { + "name": "Python: Flask", + "type": "python", + "request": "launch", + "module": "flask", + "env": { + "FLASK_APP": "app.py", + "FLASK_DEBUG": "1" + }, + "args": [ + "run", + "--no-debugger", + "--no-reload" + ], + "jinja": true, + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5c80254 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "[python]": { + "editor.defaultFormatter": "ms-python.autopep8" + }, + "python.formatting.provider": "none" +} diff --git a/app/__init__.py b/app/__init__.py index 7be15bf..8f9f7fd 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -2,7 +2,8 @@ from flask import Flask from flask_sqlalchemy import SQLAlchemy import os -persistent_path = os.getenv("PERSISTENT_STORAGE_DIR", os.path.dirname(os.path.realpath(__file__))) +persistent_path = os.getenv( + "PERSISTENT_STORAGE_DIR", os.path.dirname(os.path.realpath(__file__))) app = Flask(__name__) @@ -16,8 +17,12 @@ db = SQLAlchemy() from app import views from app import models +from app.tracker import Tracker db.init_app(app) +sheets_path = os.path.join(persistent_path, "export.csv") +codes_path = os.path.join(persistent_path, "codes.csv") with app.app_context(): - db.create_all() \ No newline at end of file + db.create_all() + app.tracker = Tracker(codes_path=codes_path, sheets_path=sheets_path) diff --git a/app/__pycache__/__init__.cpython-310.pyc b/app/__pycache__/__init__.cpython-310.pyc index c06de74..27d7d35 100644 Binary files a/app/__pycache__/__init__.cpython-310.pyc and b/app/__pycache__/__init__.cpython-310.pyc differ diff --git a/app/__pycache__/app.cpython-310.pyc b/app/__pycache__/app.cpython-310.pyc new file mode 100644 index 0000000..b69a4bb Binary files /dev/null and b/app/__pycache__/app.cpython-310.pyc differ diff --git a/app/__pycache__/models.cpython-310.pyc b/app/__pycache__/models.cpython-310.pyc index fab97f4..a3c0c7e 100644 Binary files a/app/__pycache__/models.cpython-310.pyc and b/app/__pycache__/models.cpython-310.pyc differ diff --git a/app/__pycache__/tracker.cpython-310.pyc b/app/__pycache__/tracker.cpython-310.pyc new file mode 100644 index 0000000..cb6dfac Binary files /dev/null and b/app/__pycache__/tracker.cpython-310.pyc differ diff --git a/app/__pycache__/views.cpython-310.pyc b/app/__pycache__/views.cpython-310.pyc index 0a8646a..d377301 100644 Binary files a/app/__pycache__/views.cpython-310.pyc and b/app/__pycache__/views.cpython-310.pyc differ diff --git a/app/codes.csv b/app/codes.csv new file mode 100644 index 0000000..e17a6ad --- /dev/null +++ b/app/codes.csv @@ -0,0 +1,110 @@ +-1, Undefined +0, Sleep +, +, +0.4, Airplane sleep +0.5, Nap +, +, +, +, +, +1, Family +, +, +, +15, Neighborhood / Community work +, +, +, +, +, +2, Friends +, +, +, +, +, +, +28, Meal +29, Drugs +, +3, Dating / Partner +31, Jen's family +32, Jen's friends +33, Sex +34, Exploring +35, Errands and logistics +36, Watching something +37," Hiking, adventuring " +38, Meal +39, Relaxing +, +4, Flying +41," Airports, etc." +43, Flying with Jen +45, Flying for business +46, Maintenance +47, Training +, +, +, +, +, +, +5, Work +, +, +, +56, Inbox +57, Work meditation +58, Socializing +, +, +, +6, Productive +61, Cleaning +63, Home project +65, Personal finances / life admin +66, Outdoor exercise +67, Gym +, +69, Bureaucracy / bullshit +7, Hobbies and Skills +, +, +73, Home Improvement +, +, +, +, +, +, +8, Relaxation and Leisure +81, TV / Movies +82, Hot tub / Sauna +83, Masturbation +, +, +, +, +88, Video games +89, Social Media +9, Waste +91, Waiting / killing time +, +, +, +96, Disaster +, +, +98, Can't sleep +99, Stress eating +10, Health and Travel +101, Food +, +103, Bath +104, In transit +105, Shower and get ready +106," Cleaning, packing " +108, Massage \ No newline at end of file diff --git a/app/export.csv b/app/export.csv new file mode 100644 index 0000000..0937b96 --- /dev/null +++ b/app/export.csv @@ -0,0 +1,366 @@ +DATE,DAY,12 AM,1 AM,2 AM,3 AM,4 AM,5 AM,6 AM,7 AM,8 AM,9 AM,10 AM,11 AM,12 PM,1 PM,2 PM,3 PM,4 PM,5 PM,6 PM,7 PM,8 PM,9 PM,10 PM,11 PM,Mood,Comments,#, Name +1/1,SUN,2,2,2,0,0,0,0,0,0,0,0,9,2,3,3,2,2,2,2,2,2,2,2,2,5,"Upstate with Hil, Averi, Lex, etc",0, Sleep +1/2,MON,2,2,0,0,0,0,0,0,0,0,2,2,10,10,10,9,9,9,10,2,2,2,2,2,6,Hungover return; dinner with Gabe and Jackie,1, Family +1/3,TUE,3,9,0,0,0,0,0,0,0,8,8,6,3,8,9,9,5,9,9,9,9,9,3,7,3,Languishing ,2, Friends +1/4,WED,7,9,0,0,0,0,0,0,0,0,8,9,7,7,6,0,3,3,3,3,3,8,9,9,4,Still languishing,3, Dating / Partner +1/5,THU,9,0,0,0,0,0,0,0,0,0,8,9,9,10,9,9,9,10,4,4,4,4,4,10,3,Finally on the way home,4,Flying +1/6,FRI,10,0,0,0,0,0,0,0,3,10,10,10,10,10,10,10,10,10,10,10,10,8,8,8,6,"En route via Springfield, IL!",5, Work +1/7,SAT,8,8,0,0,0,0,0,0,6,6,3,3,8,8,8,8,8,1,1,1,3,8,8,8,8,First day back; gym; family; fast,6, Productive +1/8,SUN,0,0,0,0,0,0,0,0,0,8,8,8,10,10,10,10,10,3,6,7,7,9,9,9,8,"Cleaning, relaxing, getting shit done.",7, Hobbies and Skills +1/9,MON,0,0,0,0,0,0,0,0,8,9,8,5,6,8,5,8,5,5,6,6,8,3,3,9,6,Lazy first Monday. Couple calls. Worked from home. Caught up on wedding and house needs.,8, Relaxation and Leisure +1/10,TUE,0,0,0,0,0,0,0,0,8,7,7,6,5,5,5,5,5,5,3,8,8,8,6,8,6,Prep for tomorrow,9, Waste +1/11,WED,9,0,0,0,0,0,0,0,8,10,5,5,5,5,5,5,5,5,5,5,5,8,3,9,7,SK,10, Health and Travel +1/12,THU,0,0,0,0,0,0,0,10,5,10,5,5,5,5,5,5,5,5,5,5,5,3,8,9,8,Ontario Teachers OTPP,, +1/13,FRI,0,0,0,0,0,0,0,3,8,3,6,5,3,3,5,10,10,7,7,1,1,1,3,0,8,Jamaican dinner for Peru/Kiri and parents,, +1/14,SAT,0,0,0,0,0,0,0,0,0,0,8,10,10,7,0,0,7,10,8,9,9,9,9,9,7,"Nice needed lazy day. Did some drugs, probably too many.",, +1/15,SUN,6,8,0,0,0,0,0,0,0,0,0,10,10,8,8,7,7,3,8,2,2,2,3,8,8,Lazy rainy day. Saw Andrew and sienna in the evening.,, +1/16,MON,9,0,0,0,0,0,0,0,0,0,3,8,6,7,8,8,8,8,8,8,3,3,3,9,6,Stressed about work. Had vodka and popcorn.,, +1/17,TUE,3,0,0,0,0,0,0,9,0,0,9,6,5,7,7,5,8,8,8,8,7,7,8,8,7,Hindi lessons!,, +1/18,WED,9,0,0,0,0,0,0,10,5,5,5,5,8,6,6,3,3,7,7,3,8,8,3,3,7,Lazy,, +1/19,THU,8,0,0,0,0,0,0,0,0,10,10,3,8,10,0,6,8,8,6,3,6,3,9,9,5,not sure,, +1/20,FRI,9,0,0,0,8,0,0,0,0,0,10,6,6,5,3,6,8,7,7,3,3,3,9,9,6,long Hindi lesson and RDR2,, +1/21,SAT,9,9,9,9,0,0,0,0,0,0,10,8,3,3,10,3,8,0,0,6,6,6,6,6,6,Polestar demo; In n out; Cleaning and packing,, +1/22,SUN,7,3,8,0,0,0,0,0,10,10,1,1,10,10,10,10,10,10,10,10,10,10,10,10,7,Flying to Chicago,, +1/23,MON,9,0,0,0,0,0,0,10,10,5,5,5,5,5,5,5,5,5,5,5,5,5,8,0,7,First day with TM,, +1/24,TUE,0,0,0,0,0,0,0,10,10,10,10,5,5,5,5,5,1,1,2,2,2,3,10,9,6,Second day with TM; basketball game,, +1/25,WED,0,0,0,0,0,0,0,10,10,10,5,10,10,10,10,10,10,10,3,3,3,5,8,0,7,No-Go Decision! Commercial to NY,, +1/26,THU,0,0,0,0,0,10,10,10,10,6,6,5,10,10,10,3,3,3,3,3,5,8,3,0,6,Driving upstate for wedding rentals,, +1/27,FRI,0,0,0,0,0,0,0,0,5,5,5,10,8,8,10,9,9,9,5,5,5,9,9,0,5,Board meeting sucked,, +1/28,SAT,0,0,0,0,0,0,0,0,5,8,8,5,3,8,6,8,8,10,3,3,3,3,0,0,4,Hangover and day wastage,, +1/29,SUN,0,8,0,0,0,0,0,0,0,9,9,8,7,7,7,3,9,9,9,9,9,0,0,0,6,Quiet day in feat several hours of Hindi,, +1/30,MON,0,0,0,0,0,0,10,3,3,3,8,8,6,10,7,10,10,10,10,10,10,0,0,0,6,Another wedding rentals; flight to India,, +1/31,TUE,0,0,0,0,0,10,10,10,0,0,0,0,10,10,8,0,0,0,8,10,10,10,10,10,7,Endless travel forever,, +2/1,WED,5,5,5,5,5,5,0,5,5,8,0,0,0,0,0,0,0,5,8,10,8,5,5,5,4,Cool safari. why the fuck are we in India.,, +2/2,THU,5,5,5,5,5,5,5,5,5,5,9,9,0,0,0,0,0,0,0,0,10,10,10,10,3,"welp, I'm sick ",, +2/3,FRI,10,10,10,10,10,10,10,10,10,10,10,10,0,0,0,0,0,0,0,0,10,5,5,5,2,and still in fucking India,, +2/4,SAT,8,10,5,5,5,5,5,5,5,5,5,3,0,0,0,0,0,0,0,0,10,10,10,10,1,planned how to continue drowning; met Aftab,, +2/5,SUN,10,10,10,10,10,8,8,8,8,8,0,0,0,0,0,0,0,0,10,5,5,5,5,5,1,Why does it take fucking forever to travel anywhere in India,, +2/6,MON,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,10,5,5,5,5,5,4,A little better. PD India day 1,, +2/7,TUE,5,5,5,5,5,5,0,0,9,9,9,10,10,10,10,10,10,0,0,10,10,10,10,10,1,"PD India Day 2, town hall, doomsday, our fates, getting home.",, +2/8,WED,10,0,0,0,0,0,10,10,0,0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,5,Infinity travel and flying,, +2/9,THU,10,3,3,0,0,0,0,0,0,5,5,8,8,5,8,8,0,0,0,9,3,3,8,7,7,Nice to be home.,, +2/10,FRI,9,9,9,9,0,0,0,0,0,0,10,5,9,0,0,0,9,5,8,3,3,8,0,0,6,avoidance ,, +2/11,SAT,0,0,0,0,0,0,10,8,9,9,6,8,8,8,8,8,8,0,7,8,8,8,3,8,7,,, +2/12,SUN,0,0,0,0,0,0,0,0,0,8,8,8,8,2,2,2,1,1,1,1,1,8,0,0,6,Annie and family.,, +2/13,MON,0,0,0,0,0,0,0,10,6,6,5,5,5,5,5,5,5,5,5,9,3,0,0,0,4,Connecting with folks at the office. Doomsday planning.,, +2/14,TUE,0,0,0,0,0,0,0,0,0,10,8,5,5,5,5,6,10,6,6,7,3,3,3,3,3,Dreading work. Good Valentine's dinner with Jen.,, +2/15,WED,0,0,0,0,0,0,0,0,5,7,5,5,5,7,5,5,5,5,3,9,10,6,9,0,2,Coming to terms with / trying to fight killing marketing at PD,, +2/16,THU,0,0,0,0,0,0,8,7,7,7,7,7,10,9,5,7,8,7,9,9,3,8,9,0,4,Waste of a day.,, +2/17,FRI,0,0,0,0,0,0,0,8,9,6,6,6,6,6,10,8,7,7,7,7,7,7,10,8,6,Playing with AI and cooking!,, +2/18,SAT,0,0,0,0,0,0,0,0,0,7,10,10,10,10,3,3,3,3,3,3,3,3,0,0,7,Birthday weekend!,, +2/19,SUN,0,0,0,0,0,0,0,8,10,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,7,Birthday weekend part 2,, +2/20,MON,0,0,0,9,0,0,0,0,8,3,3,10,10,10,9,9,3,5,5,5,5,3,9,9,6,Mostly helping Jen with her case study,, +2/21,TUE,0,0,0,0,0,0,0,10,10,5,5,5,5,5,5,5,5,5,5,1,1,3,6,0,5,First day of construction! Dilhan lunch. ,, +2/22,WED,0,0,0,0,0,0,0,0,10,9,3,9,5,10,5,9,8,3,9,9,3,3,3,3,2,ugh everything is so exhausting,, +2/23,THU,0,0,0,0,0,0,0,0,0,3,6,2,5,8,8,8,3,3,6,8,6,3,8,0,4,Yeah,, +2/24,FRI,0,0,0,0,0,0,0,0,0,8,8,5,6,7,7,6,6,6,6,6,6,6,6,6,4,moving out (temporarily),, +2/25,SAT,8,8,9,9,0,0,0,0,8,3,6,6,6,6,6,6,6,10,2,2,2,2,2,2,5,"more moving, friends and bwc",, +2/26,SUN,3,9,9,9,9,9,9,9,0,0,6,6,10,10,10,10,0,0,0,0,0,0,0,0,5,MDMA night and flight to Dubai,, +2/27,MON,10,0,0,0,0,10,10,10,0,0,9,9,0,0,0,0,0,3,8,10,10,5,5,5,5,Meeting with CG.,, +2/28,TUE,5,5,5,5,5,5,5,5,0,0,0,0,10,8,0,0,0,8,10,5,5,5,5,5,5,Meeting with mubadala/strata.,, +3/1,WED,5,5,5,5,5,5,10,10,0,5,0,0,0,0,0,0,5,5,8,8,8,3,0,5,6,Conference in Abu Dhabi ,, +3/2,THU,5,5,5,5,5,5,5,8,0,0,0,0,0,5,0,0,0,8,10,5,5,5,8,8,7,Maybe things are looking up?,, +3/3,FRI,8,10,10,10,8,0,0,0,10,5,5,8,8,8,0,0,10,10,8,8,10,10,10,0,7,Nalin; coming home,, +3/4,SAT,0,0,0,0,0,0,0,0,0,10,10,10,10,10,10,8,8,3,3,3,3,3,3,0,8,Good to be back. Emily Calkins and Co like it in the Bay! Lasagna in a restaurant with a bad memory.,, +3/5,SUN,0,9,9,9,0,0,0,0,0,0,0,3,6,3,10,3,10,10,10,10,10,8,0,0,8,Home and flight to Scottsdale,, +3/6,MON,0,0,0,0,0,10,7,7,7,7,7,7,7,7,7,7,7,7,10,10,10,10,10,3,7,Recurrent training for PA46,, +3/7,TUE,9,9,9,0,0,0,0,0,0,6,8,6,6,6,6,8,8,10,10,10,10,10,10,10,4,Flew to Lummi Island. Got in late. No dinner for us,, +3/8,WED,8,0,0,0,0,0,0,3,5,5,6,5,5,3,5,9,0,3,5,3,3,3,3,8,4,"Nail biting for both of us. yet, enjoying the cabin and northwest.",, +3/9,THU,0,0,0,0,9,0,0,0,0,5,3,10,5,6,6,7,5,5,5,5,3,3,3,3,3,"Hiked, cooked, talked to TM. Worlds starting and ending for Jen and me.",, +3/10,FRI,3,9,0,0,0,0,0,0,8,5,5,3,5,6,6,10,10,1,1,1,1,1,1,1,6,"Seattle, meeting Josh's sister Kyra",, +3/11,SAT,0,0,0,0,0,0,0,0,0,0,10,3,3,10,10,10,10,10,10,3,8,8,8,9,5,basically just getting home,, +3/12,SUN,0,0,0,0,0,0,0,7,8,0,0,0,0,3,3,6,10,10,3,3,2,3,3,3,6,Checked into the Claremont hotel. Bonnie Cole. grey's anatomy.,, +3/13,MON,0,0,0,0,0,0,0,5,10,3,8,5,3,8,8,8,8,3,1,1,1,3,3,3,5,Stressed about TM/Allison decision. Enjoying Claremont and new tablet.,, +3/14,TUE,3,9,9,0,0,0,0,9,9,0.5,0.5,10,5,9,0.5,0.5,0.5,5,8,8,3,3,8,3,1,One more circuit down the spiral to the drain?,, +3/15,WED,0,0,0,0,0,0,0,0,5,0.5,10,5,6,5,5,8,9,5,0.5,5,9,9,3,3,2,Still shitty,, +3/16,THU,0,0,0,0,0,0,0,0,8,8,10,10,5,5,5,5,3,5,5,10,5,5,9,9,3,Chewing glass internally. Edward. Drinking. Embarrassing myself with KG.,, +3/17,FRI,9,0,0,0,0,9,9,0,0,10,9,5,6,6,6,6,10,1,1,1,5,5,5,3,1,True colors revealed? and a nice dinner at Daytrip with Ashley and Elie. Wedding invites finally sent.,, +3/18,SAT,9,9,0,0,0,9,0,9,9,9,0,8,10,0.5,9,9,9,9,10,6,6,6,6,8,4,"Getting some good perspective, cleaning the house",, +3/19,SUN,6,6,9,0,0,0,0,0,0,0,0,0,8,10,6,6,8,8,10,8,8,8,8,8,5,Gym and sushi. New lowest weight this year!,, +3/20,MON,8,8,0,0,0,0,0,0,0,10,5,5,5,5,5,5,9,9,3,10,8,5,8,0,2,shitty,, +3/21,TUE,9,9,0,0,0,0,0,0,0,10,9,10,10,5,5,5,5,5,5,10,10,2,5,0,4,The transition day. layoffs happened. power went out. slept at the office. ran into Mario,, +3/22,WED,0,0,0,0,0,0,0,0,0,0,8,10,3,5,5,5,9,9,5,10,10,8,9,0,5,Getting there.,, +3/23,THU,0,9,9,0,0,9,0,9,10,5,5,8,0.5,10,108,108,108,8,8,8,8,8,8,9,6,Relaxed.,, +3/24,FRI,8,0,0,0,0,0,0,0,10,10,6,0.5,0.5,8,5,8,6,6,8,8,8,8,8,0,5,Didn't do much with my day.,, +3/25,SAT,0,0,0,0,0,0,0,0,0,0,8,10,6,6,6,6,5,6,8,8,8,9,9,9,6,At least I've gotten exercise and haven't eaten or drank too much,, +3/26,SUN,9,9,9,9,9,9,9,0,0,0,0,0,10,0.5,0.5,8,8,3,8,8,8,8,8,8,5,Lazy day,, +3/27,MON,9,9,0,0,0,0,0,0,0,10,8,8,5,5,5,7,1,1,67,67,8,8,8,8,6,Feeling alright today.,, +3/28,TUE,83,9,0,0,0,0,0,0,0,5,103,0.5,0.5,89,89,81,101,81,81,0.5,0.5,8,89,89,4,Kinda aimless. ,, +3/29,WED,3,3,33,0,0,0,0,0,0,105,35,73,10,65,65,5,31,31,35,35,33,57,101,99,7,Good to have Jen back!,, +3/30,THU,83,0,0,0,0,98,98,3,10,5,5,6,6,6,73,5,0.5,0.5,3,3,3,3,33,83,5,"Alright, but stressed. Good life admin progress.",, +3/31,FRI,0,0,0,0,0,0,0,0,0,10,5,5,57,2,9,5,5,5,10,3,2,2,2,0,3,ugh,, +4/1,SAT,0,0,0,0,0,0,0,0,0,103,101,83,106,104,2,2,2,2,2,2,28,2,104,104,4,Graziano! Radio show! Rushed stressful trip!,, +4/2,SUN,10,0.4,0.4,0.4,10,10,10,10,10,10,0.4,0.4,0.4,104,0.4,0.4,10,10,10,10,10,10,10,10,6,"I mean, stressed kinda, but nice to be in Pategonia!",, +4/3,MON,10,10,10,10,10,10,10,37,37,10,10,10,10,103,8,3,3,3,3,0,0,0,0,0,7,Long (excessive) but very good and beautiful hike up Mt Fitz Roy in Patagonia,, +4/4,TUE,0,0,0,0,37,37,37,37,37,37,37,37,37,37,38,10,3,8,33,8,0,0,0,0,7,Long (way too long) but very nice hike!,, +4/5,WED,0,0,0,0,0,0,37,37,37,37,38,38,3,65,37,37,10,38,38,38,3,0,0,0,7,Pretty much same as above!,, +4/6,THU,0,0,0,0,106,37,37,37,37,38,10,104,104,104,104,104,104,104,104,38,38,10,0,0,6,Beautiful trip.,, +4/7,FRI,0,0,0,0,0,0,0,33,38,56,56,65,38,39,83,2,2,2,2,2,2,2,33,0,8,"Gabe, Jackie, tango lessons!",, +4/8,SAT,0,0,0,0,0,0,83,106,106,38,10,2,2,2,2,2,10,28,28,28,28,0,0,0,8,"Gorgeous hotel ""home"" in BA. Day with Gabe and Jackie. dinner with Phoebe.",, +4/9,SUN,0,0,0,0,0,38,38,103,28,28,34,34,39,39,36,36,28,28,28,2,3,0,0,0,8,Really fun day!,, +4/10,MON,0,0,0,0,0,0,0.5,36,103,39,38,38,38,3,39,2,28,28,28,2,8,0,0,0,8,Don Julio and more Buenos Aires!,, +4/11,TUE,0,0,0,0,0,108,108,106,104,104,38,34,34,34,104,104,38,104,104,104,104,0.4,0.4,0.4,8,Day in Uruguay; heading home,, +4/12,WED,0.4,0.4,98,0.4,0.4,104,104,104,104,0.4,0.4,0.4,104,104,5,103,89,101,38,103,8,8,8,83,7,Back home.,, +4/13,THU,0,0,0,0,0,0,0,83,5,6,6,5,8,8,6,88,88,88,88,88,88,88,88,83,6,Pretty much just video games ,, +4/14,FRI,0,0,0,0,0,0,0,0,8,8,8,6,8,88,66,66,101,8,8,3,38,38,36,36,5,Good walk. Not productive,, +4/15,SAT,0,0,0,0,0,0,33,8,88,88,33,88,88,104,3,38,104,1,1,3,88,88,88,88,6,Family time,, +4/16,SUN,88,0,0,0,0,0,0,0,0,0,3,82,69,69,66,66,1,1,3,36,38,88,88,83,6,"Walked, saw parents.",, +4/17,MON,0,0,0,0,0,0,0,3,83,105,69,69,69,69,83,88,0.5,99,3,36,88,36,36,99,5,Jen's first day! My 3200th. No work done.,, +4/18,TUE,0,0,0,0,0,0,0,98,0,61,61,61,5,5,5,5,69,89,91,3,3,3,3,3,5,Finally cleaned (annoyed how long it goes).,, +4/19,WED,83,0,0,0,0,0,0,0,83,89,89,5,101,5,0.5,5,9,9,1,36,36,8,33,8,4,IDK,, +4/20,THU,0,0,0,0,0,0,0,98,103,8,83,8,101,88,66,66,88,104,31,31,31,36,36,0,4,IDK still,, +4/21,FRI,0,0,0,0,0,0,0,5,33,103,8,101,5,63,46,46,46,46,3,5,3,3,9,83,2,I guess drugs?,, +4/22,SAT,83,83,9,9,9,0,0,0,0,0,0,0,0,3,103,104,2,2,3,3,104,96,96,96,3,Burglarized!!,, +4/23,SUN,0,0,0,0,0,0,0,0,0,96,96,96,96,96,36,96,96,63,8,8,36,36,8,36,4,Aftermath. Goose chase at the flea market and in Antioch,, +4/24,MON,0,0,0,0,0,0,0,0,5,83,63,63,5,89,5,0.5,99,9,9,9,36,106,36,8,4,didn't do much. had a few calls,, +4/25,TUE,0,0,0,0,0,0,0,0,8,10,5,67,67,5,5,5,10,8,0.5,3,89,36,36,36,6,Caught up. Worked out,, +4/26,WED,98,0,0,0,0,0,0,0,0,103,83,5,5,67,67,101,5,5,7,5,5,3,3,3,6,Starting to feel more on top of things,, +4/27,THU,0,0,0,0,98,98,0,0,0,89,91,91,67,67,101,5,65,58,10,15,15,38,3,89,6,Neighborhood meeting re public safety. Caught up. Nice to see Perumal a bit more.,, +4/28,FRI,0,0,0,0,0,0,0,0,0,33,6,7,7,9,9,9,9,7,91,1,1,1,8,36,5,"Kind of wasted due to Jen's struggle, but overall a good day. saw family and Samoti.",, +4/29,SAT,8,83,0,0,0,0,0,0,,,,,,,,,,,,,,,,,,,, +4/30,SUN,,,,,,,,,,,,,,,,,,,,,,,,,,,, +5/1,MON,,,,,,,,,,,,,,,,,,,,,,,,,,,, +5/2,TUE,,,,,,,,,,,,,,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,,, +12/19,TUE,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/20,WED,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/21,THU,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/22,FRI,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/23,SAT,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/24,SUN,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/25,MON,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/26,TUE,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/27,WED,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/28,THU,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/29,FRI,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/30,SAT,,,,,,,,,,,,,,,,,,,,,,,,,,,, +12/31,SUN,,,,,,,,,,,,,,,,,,,,,,,,,,,, \ No newline at end of file diff --git a/app/models.py b/app/models.py index d9c41e2..c0862e9 100644 --- a/app/models.py +++ b/app/models.py @@ -1,16 +1,37 @@ from app import db +import json + class Day(db.Model): day_id = db.Column(db.Integer, primary_key=True) + date = db.Column(db.Date, unique=True) note = db.Column(db.String) - books = db.relationship("Hour", backref="day") + hours = db.relationship("Hour", backref="day") def __repr__(self): - return ''.format(self.hours) + return ''.format(self.date.strftime("%x")) + + def toJson(self): + return json.dumps(self, default=lambda o: o.__dict__) + + +class Activity(db.Model): + activity_id = db.Column(db.Integer, primary_key=True) + code = db.Column(db.Integer, unique=True) + name = db.Column(db.String) + hours = db.relationship("Hour", backref="activity") + color = db.Column(db.String) + + def __repr__(self): + return "".format(self.code, self.name) class Hour(db.Model): hour_id = db.Column(db.Integer, primary_key=True) time = db.Column(db.Integer) - day_id = db.Column(db.Integer, db.ForeignKey("author.author_id")) - + day_id = db.Column(db.Integer, db.ForeignKey("day.day_id")) + note = db.Column(db.String) + activity_code = db.Column(db.Integer, db.ForeignKey("activity.code")) + + def __repr__(self): + return "".format(self.time, self.day_id) diff --git a/app/sqlite.db b/app/sqlite.db index 820c49b..8f7519b 100644 Binary files a/app/sqlite.db and b/app/sqlite.db differ diff --git a/app/static/ltx.css b/app/static/ltx.css index ff5e826..c64dca5 100644 --- a/app/static/ltx.css +++ b/app/static/ltx.css @@ -12,7 +12,7 @@ body{ table { font-family: "Monospace"; border-collapse: collapse; - width: 100%; + font-size: 11pt; } th{ @@ -26,10 +26,51 @@ tr.htmx-swapping td { td, th { border: 1px solid #383737; - text-align: left; - padding: 8px; + text-align: center; + padding: 4px; + min-width: 4em; +} + +td.now, th.now{ + background: var(--fg); + color: var(--bg); + border-left: 0px; + border-right: 0px; +} + +td.day-note{ + width: max-content; } tr:nth-child(even) { - background-color: #dddddd; + background-color: #2f3941; } + +input.update-entry-form{ + width: 3em; + text-align: center; +} + +div#color-chooser{ + position:absolute; + display:flex; + margin: 2px; +} + +.color-choice{ + padding: 1px 5px; + border: 1px solid black; +} +.color-choice:hover{ + border: 1px solid white; +} +div.upcase{ text-transform: uppercase;} +div#table{font-family:monospace;display: grid;grid-template-columns: repeat(28, 1fr);} +div#header{border-bottom:2px solid gray;} +div.table-row{border-bottom:1px solid gray;} +div.cell{ + width: 75px; + font-size:10pt; + text-align: center; padding: 1px 5px} + + .hot-display-license-info{display:none;} \ No newline at end of file diff --git a/app/templates/categories.html b/app/templates/categories.html new file mode 100644 index 0000000..fcb7f55 --- /dev/null +++ b/app/templates/categories.html @@ -0,0 +1,27 @@ +{% extends "layout.html" %} + +{% block content %} + +

+ Category Editor +

+ + + + + + + + + + + {%for activity in activities %} + + + + + + {% endfor %} + +
CodeNameColor
{{ activity.code }}{{ activity.name }}{{ activity.color }}
+{% endblock %} \ No newline at end of file diff --git a/app/templates/colors.css b/app/templates/colors.css new file mode 100644 index 0000000..9e72112 --- /dev/null +++ b/app/templates/colors.css @@ -0,0 +1,51 @@ +:root{ + --black: #273036; + --red: #c71634; + --cyan: #005744; + --pink: #ff65ae; + --blue: #00a9b3; + --green: #189749; + --yellow: #fff336; + --orange: #ff6d01; + --purple: #5b3ab1; + --darkred: #ff2816; + --lime: #bfff55; +} +tr.color-black{ + background: var(--black); +} +tr.color-red{ + background: var(--red); +} +tr.color-blue{ + background: var(--blue); +} +tr.color-green{ + background: var(--green); +} +tr.color-purple{ + background: var(--purple); +} +tr.color-lime{ + background: var(--lime); + color: var(--black); +} +tr.color-cyan{ + background: var(--cyan); +} +tr.color-darkred{ + background: var(--darkred); +} +tr.color-pink{ + background: var(--pink); +} +tr.color-orange{ + background: var(--orange); +} +tr.color-yellow{ + background: var(--yellow); + color: var(--black); +} +h2{ + color:green; +} \ No newline at end of file diff --git a/app/templates/forms/select-color.html b/app/templates/forms/select-color.html new file mode 100644 index 0000000..78caaef --- /dev/null +++ b/app/templates/forms/select-color.html @@ -0,0 +1,15 @@ +
+ {% for color in [ + "black", "red", "cyan", "blue", "green", + "purple", "yellow", "darkred", "orange", + "pink", "lime"] %} +
+ {{ color.capitalize() }} +
+ {% endfor %} +
\ No newline at end of file diff --git a/app/templates/forms/update-entry.html b/app/templates/forms/update-entry.html new file mode 100644 index 0000000..1160b38 --- /dev/null +++ b/app/templates/forms/update-entry.html @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html deleted file mode 100644 index 2b44b9c..0000000 --- a/app/templates/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - Life Tracker Expanded - - - - - - -

Life Tracker, Expanded

- - - - - - {% for m in ["am", "pm"]%} - - {% for t in range(1,12) %} - - {% endfor %} - {% endfor %} - - - - {%for book in books%} - - - - - - - {%endfor%} - -
DateDay12 {{m}}{{t}} {{m}}
{{book.Book.title}}{{book.Author.name}} - - - -
- - \ No newline at end of file diff --git a/app/templates/layout.html b/app/templates/layout.html new file mode 100644 index 0000000..137d587 --- /dev/null +++ b/app/templates/layout.html @@ -0,0 +1,19 @@ + + + + Life Tracker Expanded + + + + + + + + + +

Life Tracker, Expanded

+ + {% block content %}{% endblock %} + + \ No newline at end of file diff --git a/app/templates/table.html b/app/templates/table.html new file mode 100644 index 0000000..cb99e30 --- /dev/null +++ b/app/templates/table.html @@ -0,0 +1,26 @@ +{% extends "layout.html" %} + +{% block content %} + +
+ + +{% endblock %} \ No newline at end of file diff --git a/app/templates/table2.html b/app/templates/table2.html new file mode 100644 index 0000000..18f3d3b --- /dev/null +++ b/app/templates/table2.html @@ -0,0 +1,56 @@ +{% extends "layout.html" %} +{% block content %} +

+ {{ days[0].date.strftime("%h %d") }} + – + {{ days[-1].date.strftime("%h %d") }} +

+
+
Date
+
Day
+ {% for m in ["am", "pm"]%} + {% for t in [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] %} + {% if now.strftime("%P") == m and now.strftime("%l").strip() == "{}".format(t) %} +
+ {% else %} +
+ + {% endif %} + {{t}} {{m}} +
+ {% endfor %} + {% endfor %} +
Mood
+
Comments
+ + {%for day in days%} + + {% if day.date.strftime("%x") == now.strftime("%x") %} +
+ {% else %} +
+ {% endif %} + {{day.date.strftime("%m/%d")}} +
+ {% if day.date.strftime("%x") == now.strftime("%x") %} +
+ {% else %} +
+ {% endif %} + {{day.date.strftime("%a").upper()}} +
+ {%for hour in day.hours%} +
+ {% if hour.activity.code != -1 %} + {{hour.activity.code}} + {% endif %} +
+ {% endfor %} +
{{day.mood}}
+ +
{{day.note}}
+ {%endfor%} + +
+{% endblock %} \ No newline at end of file diff --git a/app/templates/table_.html b/app/templates/table_.html new file mode 100644 index 0000000..616b518 --- /dev/null +++ b/app/templates/table_.html @@ -0,0 +1,57 @@ +{% extends "layout.html" %} +{% block content %} +

+ {{ days[0].date.strftime("%h %d") }} + – + {{ days[-1].date.strftime("%h %d") }} +

+ + + + + + {% for m in ["am", "pm"]%} + {% for t in [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] %} + {% if now.strftime("%P") == m and now.strftime("%l").strip() == "{}".format(t) %} + + {% endfor %} + {% endfor %} + + + + {%for day in days%} + + {% if day.date.strftime("%x") == now.strftime("%x") %} + + {% if day.date.strftime("%x") == now.strftime("%x") %} + + {%for hour in day.hours%} + + {% endfor %} + + + {%endfor%} + +
DateDay + {% else %} + + + {% endif %} + {{t}} {{m}} +
+ {% else %} + + {% endif %} + {{day.date.strftime("%m/%d")}} + + {% else %} + + {% endif %} + {{day.date.strftime("%a").upper()}} + + {% if hour.activity.code != -1 %} + {{hour.activity.code}} + {% endif %} + {{day.note}}
+{% endblock %} \ No newline at end of file diff --git a/app/tracker.py b/app/tracker.py new file mode 100644 index 0000000..441fdf3 --- /dev/null +++ b/app/tracker.py @@ -0,0 +1,76 @@ +from app import db +from app.models import Day, Hour, Activity +import csv +import datetime + + +class Tracker(): + def __init__(self, codes_path=None, sheets_path=None): + self.codes_path = codes_path + self.sheets_path = sheets_path + + def __repr__(self): + return "".format(self.__hash__()) + + def parse_activity(self, str): + try: + return int(str) + except ValueError: + try: + return float(str) + except: + return -1 + + def import_codes(self): + with open(self.codes_path) as csv_file: + data = csv_file.readlines() + lines = csv.reader(data) + for line in lines: + [code_str, name] = line + code = self.parse_activity(code_str) + exists = db.session.query(Activity).filter( + Activity.code == code).first() + if exists: + pass + else: + activity = Activity( + code=code, name=name.strip()) + db.session.add(activity) + db.session.commit() + + def import_csv(self): + with open(self.sheets_path) as csv_file: + # Skip the header row + data = csv_file.readlines()[1:] + lines = csv.reader(data) + for line in lines: + # Parse each row + date_str = line[0] + hours_str = line[2:26] + note = line[27] + + # Create the right date + [month, day] = date_str.split("/") + date = datetime.datetime(2023, int(month), int(day)) + + # Initialize the Day + try: + entry = db.session.execute( + db.select(Day).filter_by(date=date.strftime("%F"))).scalar_one() + except: + entry = Day(date=date, note=note) + db.session.add(entry) + db.session.commit() + + print("Parsed {}".format(entry.date)) + + # Create an Hour for each hour + for t in range(len(hours_str)): + activity_code = self.parse_activity(hours_str[t]) + activity = db.session.query(Activity).filter( + Activity.code == activity_code).first() + hour = Hour( + time=t, activity_code=activity.code, day_id=entry.day_id) + db.session.add(hour) + + db.session.commit() diff --git a/app/views.py b/app/views.py index 7ee7ae2..18a015a 100644 --- a/app/views.py +++ b/app/views.py @@ -1,54 +1,67 @@ from app import app, db -from flask import render_template, request, jsonify -from app.models import Author, Book +from flask import render_template, request, jsonify, redirect +from app.models import Day, Hour, Activity +from datetime import datetime, timedelta -@app.route("/", methods=["GET"]) + +@app.route("/import", methods=["GET"]) +def import_db(): + tracker = app.tracker + tracker.import_codes() + tracker.import_csv() + return redirect("/") + + +@app.route("/") def home(): - books = db.session.query(Book, Author).filter(Book.author_id == Author.author_id).all() - return render_template("index.html", books=books) -@app.route("/submit", methods=["POST"]) + return redirect("/tracker") -def submit(): - global_book_object = Book() - title = request.form["title"] - author_name = request.form["author"] +@app.route("/tracker", methods=["GET"]) +def tracker(): + past = datetime.today() - timedelta(days=5) + future = datetime.today() + timedelta(days=1) - author_exists = db.session.query(Author).filter(Author.name == author_name).first() - print(author_exists) - # check if author already exists in db - if author_exists: - author_id = author_exists.author_id - book = Book(author_id=author_id, title=title) - db.session.add(book) - db.session.commit() - global_book_object = book - else: - author = Author(name=author_name) - db.session.add(author) - db.session.commit() + days = db.session.query(Day).filter(Day.date >= past, + Day.date <= future).all() - book = Book(author_id=author.author_id, title=title) - db.session.add(book) - db.session.commit() - global_book_object = book + return render_template("table.html", days=days, now=datetime.now()) - response = f""" - - {title} - {author_name} - - - - - - - - """ - return response \ No newline at end of file + +@app.route("/categories", methods=["GET"]) +def categories(): + activities = db.session.query(Activity).all() + + return render_template("categories.html", activities=activities) + + +@app.route("/colors.css") +def colors(): + return render_template("colors.css"), 200, {'Content-Type': 'text/css; charset=utf-8'} + + +@app.route("/get-activity-form/", methods=["GET"]) +def update_entry(hour_id): + hour = db.session.query(Hour).filter(Hour.hour_id == hour_id).first() + return render_template("forms/update-entry.html", hour=hour) + + +@app.route("/get-color-form/", methods=["GET"]) +def update_color(activity_id): + activity = db.session.query(Activity).filter( + Activity.activity_id == activity_id).first() + + return render_template("forms/select-color.html", activity=activity) + + +@app.route("/change-color", methods=["POST"]) +def change_color(): + activity_id = request.form.get("activity_id") + color = request.form.get("color") + + activity = db.session.query(Activity).filter( + Activity.activity_id == activity_id).first() + + activity.color = color + db.session.commit() + return render_template("/categories.html")