1、最初にアイデアと実現について話します
- このソフトウェアが、アクションの種類、特定のイベント、期間など、1日のほとんどのアクションを記録し、最終的な分析を行うことができることを願っています。物事を行うとき、それは彼のアクションを記録および分析している小さな執事に相当します。内部ビジョンの効果。
- 棒グラフを描いて、アクションイベントと1日の時間を詳細に説明します
- あなたが一日に行うことの時間分類と分析のために円グラフを描く
- 1日に行うことの主要なカテゴリをサブカテゴリに分割し、各カテゴリのサブカテゴリの時間比率を一覧表示します
- すべての日の進化の傾向を一覧表示します
- サブカテゴリの進化の傾向を主要なカテゴリにリストします。
その日の詳細な分析を行うだけで、自分の行動を要約し、自分の人生を計画するのに便利です。
2.技術原則について話します
実際、必要なテクノロジーは
1であり、現在のイベントと現在の時刻をいつでも記録するデータベースです。新しいイベントが到着したら、イベントが実行された時間を計算し、開始時刻、終了時刻、およびデータベースに含める現在時刻の特定の情報を計算します
。2つのデータベース設計があり、1つは各カテゴリとサブカテゴリ間の対応を記録し、もう1つは他のレコードを記録します。イベント発生
イベント属性の
記録イベント
2の記録。python描画
は実際には縦棒グラフ、線グラフであり、特定のデータ操作は加算、減算、乗算、除算にすぎません。必要に応じて分析する
3.ソフトウェアの紹介
ご覧のとおり、このソフトウェアは、音声認識、音声生成、手書き認識、手書き録音、アクション録音、アクションデータグラフィック分析を実現できます。
プロジェクトをアップロードしました。アドレスは次のとおりです。https://download.csdn.net/download/lidashent/12555041
データベースは含まれていません。データベースで使用するアカウントを使用して、自分で作成してください。以下に示すように使用されるデータベースもあります
4.ソースコードの一部を提供する
#将毫秒转化为时分秒结构
def make_senconds_hour(a):
hour=60*60
minute=60
save_hour=0
save_min=0
dic_time=""
if a>hour:
save_hour=int(a/hour)
a=a-save_hour*hour
dic_time+=str(save_hour)+"时"
if a>minute:
save_min=int(a/minute)
a=a-save_min*minute
dic_time+=str(save_min)+"分"
if (save_hour==0 and save_min==0) or a is not 0:
dic_time+=str(a)+"秒"
print(dic_time)
return dic_time
#画出详细的一天时间结构图
def draw_time_fourD():
"""条形图bar"""
nowTime_str = ex.lineEdit_time_2.text()
key_word='%'+nowTime_str+'%'
print(key_word)
sql_get_x_start="select events_start,events_use_time,events_sort,events_real from moment_record_events where events_start like '%s' order by events_start asc"%(key_word)
cur1.execute(sql_get_x_start)
all_x=cur1.fetchall()
x=[]
y=[]
flag_info=[]
all_time=0
for i in all_x:
x.append(i[0][11:-3])
y.append(i[1])
all_time+=i[1]
flag_info.append(i[3]+"\n"+make_senconds_hour(i[1]))
print(flag_info)
list_len=len(x)
plt.title("日详细分析:"+ nowTime_str+"共:"+make_senconds_hour(all_time))
plt.bar(range(list_len), y, color='lightsteelblue')
plt.plot(range(list_len), y, marker='o', color='coral',label='DAY') # coral
plt.xticks(range(list_len), x)
plt.xlabel('时间24h制')
plt.ylabel("花费时间(单位:毫秒)")
plt.legend()
for a, b,c in zip(range(list_len), y,flag_info):
plt.text(a, b,c, ha='center', va='bottom', fontsize=8)
plt.show()
#获得大分类的一天的各个项的时间分析数据
def get_day_big_sort_info(key_word):
event_sorts = get_data_event_sort()
time_name = []
time_sum = []
all_time = 0
for i in event_sorts:
temp_sum = get_sum_time(1, i, 1,key_word)
all_time += temp_sum
time_sum.append(temp_sum)
time_name.append(i + ":" + make_senconds_hour(temp_sum))
return time_sum,time_name,all_time,event_sorts
#获得小分类的一天的各个时间分析数据
def get_area_small_real_info(area_word,key_word):
sql_select_reals = "select basic_two from file_basic_property where basic_one='%s'and flag_property='moments_event'" % (
area_word)
cur1.execute(sql_select_reals)
row = cur1.fetchall()
time_name = []
time_sum = []
all_time = 0
real_list=[]
if row:
for i in row:
temp_sum = get_sum_time(2,area_word, i[0], key_word)
all_time += temp_sum
time_sum.append(temp_sum)
time_name.append(i[0] + "\n" + make_senconds_hour(temp_sum))
real_list.append(i[0])
return time_sum, time_name, all_time,real_list
else:
return [0],["none"],0,["none"]
#根据分类信息得到时间数据
def get_sum_time(i, j,k,key_word):
if i == 1:
time_sql = "select events_use_time from moment_record_events where events_sort='%s' and events_start like '%s' " % (
j, key_word)
elif i==2:
time_sql = "select events_use_time from moment_record_events where events_sort='%s' and events_real='%s' and events_start like '%s' " % (
j,k, key_word)
else:
time_sql = "select events_use_time from moment_record_events where events_sort='%s' and events_real='%s' and events_start like '%s'" % (
i, j, key_word)
cur1.execute(time_sql)
row = cur1.fetchall()
time_sum = 0
for i in row:
time_sum += i[0]
return time_sum
#画饼状图的函数,导入数据就成
def draw_cookie_time(a):
nowTime_str = ex.lineEdit_time_2.text()
# datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') # 现在
if nowTime_str:
key_word = '%' + nowTime_str + '%'
else:
nowTime_str="全局"
key_word = "%%"
if a=="day_time":
time_sum, time_name,all_time,_=get_day_big_sort_info(key_word)
title_flag="日行动分析:"+nowTime_str+"共:"+make_senconds_hour(all_time)
if a=="day_area_time":
area_word = ex.comboBox_esort.currentText()
time_sum, time_name, all_time,_=get_area_small_real_info(area_word,key_word)
title_flag =area_word+ "区域行动分析:" + nowTime_str+"共:"+make_senconds_hour(all_time)
len_list=len(time_name)
plt.title(title_flag)
labels = tuple(time_name)
sizes = tuple(time_sum)
temp_colors=['bisque', 'lightgreen', 'darkorange','forestgreen','burlywood','limegreen','antiquewhite','darkgreen'\
,'lightseagreen', 'medlumpurple', 'mediumturquoise', 'blueviolet', 'azure', 'indigo', 'lightcyan', 'darkorchid', \
'darkviolet', 'mediumorchid', 'thistle', 'teal', 'plum', 'darkcyan', 'violet', 'purple', 'cyan', 'darkmagenta', \
'm', 'darkturquoise', 'fuchsia', 'cadetblue', 'magenta', 'powderblue', 'orchid', 'lightblue', 'mediumvioletred',\
'deepskyblue', 'deeppink']
colors =temp_colors[0:len_list]
explode = []
for i in range(len_list):
explode.append(0.015)
plt.pie(sizes, explode=explode, labels=labels,
colors=colors, autopct='%1.1f%%', shadow=False, startangle=50)
plt.axis('equal')
plt.show()
def draw_one_day_cookie():
draw_cookie_time("day_time")
def draw_area_time():
draw_cookie_time("day_area_time")
#画折线图的函数
def draw_basic_line_chart(a):
sql_get_day_name = "select events_start from moment_record_events"
cur1.execute(sql_get_day_name)
row = cur1.fetchall()
day_info = []
temp_day = ""
for i in row:
row_day = i[0][0:10]
if row_day == temp_day:
pass
else:
print(row_day is not temp_day)
print(row_day + "比较" + temp_day)
day_info.append(row_day)
temp_day = row_day
# print(temp_day)
print("得到天数时间序列:", day_info)
# 获得天数的大项数据列,人总是有生有死,谁能无愧于心呢?
time_list = []
label_list = []
day_x = []
data_len = len(day_info)
if a=="all_tender":
for i in day_info:
time_sum, time_name, all_time,event_sorts = get_day_big_sort_info('%'+i+'%')
print(time_sum,time_sum,all_time)
for a,b in zip(time_sum,time_name):
time_list.append(a)
label_list.append(b)
day_x.append(i)
title_flag="全局信息演化趋势"
if a=="area_tender":
area_word = ex.comboBox_esort.currentText()
for i in day_info:
time_sum, time_name, all_time, event_sorts = get_area_small_real_info(area_word,'%' + i + '%')
print(time_sum, time_sum, all_time)
for a, b in zip(time_sum, time_name):
time_list.append(a)
label_list.append(b)
day_x.append(i)
title_flag = "分区信息演化趋势"
plt.title(title_flag)
x_axis_data = day_x
y_axis_data =time_list
row_num=len(event_sorts)
all_len=row_num*data_len
print("得到所有的时间列为",time_list,"总长度为",all_len)
print("标签为:",label_list)
temp_colors = ['red', 'green', 'blue', 'forestgreen', 'burlywood', 'limegreen', 'antiquewhite',
'darkgreen' \
, 'lightseagreen', 'medlumpurple', 'mediumturquoise', 'blueviolet', 'azure', 'indigo', 'lightcyan',
'darkorchid', \
'darkviolet', 'mediumorchid', 'thistle', 'teal', 'plum', 'darkcyan', 'violet', 'purple', 'cyan',
'darkmagenta', \
'm', 'darkturquoise', 'fuchsia', 'cadetblue', 'magenta', 'powderblue', 'orchid', 'lightblue',
'mediumvioletred', \
'deepskyblue', 'deeppink']
# plot中参数的含义分别是横轴值,纵轴值,颜色,透明度和标签
for i in range(row_num):
temp_data = []
for j in range(i,all_len,row_num):
# print(j)
temp_data.append(time_list[j])
plt.plot(x_axis_data, temp_data, 'ro-', color=temp_colors[i], alpha=0.8, label=event_sorts[i])
for x, y in zip(x_axis_data, temp_data):
plt.text(x, y, make_senconds_hour(y), ha='center', va='bottom', fontsize=8)
# 显示标签,如果不加这句,即使加了label='一些数字'的参数,最终还是不会显示标签
plt.legend(loc="upper right")
plt.xlabel('日时间序列')
plt.ylabel('时间(单位:毫秒)')
plt.show()
def all_time_tender():
draw_basic_line_chart("all_tender")
def area_time_tender():
draw_basic_line_chart("area_tender")