Skip to content

Commit

Permalink
bug fixes, improved docs etl, docs eda, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
lostmygithubaccount committed Sep 17, 2024
1 parent f8e5e3d commit 15b3fc1
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 3 deletions.
103 changes: 103 additions & 0 deletions eda.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,109 @@ ibis.options.repr.interactive.max_columns = None
px.defaults.template = "plotly_dark"
```

```{python}
def lookback(t, days=None):
if days is None:
return t
return t.filter(t["timestamp"] > ibis.now() - ibis.interval(days=days))
```

```{python}
t = docs_t
t
```

```{python}
t.filter(t["path"].startswith("/posts/"))
```

```{python}
px.bar(
t.filter(t["path"].startswith("/posts/"))
.mutate(path=ibis._["path"].re_extract(r"^/posts/[^/]+", 0))
# .filter(t["path"].contains("ibis-version-"))
.group_by("path")
.agg(count=ibis._.count())
.order_by(ibis.desc("count"))
.limit(10),
x="path",
y="count",
log_y=True,
)
```

```{python}
c = px.line(
metrics.docs_rolling_by_path(
t.filter(t["path"].startswith("/posts/"))
.filter(~ibis._["path"].contains("ibis-version-"))
.mutate(path=ibis._["path"].re_extract(r"^/posts/[^/]+", 0)),
days=28,
).pipe(lookback, days=None),
x="timestamp",
y="rolling_docs",
color="path",
log_y=True,
)
# no legend
c.update_layout(showlegend=False)
```


---

```{python}
```



















































```{python}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ allow-direct-references = true

[project]
name = "ibis-analytics"
version = "0.10.0"
version = "0.11.0"
authors = [{ name = "Cody", email = "[email protected]" }]
description = "Ibis analytics with Ibis"
readme = "readme.md"
Expand Down
2 changes: 2 additions & 0 deletions src/ibis_analytics/etl/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ def docs(t):

def transform(t):
t = t.rename({"path": "2_path", "timestamp": "date"})
t = t.mutate(path=ibis._["path"].replace("/index.html", ""))
t = t.mutate(path=ibis._["path"].re_extract(r"^/posts/[^/]+", 0))
return t

docs = t.pipe(preprocess).pipe(transform).pipe(postprocess)
Expand Down
4 changes: 2 additions & 2 deletions src/ibis_analytics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def docs_rolling(t: ibis.Table, days: int = 28) -> ibis.Table:
.over(
ibis.window(
order_by="timestamp",
preceding=28,
preceding=days,
following=0,
)
),
Expand All @@ -115,7 +115,7 @@ def docs_rolling_by_path(t: ibis.Table, days: int = 28) -> ibis.Table:
ibis.window(
order_by="timestamp",
group_by="path",
preceding=28,
preceding=days,
following=0,
)
),
Expand Down

0 comments on commit 15b3fc1

Please sign in to comment.