-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathgrading.py
More file actions
72 lines (64 loc) · 2.73 KB
/
grading.py
File metadata and controls
72 lines (64 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
60
61
62
63
64
65
66
67
68
69
70
71
72
import json
import typing as t
from ..core.rate_limit import rate_limiter
from ..core.validation import (
KEY_REGEX,
ORDER_BY_VALUES,
SORT_BY_VALUES,
validate_key,
validate_limit,
validate_page,
validate_provider_keys,
validate_reference,
validate_response,
validate_value,
)
class ProfileGrading:
def __init__(self, api):
"""Initialize the ProfileGrading class with the provided API client."""
self.client = api
@rate_limiter
def get(
self,
algorithm_key: str,
source_key: str,
board_key: str,
profile_key: t.Optional[str] = None,
profile_reference: t.Optional[str] = None,
job_key: t.Optional[str] = None,
job_reference: t.Optional[str] = None,
):
"""
💾 Grade a Profile indexed in a Source for a Job
(https://api.hrflow.ai/v1/profile/grading).
Args:
algorithm_key: <string>
The key of the grading algorithm to use.
Refer to the documentation: https://developers.hrflow.ai/reference/grade-a-profile-indexed-in-a-source-for-a-job
for all possible values.
source_key: <string>
The key of the Source where the profile to grade is indexed.
board_key: <string>
The key of the Board where the job to grade to is indexed.
profile_key: <string>
(Optional) The Profile unique identifier.
profile_reference: <string>
(Optional) The Profile reference chosen by the customer.
job_key: <string>
(Optional) The Job unique identifier.
job_reference: <string>
(Optional) The Job reference chosen by the customer.
Returns:
The grading information for the profile, based on the specified job.
"""
query_params = {
"algorithm_key": algorithm_key,
"source_key": validate_key("Source", source_key, regex=KEY_REGEX),
"profile_key": validate_key("Key", profile_key, regex=KEY_REGEX),
"profile_reference": validate_reference(profile_reference),
"board_key": validate_key("Board", board_key, regex=KEY_REGEX),
"job_key": validate_key("Key", job_key, regex=KEY_REGEX),
"job_reference": validate_reference(job_reference),
}
response = self.client.get("profile/grading", query_params)
return validate_response(response)