Projects Table
projects/projects.py¶
ProjectsDB ¶
ProjectsDB(dburi='localhost/tm_admin')
Bases: DBSupport
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dburi |
str
|
The URI string for the database connection |
'localhost/tm_admin'
|
Returns:
Type | Description |
---|---|
ProjectsDB
|
An instance of this class |
Source code in tm_admin/projects/projects.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
mergeAuxTables
async
¶
mergeAuxTables(inuri, outuri)
Merge more tables from TM into the unified projects table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inuri |
str
|
The input database |
required |
outuri |
str
|
The output database |
required |
Source code in tm_admin/projects/projects.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
updateThread
async
¶
updateThread(queries, db)
Thread to handle importing data
Parameters:
Name | Type | Description | Default |
---|---|---|---|
queries |
list
|
The list of SQL queries to execute |
required |
db |
PostgresClient
|
A database connection |
required |
Source code in tm_admin/projects/projects.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
main
async
¶
main()
This main function lets this class be run standalone by a bash script.
Source code in tm_admin/projects/projects.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
|
options: show_source: false heading_level: 3
projects/projects_class.py¶
options: show_source: false heading_level: 3
projects/api.py¶
ProjectsAPI ¶
ProjectsAPI()
Bases: PGSupport
Returns:
Type | Description |
---|---|
ProjectsAPI
|
An instance of this class |
Source code in tm_admin/projects/api.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
initialize
async
¶
initialize(inuri)
Connect to all tables for API endpoints that require accessing multiple tables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inuri |
str
|
The URI for the TM Admin output database |
required |
Source code in tm_admin/projects/api.py
76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
getByID
async
¶
getByID(project_id)
Get all the information for a project using it's ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
int
|
The team to get the data for |
required |
Returns:
Type | Description |
---|---|
dict
|
the project information |
Source code in tm_admin/projects/api.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
getTeamRole
async
¶
getTeamRole(project_id, team_id)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
id
|
The project ID |
required |
team_id |
id
|
The team ID |
required |
Returns:
Type | Description |
---|---|
Teamrole
|
The role of this team in this project |
Source code in tm_admin/projects/api.py
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 133 134 135 136 137 138 139 |
|
getByName
async
¶
getByName(name)
Get all the information for a project using the name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The project to get the data for |
required |
Returns:
Type | Description |
---|---|
dict
|
the project information |
Source code in tm_admin/projects/api.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
changeStatus
async
¶
changeStatus(project_id, status)
Manage the status of a task. This would be locking or unlocking, validation status, etc...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
int
|
The project ID to change |
required |
status |
ProjectStatus
|
The status to change to |
required |
Returns:
Type | Description |
---|---|
bool
|
Whether locking/unlocking the task was sucessful |
Source code in tm_admin/projects/api.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
evaluateMappingPermissions
async
¶
evaluateMappingPermissions(uid, pid, perm)
evaluate_mapping_permission()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
int
|
The user ID |
required |
pid |
int
|
The project ID |
required |
perm |
Permissions
|
The permission level to check against |
required |
Returns:
Type | Description |
---|---|
bool
|
If the user has the right permissions for this project |
Source code in tm_admin/projects/api.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
permittedUser
async
¶
permittedUser(project_id, user_id)
Is a user permitted to map on this project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id |
int
|
The user ID to lock |
required |
project_id |
int
|
The project this task is in |
required |
Returns:
Type | Description |
---|---|
Mappingnotallowed
|
The results of checking permissions |
Source code in tm_admin/projects/api.py
203 204 205 206 207 208 209 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 |
|
toggleFavorites
async
¶
toggleFavorites(flag=None)
Add or remove this project favorites for a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag |
bool
|
The value to set to, otherwise defaults to flipping it. |
None
|
Source code in tm_admin/projects/api.py
249 250 251 252 253 254 255 256 257 258 259 260 |
|
toggleFeatures
async
¶
toggleFeatures(flag=None)
Args:
Returns:
Source code in tm_admin/projects/api.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
unlockTasks
async
¶
unlockTasks(project_id)
Args:
Returns:
Source code in tm_admin/projects/api.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|
getUserStats
async
¶
getUserStats(user_id, project_id)
Args:
Returns:
Source code in tm_admin/projects/api.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
|
getProjectStats
async
¶
getProjectStats(project_id)
Args:
Returns:
Source code in tm_admin/projects/api.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
|
getAOI
async
¶
getAOI(project_id)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
int
|
The project to get the data for |
required |
Returns:
Source code in tm_admin/projects/api.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
getDailyContributions
async
¶
getDailyContributions(project_id)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
int
|
The project to get the data for |
required |
Returns:
Source code in tm_admin/projects/api.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
|
getProjectSummary
async
¶
getProjectSummary()
Args:
Returns:
Source code in tm_admin/projects/api.py
356 357 358 359 360 361 362 363 364 365 366 367 |
|
main
async
¶
main()
This main function lets this class be run standalone by a bash script.
Source code in tm_admin/projects/api.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
|
options: show_source: false heading_level: 3