Counts the total number of words published across all pages in the IPCC namespace (3000) of the ClimateKG production MediaWiki instance, using the MediaWiki Action API.
Instructions: 1. Set API_URL below to match your target environment. 2. Run all cells — the API calls take ~30–60 s for 99 pages. 3. Quarto renders from the stored cell outputs; no re-execution needed on quarto render.
Data source:https://prod-climatekg.semanticclimate.org/w/api.php Namespace: IPCC (3000) Method:action=query&list=allpages then prop=revisions&rvslots=main per page batch, with full continue-token handling to avoid response-size truncation.
# Words by report group — bar chartgroup_totals = ( df_content.groupby("Report Group")["Word Count"] .sum() .sort_values(ascending=False) .reset_index())fig = px.bar( group_totals, x="Report Group", y="Word Count", title="Total Words by IPCC Report Group", labels={"Word Count": "Total Words", "Report Group": "Report Group"}, color="Report Group", text="Word Count",)fig.update_traces(texttemplate="%{text:,.0f}", textposition="outside")fig.update_layout( showlegend=False, yaxis_tickformat=",", uniformtext_minsize=9, uniformtext_mode="hide", margin=dict(t=60, b=40),)# Render as text/html so Quarto can display it from stored outputsdisplay(HTML(fig.to_html(full_html=False, include_plotlyjs="cdn")))
Word Count Table — All IPCC Namespace Pages
All 99 pages in namespace 3000, sorted by word count (descending). Pages with zero words are empty placeholders not yet populated with content.
Show code
table_df = df[["Short Title", "Report Group", "Word Count", "Has Content"]].copy()table_df.columns = ["Page", "Report Group", "Word Count", "Has Content"]table_df["Has Content"] = table_df["Has Content"].map({True: "Yes", False: "No"})fig_table = go.Figure( data=[go.Table( columnwidth=[300, 100, 120, 100], header=dict( values=["<b>Page</b>", "<b>Report Group</b>","<b>Word Count</b>", "<b>Has Content</b>"], fill_color="#4472C4", font=dict(color="white", size=13), align="left", height=32, ), cells=dict( values=[ table_df["Page"].tolist(), table_df["Report Group"].tolist(), [f"{v:,}"for v in table_df["Word Count"]], table_df["Has Content"].tolist(), ], fill_color=[ ["#e8f4e8"if has =="Yes"else"#fff3cd"for has in table_df["Has Content"] ] ], align="left", font=dict(size=12), height=26, ), )])fig_table.update_layout( title="IPCC Namespace Pages — Word Count (sorted by word count, descending)", margin=dict(t=60, b=10, l=10, r=10), height=100+28*len(table_df),)# Render as text/html so Quarto can display it from stored outputsdisplay(HTML(fig_table.to_html(full_html=False, include_plotlyjs="cdn")))