metrics package

Submodules

metrics.date_utils module

Various date utility functions

metrics.date_utils.lastMonthDay(month: str) str[source]

expects YYYY-MM as input returns YYYY-MM-XX where XX is the last day for month MM

metrics.date_utils.leapYear(year: int) bool[source]

return True for leap years

metrics.date_utils.lookAhead(offset: int, from_date: str = Timestamp('2024-11-11 21:41:03.883862'))[source]
metrics.date_utils.lookBack(offset: int, from_date: str = Timestamp('2024-11-11 21:41:03.883908'))[source]
metrics.date_utils.monthBegin(from_date: str = Timestamp('2024-11-11 21:41:03.883912'))[source]

Return with the first for the date

metrics.date_utils.splitMonthTable(df: DataFrame) DataFrame[source]

split the table into two entries per month

metrics.date_utils.weekdays(from_date: str, to_date: str)[source]

Returns the number of weekdays between the dates using np

metrics.index module

metrics.notion module

Notion related functions and classes

class metrics.notion.Allocations(token: str | None = None, database_id: str = '')[source]

Bases: Notion

The class for allocations

data: DataFrame
get_allocations() None[source]
class metrics.notion.Crew(token: str | None = None, database_id: str = '')[source]

Bases: Notion

The class for crew data

data: DataFrame
get_crew() None[source]
class metrics.notion.Financials(token: str | None = None, database_id: str = '')[source]

Bases: Notion

The class for finance data

data: DataFrame
get_financials() None[source]
class metrics.notion.Notion(token: str | None = None, database_id: str = '')[source]

Bases: object

I’M A DOCSTRING SHORT AND STOUT

database_id: str
fetch_data(database_id) Response[source]
token: str
class metrics.notion.WorkingHours(token: str | None = None, database_id: str = '')[source]

Bases: Notion

The class for working hour handling

data: DataFrame
get_workinghours() None[source]

metrics.supplementary_data module

Tempo related functions and classes

class metrics.supplementary_data.SupplementaryData(config_path: str, financials: DataFrame, working_hours: DataFrame)[source]

Bases: object

SupplementaryData data class

costs: DataFrame
financials: DataFrame
internal_keys: DataFrame
load(users: Series) None[source]
working_hours: DataFrame
class metrics.supplementary_data.SupplementaryRatesData(config_path: str)[source]

Bases: object

load()[source]
rates_json_data: dict
rates_path: str

metrics.tempo_config module

Config module

metrics.tempo_data module

Tempo related functions and classes

class metrics.tempo_data.TempoData(config_path: str, tempo_base_url: str = 'https://api.tempo.io/4', tempo_key: str | None = None, jira_base_url: str = 'https://verifa.atlassian.net', jira_user: str | None = None, jira_api_token: str | None = None)[source]

Bases: object

Tempo data class.

allJiraIssues() DataFrame[source]

Fetches all the JIRA issues with IssueId and Key columns as DataFrame

allJiraUsers() DataFrame[source]

Fetches all the JIRA users with UserId and User coloums as DataFrame

byDay() DataFrame[source]

returns aggregated time and billable time grouped by date, user and issue key

byEggBaskets() DataFrame[source]

returns aggregated billable income grouped by issue key group, user and time box (30, 60, 90)

byGroup() DataFrame[source]

returns aggregated time and billable time grouped by date, user and group

byTimeType() DataFrame[source]

returns aggregated time and time type grouped by date, user and group

byTotalGroup(days_back) DataFrame[source]

returns aggregated billable time grouped by issue key group and user

byUser(working_hours: DataFrame) DataFrame[source]

returns aggregated time and billable time grouped by user

client: Tempo
data: DataFrame
firstEntry(user, start) Timestamp[source]
getUsers() Series[source]

returns list of users

getYear(year) DataFrame[source]

returns a dataFrame with entries for the given year

injectRates(rates: DataFrame) None[source]

Modify data by merging in the given rates data

jira_client: JIRA
lastEntry(user, stop) Timestamp[source]
lastYear() DataFrame[source]

returns a dataFrame with entries for the previous year

last_year: int
load(from_date: str = '1970-01-01', to_date: str = '2024-11-11', crew=Empty DataFrame Columns: [] Index: []) None[source]

Fetch and populate data from Tempo for the given date range

missingRatesTable(fnTableHeight=None, color_head='paleturquoise', color_cells='lavender') Figure[source]
padTheData(working_hours: DataFrame) None[source]

creates the self.padded_data padded with zero data for each User, an entry for the ZP group will be added for each date >= min(Date) && <= max(Date) Key: ZP-1, Time: 0, Billable: 0, Group: ZP, Internal: 0, Currency: EUR, Rate: 0, Income: 0

padded_data: DataFrame
ratesTable(fnTableHeight=None, color_head='paleturquoise', color_cells='lavender') Figure[source]
raw: DataFrame
rawRatesTable() DataFrame[source]
tableByUser(working_hours, fnTableHeight=None, color_head='paleturquoise', color_cells='lavender') Figure[source]
teamRolling7(to_sum) DataFrame[source]

returns rolling 7 day sums for Billable and non Billable time grouped by user

teamRolling7Relative(costs: Series) DataFrame[source]

returns rolling 7 day sums for Billable and non Billable time grouped by user, relative to the costs

thisYear() DataFrame[source]

returns a dataFrame with entries for the current year

this_year: int
totalHours(user, start, stop=None)[source]
userRolling7(to_sum) DataFrame[source]

returns rolling 7 day sums for Billable and non Billable time grouped by user

zeroOutBillableTime(keys: DataFrame) None[source]

Sets billable time to zero (0) for internal project keys

metrics.tempo_figures module

The figures module

metrics.tempo_figures.figureEarningsVersusWorkload(user_data)[source]
metrics.tempo_figures.figureFinancialTotal(supplementary_data, year=None)[source]
metrics.tempo_figures.figureNormalisedIndividual(user_data)[source]
metrics.tempo_figures.figureNormalisedTeam(team_data, last_date)[source]
metrics.tempo_figures.figureRatesToEUR()[source]

Simple plot to show € for rates in SEK and DKK

metrics.tempo_figures.figureRollingIncomeIndividual(df_user_income_rolling)[source]
metrics.tempo_figures.figureRollingIncomeTeam(df_average_income_rolling_30, last_date)[source]
metrics.tempo_figures.figureRollingTotal(df_team_rolling_total, supplementary_data)[source]
metrics.tempo_figures.figureSpentTimePercentage(tempo_data)[source]

Module contents