Skip to content

Commit 20dd123

Browse files
authored
📝 : Add detailed objects documentation in docstring (#10)
* 📝 : Add detailed objects documentation in docstring * 🔖 Pyton SDK Version 3.1.1
1 parent 1581ce1 commit 20dd123

4 files changed

Lines changed: 208 additions & 17 deletions

File tree

hrflow/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__title__ = "hrflow"
22
__description__ = "Python hrflow.ai API package"
33
__url__ = "https://github.com/hrflow/python-hrflow-api"
4-
__version__ = "3.1.0"
4+
__version__ = "3.1.1"
55
__author__ = "HrFlow.ai"
66
__author_email__ = "contact@hrflow.ai"
77
__license__ = "MIT"

hrflow/hrflow/job/storing.py

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import json
2+
23
from ..utils import (
4+
ORDER_BY_VALUES,
5+
SORT_BY_VALUES,
36
format_item_payload,
47
validate_boolean,
58
validate_key,
69
validate_limit,
710
validate_page,
811
validate_provider_keys,
9-
validate_response,
1012
validate_reference,
11-
ORDER_BY_VALUES,
12-
SORT_BY_VALUES,
13+
validate_response,
1314
validate_value,
1415
)
1516

@@ -18,11 +19,91 @@ class JobStoring:
1819
"""Manage Storing related job calls."""
1920

2021
def __init__(self, api):
21-
"""Init."""
22+
"""_summary_
23+
24+
Parameters
25+
----------
26+
api : _type_
27+
_description_
28+
"""
2229
self.client = api
2330

2431
def add_json(self, board_key, job_json):
25-
"""Use the api to add a new profile using profile_data."""
32+
"""This endpoint allows you to Index a Job object.
33+
Note: If your Job is an unstructured text, make sure to parse it first before indexing it.
34+
See how in 🧠 Parse a raw Text at: https://developers.hrflow.ai/ .
35+
Parameters
36+
----------
37+
board_key : string [required]
38+
Identification key of the Board attached to the Job.
39+
job_json : dict [required]
40+
A dictionary representing the HrFlow.ai Job object. The dictionary should have the following fields:
41+
42+
- key (str): Identification key of the Job.
43+
- reference (str): Custom identifier of the Job.
44+
- name (str) [required]: Job title.
45+
- location (dict): Location information for the job.
46+
- text (str): Location text.
47+
- lat (float): Latitude coordinate.
48+
- lng (float): Longitude coordinate.
49+
- sections (list[dict]): List of sections in the job.
50+
Each section is represented by a dictionary with the following fields:
51+
- name (str): Section name.
52+
- title (str): Section title.
53+
- description (str): Section description.
54+
- url (str): Job post original URL.
55+
- summary (str): Brief summary of the Job.
56+
- created_at (str): Creation date of the Job in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ).
57+
- skills (list[dict]): List of skills required for the Job.
58+
Each skill is represented by a dictionary with the following fields:
59+
- name (str): Skill name.
60+
- type (str): Skill type: `hard` or `soft`.
61+
- value (any): Skill value. The value attached to the Skill. Example: 90/100
62+
- languages (list[dict]): List of languages required for the Job.
63+
Each language is represented by a dictionary with the following fields:
64+
- name (str): Language name.
65+
- value (any): Language value. The value attached to the Language. Example: fluent.
66+
- cetifications (list[dict]): List of certifications required for the Job.
67+
Each certification is represented by a dictionary with the following fields:
68+
- name (str): Certification name.
69+
- value (any): Certification value. The value attached to the Certification. Example: 4.5/5.
70+
- courses (list[dict]): List of courses required for the Job.
71+
Each course is represented by a dictionary with the following fields:
72+
- name (str): Course name.
73+
- value (any): Course value. The value attached to the Course.
74+
- tasks (list[dict]): List of tasks required for the Job.
75+
Each task is represented by a dictionary with the following fields:
76+
- name (str): Task name.
77+
- value (any): Task value. The value attached to the Task.
78+
- tags (list[dict]): List of tags added to the Job. Tags are a way we can extend the Job object with custom information.
79+
Each tag is represented by a dictionary with the following fields:
80+
- name (str): The name of the Tag. Example: `is_active`.
81+
- value (any): The value of the Tag. Example: `True`.
82+
- metadata (list[dict]): Custom metadata added to the Job.
83+
Each metadata is represented by a dictionary with the following fields:
84+
- name (str): The name of the metadata. Example: interview-note
85+
- value (any): The value of the metadata. Example: `The candidate was very good ...`.
86+
- ranges_float (list[dict]): List of float ranges added to the Job.
87+
Each range is represented by a dictionary with the following fields:
88+
- name (str): The name of the range. Example: salary.
89+
- value_min (float): The minimum value of the range. Example: 50000.
90+
- value_max (float): The maximum value of the range. Example: 60000.
91+
- unit (str): The unit of the range. Example: EUR.
92+
- ranges_date (list[dict]): List of date ranges added to the Job.
93+
Each range is represented by a dictionary with the following fields:
94+
- name (str): The name of the range. Example: availability.
95+
- value_min (str): The minimum value of the range in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Example: 2020-01-01.
96+
- value_max (str): The maximum value of the range in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Example: 2020-03-01.
97+
- culture (str): The company culture description in the Job.
98+
- benefits (str): The job opening benefits description in the Job.
99+
- responsibilities (str): The job opening responsibilities description in the Job.
100+
- requirements (str): The job opening requirements description in the Job.
101+
- interviews (str): The job opening interviews.
102+
Returns
103+
-------
104+
dict
105+
Server response.
106+
"""
26107
job_json["board_key"] = validate_key("Board", board_key)
27108
response = self.client.post("job/indexing", json=job_json)
28109
return validate_response(response)
@@ -31,11 +112,11 @@ def edit(self, board_key, job_json, key=None):
31112
"""
32113
Edit a job already stored in the given source.
33114
This method uses the endpoint : [PUT] https://api.hrflow.ai/v1/job/indexing
34-
It requires :
115+
It requires :
35116
- source_key : <string> The key of the source where the job is stored
36117
- job_json : <dict> The job data to update
37118
The job object must meet the criteria of the HrFlow.ai job Object
38-
Otherwise the Put request will return an error.
119+
Otherwise the Put request will return an error.
39120
A key or a reference must be provided in the job object `job_json`, to identify the job to update.
40121
The method will update the object already stored by the fields provided in the job_json.
41122
"""
@@ -48,7 +129,7 @@ def edit(self, board_key, job_json, key=None):
48129
# It should be removed in the future after a Major release
49130
if key:
50131
job_json["key"] = validate_key("Job", key)
51-
132+
52133
response = self.client.put("job/indexing", json=job_json)
53134
return validate_response(response)
54135

hrflow/hrflow/profile/storing.py

Lines changed: 116 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import json
2+
23
from ..utils import (
4+
ORDER_BY_VALUES,
5+
SORT_BY_VALUES,
36
format_item_payload,
47
validate_boolean,
58
validate_key,
69
validate_limit,
710
validate_page,
811
validate_provider_keys,
9-
validate_response,
1012
validate_reference,
11-
ORDER_BY_VALUES,
12-
SORT_BY_VALUES,
13+
validate_response,
1314
validate_value,
1415
)
1516

@@ -22,7 +23,115 @@ def __init__(self, api):
2223
self.client = api
2324

2425
def add_json(self, source_key, profile_json):
25-
"""Use the api to add a new profile using profile_data."""
26+
"""This endpoint allows you to Index a Profile object.
27+
28+
Parameters
29+
----------
30+
source_key : string [required]
31+
Identification key of the Source attached to the Profile.
32+
profile_json : dict [required]
33+
A dictionary representing the HrFlow.ai Profile object. The dictionary should have the following fields:
34+
35+
- key (str): Identification key of the Profile.
36+
- reference (str): Custom identifier of the Profile.
37+
- text_language (str): Code language of the Profile. Example : `en` for English.
38+
- text (str): Full text of the content of the Profile.
39+
- consent_algorithmic (dict) : Algorithmic consent status of the Profile.
40+
- owner (dict) : Owner of the Profile.
41+
- parsing (bool)
42+
- revealing (bool)
43+
- embedding (bool)
44+
- searching (bool)
45+
- scoring (bool)
46+
- upskilling (bool)
47+
- created_at (str): Creation date of the Profile in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). This could be the date of the creation of the Profile in your ATS.
48+
49+
------------------- Profile's info -------------------
50+
- info (dict): Object containing the Profile's info.
51+
- full_name (str): Full name of the Profile.
52+
- first_name (str): First name of the Profile.
53+
- last_name (str): Last name of the Profile.
54+
- email (str): Email of the Profile.
55+
- phone (str): Phone number of the Profile.
56+
- date_birth (str): Date of birth of the Profile in ISO 8601 format (YYYY-MM-DD).
57+
- location (dict): Main location of the Profile.
58+
- text (str): Location text.
59+
- lat (float): Latitude coordinate.
60+
- lng (float): Longitude coordinate.
61+
- fields (dict): Location fields.
62+
- urls (list): List of urls of the Profile.
63+
- picture (str): Url of the Profile's picture.
64+
- gender (str): `male`, `female` or `undefined`.
65+
- summary (str): Summary of the Profile.
66+
------------------- Profile's sections : skills, languages, interests ... -------------------
67+
- skills (list[dict]): List of skills details in the main skills sections of a resume or the Profile.
68+
Each skill is represented by a dictionary with the following fields:
69+
- name (str): Skill name.
70+
- type (str): Skill type: `hard` or `soft`.
71+
- value (any): Skill value. The value attached to the Skill. Example: 90/100
72+
- languages (list[dict]): List of languages of the Profile.
73+
Each language is represented by a dictionary with the following fields:
74+
- name (str): Language name.
75+
- value (any): Language value. The value attached to the Language. Example: fluent.
76+
- cetifications (list[dict]): List of certifications of the Profile.
77+
Each certification is represented by a dictionary with the following fields:
78+
- name (str): Certification name.
79+
- value (any): Certification value. The value attached to the Certification. Example: 4.5/5.
80+
- courses (list[dict]): List of courses of the Profile.
81+
Each course is represented by a dictionary with the following fields:
82+
- name (str): Course name.
83+
- value (any): Course value. The value attached to the Course.
84+
- tasks (list[dict]): List of tasks of the Profile.
85+
Each task is represented by a dictionary with the following fields:
86+
- name (str): Task name.
87+
- value (any): Task value. The value attached to the Task.
88+
- interests (list[dict]): List of interests of the Profile.
89+
Each interest is represented by a dictionary with the following fields:
90+
- name (str): Interest name. Example : `music`.
91+
- value (any): Interest value. The value attached to the Interest. Example: beginner.
92+
------------------- Profile's experiences and educations -------------------
93+
- experiences_duration (float): Total duration of the Profile's experiences in years. Example : 2.5 for 2 years and 6 months.
94+
- educations_duration (float): Total duration of the Profile's educations in years. Example : 2.5 for 2 years and 6 months.
95+
- experiences (list[dict]): List of the Profile's experiences.
96+
Each experience is represented by a dictionary with the following fields:
97+
- company (str): Name of the company.
98+
- title (str): Title of the experience.
99+
- description (str): Description of the experience.
100+
- location (dict): Same location object as in the Profile's info.
101+
- date_start (str): Start date of the experience in ISO 8601 format (YYYY-MM-DD).
102+
- date_end (str): End date of the experience in ISO 8601 format (YYYY-MM-DD).
103+
- skills (list[str]): List of skills used in the experience. Same format as the Profile's skills.
104+
- tasks (list[str]): List of tasks performed in the experience. Same format as the Profile's tasks.
105+
- certifications (list[str]): List of certifications obtained in the experience. Same format as the Profile's certifications.
106+
- courses (list[str]): List of courses followed in the experience. Same format as the Profile's courses.
107+
- educations (list[dict]): List of the Profile's educations.
108+
Each education is represented by a dictionary with the following fields:
109+
- school (str): Name of the school.
110+
- title (str): Title of the education.
111+
- description (str): Description of the education.
112+
- location (dict): Same location object as in the Profile's info.
113+
- date_start (str): Start date of the education in ISO 8601 format (YYYY-MM-DD).
114+
- date_end (str): End date of the education in ISO 8601 format (YYYY-MM-DD).
115+
- skills (list[str]): List of skills used in the education. Same format as the Profile's skills.
116+
- tasks (list[str]): List of tasks performed in the education. Same format as the Profile's tasks.
117+
- certifications (list[str]): List of certifications obtained in the education. Same format as the Profile's certifications.
118+
- courses (list[str]): List of courses followed in the education. Same format as the Profile's courses.
119+
------------------- Profile's attachments, tags and metadatas -------------------
120+
- attachments (list[dict]): List of the Profile's attachments. This field currently is internally handeled by HrFlow.ai.
121+
- tags (list[str]): List of the Profile's tags. Tags are used to extend the Profile's information. For example, a tag could be `salary_expectation`.
122+
Each tag is represented by a dictionary with the following fields:
123+
- name (str): The name of the Tag. Example: `is_active`.
124+
- value (any): The value of the Tag. Example: `True`.
125+
- metadata (list[dict]): Custom metadata added to the Job. They are similar to tags, but used for non indexable/searchable information.
126+
Each metadata is represented by a dictionary with the following fields:
127+
- name (str): The name of the metadata. Example: `cover_letter`.
128+
- value (any): The value of the metadata. Example: `I am applying for this job because...`.
129+
130+
Returns
131+
-------
132+
dict
133+
Server response.
134+
"""
26135
profile_json["source_key"] = validate_key("Source", source_key)
27136
response = self.client.post("profile/indexing", json=profile_json)
28137
return validate_response(response)
@@ -31,11 +140,11 @@ def edit(self, source_key, profile_json, key=None):
31140
"""
32141
Edit a profile already stored in the given source.
33142
This method uses the endpoint : [PUT] https://api.hrflow.ai/v1/profile/indexing
34-
It requires :
143+
It requires :
35144
- source_key : <string> The key of the source where the profile is stored
36145
- profile_json : <dict> The profile data to update
37146
The profile object must meet the criteria of the HrFlow.ai Profile Object
38-
Otherwise the Put request will return an error.
147+
Otherwise the Put request will return an error.
39148
A key or a reference must be provided in the profile object `profile_json`, to identify the profile to update.
40149
The method will update the object already stored by the fields provided in the profile_json.
41150
"""
@@ -44,7 +153,7 @@ def edit(self, source_key, profile_json, key=None):
44153
# It should be removed in the future after a Major release
45154
if key:
46155
profile_json["key"] = validate_key("Profile", key)
47-
156+
48157
response = self.client.put("profile/indexing", json=profile_json)
49158
return validate_response(response)
50159

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import os
3-
from setuptools import setup, find_packages
3+
4+
from setuptools import find_packages, setup
45

56
try:
67
from pip._internal.req import parse_requirements

0 commit comments

Comments
 (0)