analytics
main.analytics
¤
Functions for calculating team activity stats.
Functions:¤
get_funding_per_budget_type(projects)
¤
Determine the total project funding per type of budget.
Budget types are: 1. Internal (internal projects) 2. External FEC DI (directly incurred) 3. External FEC DA (directly allocated) 4. External Non-FEC 5. Other (internal funds for external projects)
Projects with status='Tentative' or 'Not done' will be excluded, as they have no analysis code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projects
|
list[Project]
|
The list of projects. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, int]
|
A dictionary with budget types and the total project funding per type. |
Source code in main/analytics.py
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 94 95 96 97 98 99 100 101 102 103 104 105 | |
get_funding_per_department(projects)
¤
Determine the total project funding per department.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projects
|
list[Project]
|
The list of projects. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
A dictionary with department names and the project funding per department. |
Source code in main/analytics.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
get_funding_per_faculty(projects)
¤
Determine the total project funding per faculty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projects
|
list[Project]
|
The list of projects. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
A dictionary with faculty names and the project funding per faculty. |
Source code in main/analytics.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
get_funding_per_funding_body(projects)
¤
Determine the total project funding per funding body.
Projects with funding body TBC are excluded, as are tentative projects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projects
|
list[Project]
|
The list of projects. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
A dictionary with funding bodies and the total project funding per body. |
Source code in main/analytics.py
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 | |
get_project_count_per_department(projects)
¤
Determine the number of projects per department.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projects
|
list[Project]
|
The list of projects. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, int]
|
A dictionary with department names and the number of projects per department. |
Source code in main/analytics.py
9 10 11 12 13 14 15 16 17 18 | |
get_project_count_per_faculty(projects)
¤
Determine the number of projects per faculty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projects
|
list[Project]
|
The list of projects. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, int]
|
A dictionary with faculty names and the number of projects per faculty. |
Source code in main/analytics.py
21 22 23 24 25 26 27 28 29 30 | |
get_project_count_per_funding_body(projects)
¤
Determine the number of projects per funding body.
Projects with funding body TBC are excluded, as are tentative projects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
projects
|
list[Project]
|
The list of projects. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, int]
|
A dictionary with funding bodies and the number of projects per body. |
Source code in main/analytics.py
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 133 134 135 136 | |
get_projects_active_between(from_date, to_date)
¤
Get the projects under active development within a time frame.
Exclude "Not done", which is projects whose start date has passed, but are not under development.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
from_date
|
date
|
A datetime.date marking the start of the search interval. |
required |
to_date
|
date
|
A datetime.date marking the end of the search interval. |
required |
Returns:
| Type | Description |
|---|---|
list[Project]
|
The list of projects under active development within the time interval. |
Source code in main/analytics.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |