HR records
1. Extract information of HR records with image URL or pdf URL input
API:
| Method | URL |
|---|---|
| GET | https://demo.computervision.com.vn/api/v2/ocr/employee_profile |
Params:
| Key | Value | Description |
|---|---|---|
img | https://example.com/image.png | URL of photo or pdf |
format_type | url | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Demo Python:
import requestsapi_key = "YOUR_API_KEY"api_secret = "YOUR_API_SECRET"image_url = 'https://example.com/image.png'response = requests.get("https://demo.computervision.com.vn/api/v2/ocr/employee_profile?img=%s&format_type=url&get_thumb=false"% image_url,auth=(api_key, api_secret))print(response.json())
2. Extract information of HR records with image file or pdf file input
API:
| Method | URL | content-type |
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v2/ocr/employee_profile | multipart/form-data |
Params:
| Key | Value | Description |
|---|---|---|
format_type | file | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Body:
| Key | Type | Value | Description |
|---|---|---|---|
img | file | example.jpg | Image file or pdf file |
Demo Python:
import requestsapi_key = "YOUR_API_KEY"api_secret = "YOUR_API_SECRET"image_path = '/path/to/your/image.jpg'response = requests.post("https://demo.computervision.com.vn/api/v2/ocr/employee_profile?format_type=file&get_thumb=false",auth=(api_key, api_secret),files={'img': open(image_path, 'rb')})print(response.json())
3. Extract information of HR records with JSON input
API:
| Method | URL | content-type |
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v2/ocr/employee_profile | application/json |
Params:
| Key | Value | Description |
|---|---|---|
format_type | base64 | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Body:
{"img": "iVBORw0KGgoAAAANSU..." // string base64 of the image or pdf to extract}
Demo Python:
import base64import ioimport requestsfrom PIL import Imagedef get_byte_img(img):img_byte_arr = io.BytesIO()img.save(img_byte_arr, format='PNG')encoded_img = base64.encodebytes(img_byte_arr.getvalue()).decode('ascii')return encoded_imgapi_key = "YOUR_API_KEY"api_secret = "YOUR_API_SECRET"img_name = "path_img"encode_cmt = get_byte_img(Image.open(img_name))response = requests.post("https://demo.computervision.com.vn/api/v2/ocr/employee_profile?format_type=base64&get_thumb=false",auth=(api_key, api_secret),json={'img' : encode_cmt})print(response.json())
4. Response
The response will be a JSON with the following format:
{"data": [xxxx],"errorCode": string,"errorMessage": string}
The data field is a JSON with the following format:
{"id_card": [xxx],"registration_book": [xxx],"curriculum_vitae": [xxx],"academic_degree": [xxx],"birth_certificate": [xxx],"health_certification": [xxx],"confirm_residence": [xxx],"image_negative": [xxx],"id_negative": [xxx]}
Details of the fields are described below:
For keys id_card, academic_degree, birth_certificate the value is an array with one or more elements.
For keys registration book, curriculum vitae, value is an array with only one element.
For key image_negative is an array of images that cannot extract any information of any type of document (images in base64 format).
Each element in the array has the following format:
{"type": string,"info": object}
If type field is id_doc, the info field contains the following fields:
addressaddress_boxaddress_confidencedobdob_boxdob_confidencegendergender_boxgender_confidencehometownhometown_boxhometown_confidenceidid_boxid_confidenceimage_frontimage_backissue_dateissue_date_boxissue_date_confidenceissued_atissued_at_boxissued_at_confidencenamename_boxname_confidence
If type field is curriculum_vitae, the info field contains the following fields:
academic_levelacademic_level_boxacademic_level_confidenceacademic_level_idcurrent_addresscurrent_address_boxcurrent_address_confidencecurrent_address_iddobdob_boxdob_confidencedob_idfather_dobfather_dob_boxfather_dob_confidencefather_dob_idfather_namefather_name_boxfather_name_confidencefather_name_idgendergender_boxgender_confidencegender_idimage_0image_1image_2image_3mother_dobmother_dob_boxmother_dob_confidencemother_dob_idmother_namemother_name_boxmother_name_confidencemother_name_idnamename_boxname_confidencename_idplace_of_birthplace_of_birth_boxplace_of_birth_confidenceplace_of_birth_idwork_experiencework_experience_boxwork_experience_confidencework_experience_id
If type field is registration_book, the info field contains the following fields:
addressaddress_boxaddress_confidencebook_numberbook_number_boxbook_number_confidencehead_namehead_name_boxhead_name_confidenceimagemember: This field is a list. Each element contains the following fields:- `dob
- `dob_box
dob_confidencegendergender_boxgender_confidenceid_cardid_card_boxid_card_confidenceimage_membernamename_boxname_confidencerelationship_to_headrelationship_to_head_boxrelationship_to_head_confidence
If type field is academic_degree, the info field contains the following fields:
academic_levelacademic_level_boxacademic_level_confidenceaward_classificationaward_classification_boxaward_classification_confidencedobdob_boxdob_confidencegraduation_yeargraduation_year_boxgraduation_year_confidenceimagemajormajor_boxmajor_confidencenamename_boxname_confidenceschoolschool_boxschool_confidence
If type field is birth_certificate, the info field contains the following fields:
dobdob_boxdob_confidencefather_addressfather_address_boxfather_address_confidencefather_dobfather_dob_boxfather_dob_confidencefather_namefather_name_boxfather_name_confidencegendergender_boxgender_confidenceimagemother_addressmother_address_boxmother_address_confidencemother_dobmother_dob_boxmother_dob_confidencemother_namemother_name_boxmother_name_confidencenumbernumber_boxnumber_confidencenumber_booknumber_book_boxnumber_book_confidenceplace_of_birthplace_of_birth_boxplace_of_birth_confidenceregis_placeregis_place_boxregis_place_confidence
If type field is confirm_residence, the info field contains the following fields:
addressaddress_boxaddress_confidencecurrent_addresscurrent_address_boxcurrent_address_confidencedobdob_boxdob_confidenceethnicityethnicity_boxethnicity_confidencegendergender_boxgender_confidencehead_idhead_id_boxhead_id_confidencehead_namehead_name_boxhead_name_confidencehometownhometown_boxhometown_confidenceidid_boxid_confidenceimageimage_membermember: This field is a list. Each element contains the following fields:relationship_to_headrelationship_to_head_boxrelationship_to_head_confidencenamename_boxname_confidencedobdob_boxdob_confidencegendergender_boxgender_confidenceid_cardid_card_boxid_card_confidence
namename_boxname_confidencenationalitynationality_boxnationality_confidenceregistered_addressregistered_address_boxregistered_address_confidencerelationship_to_headrelationship_to_head_boxrelationship_to_head_confidencereligiousreligious_boxreligious_confidence
If type field is health_certification, the info field contains the following fields:
namename_boxname_confidencename_iddobdob_boxdob_confidencedob_idhealth_conditionhealth_condition_boxhealth_condition_confidencehealth_condition_idheightheight_boxheight_confidenceheight_idweightweight_boxweight_confidenceweight_idimage_0image_1image_2
For pages that cannot extract information, the corresponding two fields are image_negative and id_negative in data. In there:
image_negative: Is a list ofbase64images of pages where information could not be extracted.id_negative: Is a listindexrepresenting the page that could not be extracted information as to how many pages in the records.
Note : information fields (except image) will have _box and _confidence included
Error code table:
| Code | Message |
|---|---|
| 0 | Success |
| 1 | The photo does not contain content |
| 2 | Url is unavailable |
| 3 | Incorrect image format |
| 4 | Out of requests |
| 5 | Incorrect api_key or api_secret |
| 6 | Incorrect format type |