API Referenceapipatient-graphPUT /v1/patients/{patient_id}/protocols/{protocol_id}/schedule

PUT /v1/patients/\{patient_id\}/protocols/\{protocol_id\}/schedule

Service: patient-graph · operationId: (none)

Required scopes

(no scope declared — review service config)

Path parameters

  • patient_id (string) required
  • protocol_id (string) required

Request body

{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "protocol_compound_id": {
        "type": "string",
        "format": "uuid"
      },
      "days_of_week": {
        "type": "array",
        "items": {
          "type": "integer",
          "minimum": 0,
          "maximum": 6
        },
        "minItems": 1
      },
      "time_of_day": {
        "type": "string",
        "enum": [
          "morning",
          "afternoon",
          "evening",
          "before_bed"
        ]
      },
      "time_local": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^\\d{2}:\\d{2}(:\\d{2})?$"
      },
      "dose_amount_override": {
        "anyOf": [
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "schedule_changed": {
        "type": "boolean"
      },
      "paused_until": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "notes": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "required": [
      "protocol_compound_id",
      "days_of_week",
      "time_of_day"
    ]
  }
}

Responses

200 Schedule upserted

{
  "type": "object",
  "properties": {
    "patient_id": {
      "type": "string",
      "format": "uuid"
    },
    "protocol_id": {
      "type": "string",
      "format": "uuid"
    },
    "schedule": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "patient_id": {
            "type": "string",
            "format": "uuid"
          },
          "protocol_compound_id": {
            "type": "string",
            "format": "uuid"
          },
          "days_of_week": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            }
          },
          "time_of_day": {
            "type": "string",
            "enum": [
              "morning",
              "afternoon",
              "evening",
              "before_bed"
            ]
          },
          "time_local": {
            "type": [
              "string",
              "null"
            ]
          },
          "dose_amount_override": {
            "type": [
              "string",
              "null"
            ]
          },
          "schedule_changed": {
            "type": "boolean"
          },
          "paused_until": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "patient_id",
          "protocol_compound_id",
          "days_of_week",
          "time_of_day",
          "time_local",
          "dose_amount_override",
          "schedule_changed",
          "paused_until",
          "notes"
        ]
      }
    }
  },
  "required": [
    "patient_id",
    "protocol_id",
    "schedule"
  ]
}

400 Validation error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

401 Unauthorized

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

404 Patient or protocol not found

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

500 Internal error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X PUT https://patient-graph.platform.loop.health/v1/patients/{patient_id}/protocols/{protocol_id}/schedule \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'