Skip to content

Commit

Permalink
Add issues summary page (#22)
Browse files Browse the repository at this point in the history
* Add issues summary page

* readability tweaks to the issues page

* added top contributor

* add sample of top issue

* add num formatting

* add else issue_action

* Add explicit schema for MD cross-compatibility

---------

Co-authored-by: winnie <91998347+gwenwindflower@users.noreply.github.com>
  • Loading branch information
ashrodan and gwenwindflower authored Oct 2, 2023
1 parent d4623d3 commit aabcb7d
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 1 deletion.
151 changes: 150 additions & 1 deletion reports/pages/issues.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,154 @@
---
title: Analyzing Issues
sources:
- issues.sql
---

Coming soon! You could contribute this page!
In the last <Value data={issue_summary} column="last_hours"/> hours there have been <b><Value data={issue_summary} column="issues" fmt="num0 auto"/></b> events across <Value data={issue_summary} column="repo_count" fmt="num0 auto"/> repositories! This has involved <Value data={issue_summary} column="actor_count" fmt="num0 auto"/> contributors opening and closing issues, <Value data={issue_summary} column="opened_events" fmt="num0 auto"/> and <Value data={issue_summary} column="closed_events" fmt="num0 auto"/> respectively.

<b><Value data={top_actor} /></b> was the top contributor with <b><Value data={top_actor_repo} column="repo_events"/></b> issues added to <b><Value data={top_actor_repo} column="repo_name"/></b> repository!

<br>
<br>

<!-- Coming soon! You could contribute this page! -->
<BigValue
data={issue_count}
sparkline='date'
comparison='count_day_prior'
comparisonTitle="Compared to Yesterday"
value='issues'
maxWidth='10em'
/>

<BigValue
data={issue_summary}
value='repo_count'
maxWidth='10em'
/>

<BigValue
data={issue_summary}
value='actor_count'
maxWidth='10em'
/>


### Issues by hour
<BarChart
data={issue_count_hour}
x="hour_of_day"
y="issues"
series="issue_action"
/>





### Issues summary by repo
<DataTable
search="true"
data="{issues_per_repo}"
link="issue_repo_url"
>
<Column id= "repo_name"/>
<Column id= "actors"/>
<Column id= "closed_events"/>
<Column id= "closed_events"/>
<Column id= "number_of_issues"/>
</DataTable>
## Issue Sample
```sql issuesraw
select * from ${issues} limit 100

```

<br>

_The longest content issue in the data set reads:_ <Value data={issue_content_len} />
<br>
<Details title="Definitions">

```sql issue_summary
select
count(1)::INT as issues,
count(distinct actor_id)::INT as actor_count,
count(distinct repo_id)::INT as repo_count,
date_diff('hour', min(event_created_at)::TIMESTAMPTZ, now()::TIMESTAMPTZ) as last_hours,
count(1) filter(where issue_action = 'opened')::INT as opened_events,
count(1) filter(where issue_action = 'closed')::INT as closed_events,
from ${issues}

```
<!-- Actor summary -->
```sql top_actor
select
actor_login,
count(1) as actor_events,
from ${issues}
group by all
having actor_events>1
order by actor_login desc
limit 1
```

```sql top_actor_repo
select repo_name,
count(1) as repo_events
from ${issues}
where actor_login = (select actor_login from ${top_actor})
group by all
limit 1
```


```sql issue_content_len
select
left(issue_body, 400) as content_summary,
issue_body,
length(issue_body) as issue_body_len,
from ${issues}
group by all
order by issue_body_len desc
limit 1
```

```sql issue_count
select count(1) as issues,
count(1) - count(1) filter(where issue_created_at < now() AT TIME ZONE 'UTC' - interval '1 Day') as count_day_prior,
from ${issues}
group by all
```

```sql issue_count_hour
select
date_trunc('hour', event_created_at) as hour_of_day,
case
when issue_action = 'opened' then 'Opened'
when issue_action = 'closed' then 'Closed'
else issue_action
end as issue_action,
count(1) as issues,
from ${issues}
group by all
order by all

```

```sql issues_per_repo
select
repo_name,
issue_repo_url,
count(distinct issue_id) as number_of_issues,
count(distinct actor_id) as actors,
count(1) filter(where issue_action = 'opened') as opened_events,
count(1) filter(where issue_action = 'closed') as closed_events,
from ${issues}
group by all
having number_of_issues > 2
order by 2 desc
```

</Details>
1 change: 1 addition & 0 deletions reports/sources/issues.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from octocatalog.issue_events

0 comments on commit aabcb7d

Please sign in to comment.