EndpointsEye Consultations

Eye Consultations

Function-calling namespace: eyeConsultations

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

Clinical Payload Notes

  • visualAcuity stores unaided, pinhole, and Best Corrected VA (BCVA) for right and left eyes.
  • refraction stores Sphere (SPH), Cylinder (CYL), Axis, Addition (ADD), VA, and Near Add for right and left eyes.
  • Axis must be between 0 and 180.
  • Supported visual acuity values: 6/6, 6/9, 6/12, 6/18, 6/24, 9/18, N6, N8, N10.

create

Source: backend/endpoints/eye-consultations/create

Input Fields

FieldTypeRequiredConstraints
consultationIdstringYes-
organizationIdstringYes-
visualAcuityobjectYesrequires rightEye and leftEye acuity values; nullable
refractionobjectYesrequires rightEye and leftEye refraction values; axis: 0-180; nullable
notesstringNo-

Nested Field Structures

visualAcuity

FieldTypeRequiredConstraints
rightEyeobjectNo-
leftEyeobjectNo-

refraction

FieldTypeRequiredConstraints
rightEyeobjectNo-
leftEyeobjectNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "eyeConsultations",
  "apiName": "create",
  "data": {
    "consultationId": "consultation_123",
    "organizationId": "org_123",
    "visualAcuity": {
      "rightEye": {
        "unaidedDistance": "9/18",
        "unaidedNear": "N8",
        "pinholeDistance": "6/12",
        "pinholeNear": "N6",
        "bestCorrectedDistance": "6/12",
        "bestCorrectedNear": "N6"
      },
      "leftEye": {
        "unaidedDistance": "6/24",
        "unaidedNear": "N10",
        "pinholeDistance": "6/18",
        "pinholeNear": "N8",
        "bestCorrectedDistance": "6/6",
        "bestCorrectedNear": "N6"
      }
    },
    "refraction": {
      "rightEye": {
        "sphere": -1.25,
        "cylinder": -0.75,
        "axis": 90,
        "addition": 1,
        "va": "6/6",
        "nearAdd": 1.25
      },
      "leftEye": {
        "sphere": -1.5,
        "cylinder": -0.5,
        "axis": 85,
        "addition": 1,
        "va": "6/6",
        "nearAdd": 1.25
      }
    },
    "notes": "Patient reports blurry distance vision."
  }
}'

Example Response

{ "status": "ok", "data": {} }

delete

Source: backend/endpoints/eye-consultations/delete

Input Fields

FieldTypeRequiredConstraints
consultationIdstringYes-
organizationIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "eyeConsultations",
  "apiName": "delete",
  "data": {
    "consultationId": "consultation_123",
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

getByConsultation

Source: backend/endpoints/eye-consultations/get-by-consultation

Input Fields

FieldTypeRequiredConstraints
consultationIdstringNo-
appointmentIdstringNo-
organizationIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "eyeConsultations",
  "apiName": "getByConsultation",
  "data": {
    "consultationId": "consultation_123",
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

update

Source: backend/endpoints/eye-consultations/update

Input Fields

FieldTypeRequiredConstraints
consultationIdstringNo-
appointmentIdstringNo-
organizationIdstringYes-
visualAcuityobjectNooptional; when creating a missing eye record, full visualAcuity is required; nullable
refractionobjectNooptional; when creating a missing eye record, full refraction is required; axis: 0-180; nullable
notesstringNonullable

Nested Field Structures

visualAcuity

FieldTypeRequiredConstraints
rightEyeobjectNo-
leftEyeobjectNo-

refraction

FieldTypeRequiredConstraints
rightEyeobjectNo-
leftEyeobjectNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "eyeConsultations",
  "apiName": "update",
  "data": {
    "consultationId": "consultation_123",
    "organizationId": "org_123",
    "visualAcuity": {
      "rightEye": {
        "unaidedDistance": "9/18",
        "unaidedNear": "N8",
        "pinholeDistance": "6/12",
        "pinholeNear": "N6",
        "bestCorrectedDistance": "6/12",
        "bestCorrectedNear": "N6"
      },
      "leftEye": {
        "unaidedDistance": "6/24",
        "unaidedNear": "N10",
        "pinholeDistance": "6/18",
        "pinholeNear": "N8",
        "bestCorrectedDistance": "6/6",
        "bestCorrectedNear": "N6"
      }
    },
    "refraction": {
      "rightEye": {
        "sphere": -1.25,
        "cylinder": -0.75,
        "axis": 90,
        "addition": 1,
        "va": "6/6",
        "nearAdd": 1.25
      },
      "leftEye": {
        "sphere": -1.5,
        "cylinder": -0.5,
        "axis": 85,
        "addition": 1,
        "va": "6/6",
        "nearAdd": 1.25
      }
    },
    "notes": "Updated after refraction check."
  }
}'

Example Response

{ "status": "ok", "data": {} }