-
Notifications
You must be signed in to change notification settings - Fork 16
Feature/jira issue status category flow analysis #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fivetran-savage
merged 8 commits into
release/1.1.0
from
feature/jira_issue_status_category_flow_analysis
Oct 29, 2025
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ec5d0f5
feature/jira_issue_status_category_flow_analysis
fivetran-savage dc16833
convert_minutes_to_days
fivetran-savage e9decd0
add_cumulative_flow_metric
fivetran-savage 57a17ef
update_model_and_add_changelog_entry
fivetran-savage bba8c0f
add_additional_analysis_model
fivetran-savage 5584511
update_formatting
fivetran-savage 2b81df0
Apply suggestions from code review
fivetran-savage cd9807e
Apply suggestions from code review
fivetran-savage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Jira Analysis | ||
| > Note: The compiled sql within the analysis folder references the final models [jira__issue_status_transitions](https://github.com/fivetran/dbt_jira/blob/master/models/jira__issue_status_transitions.sql), [jira__timestamp_issue_field_history](https://github.com/fivetran/dbt_jira/blob/master/models/jira__timestamp_issue_field_history), and [jira__daily_issue_field_history](https://github.com/fivetran/dbt_jira/blob/master/models/jira__daily_issue_field_history). As such, prior to | ||
| compiling the provided sql to analyze issue status category metrics, you must first execute `dbt run`. | ||
|
|
||
|
|
||
| ## Analysis SQL | ||
| | **sql** | **description** | | ||
| | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | [jira__daily_issue_status_category_analysis](https://github.com/fivetran/dbt_jira/blob/master/analysis/jira__daily_issue_status_category_analysis.sql) | The output of the compiled sql will generate daily counts of issues in each status category by date, project, and team. The analysis provides a snapshot view of how many issues are in each status category (To Do, In Progress, Done) on any given day. The SQL references the `jira__daily_issue_field_history` model and can be customized by adjusting the `issue_field_history_columns` var in your dbt_project.yml. `status` can be used in place of `status_category` if desired by modifying the model accordingly. | | ||
|
fivetran-savage marked this conversation as resolved.
Outdated
|
||
| | [jira__issue_transition_cumulative_flow_analysis](https://github.com/fivetran/dbt_jira/blob/master/analysis/jira__issue_transition_cumulative_flow_analysis.sql) | The output of the compiled sql will generate daily transition metrics for issue status categories with cumulative flow calculations. The analysis joins status transitions with field history data to provide: count of distinct issues transitioning into a new status category, cumulative count of issues in each status category over time, and counts of issues that started work, completed work, or reopened work. The SQL references the `jira__issue_status_transitions` and `jira__timestamp_issue_field_history` models. Aggregation granularity can be adjusted by adding/removing field names in the `issue_field_history_columns` var in your dbt_project.yml. `status` can be used in place of `status_category` if desired by modifying the model accordingly. | | ||
|
fivetran-savage marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
fivetran-savage marked this conversation as resolved.
Outdated
|
||
| ## SQL Compile Instructions | ||
| Leveraging the above sql is made possible by the [analysis functionality of dbt](https://docs.getdbt.com/docs/building-a-dbt-project/analyses/). In order to | ||
| compile the sql, you will perform the following steps: | ||
| - Execute `dbt run` to create the package models. | ||
| - Execute `dbt compile` to generate the target specific sql. | ||
| - Navigate to your project's `/target/compiled/jira/analysis` directory. | ||
| - Copy the desired analysis code (`jira__daily_issue_status_category_analysis` or `jira__issue_transition_cumulative_flow_analysis`) and run in your data warehouse. | ||
| - Confirm the issue status category metrics match your expected workflow patterns. | ||
| - Analyze the daily counts, transition metrics, and cumulative flow data to identify trends and bottlenecks in your development process. | ||
|
|
||
|
|
||
|
fivetran-savage marked this conversation as resolved.
|
||
| ## Contributions | ||
| Don't see a compiled sql statement you would have liked to be included? Notice any bugs when compiling | ||
| and running the analysis sql? If so, we highly encourage and welcome contributions to this package! | ||
| Please create issues or open PRs against `master`. Check out [this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) on the best workflow for contributing to a package. | ||
|
|
||
|
|
||
|
fivetran-savage marked this conversation as resolved.
Outdated
|
||
| ## Database Support | ||
| This package has been tested on BigQuery, Snowflake, Redshift, Postgres, and Databricks. | ||
|
|
||
|
|
||
|
fivetran-savage marked this conversation as resolved.
Outdated
|
||
| ## Are there any resources available? | ||
| - If you have questions or want to reach out for help, see the [GitHub Issue](https://github.com/fivetran/dbt_jira/issues/new/choose) section to find the right avenue of support for you. | ||
| - If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW). | ||
|
|
||
|
fivetran-savage marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| with field_history as ( | ||
|
|
||
| select * | ||
| from {{ ref('jira__daily_issue_field_history') }} | ||
| ), | ||
|
|
||
| statuses as ( | ||
|
|
||
| select * | ||
| from {{ ref('stg_jira__status') }} | ||
| ), | ||
|
|
||
| status_category as ( | ||
|
|
||
| select * | ||
| from {{ ref('stg_jira__status_category') }} | ||
| ), | ||
|
|
||
| status_mapping as ( | ||
|
|
||
| select | ||
| statuses.status_id, | ||
| statuses.status_name, | ||
| status_category.status_category_id, | ||
| case when lower(status_category.status_category_name) = 'to do' then 'To Do' | ||
| when lower(status_category.status_category_name) = 'in progress' then 'In Progress' | ||
| when lower(status_category.status_category_name) = 'done' then 'Done' | ||
| else 'Other' | ||
| end as status_category_name | ||
| from statuses left join status_category | ||
|
fivetran-savage marked this conversation as resolved.
Outdated
|
||
| on statuses.status_category_id = status_category.status_category_id | ||
| ), | ||
|
|
||
| --if you prefer to keep analytics at the status level, substitute 'status' for 'status_category' throughout this model and skip the status_mapping step | ||
| daily_issue_status_category as ( | ||
| select | ||
|
fivetran-savage marked this conversation as resolved.
|
||
| field_history.date_day as report_date, | ||
| -- edit field_history columns as desired based on the issue_field_history_columns var for your dbt project | ||
| -- project and team have been chosen for this example | ||
| field_history.project, | ||
| field_history.team, | ||
| field_history.issue_id, | ||
| field_history.status, | ||
| status_mapping.status_category_name as status_category, | ||
| from field_history | ||
| left join status_mapping | ||
| on lower(field_history.status) = lower(status_mapping.status_name) | ||
|
fivetran-savage marked this conversation as resolved.
|
||
| ), | ||
|
|
||
| --count of issues in each status on report date | ||
| daily_counts as ( | ||
| select | ||
|
fivetran-savage marked this conversation as resolved.
|
||
| report_date, | ||
| project, | ||
| team, | ||
| status_category, | ||
| count(distinct issue_id) as issues_in_status | ||
| from daily_issue_status_category | ||
| group by 1,2,3,4 | ||
| ) | ||
|
|
||
| select * | ||
| from daily_counts | ||
61 changes: 61 additions & 0 deletions
61
analysis/jira__issue_transition_cumulative_flow_analysis.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| with field_history as ( | ||
|
|
||
| select * | ||
| from {{ ref('jira__timestamp_issue_field_history') }} | ||
|
|
||
| ), | ||
|
|
||
| status_transitions as ( | ||
|
|
||
| select * | ||
| from {{ ref('jira__issue_status_transitions') }} | ||
| ), | ||
|
|
||
| ---if you prefer to keep analytics at the status level, substitute 'status' for 'status_category' throughout this model | ||
| joined as ( | ||
|
|
||
| select | ||
| transitions.transition_at, | ||
| transitions.issue_id, | ||
| transitions.status_category_name, | ||
| -- edit field_history columns as desired based on the issue_field_history_columns var for your dbt project | ||
| -- project and team have been chosen for this example | ||
| field_history.team, | ||
| field_history.project | ||
| from status_transitions as transitions | ||
| join field_history | ||
| on transitions.issue_id = field_history.issue_id | ||
| and transitions.transition_at = field_history.valid_from | ||
|
fivetran-savage marked this conversation as resolved.
|
||
| ), | ||
|
|
||
| ---roll up to daily for reporting | ||
| daily_rollup as ( | ||
|
|
||
| select | ||
| cast(transition_at as date) as status_category_transition_date, | ||
| project, | ||
| team, | ||
| status_category_name as status_category, | ||
| count(distinct issue_id) as issues_in_new_status_category, | ||
| from joined | ||
| group by 1,2,3,4 | ||
| ), | ||
|
|
||
| --add cumulative flow calculation | ||
| cumulative_flow as ( | ||
| select | ||
|
fivetran-savage marked this conversation as resolved.
|
||
| status_category_transition_date, | ||
| project, | ||
| team, | ||
| status_category, | ||
| issues_in_new_status_category, | ||
| sum(issues_in_new_status_category) over ( | ||
| partition by project, team, status_category | ||
| order by status_category_transition_date | ||
| rows unbounded preceding | ||
| ) as cumulative_issues_in_status_category | ||
| from daily_rollup | ||
| ) | ||
|
|
||
| select * | ||
| from cumulative_flow | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.