timeseries
main.timeseries
¤
Timeseries for generating ProCAT plots.
Functions:¤
get_allocation_timeseries(start_date, end_date)
¤
Get the timeseries data for project allocations.
Each user gets a DataFrame with the projects they are involved and to what level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
datetime
|
datetime object representing the start of the plotting period |
required |
end_date
|
datetime
|
datetime object representing the end of the plotting period |
required |
Returns:
| Type | Description |
|---|---|
dict[str, DataFrame]
|
Pandas series of aggregated capacities with date range as index. |
Source code in main/timeseries.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
get_capacity_timeseries(start_date, end_date)
¤
Get the timeseries data for aggregated user capacities.
A user may have multiple capacity entries associated. We order them by start_date and then calculate the trace by overriding the old values based on the newest ones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
datetime
|
datetime object representing the start of the plotting period |
required |
end_date
|
datetime
|
datetime object representing the end of the plotting period |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Pandas series of aggregated capacities with date range as index. |
Source code in main/timeseries.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
get_cost_recovery_timeseries(dates)
¤
Get the cost recovery timeseries for the previous year.
For each month in the past year, this function aggregates all time entries and divides this by the number of working days. This value is added to the time series. The total monthly charges for the month are also recorded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dates
|
list[tuple[date, date]]
|
list of tuples (from oldest to most recent) containing dates for all months of the previous year; each tuple contains two dates for the first and last date of the month |
required |
Returns:
| Type | Description |
|---|---|
Series[float]
|
Tuple of Pandas series containing cost recovery timeseries data and a list of |
list[float]
|
monthly totals. |
Source code in main/timeseries.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
get_effort_timeseries(start_date, end_date, project_statuses=None)
¤
Get the timeseries data for aggregated project effort.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
datetime
|
datetime object representing the start of the plotting period |
required |
end_date
|
datetime
|
datetime object representing the end of the plotting period |
required |
project_statuses
|
list[str] | None
|
a list of project status values to filter the Project results by (e.g. ['Active', 'Confirmed']), or None if no filter applied |
None
|
Returns:
| Type | Description |
|---|---|
Series[float]
|
Pandas series of aggregated effort with date range as index. |
Source code in main/timeseries.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
get_internal_effort_timeseries(start_date, end_date)
¤
Get the timeseries data for projects that are not included in MonthlyCharges.
This includes internal projects that are not charged to an external funding source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
datetime
|
datetime object representing the start of the plotting period |
required |
end_date
|
datetime
|
datetime object representing the end of the plotting period |
required |
Returns:
| Type | Description |
|---|---|
Series[float]
|
Pandas Series containing internal effort timeseries data. |
Source code in main/timeseries.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
get_team_members_timeseries(start_date, end_date)
¤
Get number of active team members with capacity above zero in a given period.
The number of team members is time dependent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
datetime
|
datetime object representing the start of the plotting period |
required |
end_date
|
datetime
|
datetime object representing the end of the plotting period |
required |
Returns:
| Type | Description |
|---|---|
Series[float]
|
The number of active team members with capacity above zero over the time period. |
Source code in main/timeseries.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
update_timeseries(timeseries, object, attr_name)
¤
Update the initialized timeseries with value from a Model object.
The dates for the Model are used to index the timeseries. The value added is specified by the attr_name.
TODO: For advanced capacity planning, keep separate Project and User timeseries so these can be plotted individually.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeseries
|
Series[float]
|
the Pandas series containing the Project or Capacity data with the dates of the plotting period as the index |
required |
object
|
Project | Capacity
|
the Project or Capacity object used to update the timeseries |
required |
attr_name
|
str
|
the name of the attribute representing the value to add to the timeseries (e.g. 'value') |
required |
Returns:
| Type | Description |
|---|---|
Series[float]
|
Pandas series containing updated timeseries data. |
Source code in main/timeseries.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |