NAV
javascript

Introduction

If you don’t have yet an EyeNetra account, create one, it’s free!

Insight is the only modern-day EMR platform for Eye Care Professionals that streamlines patient management and enhances engagement. It’s a natural extension of EyeNetra’s product suite featuring built-in connectivity.

With an intuitive interface and unlimited cloud-based storage, Insight facilitates everything from prescription writing and data analytics to digital marketing and online booking for your patients.

This is the documentation of Insight API.

Basic Authentication

Authorization Header

Authorization: Token token="123456......abcdef"

All API requests requiring authentication must have an authorization header with a valid API token. The token is generated by the rails server, when the credentials are correct. Each key will be saved on the server until the user logs off using that key.

Login

Request Body

{
  "email":"user@eyenetra.com",
  "password":"password"
}

Response Example

{
  "info": "Success",
  "token": "e6d21171662392915a6f093fb078ada6",
  "user": {
    "id": 1,
    "firstName": "user",
    "lastName": "user",
    "email": "user@eyenetra.com",
    "superAdmin": false,
    "canAdmin": false,
    "canPrescribe": false,
    "appointments": [],
    "locale": "en-US"
  },
  "organization": {
    "id": 1,
    "logo": "assets/images/eyenetra-brand.png",
    "prescribers": true,
    "plan": "professional",
    "created_at": "2016-06-20T19:51:40.064Z"
  }
}

The API Login uses email and password as the credentials to generate a token, that will be returned on the response body. The request also returns the user and organization information, which can be used to customize the user experience. Multiples logins are permitted, creating a key for each login.

HTTP Request

POST https://insight-api.eyenetra.com/api/v1/login

Body Parameters

Parameter Description
email The email used on the sign up
password Password (8 or more characters, at least 1 number)

Logout

Authorization Header

Authorization: Token token="123456......abcdef"

Response Example

{
  "info": "Success"
}

The API logout is a DELETE request. The API will use the token on the authorization header to do the log off logic. After login off, the key used for that will be deleted. With the multiple login logic, after logging off with one key, the possible other keys and sessions will not be affected.

HTTP Request

DELETE https://insight-api.eyenetra.com/api/v1/logout

Body Parameters

None

Customer Authentication

Authorization Header

Authorization: Token token="123456......abcdef"

Customer API requests requiring authentication must have an authorization header with a valid API token. The token is generated by the rails server, when the credentials are correct. Each key will be saved on the server until the user logs off using that key.

Customer Login

Request Body

{
  "uuid":"00000000-0000-0000-0000-000000000000",
  "birthdate":"1950-01-01"
}

Response Example

{
  "info": "Success",
  "token": "123456......abcdef",
  "user": {
    "firstName": "Ammo"
  },
  "organization": {
    "id": 1,
    "logo": "assets/images/eyenetra-brand.png"
  }
}

The API Login uses visit uuid and the customer birthdate as the credentials to generate a token, that will be returned on the response body. The request also returns the customer and organization information, which can be used to customize the customer experience. Multiples logins are permitted, creating a key for each login.

HTTP Request

POST https://insight-api.eyenetra.com/api/v1/customer_login

Body Parameters

Parameter Description
uuid The UUID of a prescription in the database
birthdate The birthdate of the customer for whom that prescription applies.

Customer Logout

Authorization Header

Authorization: Token token="123456......abcdef"

Response Example

{
  "info": "Success"
}

The API logout is a DELETE request. The API will use the token on the authorization header to do the log off logic. After login off, the key used for that will be deleted. With the multiple login logic, after logging off with one key, the possible other keys and sessions will not be affected.

HTTP Request

DELETE https://insight-api.eyenetra.com/api/v1/customer_logout

Body Parameters

None

Appointments

Example of a Appointment structure

{
  "appointment": {
    "id": 40,
    "title": "test eyewear",
    "start": "2016-08-12T15:00:00.000Z",
    "end": "2016-08-12T16:00:00.000Z",
    "user_id": 2,
    "visit_id": 9762,
    "created_at": "2016-08-12T17:59:28.779Z",
    "updated_at": "2016-08-12T17:59:28.779Z",
    "organization_id": 1
  }
}

Appointments are structures containing the appointment data of visits scheduled by patients at the book visit page. Each appointment is related to one user ID and this user can get the list of his appointments by accessing the index request.

Structure

The appointment object structure is optimized to work with Full Calendar.

Field Description
id The object ID
title Short description/note to help to identify the appointment
start Date and Hour when the appointment will start
end Date and Hour when the appointment will end
user_id ID of the User associated with this element
visit_id ID of the Visit associated with this element
created_at When this object was created
updated_at Last time this objected was updated
organization_id ID of the Organization associated with this element

List

Response Example

{
  "appointments": [
    {
      "id": 40,
      "title": "test",
      "start": "2016-08-12T15:00:00.000Z",
      "end": "2016-08-12T16:00:00.000Z",
      "user_id": 2,
      "visit_id": 9762,
      "created_at": "2016-08-12T17:59:28.779Z",
      "updated_at": "2016-08-12T17:59:28.779Z",
      "organization_id": 1
    },
    {
      "id": 42,
      "title": "another test",
      "start": "2016-08-12T15:00:00.000Z",
      "end": "2016-08-12T16:00:00.000Z",
      "user_id": 2,
      "visit_id": 9762,
      "created_at": "2016-08-12T17:59:28.779Z",
      "updated_at": "2016-08-12T17:59:28.779Z",
      "organization_id": 1
    }    
  ]
}

The List request will return all the appointments of the current user. There’s no need to identify the user by passing an ID or something like that, the user will be identified by the auth token.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/appointments/

Query Parameters

None

Show

Response Example

{
  "appointment": {
    "id": 40,
    "title": "test eyewear",
    "start": "2016-08-12T15:00:00.000Z",
    "end": "2016-08-12T16:00:00.000Z",
    "user_id": 2,
    "visit_id": 9762,
    "created_at": "2016-08-12T17:59:28.779Z",
    "updated_at": "2016-08-12T17:59:28.779Z",
    "organization_id": 1
  }
}

The show request will return the appointment for the ID passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/appointments/{id}

Query Parameters

Parameter Description
id The object ID

Binocular

Example of a Binocular structure

{
  "binocular": {
    "id": 1,
    "pd": null,
    "va": "0.8",
    "right_eye_id": 1,
    "left_eye_id": 2
  },
  "monoculars": ["..."]
}

Binoculars are test results structures containing both eyes refraction information. Each binocular object contains the binocular information (pd, visual acuity for both eyes, etc.) and also contains two monoculars objects, one for right eye and other for left eye.

Se more about the monocular structure at the correspondent section on this documentation.

Structure

Field Description
id The object ID
pd Binocular PD
va Binocular Visual Acuity
right_eye_id Right Eye Monocular ID
left_eye_id Left Eye Monocular ID
monoculars List of monoculars associated with this binocular

Show

Response Example

{
  "binocular": {
    "id": 1,
    "pd": null,
    "va": "0.8",
    "right_eye_id": 1,
    "left_eye_id": 2
  },
  "monoculars": ["..."]
}

You can get a specfic binocular information by passing the binocular ID to the show request. The object will be returned with the binocular information and also the right and left eyes monocular information, sideloaded on the response body.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/binoculars/{id}

Query Parameters

Parameter Description
id The Binocular object ID

Book Visit

The Book Visit endpoint is the most importante input entry on our API, responsible to save all the data acquired during a complete visit (readings, customer information, appointment, etc.) on the insight database.

Create

Request Body

{
  "book_visit": {
    "user": { "id": "5" },
    "customer": {
      "first_name": "test",
      "last_name": "test",
      "email": "test@test.com",
      "birthdate": "January 1, 1950"
    },
    "intake": {
      "occupation": "test",
      "is_driver": false,
      "eye_brain_surgery": false,
      "additional_info": "test",
      "prescriptions": "test",
      "vision_insurance": "No",
      "hear_about_us": "Word of mouth",
      "last_eye_exam": "Less than 6 months",
      "how_wear_glasses": "No Glasses",
      "age_glasses": "Prescribed at last eye exam",
      "current_eyewear": ["Nothing", "Constant Wear Glasses", "Distance Only Glasses", "Readers", "Bifocals", "Progressives", "Contacts", "Unknown"],
      "reasons_for_visit_eyewear": {
        "Near vision trouble": "Any eyewear",
        "Distance vision trouble": "Any eyewear",
        "Computer eye fatigue": "Any eyewear",
        "Reading eye fatigue": "Any eyewear",
        "Checkup": "Any eyewear",
        "Prescription renewal": "Any eyewear"
      },
      "eye_symptoms": ["Amblyopia", "Blurred Vision", "Distorted Vision Halos", "Double Vision", "Dryness In Eyes", "Eye Pain", "Eyelid Infection", "Eye Burn", "Eye Injury", "Eye Itch", "Eyes Light Sensitives", "Eyes Water Tear", "Fluctuating Vision", "Foreign Body Feeling", "Lazy Eye", "Loss Of Vision", "Mucuos In Eyes", "Redness In Eyes", "Sandy Feeling", "Stye", "Tired Eyes"],
      "health_conditions": ["HIV", "Arthritis", "Blindness", "Cancer", "Cataracts", "Corneal Disease", "Diabetes", "Glaucoma", "Heart Disease", "High Blood Pressure", "High Cholesterol", "Kidney Disorder", "Lupus", "Macular Degeneration", "Retinal Disorder", "Sjogrens Syndrome", "Stroke", "Thyroid Disease", "Turned Eye Strabismus"]
    },
    "appointment": {
      "title": "test test",
      "start": "2016-10-06T11:00:00",
      "end": "2016-10-06T12:00:00"
    }
  }
}

Response Example

{
  "visit": {
    "id": 17314,
    "customer_id": 12172,
    "created_at": "2016-09-30T20:09:47.383Z",
    "updated_at": "2016-09-30T20:09:47.401Z",
    "status": "incomplete",
    "decision": null,
    "decision_note": null,
    "test_confidence": null,
    "distance_preference": null,
    "near_preference": null,
    "screening_id": null,
    "netra_id": null,
    "predisposition": null,
    "uuid": "e877eb12-188e-4fec-9edc-b64888a6eca4",
    "contacts_id": null,
    "internal_note": null,
    "organization_id": 1,
    "netrometer_id": null,
    "prescribing_od_id": 5
  },
  "customer": {
    "id": 12172,
    "first_name": "test",
    "last_name": "test",
    "email": "test@test.com",
    "phone": null,
    "address": null,
    "city": null,
    "state": null,
    "zip_code": null,
    "created_at": "2016-09-07T21:10:38.964Z",
    "updated_at": "2016-09-07T21:10:38.964Z",
    "birthdate": "1950-01-01",
    "organization_id": 1
  },
  "intake_form": {
    "id": 17311,
    "is_driver": false,
    "eye_brain_surgery": false,
    "terms_accepted_on": null,
    "occupation": "test",
    "prescriptions": "test",
    "inches_from_screen": null,
    "last_eye_exam": "Less than 6 months",
    "visit_id": 17314,
    "created_at": "2016-09-30T20:09:47.375Z",
    "updated_at": "2016-09-30T20:09:47.386Z",
    "eye_symptoms": ["Amblyopia", "Blurred Vision", "Distorted Vision Halos", "Double Vision", "Dryness In Eyes", "Tired Eyes", "Stye", "Sandy Feeling", "Redness In Eyes", "Mucuos In Eyes"],
    "requested_eyewear": [],
    "health_conditions": ["HIV", "Arthritis", "Blindness", "Cancer", "Cataracts", "Turned Eye Strabismus", "Thyroid Disease", "Stroke", "Sjogrens Syndrome", "Retinal Disorder"],
    "current_eyewear": ["Readers", "Distance Only Glasses", "Contacts", "Bifocals", "Progressives", "Constant Wear Glasses"],
    "reasons_for_visit_eyewear": {
      "Near vision trouble": "Any eyewear",
      "Computer eye fatigue": "Any eyewear",
      "Distance vision trouble": "Any eyewear",
      "Checkup": "Any eyewear",
      "Reading eye fatigue": "Any eyewear",
      "Prescription renewal": "Any eyewear"
    },
    "has_driving_vision_trouble": null,
    "vision_insurance": "No",
    "hear_about_us": "Word of mouth",
    "how_wear_glasses": "No Glasses",
    "age_glasses": "Prescribed at last eye exam",
    "additional_info": "test"
  },
  "appointment": {
    "id": 46,
    "title": "test test",
    "start": "2016-10-05T14:00:00.000Z",
    "end": "2016-10-05T15:00:00.000Z",
    "user_id": 5,
    "visit_id": 17314,
    "created_at": "2016-09-30T20:09:47.430Z",
    "updated_at": "2016-09-30T20:09:47.430Z",
    "organization_id": 1
  }
}

Using the book_visit create endpoint with the correct request body will save a visit on your organization database. This visit will be already associated with the user passed on the parameters. The apointment information will be loaded on the Visit request (List or Show) and on it’s own endpoint. If the customer email is already on Insight Database, his information will be updated. If not, a new patient/customer entry will be created.

HTTP Request

POST https://insight-api.eyenetra.com/api/v1/book_visit

Body Parameters

Parameter Description
user OD user ID to whom this visit will be related
customer Customer personal information
intake Customer intake information information
appointment Appointment information

Customers

Customer Structure Example

{
  "customer": [
    {
      "id":5,
      "first_name":"Pixel",
      "last_name":"Purrfect",
      "email":"pixel@yahoo.com",
      "phone":"6171111223",
      "address":"35 Medford St",
      "city":"Boston",
      "state":"MA",
      "zip_code":"02143",
      "created_at":"2014-12-23T19:23:56.824Z",
      "updated_at":"2014-12-23T19:23:56.824Z"
    }
  ]
}

These endpoints returns Eyenetra’s Customers personal information as list or specific instance. The “Select New Customer” endpoint, though, is responsible to create an customer relationship between the current OD and the next new customer in line.

Structure

Field Description
id The object ID
first_name The Customer first name
last_name The Customer last name
email The Customer email, used to send the e-prescription
phone The Customer phone
address The Customer address
city The Customer city
state The Customer state
zip_code The Customer zip_code
created_at When this object was created
updated_at Last time this objected was updated

List

Response Example

{
  "customers": [
    {
      "id":1,
      "first_name":"Pixel",
      "last_name":"Purrfect",
      "email":"pixel@yahoo.com",
      "phone":"6171111223",
      "address":"35 Medford St",
      "city":"Boston",
      "state":"MA",
      "zip_code":"02143",
      "created_at":"2014-12-23T19:23:56.824Z",
      "updated_at":"2014-12-23T19:23:56.824Z"
    },{
      "id":2,
      "first_name":"Milk",
      "last_name":"Cookie",
      "email":"milk@hotmail.com",
      "phone":"6171122334",
      "address":"111 State St",
      "city":"Boston",
      "state":"MA",
      "zip_code":"02109",
      "created_at":"2014-12-23T19:23:56.830Z",
      "updated_at":"2014-12-23T19:23:56.830Z"
    }
  ]
}

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/customers

Obs.: To CSV exported data, add .csv as the format.

Filters

GET https://insight-api.eyenetra.com/api/v1/customers?email=johndoe@email.com

The following columns are available for filtering:

Searching

GET https://insight-api.eyenetra.com/api/v1/customers?q=John

You can use the param “q” (for query) to set a string that will be used to search alike entries (case insensitive, using SQL “LIKE” command) on the following columns:

Sorting

GET https://insight-api.eyenetra.com/api/v1/customers?sort=first_name

The same columns used for filtering can be used for sorting. To sort your request, you pass the column name on the parameter “sort”:

GET https://insight-api.eyenetra.com/api/v1/customers?sort=-first_name

The default order when passing a parameter is ascending, you can change for descending passing a “-” before the column name:

The default sort for requests is “-updated_at”.

“Since” parameters

GET https://insight-api.eyenetra.com/api/v1/customers?q=john&sort=-email&updated_since="01-01-2016"

You can also set “updated_since” or “created_since” parameters, specifying a bottom limit date or date/time to your requests

Show

Response Example

{
  "customer": [
    {
      "id":5,
      "first_name":"Pixel",
      "last_name":"Purrfect",
      "email":"pixel@yahoo.com",
      "phone":"6171111223",
      "address":"35 Medford St",
      "city":"Boston",
      "state":"MA",
      "zip_code":"02143",
      "created_at":"2014-12-23T19:23:56.824Z",
      "updated_at":"2014-12-23T19:23:56.824Z"
    }
  ]
}

This show endpoint will return the Customer information correspondent to the id passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/customers/<id>

Obs.: To CSV exported data, add .csv as the format.

Note: user must be at least a CSR or in the case of an OD, have a relationship with the customer, else the response will be 403 Forbidden

The following fields are included only if CSR or Admin level access: * email * phone * address * city * state * zip_code

Customer Results

Customer Result Structure Example

{
  "customer_result": {
    "id": "00000000-0000-0000-0000-000000000000",
    "status": "completed",
    "decision": "prescribed",
    "decision_note": "This is the decision note of the Magic Prescribed Customer!",
    "internal_note": "FOR INTERNAL USE ONLY",
    "customer_id": 3,
    "test_confidence": null,
    "distance_preference": null,
    "near_preference": null,
    "predisposition": null,
    "uuid": "00000000-0000-0000-0000-000000000000",
    "prescription_id": 1,
    "intake_form_id": 2,
    "appointment_id": null,
    "contacts_id": null,
    "screening_id": null,
    "netra_id": null,
    "netrometer_id": null,
    "visit_note_ids": ["..."],
    "prescribing_od_id": 5,
    "customer_relationship_ids": [5],
    "test_result_ids": ["..."],
    "created_at": "2016-06-20T19:51:41.963Z",
    "updated_at": "2016-06-20T19:51:42.115Z",
    "organization_id": 1
  }
}

These are the Customer Results after his assigned OD had a decision based on the customer’s test results. It’s used to build the customer results page, on the Insight Portal, where the customer can print his prescription and use it to order new glasses.

Show

Response Example

{
  "customer_result": {
    "id": "00000000-0000-0000-0000-000000000000",
    "created_at": "2016-06-20T19:51:41.963Z",
    "updated_at": "2016-06-20T19:51:42.115Z",
    "status": "completed",
    "decision": "prescribed",
    "decision_note": "This is the decision note of the Magic Prescribed Customer!",
    "internal_note": "FOR INTERNAL USE ONLY",
    "customer_id": 3,
    "test_confidence": null,
    "distance_preference": null,
    "near_preference": null,
    "predisposition": null,
    "uuid": "00000000-0000-0000-0000-000000000000",
    "prescription_id": 1,
    "intake_form_id": 2,
    "appointment_id": null,
    "contacts_id": null,
    "screening_id": null,
    "netra_id": null,
    "netrometer_id": null,
    "visit_note_ids": ["..."],
    "prescribing_od_id": 5,
    "customer_relationship_ids": [5],
    "test_result_ids": ["..."],
    "organization_id": 1
  }
}

The show endpoint will use the visit uuid to identify and load the customer/patient results. It requires a customer authentication and is only visible for the correct customer/patient.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/customer_results/<uuid>

Note: if the uuid is not valid (no customer with a prescription with this uuid is found), a 404 status is returned.

Emails

Email Structure Example

{ 
  "emails": {
    "id": 7, 
    "template_name": "blink-od-prescribed", 
    "template_content": {
      "email": "Leda.Stiedemann18@gmail.com", 
      "name": "Jerad", 
      "vars": {
        "first_name": "Jerad", 
        "link": "https://me.eyenetra.com/visits/402"
      }
    }, 
    "visit_id": 17,
    "status": "sent", 
    "created_at": "2015-02-03T22:16:02.302Z", 
    "updated_at": "2015-02-03T22:16:02.302Z"
  }
}

List of Emails sent to the customer of a specific visit.

Filtered List

Response Example

{ 
  "emails": [ 
    {
      "id": 7, 
      "template_name": "blink-od-prescribed", 
      "template_content": {
        "email": "Leda.Stiedemann18@gmail.com", 
        "name": "Jerad", 
        "vars": {
          "first_name": "Jerad", 
          "link": "https://me.eyenetra.com/visits/402"
        }
      }, 
      "visit_id": 17,
      "status": "sent", 
      "created_at": "2015-02-03T22:16:02.302Z", 
      "updated_at": "2015-02-03T22:16:02.302Z"
    }
  ]
}

By passing the visit id to index endpoint, the list of all emails related to this visit will be returned.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/emails?visit_id=[visit id]

Health Check

Health check verification without authorization requirement.

Index

Response Example

{
  "version":"0.3.0"
}

This endpoint is just a very basic API health check, used normally on tests to verify the API current version.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/health_check

Instruments

Instrument Structure Example

{
  "instrument": {
    "id": 1,
    "instrument_id": 406,
    "instrument_type": "Netra",
    "test_result_ids": ["..."],
    "created_at": "2016-06-20T20:02:35.687Z",
    "updated_at": "2016-06-20T20:02:35.687Z",
    "organization_id": 1
  }
}

Instruments are structures containing the organization devices information. For EyeNetra devices, the information about each instrument (id, type, etc.) is saved/updated after every new test result finished and uploaded. Other non-EyeNetra devices will be saved as “custom” device, when a test result is created.

List

Response Example

{
  "instruments": [
    {
      "id": 8,
      "instrument_id": -1,
      "instrument_type": "Netra",
      "organization_id": 1,
      "test_result_ids": ["..."],
      "created_at": "2016-06-20T22:06:56.899Z",
      "updated_at": "2016-06-20T22:06:56.899Z"
    },
    {
      "id": 1,
      "instrument_id": 406,
      "instrument_type": "Netra",
      "organization_id": 1,
      "test_result_ids": ["..."],
      "created_at": "2016-06-20T20:02:35.687Z",
      "updated_at": "2016-06-20T20:02:35.687Z"
    }
  ]
}

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/instruments/

Show

Response Example

{
  "instrument": {
    "id": 1,
    "instrument_id": 406,
    "instrument_type": "Netra",
    "organization_id": 1,
    "test_result_ids": ["..."],
    "created_at": "2016-06-20T20:02:35.687Z",
    "updated_at": "2016-06-20T20:02:35.687Z"
  }
}

The basic show endpoint will return the instrument/device information for the Instrument ID passed on the request.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/instruments/{id}

Intake Forms

Intake Form Structure Example

{
  "intake_form": {
    "id": 1,
    "is_driver": true,
    "eye_brain_surgery": false,
    "terms_accepted_on": "2016-06-18",
    "occupation": "CandlestickMaker",
    "prescriptions": "Zylitol",
    "inches_from_screen": 9,
    "last_eye_exam": "6 months ago",
    "visit_id": 1,
    "eye_symptoms": [],
    "age_glasses": null,
    "requested_eyewear": ["Bifocals","Progressives"],
    "health_conditions": [],
    "current_eyewear": [],
    "reasons_for_visit_eyewear": {},
    "has_driving_vision_trouble": null,
    "vision_insurance": null,
    "hear_about_us": null,
    "how_wear_glasses": null,
    "additional_info": null
  }
}

Intake Forms contains the customer’s professional and medical information that created a visit on Insight. This visit can be created using the book visit request, with or without appointment information.

Filtered List

Response Example

{
  "intake_forms": [
    {
      "id": 1,
      "is_driver": true,
      "eye_brain_surgery": false,
      "terms_accepted_on": "2016-06-18",
      "occupation": "CandlestickMaker",
      "prescriptions": "Zylitol",
      "inches_from_screen": 9,
      "last_eye_exam": "6 months ago",
      "visit_id": 1,
      "eye_symptoms": [],
      "age_glasses": null,
      "requested_eyewear": [
        "Bifocals",
        "Progressives"
      ],
      "health_conditions": [],
      "current_eyewear": [],
      "reasons_for_visit_eyewear": {},
      "has_driving_vision_trouble": null,
      "vision_insurance": null,
      "hear_about_us": null,
      "how_wear_glasses": null,
      "additional_info": null
    },
    {
      "id": 33,
      "is_driver": true,
      "eye_brain_surgery": true,
      "terms_accepted_on": "2016-06-12",
      "occupation": "CandlestickMaker",
      "prescriptions": "Sucralose",
      "inches_from_screen": 22,
      "last_eye_exam": "6 months ago",
      "visit_id": 33,
      "eye_symptoms": [],
      "age_glasses": null,
      "requested_eyewear": [
        "Bifocals",
        "Progressives"
      ],
      "health_conditions": [],
      "current_eyewear": [],
      "reasons_for_visit_eyewear": {},
      "has_driving_vision_trouble": null,
      "vision_insurance": null,
      "hear_about_us": null,
      "how_wear_glasses": null,
      "additional_info": null
    }
  ]
}

The filtered request will return the list of intake forms that matches the customer information passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/intake_forms?filter[customers][email]=customer@mail.com

Show

Response Example

{
  "intake_form": {
    "id": 1,
    "is_driver": true,
    "eye_brain_surgery": false,
    "terms_accepted_on": "2016-06-18",
    "occupation": "CandlestickMaker",
    "prescriptions": "Zylitol",
    "inches_from_screen": 9,
    "last_eye_exam": "6 months ago",
    "visit_id": 1,
    "eye_symptoms": [],
    "age_glasses": null,
    "requested_eyewear": ["Bifocals","Progressives"],
    "health_conditions": [],
    "current_eyewear": [],
    "reasons_for_visit_eyewear": {},
    "has_driving_vision_trouble": null,
    "vision_insurance": null,
    "hear_about_us": null,
    "how_wear_glasses": null,
    "additional_info": null
  }
}

This show endpoint will return the intake form information correspondent to the intake form id passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/intake_forms/{id}

Monocular

Monoculars are the test result structure responsible to keep the refraction data of a specific eye (Right or Left). They are always associated with a Binocular structure.

Example of a Monocular structure

{
  "monocular": {
    "id": 1,
    "eye": "Right",
    "sphere": "-1.0",
    "cylinder": "-1.0",
    "axis": 1,
    "add": null,
    "va": "0.8",
    "pd": null,
    "confidence": null
  }
}

Structure

Field Description
id The Monocular object ID
eye Right or Left eye
sphere Sphere reading
cylinder Cylinder reading
axis Axis reading
add Add reading
va Monocular Visual Acuity
pd Monocular PD
confidence Confidence of this monocular

Show

Response Example

{
  "monocular": {
    "id": 1,
    "eye": "Right",
    "sphere": "-1.0",
    "cylinder": "-1.0",
    "axis": 1,
    "add": null,
    "va": "0.8",
    "pd": null,
    "confidence": null
  }
}

This show endpoint will return the Monocular information correspondent to the id passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/monoculars/{id}

Query Parameters

Parameter Description
id The Monocular object ID

Organization Stats

Organization Stats Structure Example

{
  "organization_stats": {
    "test_results": {"...":"..."},
    "visits": {"...":"..."},
    "customers": {"...":"..."},
    "graph_readings": {
      "by_year": {"...":"..."},
      "netra_by_year": {"...":"..."},
      "netrometer_by_year": {"...":"..."},
      "by_month": {"...":"..."},
      "netra_by_month": {"...":"..."},
      "netrometer_by_month": {"...":"..."},
      "by_day": {"...":"..."},
      "netra_by_day": {"...":"..."},
      "netrometer_by_day": {"...":"..."}
    }
  }
}

List of Organization Stats of the requester organization, as visits, customers and test results counts.

The graph information is optimized to be used with Chart.js.

List

Response Example

{
  "organization_stats": {
    "test_results": {
      "count": 26383,
      "netrometer": 13187,
      "netra": 13187,
      "custom": 9
    },
    "visits": {
      "count": 15459,
      "incomplete": 4187,
      "completed": 4454,
      "new": 6818
    },
    "customers": {
      "count": 16132,
      "prescribed": 1351,
      "passed": 1400,
      "referred": 1396
    },
    "graph_readings": {
      "by_year": {
        "dates": ["2012", "2013", "2014", "2015", "2016"],
        "counts": [0, 0, 0, 0, 26374]
      },
      "netra_by_year": {
        "dates": ["2012", "2013", "2014", "2015", "2016"],
        "counts": [0, 0, 0, 0, 13187]
      },
      "netrometer_by_year": {
        "dates": ["2012", "2013", "2014", "2015", "2016"],
        "counts": [0, 0, 0, 0, 13187]
      },
      "by_month": {
        "dates": ["2015-12", "2016-01", "2016-02", "2016-03", "2016-04", "2016-05", "2016-06", "2016-07", "2016-08", "2016-09"],
        "counts": [0, 0, 0, 0, 0, 0, 4840, 7421, 6165, 7948]
      },
      "netra_by_month": {
        "dates": ["2015-12", "2016-01", "2016-02", "2016-03", "2016-04", "2016-05", "2016-06", "2016-07", "2016-08", "2016-09"],
        "counts": [0, 0, 0, 0, 0, 0, 2420, 3710, 3083, 3974]
      },
      "netrometer_by_month": {
        "dates": ["2015-12", "2016-01", "2016-02", "2016-03", "2016-04", "2016-05", "2016-06", "2016-07", "2016-08", "2016-09"],
        "counts": [0, 0, 0, 0, 0, 0, 2420, 3711, 3082, 3974]
      },
      "by_day": {
        "dates": ["2016-09-20", "2016-09-21", "2016-09-22", "2016-09-23", "2016-09-24", "2016-09-25", "2016-09-26", "2016-09-27", "2016-09-28", "2016-09-29"],
        "counts": [226, 658, 366, 322, 0, 0, 488, 196, 352, 246]
      },
      "netra_by_day": {
        "dates": ["2016-09-20", "2016-09-21", "2016-09-22", "2016-09-23", "2016-09-24", "2016-09-25", "2016-09-26", "2016-09-27", "2016-09-28", "2016-09-29"],
        "counts": [113, 329, 183, 161, 0, 0, 244, 98, 176, 123]
      },
      "netrometer_by_day": {
        "dates": ["2016-09-20", "2016-09-21", "2016-09-22", "2016-09-23", "2016-09-24", "2016-09-25", "2016-09-26", "2016-09-27", "2016-09-28", "2016-09-29"],
        "counts": [113, 329, 183, 161, 0, 0, 244, 98, 176, 123]
      }
    }
  }
}

The request information is very basic. The target organization will be defined by the logged user requester.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/organization_stats/

Organizations

Organizations are a logic group inside the Insight portal. All ODs, Admins and other users belongs to one and only organization and can make their actions only with elements (customers, visits, test results, etc.) related to this specific organization.

List

Response Example

{
  "organizations": [
    {
      "id": 2,
      "name": "blonk",
      "kind": "single_OD",
      "logo": "GoBlonk.png",
      "template": "blonk"
    },
    {
      "id": 3,
      "name": "generic",
      "kind": "single_OD",
      "logo": null,
      "template": "generic"
    },
    {
      "id": 1,
      "name": "blink",
      "kind": "multiple_ODs_with_visioneers",
      "logo": "GoBlink.png",
      "template": "blink"
    }
  ]
}

This endpoint will return the list of Insight organizations, only for Super Admins.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/organizations

Show

Response Example

{
  "organization": {
    "id": 1,
    "name": "blink",
    "kind": "multiple_ODs_with_visioneers",
    "logo": "GoBlink.png",
    "template": "blink"
  }
}

This show endpoint will return the Organization information correspondent to the id passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/organizations/{:organization_id}

Create

Request Body

{
  "organization": {
    "name":"blink"
  }
}

Response Example

{
  "organization": {
    "id": 1,
    "name": "blink",
    "kind": "multiple_ODs_with_visioneers",
    "logo": "GoBlink.png",
    "template": "blink"
  }
}

The create endpoint will create a new organization if the correct information is passed.

HTTP Request

POST https://insight-api.eyenetra.com/api/v1/organizations/

Update

Response Example

{
  "organization": {
    "id": 1,
    "name": "blink",
    "kind": "multiple_ODs_with_visioneers",
    "logo": "GoBlink.png",
    "template": "blink"
  }
}

This update endpoint will update the target organization information.

HTTP Request

PUT https://insight-api.eyenetra.com/api/v1/organizations/{:organization_id}

Prescriptions

Prescription Structure Example

{
  "prescription": {
    "id": 1,
    "left_sph": -1.25,
    "left_cyl": 0.4,
    "left_axis": 180,
    "left_add": -2,
    "right_sph": 1.25,
    "right_cyl": -0.5,
    "right_axis": 90,
    "right_add": 2.5,
    "pd": 65,
    "near_pd": 62,
    "recommended_use": "Near",
    "prescribing_od_id": 5
  }
}

If the OD decided to create a Prescription, an instance is created and saved on the database.

Structure

Field Description
id The object ID
left_sph The left eye sphere reading
left_cyl The left eye cylinder reading
left_axis The left eye axis reading
left_add The left eye add reading
right_sph The right eye sphere reading
right_cyl The right eye cylinder reading
right_axis The right eye axis reading
right_add The right eye add reading
pd The prescription PD
near_pd The prescription Near PD
recommended_use Prescription user recommendation (Far, Near or Both)
prescribing_od_id ID of the correspondent OD

Show

Response Example

{
  "prescription": {
    "id": 1,
    "left_sph": -1.25,
    "left_cyl": 0.4,
    "left_axis": 180,
    "left_add": -2,
    "right_sph": 1.25,
    "right_cyl": -0.5,
    "right_axis": 90,
    "right_add": 2.5,
    "pd": 65,
    "near_pd": 62,
    "recommended_use": "Near",
    "prescribing_od_id": 5
  }
}

This show endpoint will return the Prescription information correspondent to the id passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/prescriptions/{:id}

Create

Request Body

{
  "left_sph":"0.25",
  "recommended_use":"Near",
  "note":"How many fingers am I holding up?",
  "visit_id":221
}

Response Example

{
  "prescription":    
    {
      "id": 1,
      "left_sph": -1.25,
      "left_cyl": 0.4,
      "left_axis": 180,
      "left_add": -2,
      "right_sph": 1.25,
      "right_cyl": -0.5,
      "right_axis": 90,
      "right_add": 2.5,
      "pd": 65,
      "near_pd": 62,
      "recommended_use": "Near",
      "prescribing_od_id": 5
    }
}

If the prescription information is right, a new prescription will be created and the information will be available on the response body.

HTTP Request

POST https://insight-api.eyenetra.com/api/v1/prescriptions

Update

Request Body

{
  "left_sph":"0.25",
  "recommended_use":"Near",
  "note":"How many fingers am I holding up?",
  "visit_id":221
}

Response Example

{
  "prescription":    
    {
      "id": 1,
      "left_sph": -1.25,
      "left_cyl": 0.4,
      "left_axis": 180,
      "left_add": -2,
      "right_sph": 1.25,
      "right_cyl": -0.5,
      "right_axis": 90,
      "right_add": 2.5,
      "pd": 65,
      "near_pd": 62,
      "recommended_use": "Near",
      "prescribing_od_id": 5
    }
}

Basic update endpoint, will update the target prescription if the request body information is right.

HTTP Request

PUT https://insight-api.eyenetra.com/api/v1/prescriptions

Readings Import

The Readings Import endpoint is used to save readings directly to insight database. It’s used to save the stand-alone, tabletless version of Netra and for Netrometer readings. It’s also used to save custom readings information.

Create

Request Body

{
  "readings": {
    "exam_date": "Wed Oct 28 14:38:03 EDT 2015",
    "longitude": -71.07596,
    "latitude": 42.37838,
    "app_version": "0.5.1",
    "device_id": -1,
    "test_method": "Netrometer",
    "results": {
      "distance_type": "Distance",
      "pd": 62,
      "va": 0.8,
      "right_eye": {
        "sphere": -0.75,
        "cylinder": -0.25,
        "axis": 165,
        "add": 0,
        "confidence": 0.1,
        "eye": "Right"
      },
      "left_eye": {
        "sphere": 1,
        "cylinder": -0.25,
        "axis": 130,
        "add": 0,
        "confidence": 0.1,
        "eye": "Left"
      }
    },
    "adj_results": {
      "distance_type": "Distance",
      "pd": 60,
      "va": 0.666,
      "right_eye": {
        "sphere": -0.75,
        "cylinder": 0,
        "axis": 170,
        "add": 0,
        "confidence": 0.1,
        "eye": "Right"
      },
      "left_eye": {
        "sphere": 1.25,
        "cylinder": 0,
        "axis": 180,
        "add": 0.5,
        "confidence": 0.1,
        "eye": "Left"
      }
    }
  }
}

Response Example

{
  "info": "Success",
  "test_result_id": 20997
}

This is the endpoint used by the current version of Netra/Netrometer devices to save readings to Insight. It can be used to save “custom” readings.

HTTP Request

POST https://insight-api.eyenetra.com/api/v1/readings_import/

Search

Search result Structure Example

{
  "customers": ["..."],
  "readings": ["..."],
  "visits": ["..."]
}

Search is the endpoint to make general queries that will return customers, readings and visits related to the term passed as argument.

Query

Response Example

{
  "customers": [
    {
      "id": 80,
      "first_name": "Wilmer",
      "last_name": "Testing",
      "email": "ruby-devs-f1a01239-e0da-4859-8a5e-14499cb180f1@goblink.co",
      "phone": "1234567890",
      "address": "",
      "city": "",
      "state": "",
      "zip_code": "",
      "created_at": "2016-06-20T22:11:07.811Z",
      "updated_at": "2016-06-20T22:11:07.811Z",
      "birthdate": "1950-01-01",
      "organization_id": 1
    }
  ],
  "readings": [],
  "visits": [
    {
      "id": 37,
      "customer_id": 19,
      "created_at": "2016-06-20T19:56:31.620Z",
      "updated_at": "2016-06-20T22:07:14.255Z",
      "status": "completed",
      "decision": "passed",
      "decision_note": "Test pass note",
      "test_confidence": null,
      "distance_preference": null,
      "near_preference": null,
      "screening_id": null,
      "netra_id": null,
      "predisposition": null,
      "uuid": "8f4af320-558b-47e4-aac9-fbeb1a08568a",
      "contacts_id": null,
      "internal_note": "Test internal pass note",
      "organization_id": 1,
      "netrometer_id": null,
      "prescribing_od_id": 5
    }
  ]
}

The API will search the query term on customers, readings and visits entries.

Note: There’s no fuzzy logic (yet).

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/search?q={query}

SignUp

After a customer bought a Netra product, he needs to SignUp to start using his new device. This sign up are responsible to create a organization which encapsulates all the data of this new user, as the user instance itself. A user can sign up without devices, by using the Insight Sign Up Page.

Create

Request Body

{
  "sign_up": {
    "organization": {
      "name": "Test Organization" },
    "user": {
      "first_name": "First",
      "last_name": "Last",
      "email": "test@createorg.com",
      "password": "createorgPassword1",
      "role": "admin"
    }
  }
}

Response Example

{
  "organization": {
    "id": 1055,
    "name": "Test Organization",
    "kind": "single_OD",
    "logo": null,
    "template": null,
    "created_at": "2016-09-30T19:50:47.626Z",
    "updated_at": "2016-09-30T19:50:47.626Z",
    "status": "ok",
    "plan": null,
    "description": null,
    "address1": null,
    "address2": null,
    "zip_code": null,
    "city": null,
    "state": null,
    "country": null,
    "prescribed_message": null,
    "passed_message": null,
    "referred_message": null,
    "subscription_id": null,
    "reminder_message": null,
    "thanks_message": null
  },
  "user": {
    "id": 2115,
    "first_name": "First",
    "last_name": "Last",
    "email": "test@createorg.com",
    "password_digest": "$2a$10$aWQRb7VpV8K5ENEJ1N/tke3l9ICf2Nn3ExQkOuTJI.RTXQgnwughu",
    "created_at": "2016-09-30T19:50:47.700Z",
    "updated_at": "2016-09-30T19:50:47.735Z",
    "api_key_id": null,
    "signature": null,
    "title": null,
    "npi": null,
    "license_number": null,
    "license_state": null,
    "organization_id": 1055,
    "longitude": null,
    "latitude": null,
    "photo_url": null,
    "description": null,
    "group_id": null,
    "deleted": false,
    "locale": "en-US"
  },
  "token": "d75f861ed4401338b736ac4849d80862"
}

With the correct data, this endpoint will create a new organization with a Admin user.

HTTP Request

POST https://insight-api.eyenetra.com/api/v1/sign_up/

Test Results

Test Result Structure Example

{
  "test_result": {
    "id": 1,
    "longitude": null,
    "latitude": null,
    "uuid": null,
    "exam_date": null,
    "created_at": "2015-11-13T16:27:21.466Z",
    "updated_at": "2015-11-13T16:27:21.466Z",
    "distance_eyewear": "Constant wear glasses",
    "near_eyewear": "Constant wear glasses",
    "test_method": "Screening",
    "device_id": null,
    "app_version": null,
    "distance_binocular_id": 1,
    "near_binocular_id": 2,
    "notes": "This is the tag"
  }
}

The Test Results are the logic structure used to save the readings from Netra and Netrometer devices and, also, the customer’s screening and contacts information.

Structure

Field Description
id Id of this object
longitude Longitude coordinate where this reading was taken
latitude Latitude coordinate where this reading was taken
uuid UUID, used for sync
exam_date Date where this reading was taken
test_method Method or Device used to create this reading (Screening, contacts, Netra, Netrometer, etc.)
device_id ID of the device used
app_version Version of the APP (Netra or Netrometer)
distance_binocular_id Distance binocular ID
near_binocular_id Near binocular ID
notes Notes (Tags) added during the reading
created_at When this object was created
updated_at Last time this objected was updated

List

Response Example

{
  "test_results": [
    {
      "id": 313,
      "test_method": "Netrometer",
      "distance_eyewear": null,
      "near_eyewear": null,
      "distance_binocular_id": 625,
      "near_binocular_id": null,
      "visit_id": null,
      "created_at": "2015-11-16T21:53:25.314Z",
      "updated_at": "2015-11-16T21:53:25.314Z",
      "retinal_sync_id": null,
      "retinal_protocol_version": null,
      "organization_id": 1,
      "longitude": "-71.08785",
      "latitude": "42.374336",
      "uuid": "23aaf627-076c-459d-a563-0581bf382e90",
      "exam_date": "2015-10-30T18:11:49.000Z",
      "device_id": "-1.0",
      "app_version": "0.5.1",
      "notes": "This is the tag"
    }
  ]
}

The list will return all test results avaiable for this user. If it’s and Admin, everything will be returned. If it’s an OD, only the test results realated to that user will be returned.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/test_results/

Obs.: To CSV exported data, add .csv as the format.

Filters

GET https://insight-api.eyenetra.com/api/v1/test_results?test_method=Netrometer

The following columns are available for filtering:

Searching

GET https://insight-api.eyenetra.com/api/v1/test_results?q=netra

You can use the param “q” (for query) to set a string that will be used to search alike entries (case insensitive, using SQL “LIKE” command) on the following columns:

Sorting

GET https://insight-api.eyenetra.com/api/v1/test_results?sort=app_version

The same columns used for filtering can be used for sorting. To sort your request, you pass the column name on the parameter “sort”:

GET https://insight-api.eyenetra.com/api/v1/test_results?sort=-app_version

The default order when passing a parameter is ascending, you can change for descending passing a “-” before the column name:

The default sort for requests is “-updated_at”.

“Since” parameters

GET https://insight-api.eyenetra.com/api/v1/test_results?q=netra&sort=-uuid&updated_since="01-01-2016"

You can also set “updated_since” or “created_since” parameters, specifying a bottom limit date or date/time to your requests

Show

Response Example

{
  "test_result": {
    "id": 1,
    "longitude": null,
    "latitude": null,
    "uuid": null,
    "exam_date": null,
    "created_at": "2015-11-13T16:27:21.466Z",
    "updated_at": "2015-11-13T16:27:21.466Z",
    "distance_eyewear": "Constant wear glasses",
    "near_eyewear": "Constant wear glasses",
    "test_method": "Screening",
    "device_id": null,
    "app_version": null,
    "distance_binocular_id": 1,
    "near_binocular_id": 2,
    "notes": "This is the tag"
  }
}

This show endpoint will return the Test Result information correspondent to the id passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/test_results/{:test_result_id}

Obs.: To CSV exported data, add .csv as the format.

Users

User Structure Example

{
  "user": {
    "id": 1,
    "first_name": "user",
    "last_name": "user",
    "email": "user@eyenetra.com",
    "title": null,
    "license_number": null,
    "license_state": null,
    "npi": null,
    "created_at": "2015-11-13T15:36:55.625Z",
    "role_ids": []
  }
}

Users can be created, updated, deleted and shown on the insight database. Each one can have or not a role and will belong to a single organization. ODs and Admins can administrate the users.

Structure

Field Description
id The object ID
first_name User’s first name
last_name User’s last name
email User’s email
title Title (ODs)
license_number License Number (ODs)
license_state License State (ODs)
npi NPI (ODs)
created_at When this object was created

List

Response Example

{
  "users": [
    {
      "id": 1,
      "first_name": "user",
      "last_name": "user",
      "email": "user@eyenetra.com",
      "title": null,
      "license_number": null,
      "license_state": null,
      "npi": null,
      "created_at": "2015-11-13T15:36:55.625Z",
      "role_ids": []
    },
    {
      "id": 2,
      "first_name": "admin",
      "last_name": "admin",
      "email": "admin@eyenetra.com",
      "title": "Admin",
      "license_number": null,
      "license_state": null,
      "npi": null,
      "created_at": "2015-11-13T15:36:55.724Z",
      "role_ids": [
        1
      ]
    }
  ]
}

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/users

Filters

GET https://insight-api.eyenetra.com/api/v1/users?email=johndoe@email.com

The following columns are available for filtering:

Searching

GET https://insight-api.eyenetra.com/api/v1/users?q=John

You can use the param “q” (for query) to set a string that will be used to search alike entries (case insensitive, using SQL “LIKE” command) on the following columns:

Sorting

GET https://insight-api.eyenetra.com/api/v1/users?sort=npi

The same columns used for filtering can be used for sorting. To sort your request, you pass the column name on the parameter “sort”:

GET https://insight-api.eyenetra.com/api/v1/users?sort=-npi

The default order when passing a parameter is ascending, you can change for descending passing a “-” before the column name:

The default sort for requests is “-updated_at”.

“Since” parameters

GET https://insight-api.eyenetra.com/api/v1/users?q=john&sort=-email&updated_since="01-01-2016"

You can also set “updated_since” or “created_since” parameters, specifying a bottom limit date or date/time to your requests

Show

Response Example

{
  "user": {
    "id": 1,
    "first_name": "user",
    "last_name": "user",
    "email": "user@eyenetra.com",
    "title": null,
    "license_number": null,
    "license_state": null,
    "npi": null,
    "created_at": "2015-11-13T15:36:55.625Z",
    "role_ids": []
  }
}

This show endpoint will return the User information correspondent to the id passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/users/{id}

Create

Request Body

{
  "user": {
    "first_name":"Rob",
    "last_name":"Park",
    "email":"rob@eyenetra.com",
    "password":"pass"
  }
}

Response Example

{
  "user": {
    "id": 1,
    "first_name": "user",
    "last_name": "user",
    "email": "user@eyenetra.com",
    "title": null,
    "license_number": null,
    "license_state": null,
    "npi": null,
    "created_at": "2015-11-13T15:36:55.625Z",
    "role_ids": []
  }
}

HTTP Request

POST https://insight-api.eyenetra.com/api/v1/users

Update

Request Body

{
  "user":{
    "first_name":"Robert",
    "last_name":"Park",
    "email":"rob@eyenetra.com",
    "password":"pass"
  }
}

Response Example

{
  "user": {
    "id": 1,
    "first_name": "user",
    "last_name": "user",
    "email": "user@eyenetra.com",
    "title": null,
    "license_number": null,
    "license_state": null,
    "npi": null,
    "created_at": "2015-11-13T15:36:55.625Z",
    "role_ids": []
  }
}

HTTP Request

PUT https://insight-api.eyenetra.com/api/v1/users/{id}

Visits

Visit Structure Example

{
  "visit": {
    "id": 1,
    "created_at": "2015-11-13T15:36:56.907Z",
    "updated_at": "2015-11-13T15:36:56.907Z",
    "status": "incomplete",
    "decision": null,
    "decision_note": null,
    "internal_note": null,
    "customer_id": 2,
    "test_confidence": null,
    "distance_preference": null,
    "near_preference": null,
    "predisposition": null,
    "uuid": "77bb7235-90e6-4c2a-bf30-fe5e27e60731",
    "prescription_id": null,
    "intake_form_id": 1,
    "contacts_id": null,
    "screening_id": null,
    "netra_id": null,
    "visit_note_ids": [],
    "prescribing_od_id": null,
    "customer_relationship_ids": [5]
  }
}

A Visit represents a single interaction between a customer and us. Visits are the primary workflow element for ODs and CSRs in our model. With a visit, you can get to a customer, a prescription, and payments.

Structure

Field Description
id The object ID
customer_id The ID of the customer related to this visit
status The current status of this visit, can be new, incomplete or completed
decision The OD’s decision for this visit, can be passed, referred or prescribed
decision_note The patient note
contacts_id Contacts test ID
screening_id Screening test ID
netra_id Netra test ID
netrometer_id Netrometer test ID
uuid UUID, used to sync
internal_note The internal note, used for internal use
created_at When this object was created
updated_at Last time this objected was updated
organization_id ID of the Organization associated with this element

List

Response Example

{
  "visits": [
    {
      "id": 101,
      "customer_id": 101,
      "created_at": "2015-11-13T20:37:05.425Z",
      "updated_at": "2015-11-13T20:37:05.425Z",
      "status": "new",
      "decision": null,
      "decision_note": null,
      "test_confidence": "HIGH",
      "distance_preference": "NETRA",
      "near_preference": "SCREENING",
      "screening_id": 192,
      "netra_id": 193,
      "predisposition": null,
      "uuid": "a7916e20-79c2-460a-b4e7-d4926825dfe0",
      "contacts_id": null,
      "internal_note": null,
      "organization_id": 1,
      "netrometer_id": null
    }
    {
      "id": 110,
      "customer_id": 110,
      "created_at": "2015-11-13T20:37:05.425Z",
      "updated_at": "2015-11-13T20:37:05.425Z",
      "status": "completed",
      "decision": "prescribed",
      "decision_note": "Congratulations, you have a new prescription!",
      "test_confidence": "HIGH",
      "distance_preference": "NETRA",
      "near_preference": "NETRA",
      "screening_id": 194,
      "netra_id": 195,
      "predisposition": null,
      "uuid": "a7916e20-79c2-460a-b4e7-d4926825dfe0",
      "contacts_id": null,
      "internal_note": null,
      "organization_id": 1,
      "netrometer_id": null
    }
  ],
  "meta": {
    "previous": null,
    "next": 2,
    "stats": {
      "oldestNewStatus": "critical",
      "oldestIncompleteStatus": "critical",
      "new": 47,
      "incomplete": 43,
      "completed": 61
    }
  }
}

Get a list of visits.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/visits

Obs.: To CSV exported data, add .csv as the format.

Filters

GET https://insight-api.eyenetra.com/api/v1/visits?test_confidence=HIGH

The following columns are available for filtering:

Searching

GET https://insight-api.eyenetra.com/api/v1/visits?q=congratulations

You can use the param “q” (for query) to set a string that will be used to search alike entries (case insensitive, using SQL “LIKE” command) on the following columns:

Sorting

GET https://insight-api.eyenetra.com/api/v1/visits?sort=uuid

The same columns used for filtering can be used for sorting. To sort your request, you pass the column name on the parameter “sort”:

GET https://insight-api.eyenetra.com/api/v1/visits?sort=-uuid

The default order when passing a parameter is ascending, you can change for descending passing a “-” before the column name:

The default sort for requests is “-updated_at”.

“Since” parameters

GET https://insight-api.eyenetra.com/api/v1/visits?test_confidence=LOW&sort=-uuid&updated_since="01-01-2016"

You can also set “updated_since” or “created_since” parameters, specifying a bottom limit date or date/time to your requests

Show

Response Example

{
  "visit": {
    "id": 1,
    "created_at": "2015-11-13T15:36:56.907Z",
    "updated_at": "2015-11-13T15:36:56.907Z",
    "status": "incomplete",
    "decision": null,
    "decision_note": null,
    "internal_note": null,
    "customer_id": 2,
    "test_confidence": null,
    "distance_preference": null,
    "near_preference": null,
    "predisposition": null,
    "uuid": "77bb7235-90e6-4c2a-bf30-fe5e27e60731",
    "prescription_id": null,
    "intake_form_id": 1,
    "contacts_id": null,
    "screening_id": null,
    "netra_id": null,
    "visit_note_ids": [],
    "prescribing_od_id": null,
    "customer_relationship_ids": [5]
  }
}

This show endpoint will return the Visit information correspondent to the id passed as parameter.

HTTP Request

GET https://insight-api.eyenetra.com/api/v1/visits/:id

Obs.: To CSV exported data, add .csv as the format.

Update

Request Body

{
  "visit": 
    {
      "customer_id": 12, 
      "status": "complete", 
      "decision": "prescribed"
    }
}

Response Example

{
  "visit": 
    {
      "id": 12, 
      "customer_id": 12, 
      "created_at": "Fri, 27 Feb 2015 22:18:38 UTC +00:00", 
      "updated_at": "Fri, 27 Feb 2015 22:18:38 UTC +00:00", 
      "status": "complete", 
      "decision": "prescribed"
    }
}

Update a visit, for example to mark a decision.

HTTP Request

PUT https://insight-api.eyenetra.com/api/v1/visits/:id