Skip to content

Commit f2a9c9e

Browse files
committed
Add home page navigation and mechanism links
1 parent 0495037 commit f2a9c9e

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

Home.py

+46-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,55 @@
2424
if len(query_params_chain_id) == 1 and not st.session_state.chain_id:
2525
st.session_state.chain_id = query_params_chain_id[0]
2626

27+
def display_recent_rounds():
28+
# Fetch and process round data
29+
rounds = utils.get_round_summary()
30+
current_time = pd.Timestamp.now(tz='UTC')
31+
rounds = rounds[(rounds['donations_end_time'].dt.tz_convert('UTC') < current_time) & (rounds['votes'] > 0)]
32+
rounds = rounds.sort_values('donations_end_time', ascending=False)
33+
34+
# Create round links and prepare display data
35+
rounds['Round Link'] = rounds.apply(lambda row: f"https://qf-calculator.fly.dev/?round_id={row['round_id']}&chain_id={row['chain_id']}", axis=1)
36+
rounds_display = rounds[['round_name', 'Round Link', 'votes', 'uniqueContributors', 'amountUSD']]
37+
38+
# Configure column display
39+
column_config = {
40+
"Round Link": st.column_config.LinkColumn(
41+
"Round Link",
42+
display_text="Go to Round",
43+
help="Click to view round details"
44+
),
45+
"votes": st.column_config.NumberColumn(
46+
"Total Votes",
47+
help="Total number of votes in the round"
48+
),
49+
"uniqueContributors": st.column_config.NumberColumn(
50+
"Unique Contributors",
51+
help="Number of unique contributors in the round"
52+
),
53+
"amountUSD": st.column_config.NumberColumn(
54+
"Total Amount (USD)",
55+
help="Total amount donated in USD",
56+
format="$%.2f"
57+
)
58+
}
59+
60+
# Display the dataframe
61+
st.header("Recent Rounds That Have Ended:")
62+
st.dataframe(
63+
rounds_display.head(20),
64+
column_config=column_config,
65+
hide_index=True
66+
)
67+
68+
2769
def validate_input():
2870
"""Validate the presence of round_id and chain_id in the URL."""
2971
if st.session_state.round_id is None or st.session_state.chain_id is None:
3072
st.header("Oops! Something went wrong. You're not supposed to be here 🙈")
3173
st.subheader("Please provide round_id and chain_id in the URL")
3274
st.subheader('Example: https://qf-calculator.fly.dev/?round_id=23&chain_id=42161')
75+
display_recent_rounds()
3376
st.stop()
3477
return st.session_state.round_id.lower(), int(st.session_state.chain_id)
3578

@@ -469,7 +512,7 @@ def main():
469512
filter_in_csv = handle_csv_upload(purpose='filter in')
470513

471514
half_and_half = False
472-
with st.expander("Advanced: give results as half COCM / half QF"):
515+
with st.expander("Advanced: Give results as half COCM / half QF"):
473516
st.write('''
474517
Toggle the switch below to calculate a matching result blending COCM and QF, instead of pure COCM.
475518
In this case, funding amounts will be found for each mechanism, normalized to the size of the matching pool, and then averaged for each project.
@@ -499,8 +542,8 @@ def main():
499542

500543
# Quadratic Funding Method Comparison section
501544
st.header('💚 Quadratic Funding Method Comparison')
502-
st.write('''Quadratic funding helps us solve coordination failures by creating a way for community members to fund what matters to them while amplifying their impact. However, its assumption that people make independent decisions can be exploited to unfairly influence the distribution of matching funds.''')
503-
st.write('''Connection-oriented cluster-matching (COCM) doesn't make this assumption. Instead, it quantifies just how coordinated groups of actors are likely to be based on the social signals they have in common. Projects backed by more independent agents receive greater matching funds. Conversely, if a project's support network shows higher levels of coordination, the matching funds are reduced, encouraging self-organized solutions within more coordinated groups. ''')
545+
st.write('''[Quadratic funding](https://wtfisqf.com) helps us solve coordination failures by creating a way for community members to fund what matters to them while amplifying their impact. However, its assumption that people make independent decisions can be exploited to unfairly influence the distribution of matching funds.''')
546+
st.write('''[Connection-oriented cluster-matching (COCM)](https://wtfiscocm.streamlit.app/) doesn't make this assumption. Instead, it quantifies just how coordinated groups of actors are likely to be based on the social signals they have in common. Projects backed by more independent agents receive greater matching funds. Conversely, if a project's support network shows higher levels of coordination, the matching funds are reduced, encouraging self-organized solutions within more coordinated groups. ''')
504547

505548
# Allow removal of projects from matching distribution
506549
all_projects = data['df']['project_name'].unique()

queries/get_rounds_summary_from_indexer.sql

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ SELECT
55
r."unique_donors_count" AS "uniqueContributors",
66
r."chain_id",
77
r."id" AS "round_id",
8+
"donations_end_time" AS "donations_end_time",
9+
"donations_start_time" AS "donations_start_time",
810
(r."round_metadata" #>> '{quadraticFundingConfig, matchingCap}')::boolean AS "has_matching_cap",
911
(r."round_metadata" #>> '{quadraticFundingConfig, matchingCapAmount}')::double precision AS "matching_cap_amount",
1012
(r."round_metadata" #>> '{quadraticFundingConfig, matchingFundsAvailable}')::double precision AS "matching_funds_available",
@@ -14,3 +16,6 @@ SELECT
1416
(r."round_metadata" #>> '{quadraticFundingConfig, sybilDefense}')::text AS "sybilDefense"
1517
FROM
1618
"public"."rounds" AS r
19+
WHERE
20+
"donations_end_time" <= '2030-01-01'
21+
AND (r."round_metadata" #>> '{name}')::text IS NOT NULL

0 commit comments

Comments
 (0)