Skip to content

Commit 0e32376

Browse files
authored
Skip encryption step for pages that might be broken (#86)
1 parent 2469a31 commit 0e32376

File tree

3 files changed

+20
-69
lines changed

3 files changed

+20
-69
lines changed

.github/workflows/deploy.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,16 @@ jobs:
8686
# Encrypt pages that are only meant for team consumption
8787
- name: Encrypt some pages
8888
run: |
89-
staticrypt book/_build/dirhtml/people/index.html -p ${{ secrets.STATICRYPT_PASSWORD }} -d book/_build/dirhtml/people/ --short --template-color-primary "#1D4EF5" --template-title "Only for the 2i2c team!" --template-instructions "Check the team BitWarden for the password...";
90-
staticrypt book/_build/dirhtml/finances/index.html -p ${{ secrets.STATICRYPT_PASSWORD }} -d book/_build/dirhtml/finances/ --short --template-color-primary "#1D4EF5" --template-title "Only for the 2i2c team!" --template-instructions "Check the team BitWarden for the password...";
89+
if [ -f book/_build/dirhtml/people/index.html ]; then
90+
staticrypt book/_build/dirhtml/people/index.html -p ${{ secrets.STATICRYPT_PASSWORD }} -d book/_build/dirhtml/people/ --short --template-color-primary "#1D4EF5" --template-title "Only for the 2i2c team!" --template-instructions "Check the team BitWarden for the password...";
91+
else
92+
echo "Skipping people encryption; missing book/_build/dirhtml/people/index.html"
93+
fi
94+
if [ -f book/_build/dirhtml/finances/index.html ]; then
95+
staticrypt book/_build/dirhtml/finances/index.html -p ${{ secrets.STATICRYPT_PASSWORD }} -d book/_build/dirhtml/finances/ --short --template-color-primary "#1D4EF5" --template-title "Only for the 2i2c team!" --template-instructions "Check the team BitWarden for the password...";
96+
else
97+
echo "Skipping finances encryption; missing book/_build/dirhtml/finances/index.html"
98+
fi
9199
92100
# Upload artifact for looking at later
93101
- uses: actions/upload-artifact@v4

book/cloud.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ slideshow:
115115
tags: [remove-cell]
116116
---
117117
# The latest number of unique hubs and clusters
118-
n_hubs = int(np.ceil(unique_hubs.query("date > @last_week").groupby("cluster").mean("hubs")["hubs"].sum()))
118+
n_hubs = int(np.ceil(unique_hubs.query("date > @last_week").groupby("cluster")["hubs"].mean().sum()))
119119
n_clusters = unique_hubs.query("date > @last_week")["cluster"].nunique()
120120
```
121121

@@ -150,7 +150,7 @@ slideshow:
150150
tags: [full-width, remove-input]
151151
---
152152
# Sort the clusters by most to least hubs
153-
sorted_clusters = unique_hubs.groupby("cluster").max("hubs").sort_values("hubs", ascending=False).index.values
153+
sorted_clusters = unique_hubs.groupby("cluster")["hubs"].max().sort_values(ascending=False).index.values
154154
155155
px.area(unique_hubs, x="date", y="hubs", color="cluster", title="Number of active hubs by cluster", category_orders={"cluster": sorted_clusters})
156156
```
@@ -206,7 +206,7 @@ for ix, irow in communities.iterrows():
206206
hubs = df.query("clusterhub in @clusterhub and timescale == 'monthly'")
207207
# Average across time for each hub, and then add across all hubs
208208
hubs = df.query("clusterhub in @clusterhub and timescale == 'monthly'")
209-
n_users = hubs.groupby("clusterhub").mean("users")["users"].sum().round()
209+
n_users = hubs.groupby("clusterhub")["users"].mean().sum().round()
210210
communities.loc[ix, "users"] = n_users
211211
```
212212

@@ -356,14 +356,14 @@ slideshow:
356356
tags: [remove-cell]
357357
---
358358
# Sum by cluster so we avoid having too many categories
359-
df_clusters = df.groupby(["cluster", "date", "timescale"]).sum("users").reset_index()
359+
df_clusters = df.groupby(["cluster", "date", "timescale"])["users"].sum().reset_index()
360360
361361
# Add logusers
362362
df_clusters = df_clusters.query("users > 0")
363363
df_clusters["logusers"] = df_clusters["users"].map(np.log10)
364364
365365
# List of clusters sorted by size
366-
sorted_clusters = df_clusters.groupby("cluster").mean("users").sort_values("users", ascending=False).index.values
366+
sorted_clusters = df_clusters.groupby("cluster")["users"].mean().sort_values("users", ascending=False).index.values
367367
```
368368

369369
`````{code-cell} ipython3
@@ -384,7 +384,7 @@ grid = """
384384
scale_ordering = ["daily", "monthly"]
385385
interior = []
386386
for scale in scale_ordering:
387-
users = df_clusters.query("timescale == @scale").groupby("cluster").mean("users")["users"].sum()
387+
users = df_clusters.query("timescale == @scale").groupby("cluster")["users"].mean().sum()
388388
interior.append(dedent("""\
389389
```{grid-item-card} %s
390390
%s
@@ -438,13 +438,12 @@ slideshow:
438438
tags: [remove-cell]
439439
---
440440
# Mean users for each hub
441-
df_sums = df.groupby(["clusterhub", "timescale"]).mean("users")
441+
df_sums = df.groupby(["clusterhub", "timescale"])["users"].mean().reset_index()
442442
443443
# Calculate bins and add it to data for plotting
444444
bins = [0, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000]
445445
labels = [f"{bins[ii]}-{bins[ii+1]}" for ii in range(len(bins)-1)]
446446
df_sums["bin"] = pd.cut(df_sums["users"], bins, labels=labels, right=False)
447-
df_sums = df_sums.reset_index()
448447
max_y_bins = df_sums.groupby(["timescale", "bin"]).count()["users"].max() + 10
449448
max_y_users = df_sums.groupby(["timescale", "bin"]).sum()["users"].max() + 100
450449
```
@@ -502,6 +501,7 @@ display(alt.hconcat(*chs_perc, title=f"% {scale} Total Active Users by community
502501
When the number of Monthly Active Users (MAUs) >= 5, assume the community is actively using the their hub.
503502

504503
```{code-cell} ipython3
504+
:tags: remove-cell
505505
df['date'] = pd.to_datetime(df['date'])
506506
507507
# Define cutoff = one year ago
@@ -542,6 +542,7 @@ result = result[['cluster', 'hub', 'first_value_date']]
542542
```
543543

544544
```{code-cell} ipython3
545+
:tags: remove-input
545546
import ipywidgets as widgets
546547
from IPython.display import display
547548

book/people.md

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ df["assignees"] = df["assignees"].map(extract_assignee)
168168
# Limit last day to the last day of the year
169169
date_cols = ["first day", "last day"]
170170
for col in date_cols:
171-
df.loc[:, col] = pd.to_datetime(df[col])
171+
df[col] = pd.to_datetime(df[col], errors="coerce")
172172
df["last day"] = df["last day"].map(lambda a: np.min([a, end_cal]))
173173
174174
# Drop entries with missing dates
@@ -382,61 +382,3 @@ fig.add_vline(ANNUAL_EXPECTED_DAYS_OFF, line_dash="dash")
382382
```
383383
384384
+++ {"editable": true, "slideshow": {"slide_type": ""}}
385-
386-
### Accumulated time off in the last six months
387-
388-
This shows time off accumulated over the last six months, rather than the last calendar year.
389-
This gives us an idea for how we're accumulating time off more recently in general.
390-
391-
```{code-cell} ipython3
392-
---
393-
editable: true
394-
slideshow:
395-
slide_type: ''
396-
tags: [remove-cell]
397-
---
398-
# Three month window in the past/future
399-
start_win = today - timedelta(30 * 6)
400-
end_win = today + timedelta(30 * 1)
401-
402-
# 6 month window so expected days is 40 / 2
403-
expected_n_days_in_win = 20
404-
# Calculate the "burn rate" of time off we'd expect if team members were hitting their 40 day target.
405-
expected = pd.DataFrame(
406-
[{"day": start_win, "amount": 0}, {"day": today, "amount": expected_n_days_in_win}],
407-
)
408-
expected["day"] = pd.to_datetime(expected["day"])
409-
```
410-
411-
```{code-cell} ipython3
412-
---
413-
editable: true
414-
slideshow:
415-
slide_type: ''
416-
tags: [remove-input]
417-
---
418-
# Visualize over time
419-
fig = px.line(
420-
cumulative.query("`first day` >= @start_win"),
421-
x="first day",
422-
y="cumulative",
423-
color="person",
424-
line_shape="hv",
425-
height=700,
426-
hover_data=["last day", "days_off"],
427-
color_discrete_sequence=colormap,
428-
title="Accumulated time off in a 6-month window",
429-
)
430-
fig.add_vline(pd.Timestamp.today(), line_dash="dash")
431-
fig.add_trace(
432-
px.line(
433-
expected,
434-
x="day",
435-
y="amount",
436-
line_dash_sequence=["dot"],
437-
color_discrete_sequence=["black"],
438-
).data[0]
439-
)
440-
fig.update_xaxes(range=[start_win, end_win])
441-
fig.update_yaxes(range=[0, 35])
442-
```

0 commit comments

Comments
 (0)