FindCase_v1 - Medaxion/open_api_resources GitHub Wiki

Find Case Endpoint

The Find Case function of the case_queries endpoint retrieves one to many cases based on specific patient-oriented criteria. At least one primary identifying parameter (such as patient name & DOB, case number, or patient number) must be included.

This endpoint is optimized for retrieving one or more cases belonging to a specific patient, based on identifying attributes.

In contrast, the Find Cases endpoint performs a paginated, non-patient-specific search and is designed to locate and return the state of many cases across multiple patients using broader filters such as status, location, date ranges, and other general case attributes.


HTTP Request

  • Method: POST
  • Content-Type: application/json or application/xml

URL Format

POST => X:{schedule_token}@{base_url}/open_api/v1/case_queries.(xml|json)

Request Parameters

Required and Optional Query Parameters

At least one of the following must be included:

  • Ops Data (requires case_identifier="true" for case matching)
  • Patient Name & DOB
  • Case Number
  • Patient Number

Optional parameters:

  • Status (one or more allowed values)
    • Available values:
      • UNCONFIRMED - Case created, no scheduled DoS
      • PREARRIVE - Case scheduled, not in the hands of a Clinician
      • PREOP - Patient has arrived, but Anesthesia Start not set
      • INTRAOP - Anesthesia Start set, Anesthesia Stop not set
      • POSTOP - Anesthesia Stop set
      • ABANDONED - Anesthesia Start set, currently 11:30pm local to the case, no entries in 2h
      • CANCELLED - Case was cancelled, manually or by system
  • Location ID
  • Location Tag (requires Location ID)
  • Timestamps (*_at fields like postop_atscheduled_at, etc.)

All cases that inclusively match the above parameters will be returned.


Sample Request

JSON Example (cURL)

curl -X POST \
  https://X:your_token@your_site.medaxion.com/open_api/v1/case_queries.json \
  -H "Content-Type: application/json" \
  -d '{
    "query": {
      "patient_first_name": "Timothy",
      "patient_last_name": "Lombart",
      "patient_dob": "20120102",
      "case_number": "ABC456",
      "patient_number": "M12",
      "status": "POSTOP",
      "location_id": "42",
      "postop_at": {
        "begin": "201902241930",
        "end": "202003241930"
      },
      "ops_data": [
        {
          "hidden": "true",
          "case_identifier": "true",
          "key": "lorem",
          "value": "ipsum"
        }
      ]
    }
  }

JSON Request Structure

{
    "query":
    {
        "status": "POSTOP",
        "location_id": "42",
        "postop_at":
        {
            "begin": "201902241930",
            "end": "202003241930"
        },
        "ops_data":
        [
            {
                "hidden": "true",
                "case_identifier": "true",
                "key": "lorem",
                "value": "ipsum"
            }
        ],
        "patient_first_name": "Timothy",
        "patient_last_name": "Lombart",
        "patient_dob": "20120102",
        "patient_number": "M12",
        "case_number": "ABC456"
    }
}

XML Request Structure

<query>
	<status>POSTOP</status>
	<location-id>42</location-id>
	<postop-at>
		<begin type='datetime'>201902241930</begin>
		<end type='datetime'>202003241930</end>
	</postop-at> #(and/or any other *_at column on the cases table)
	<ops-data type='aray'>
		<ops-data-datum hidden="true" case_identifier="true">
			<key>lorem</key>
			<value>ipsum</value>
		</ops-data-datum>
	</ops-data>
	<patient-first-name>Timothy</patient-first-name>
	<patient-last-name>Lombart</patient-last-name>
	<patient-dob type="date">20120102</patient-dob>
	<patient-number>M12</patient-number>
	<case-number>ABC456</case-number>
</query>

HTTP Status Codes

Status Code Description
201 Cases retrieved successfully.
404 No matching cases found.

Response Format

JSON Response

{
    "cases":
    [
        {
            "case_id": 189613,
            "schema": "lorem-ipsum",
            "synthetic_case_id": "lorem-ipsum-189613",
            "case_number": "R00022542",
            "billing_account_number": "7778889990",
            "custom_entries":
            [
                {
                    "value": "VR13631521",
                    "sysid": "prepay_acct",
                    "label": "Prepay Acct"
                }
            ],
            "scheduled_at": "2020-03-10T20:00:00Z",
            "scheduled_end_at": "2020-03-10T20:30:00Z",
            "updated_at": "2020-03-11T22:57:49Z",
            "arrived_at": null,
            "intraop_at": null,
            "postop_at": null,
            "ready_at": null,
            "cancelled_at": "2020-03-11T04:30:11Z",
            "abandoned_at": null,
            "discharged_at": null,
            "status": "CANCELLED",
            "sex": "Undifferentiated",
            "scheduled_procedure": "Hernia Repair",
            "preop_assessment_complete": true,
            "location":
            {
                "name": "Valley Hils",
                "number": null,
                "location-id": 312,
                "location-tag":
                {
                    "name": null,
                    "number": "001",
                    "sysid": "gi",
                    "syslabel": "Valley Hills GI"
                }
            },
            "patient":
            {
                "patient_id": 294771,
                "patient_number": "M0002545",
                "first_name": "Timothy",
                "last_name": "Lombart",
                "middle_name": "",
                "date_of_birth": "1991-01-01T06:00:00Z",
                "phone_number": "1234567890",
                "zip_code": "11111",
                "email": "[email protected]"
            },
            "ops_data":
            [
                {
                    "key": "lorem",
                    "value": "ipsum",
                    "hidden": true
                }
            ]
        }
    ]
}

XML Response

<?xml version="1.0" encoding="UTF-8"?>
<cases type="array">
  <case>
    <case-id type="integer">288723</case-id>
    <schema>lorem-ipsum</schema>
    <synthetic-case-id>lorem-ipsum-288723</synthetic-case-id>
    <case-number>R00022542</case-number>
    <billing-account-number>7778889990</billing-account-number>
    <custom-entries type="array">
      <custom-entry>
        <value>VR13631521</value>
        <sysid>prepay_acct</sysid>
        <label>Prepay Acct</label>
      </custom-entry>
    </custom-entries>
    <scheduled-at type="dateTime">2020-06-12T20:00:00Z</scheduled-at>
    <scheduled-end-at type="dateTime">2020-06-12T20:30:00Z</scheduled-end-at>
    <updated-at type="dateTime">2020-06-11T22:57:49Z</updated-at>
    <arrived-at nil="true"/>
    <intraop-at nil="true"/>
    <postop-at nil="true"/>
    <ready-at nil="true"/>
    <cancelled-at type="dateTime">2020-06-11T04:30:11Z</cancelled-at>
    <abandoned-at nil="true"/>
    <discharged-at nil="true"/>
    <status>CANCELLED</status>
    <sex>Undifferentiated</sex>
    <scheduled-procedure>Hernia Repair</scheduled-procedure>
    <preop-assessment-complete type="boolean">true</preop-assessment-complete>
    <location>
      <name>Valley Hills</name>
      <number nil="true"/>
      <location-id type="integer">312</location-id>
      <location-tag>
        <name nil="true"/>
        <number>001</number>
        <sysid>gi</sysid>
        <syslabel>Valley Hills GI</syslabel>
      </location-tag>
    </location>
    <patient>
      <patient-id type="integer">294771</patient-id>
      <patient-number>M0002545</patient-number>
      <first-name>Timothy</first-name>
      <last-name>Lombart</last-name>
      <middle-name></middle-name>
      <date-of-birth type="dateTime">1984-09-06T06:00:00Z</date-of-birth>
      <phone-number>1234567890</phone-number>
      <zip-code>11111</zip-code>
      <email>[email protected]</email>
    </patient>
    <ops-data type="array">
      <ops-datum>
        <key>lorem</key>
        <value>ipsum</value>
        <hidden type="boolean">true</hidden>
      </ops-datum>
    </ops-data>
  </case>
</cases>

Important Notes

  • If no matches are found, a 404 status code will be returned.
  • All datetime values must follow UTC format.
  • Ensure at least one required query element is included.

⚠️ **GitHub.com Fallback** ⚠️