Package: sd-metrics-lib
sd-metrics-libPython library for calculation of various metrics related to software development process. Provides user velocity
calculation based on data from Jira. Metrics calculation classes are using interfaces, so it could be easily extended
with another data providers, like Trello, Asana etc. from application code.Implementation notesGeneral architecture is simple and has 2 main parts:calculatorspackage:UserVelocityCalculatorclass calculates user velocity or developer performance in other words. Requires
IssueProvider, StoryPointExtractor and WorklogExtractor for calculation.GeneralizedTeamVelocityCalculatorclass calculates team generalized velocity. Requires
IssueProvider, StoryPointExtractor and IssueTotalSpentTimeExtractor for calculation.data_providerspackage:IssueProviderinterface designed to provide issues/tickets for calculators.JiraIssueProviderimplementation class, which fetches issues from Jira by JQL using jira client
fromatlassian-python-api. Supports multithreading.CachingJiraIssueProviderwrapsJiraIssueProviderwith caching.ProxyIssueProviderwrapper for issues fetched from another data providers.StoryPointExtractorinterface designed to extract "story points" from issue.JiraCustomFieldStoryPointExtractorimplementation class, which extract value of custom field from Jira.JiraTShirtStoryPointExtractorimplementation class, which extract value of custom field from Jira and maps
string value into numbers.WorklogExtractorinterface designed to extract amount of time users spent on ticket.JiraWorklogExtractorimplementation class, which uses regular jira work log entries to define user spent
time.JiraStatusChangeWorklogExtractorimplementation class, which uses issue status change history log to
define user spent time on issue.JiraResolutionTimeIssueTotalSpentTimeExtractorimplementation class, which uses creation and resolution
time to calculate total spent time on issue.ChainedWorklogExtractorimplementation class, which allows "chain"WorklogExtractorto execute them
one by one.WorkTimeExtractorinterface designed to extract and calculate working time from period.SimpleWorkTimeExtractorSimple work time calculation. For more precision calculation you can use
businesstimedelta.BoundarySimpleWorkTimeExtractorUses SimpleWorkTimeExtractor to limit calculation time range. Useful for
workload calculation in some period of time, for example for "days without work" calculation.Also library provides few util classes:JiraIssueSearchQueryBuilderbuilder for JQL queries.TimeRangeGeneratorgenerator for time ranges. Useful for filtering by resolution date to calculate velocity for
set of period of time.Code examplesCalculate amount of tickets developer resolves per day based on Jira ticket status change history.This code should work on any project and give at least some data for analysis.fromatlassianimportJirafromcalculatorsimportUserVelocityCalculatorfromcalculators.velocity_calculatorimportVelocityTimeUnitfromdata_providers.jira.issue_providerimportJiraIssueProviderfromdata_providers.jira.worklog_extractorimportJiraStatusChangeWorklogExtractorfromdata_providers.story_point_extractorimportConstantStoryPointExtractorJIRA_SERVER='server_url'JIRA_LOGIN='login'JIRA_PASS='password'jira_client=Jira(JIRA_SERVER,JIRA_LOGIN,JIRA_PASS,cloud=True)jql=" project in ('TBC') AND resolutiondate >= 2022-08-01 "jql_issue_provider=JiraIssueProvider(jira_client,jql,expand=['changelog'])story_point_extractor=ConstantStoryPointExtractor()jira_worklog_extractor=JiraStatusChangeWorklogExtractor(['In Progress','In Development'])velocity_calculator=UserVelocityCalculator(issue_provider=jql_issue_provider,story_point_extractor=story_point_extractor,worklog_extractor=jira_worklog_extractor)velocity=velocity_calculator.calculate(velocity_time_unit=VelocityTimeUnit.DAY)print(velocity)Calculate amount of story points developer resolves per day based on Jira worklog.This code will provide good enough dev performance metrics on projects, where worklog and story points are entered in
Jira.fromatlassianimportJirafromcalculatorsimportUserVelocityCalculatorfromcalculators.velocity_calculatorimportVelocityTimeUnitfromdata_providers.jira.issue_providerimportJiraIssueProviderfromdata_providers.jira.worklog_extractorimportJiraWorklogExtractorfromdata_providers.jiraimportJiraCustomFieldStoryPointExtractorJIRA_SERVER='server_url'JIRA_LOGIN='login'JIRA_PASS='password'jira_client=Jira(JIRA_SERVER,JIRA_LOGIN,JIRA_PASS,cloud=True)jql=" project in ('TBC') AND resolutiondate >= 2022-08-01 "jql_issue_provider=JiraIssueProvider(jira_client,jql)story_point_extractor=JiraCustomFieldStoryPointExtractor('customfield_10010')jira_worklog_extractor=JiraWorklogExtractor(jira_client)velocity_calculator=UserVelocityCalculator(issue_provider=jql_issue_provider,story_point_extractor=story_point_extractor,worklog_extractor=jira_worklog_extractor)velocity=velocity_calculator.calculate(velocity_time_unit=VelocityTimeUnit.DAY)print(velocity)Version history1.2.1(Improvement)Add possibility to adjust init time(Bug Fix)Fix bug with wrong cache data fetching(Bug Fix)Fix bug in week time period end date resolving1.2(Feature)Added BoundarySimpleWorkTimeExtractor(Improvement)Filter unneeded changelog items for better performance(Improvement)Add T-Shirt to story points mapping util class(Improvement)Add helper enums(Bug Fix)Fix bug with story points returned instead of spent time(Bug Fix)Fix bug with missing time for active status(Bug Fix)Fix bug with passing class instances in extractor1.1.4(Improvement)Add multithreading support for JiraIssueProvider.1.1.3(Feature)Add CachingJiraIssueProvider.1.1.2(Improvement)Add story points getter for GeneralizedTeamVelocityCalculator.1.1.1(Improvement)Execute data fetching in Jira velocity calculators only once.(Improvement)Add story points getter for Jira velocity calculators.1.1(Feature)Add team velocity calculator.(Improvement)Add JQL filter for last modified data.(Bug Fix)Fix wrong user resolving in JiraStatusChangeWorklogExtractor.(Bug Fix)Fix resolving more time than spent period of time.(Bug Fix)Fix Jira filter query joins without AND.1.0.3(Improvement)Add JiraIssueSearchQueryBuilder util class.(Improvement)Add TimeRangeGenerator util class.(Bug Fix)Fix filtering by status when no status list passed.1.0.2(Bug Fix)Fix package import exception after installing from pypi.1.0(Feature)Add user velocity calculator.