{
  "openapi": "3.0.3",
  "info": {
    "title": "EMR API",
    "version": "3.0",
    "contact": {
      "email": "admin@vsee.com"
    }
  },
  "servers": [
    {
      "url": "https://api.vseepreview.com/api_v3",
      "description": "Staging"
    }
  ],
  "x-readme": {
    "explorer-enabled": false,
    "proxy-enabled": false,
    "samples-languages": [
      "curl",
      "python",
      "javascript",
      "java"
    ]
  },
  "paths": {
    "/users/{id}/emr": {
      "get": {
        "summary": "Get user EMR data",
        "description": "Retrieve all EMR (Electronic Medical Record) data for a user\n\n**Tip:** The `:id` parameter accepts dash (`-`) for the current user.\n\nReturns all EMR categories: allergies, conditions, surgeries, family_conditions, social_history, health_habits, medications.",
        "tags": [
          "EMR"
        ],
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "path",
            "description": "User ID or dash (`-`) for current user",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "575"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "allergies": {
                          "type": "object",
                          "properties": {
                            "data": {
                              "type": "array"
                            },
                            "modified": {
                              "type": "integer"
                            },
                            "modified_by": {
                              "type": "object"
                            }
                          }
                        },
                        "conditions": {
                          "type": "object"
                        },
                        "medications": {
                          "type": "object"
                        },
                        "surgeries": {
                          "type": "object"
                        },
                        "family_conditions": {
                          "type": "object"
                        },
                        "social_history": {
                          "type": "object"
                        },
                        "health_habits": {
                          "type": "object"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "EMR Data": {
                    "value": {
                      "data": {
                        "allergies": {
                          "data": [
                            {
                              "substance": "A+D"
                            }
                          ],
                          "modified": 1467667527,
                          "modified_by": {
                            "id": "575",
                            "type": "200",
                            "first_name": "Keven2",
                            "last_name": "Teodoro2",
                            "title": "Dr.",
                            "Suffix": "MD"
                          }
                        },
                        "conditions": {
                          "data": [
                            {
                              "condition": "Bleeding problem"
                            }
                          ],
                          "modified": 1465941203,
                          "modified_by": {}
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/users/{id}/emr/{name}": {
      "post": {
        "summary": "Update EMR section",
        "description": "Update a specific EMR section for a user\n\nInput fields should follow the schema from `GET /emr/schema` for the corresponding `:name` schema.\n\n### EMR Data Formats\nEach POST body must include `data` (the health data) and optionally `data_not_reported` (boolean: true if user selects not to declare any data).\n\n**Conditions:** `{\"data\":[{\"condition\":\"Asthma\"},{\"condition\":\"Bleeding problem\"}], \"data_not_reported\":false}`\n\n**Surgeries:** `{\"data\":[{\"procedure\":\"Heart valve replaced\"}], \"data_not_reported\":false}`\n\n**Family History:** `{\"data\":[{\"condition\":\"Alcoholism\",\"relations\":[\"Mother\",\"Father\"]}], \"data_not_reported\":false}`\n\n**Social History:** `{\"data\":{\"marital_status\":\"Single\",\"highest_ed\":\"Grammar school\",\"occupation\":\"test\",\"num_kids\":\"5\"}, \"data_not_reported\":false}`\n\n**Health Habits:** `{\"data\":{\"smoking\":\"Never\",\"alcohol\":\"Never\",\"drugs\":\"none\",\"exercise\":\"Never\"}, \"data_not_reported\":false}`\n\n**Medications:** `{\"data\":[{\"name\": \"Tylenol\"}], \"data_not_reported\":false}`\n\n**Allergies:** `{\"data\":[{\"substance\": \"1-Day\"}, {\"substance\": \"12 Hour Nasal\"}], \"data_not_reported\":false}`",
        "tags": [
          "EMR"
        ],
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "path",
            "description": "User ID or '-' for current user",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "575"
          },
          {
            "name": "name",
            "in": "path",
            "description": "Name of EMR schema (conditions, surgeries, allergies, medications, family_conditions, social_history, health_habits)",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "conditions",
                "surgeries",
                "allergies",
                "medications",
                "family_conditions",
                "social_history",
                "health_habits"
              ]
            },
            "example": "conditions"
          }
        ],
        "requestBody": {
          "description": "EMR data to update",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "array"
                  },
                  "data_not_reported": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "data",
                  "data_not_reported"
                ]
              },
              "examples": {
                "Conditions": {
                  "value": {
                    "data": [
                      {
                        "condition": "Asthma"
                      },
                      {
                        "condition": "Bleeding problem"
                      }
                    ],
                    "data_not_reported": false
                  }
                },
                "Allergies": {
                  "value": {
                    "data": [
                      {
                        "substance": "1-Day"
                      },
                      {
                        "substance": "12 Hour Nasal"
                      }
                    ],
                    "data_not_reported": false
                  }
                },
                "Medications": {
                  "value": {
                    "data": [
                      {
                        "name": "Tylenol"
                      }
                    ],
                    "data_not_reported": false
                  }
                },
                "Social History": {
                  "value": {
                    "data": {
                      "marital_status": "Single",
                      "highest_ed": "Grammar school",
                      "occupation": "test",
                      "num_kids": "5"
                    },
                    "data_not_reported": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful update",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  }
                },
                "examples": {
                  "Success": {
                    "value": {
                      "data": {
                        "data": {
                          "marital_status": "Single",
                          "highest_ed": "Grammar school",
                          "occupation": "test",
                          "num_kids": "5"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    }
  }
}