_People, people, people, people, people, people, people, people, people > LIFE LOG GRAPH GENERATOR <  ̄Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y ̄
October 15, 2019 at 11:24PM bedtime
October 16, 2019 at 06:03AM Get up
October 16, 2019 at 07:08AM going out
October 16, 2019 at 08:17AM development started
October 16, 2019 at 10:49AM development finished
October 16, 2019 at 12:30PM Return home
October 16, 2019 at 12:59PM Start reading
October 16, 2019 at 04:32PM Finish reading
October 16, 2019 at 10:31PM go to bed
October 17, 2019 at 06:46AM get up
October 17, 2019 at 07:29AM going out
October 17, 2019 at 08:27AM development started
October 17, 2019 at 12:48PM development finished
October 17, 2019 at 01:48PM Return home
October 17, 2019 at 02:35PM TV started
October 17, 2019 at 04:54PM TV quit
It is a web application that creates such an interactive graph.
-** Because you can visualize your own life rhythm **, it will be an opportunity to change your life rhythm. --Just copy and paste the recorded ** life log ** and it will be graphed. ――Because you can see your actions like a ** Gantt chart ** instead of a pie chart, it is easy to compare different days.
――Not good enough ** I don't understand my lifestyle (rhythm) **. ――It's a shame to record your actions in the life log app by ** manually **. --In the life log application, it is often represented by a ** pie chart **, but I would like it to be represented like a Gantt chart.
** This app will solve it. ** **
――This web application was made by me as a hobby for IT, who is from the Faculty of Earth Sciences and currently works for a mechanical company.
Therefore, it seems that there are bugs and technical shortages.
I hope you will try it after considering that.
――It's the first web application developed, and it's a complete trial for me, so I'm currently running it with the free plan of Heroku
.
Therefore, it may be affected by 30-minute sleep and Dyno limit. Please forgive me there (crying)
It is operated by python
+ Flask
+ Plotly
+ Heroku
.
Roughly speaking
Flask
, display ʻindex.html where the input form is installed with
/ `.Create Graph
button is pressed, format the data into csv format and create a Plotly instance
of the Gantt chart.graph.html
with the createdPlotly instance
embedded in / graph
.requirement.txt
python==3.7.4
Flask==1.1.1
requests==2.22.0
gunicorn==19.9.0
pandas==0.25.1
plotly==4.1.1
app.py
import os
import re
import pandas as pd
from io import StringIO
from pathlib import Path
from datetime import datetime, timedelta
from plotly import figure_factory as pff
from plotly import offline
from flask import Flask, request, render_template
app = Flask(__name__)
#Gantt chart depiction main processing
def main(Data entered in the form):
Omitted because the code is too long and spaghetti
return plotly instance
#Format the data entered in the form into csv format.
def convert_input_data_to_csv(input_data):
temp_data = re.sub(r",", "", input_data)
conv_data = re.sub(r"(.+([AP]M|\d\d:\d\d))(\s+?)(\S+)", r"\1,\4", temp_data)
return conv_data
#Render the main page.
@app.route("/", methods=["GET", 'POST'])
def render_main_html():
return render_template("index.html")
#Render the setting page.
@app.route("/setting", methods=["GET", 'POST'])
def render_setting_html():
return render_template("setting.html")
#render the graph page.
#The main function returns a plotly instance and embeds it in html.
@app.route("/graph", methods=["GET", 'POST'])
def render_graph_at_html():
if request.method == 'GET':
res = request.args.get('data')
elif request.method == 'POST':
res = request.form['data']
else:
res = None
res_conv = convert_input_data_to_csv(res)
df = pd.read_csv(StringIO(res_conv), sep=",", header=None).set_index(0)
df.index = df.index.map(pd.to_datetime)
return render_template("graph.html", fig=main(df))
if __name__ == '__main__':
app.run(debug=False, host='0.0.0.0', port=int(os.environ.get('PORT', 5000)))
I link Google Home + IFTTT + Google Spread Sheets and take a life log by voice.
Then, the data recorded in the Spread Sheets is copied and pasted and graphed. (The linking method is explained in LIFE LOG GRAPH GENERATOR setting page.)
I found it very useful to visualize my life rhythm on a graph and look back.
First of all, ** I think it's okay to just look at the graph and grin **. It's so much fun to look at myself that I don't know, such as "Did you drink for 8 hours this day!" Or "Sleep time varies widely". I think this ** feeling of fun is a very important factor that leads to the habituation of life logs **.
And as I continue to grin, I naturally notice my own behavioral habits.
Do you take improvement action from that awareness? Or do you wait? Let's think about that later! If you can notice it, you can do anything else. (suitable)
I hope that this web app will give many people a chance to look at their lifelog graphs and grin, and to develop their awareness and actions in the future. think.
Thank you for reading until the end.
Recommended Posts