Skip to content

Commit

Permalink
init code for counter
Browse files Browse the repository at this point in the history
  • Loading branch information
luutuankiet committed Feb 19, 2024
1 parent 8368fcb commit f8b9032
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
28 changes: 26 additions & 2 deletions app/charts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def highlight_row(row):
tags_count_path = os.path.join(analytics_path,'active_tags_count.sql')


query = lambda: open(tags_count_path, 'r').read()
tags_count = cur.sql(query()).df()
tags_query = lambda: open(tags_count_path, 'r').read()
tags_count = cur.sql(tags_query()).df()
colored_tags_count = tags_count.style.map(highlight_text,subset=['clarification_progress'])
tags_count_final = colored_tags_count

Expand All @@ -80,6 +80,30 @@ def highlight_row(row):



loops_count_path = os.path.join(analytics_path,'open_loops_count.sql')
loops_query = lambda: open(loops_count_path, 'r').read()
loops_count = cur.sql(loops_query()).df()
loops = loops_count['content'].loc[0]
lines = loops.split('\n')
counter = 0
compare_clarify = int(tags_count['cnt_clarifyme'].loc[0])
for line in lines:
if line != '':
counter+=1
st.write("## open loops count (rough estimation)")
col1,col2,col3 = st.columns(3)
with col2:

st.metric(
"open loops vs to clarify",
value = f"{counter} loops to capture",
delta = f"{compare_clarify} vs captured loops to clarify",
delta_color="inverse",
# help="compared to number of items to clarify"
)




st.write("# lvl1-lvl2 analytics")
st.write("## progress summary")
Expand Down
1 change: 1 addition & 0 deletions dbt_project/analyses/open_loops_count.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select content from init_todos where id = '9be74928bd36e5772850726c'
1 change: 1 addition & 0 deletions dbt_project/models/staging/init_todos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ WITH source AS (
id,
projectId,
title,
content,
timezone,
reminder,
reminders,
Expand Down
4 changes: 0 additions & 4 deletions dbt_project/models/staging/stg_todos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ renamed AS (
'Default'
) :: text AS list_name,
status :: INT AS status_id,
-- sl.list_id::int as list_id,
-- fld.folder_id::int as folder_id,
-- ss.status_id::int as status_id,
-- dd.date_id::text as date_id,
title :: text AS title,
timeZone :: text AS timezone,
reminder,
Expand Down

0 comments on commit f8b9032

Please sign in to comment.