Skip to main content
POST
/
patients
/
{patient_id}
/
date_variables
/
{date_variable_id}
/
scrape
cURL
curl --request POST \
  --url https://backend.claros.health/patients/{patient_id}/date_variables/{date_variable_id}/scrape \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "model": "<string>"
}
'
{
  "variable_id": 123,
  "variable_name": "<string>",
  "found": true,
  "value": "2023-12-25",
  "highlight": {
    "page": 123,
    "x1": 123,
    "y1": 123,
    "x2": 123,
    "y2": 123
  }
}
This endpoint requires authentication. Include your API key in the request headers as X-API-Key.

Description

Attempts to extract a date value from the patient’s PDF document. This endpoint uses AI-powered extraction to find and extract the date value of a specific date variable from the patient’s uploaded PDF.

Path Parameters

patient_id
integer
required
The ID of the patient whose PDF will be analyzed
date_variable_id
integer
required
The ID of the date variable to extract from the PDF

Response

id
integer
The unique identifier of the patient date variable
name
string
The name of the date variable
value
string
The extracted date value in ISO 8601 format (YYYY-MM-DD)
note
string
Any additional notes about the extracted date
pdf_page
integer
The page number in the PDF where the date was found
highlight
object
The coordinates of the highlight in the PDF where the date was found

Example Response

{
  "id": 1,
  "name": "Next Appointment",
  "value": "2024-03-15",
  "note": "Extracted from visit notes",
  "pdf_page": 2,
  "highlight": {
    "x1": 100,
    "y1": 200,
    "x2": 300,
    "y2": 250
  }
}

Error Responses

400
object
Invalid request or extraction failed. The response will include an error message explaining what went wrong.
401
object
Authentication required. Make sure you’ve included a valid API key in the request headers.
404
object
Patient or date variable not found. The specified patient ID or date variable ID does not exist.

Notes

  • The patient must have a PDF document uploaded before using this endpoint
  • The extraction process may take a few seconds to complete
  • The accuracy of extraction depends on the quality and format of the PDF document
  • If multiple dates are found, the most recent or most relevant date will be returned

Authorizations

X-API-Key
string
header
required

Path Parameters

patient_id
integer
required

ID of the patient whose PDF will be analyzed

date_variable_id
integer
required

ID of the date variable to extract from the PDF

Body

application/json
model
string

Name of the model to use for scraping (e.g., 'gpt-4', 'gpt-4-mini')

Response

Date value extracted successfully

variable_id
integer

ID of the date variable

variable_name
string

Name of the date variable

found
boolean

Whether a date value was found

value
string<date>

The extracted date value in ISO 8601 format (YYYY-MM-DD)

highlight
object