ISCOUTB / AG-GestionHospitalaria

GNU Affero General Public License v3.0
0 stars 0 forks source link

Esquema de API #12

Closed dosquisd closed 1 month ago

dosquisd commented 1 month ago
openapi: 3.1.0
info:
  title: GestionHospitalaria - API
  version: 0.1.0
paths:
  /api/v1/login/:
    get:
      tags:
        - login
      summary: Root
      operationId: login-root
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                title: Response Login-Root
  /api/v1/login/access-token:
    post:
      tags:
        - login
      summary: Login Access Token
      description: Obtiene el token de acceso al sistema
      operationId: login-login_access_token
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Body_login-login_access_token'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Token'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/login/test-token:
    get:
      tags:
        - login
      summary: Test Token
      description: Probar el token de acceso
      operationId: login-test_token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRoles'
      security:
        - OAuth2PasswordBearer: []
  /api/v1/users/:
    get:
      tags:
        - users
      summary: Root
      operationId: users-root
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                title: Response Users-Root
    put:
      tags:
        - users
      summary: Update Info
      description: Modifica la información no esencial de para determinado usuario
      operationId: users-update_info
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsersInfo'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
  /api/v1/users/info:
    get:
      tags:
        - users
      summary: Get Info
      description: Obtiene toda la información del usuario
      operationId: users-get_info
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
      security:
        - OAuth2PasswordBearer: []
  /api/v1/admin/:
    get:
      tags:
        - admins
      summary: Root
      operationId: admins-root
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                title: Response Admins-Root
    post:
      tags:
        - admins
      summary: Create Admin
      description: >-
        Crea un nuevo administrador en el sistema. Esta operación es únicamente
        reservada para el super usuario del sistema

        Args:  
            new_admin (UserCreate): Información esencial del nuevo administrador
      operationId: admins-create_admin
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRoles'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
  /api/v1/admin/users:
    get:
      tags:
        - admins
      summary: Get All Users
      description: |-
        Obtiene todos los usuarios dentro del sistema.

        Args:

            rol (bool): Se especifica si se muestra todos los roles del mismo usuario.
                Cuando `rol=True`, entonces la API retorna un objeto del tipo `list[UserAll]` y `UserInfo` cuando `rol=False`.
                Por defecto `rol=False`.

            active (bool): Filtro de solo los usuarios activos dentro del hospital.
                Por defecto `active=True`.
      operationId: admins-get_all_users
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: rol
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Rol
        - name: active
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Active
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  anyOf:
                    - $ref: '#/components/schemas/UserRoles'
                    - $ref: '#/components/schemas/UserAll'
                title: Response Admins-Get All Users
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/users/{num_document}:
    get:
      tags:
        - admins
      summary: Get User
      description: >-
        Obtiene la información básica de un usuario del sistema sin importar el
        rol 

        Args:

            num_document (str): Número de documento del usuario que se desea encontrar.

            active (bool): Filtro de solo los usuarios activos dentro del hospital.
                Por defecto `active=True`.
      operationId: admins-get_user
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
        - name: active
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Active
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/UsersInfo'
                  - type: 'null'
                title: Response Admins-Get User
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
        - admins
      summary: Update User
      description: >-
        Actualiza la información completa de cualquier usuario dentro del
        sistema que no sea un administrador.

        Args:  
            num_document (str): Número de documento del usuario a modifical  
            updated_info (UserUpdate): Información que se quiere actualizar.
      operationId: admins-update_user
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserBase'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsersInfo'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/doctors:
    get:
      tags:
        - admins
      summary: Get All Doctors
      description: |-
        Obtiene la información de todos los doctores dentro del sistema

        Args:

            active (bool): Filtro de solo los doctores activos dentro del hospital.
                Por defecto `active=True`.
      operationId: admins-get_all_doctors
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: active
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Active
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DoctorAll'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/doctors/{num_document}:
    get:
      tags:
        - admins
      summary: Get Doctor
      description: |-
        Obtiene la información esencial de un doctor en particular

        Args:

            num_document (str): Número de documento del doctor que se desea encontrar.

            active (bool): Filtro de solo los doctores activos dentro del hospital.
                Por defecto `active=True`.
      operationId: admins-get_doctor
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
        - name: active
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Active
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DoctorAll'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
        - admins
      summary: Add Doctor Specialities
      description: >-
        Agrega las especialidades dado el número documento del doctor. Antes de
        agregar las especialidades, la información 

        esencial del doctor tuvo que haber sido previamente creada. 

        Args:  
            num_document (str): Número de documento del doctor  
            specialities (list[SpecialityBase]): Lista con el nombre de las especialidades que se le agregarán al doctor.
      operationId: admins-create_doctor
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/SpecialityBase'
              title: Specialities
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DoctorAll'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
        - admins
      summary: Delete Speciality
      description: >-
        Elimina la especialidad de un doctor especificando su número de
        documento.

        Args:

            num_document (str): Número del documento del doctor

            speciality (SpecialityBase): Especialidad del doctor que se quiere eliminar
      operationId: admins-delete_speciality
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpecialityBase'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DoctorAll'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/specialities:
    get:
      tags:
        - admins
      summary: Get All Specialities
      description: >-
        Obtiene todas las especialidades de los doctores activos dentro del
        hospital
      operationId: admins-get_all_specialities
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/SpecialityBase'
                type: array
                title: Response Admins-Get All Specialities
      security:
        - OAuth2PasswordBearer: []
  /api/v1/admin/specialities/{speciality}:
    get:
      tags:
        - admins
      summary: Get Speciality Doctor
      description: |-
        Obtiene todos los doctores los cuales tengan una especialidad especifica

        Args:

            speciality (str): Nombre de la especialidad por la que se quiere filtrar.

            active (bool): Filtra únicamente por los doctores que estén activos dentro del hospital.
                Por defecto `active=True`
      operationId: admins-get_speciality_doctor
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: speciality
          in: path
          required: true
          schema:
            type: string
            title: Speciality
        - name: active
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Active
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DoctorAll'
                title: Response Admins-Get Speciality Doctor
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/patients:
    get:
      tags:
        - admins
      summary: Get Patients
      description: |-
        Obtiene todos los pacientes que están dentro del sistema 

        Args:

            active (bool): Filtra únicamente por los usuarios que estén activos dentro del hospital.
                Por defecto `active=True`.
      operationId: admins-get_patients
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: active
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Active
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PatientAll'
                title: Response Admins-Get Patients
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/patients/{num_document}:
    get:
      tags:
        - admins
      summary: Get Patient
      description: >-
        Obtiene toda la información de un paciente especificando su número de
        documento

        Args:

            num_document (str): Número de documento del paciente que se desea obtener

            active (bool): Filtra únicamente por todos los pacientes que estén activos en el hospital.
                Por defecto `active=True`.
      operationId: admins-get_patient
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
        - name: active
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Active
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientAll'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/stats:
    get:
      tags:
        - admins
      summary: Get Statistics About Hospital
      description: >-
        Obtiene los indicadores estadísiticos del hospital.

        Los indicadores estadísitcos del hospital están listados de la siguiente
        manera:  
            1. Porcentaje de ocupación hospitalaria.  
            2. Promedios de estancia de los pacientes en el hospital.  
            3. Cantidad de admisiones y altas por día.
      operationId: admins-get_stats
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  type: number
                type: array
                title: Response Admins-Get Stats
      security:
        - OAuth2PasswordBearer: []
  /api/v1/admin/beds:
    get:
      tags:
        - admins
      summary: Get Number All Beds
      description: Obtiene la cantidad de camas totales en el hospital
      operationId: admins-get_beds
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: integer
                title: Response Admins-Get Beds
      security:
        - OAuth2PasswordBearer: []
  /api/v1/admin/beds/:
    post:
      tags:
        - admins
      summary: Add Bed
      description: Agrega una nueva cama al hospital al hospital especificando el cuarto
      operationId: admins-add_bed
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BedBase'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Beds'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
  /api/v1/admin/{num_document}:
    put:
      tags:
        - admins
      summary: Update Admin
      description: >-
        Actualiza la información completa de cualquier usuario, incluyendo
        administradores
      operationId: admins-update_admin
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
        - name: updated_info
          in: query
          required: true
          schema:
            title: Updated Info
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsersInfo'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
        - admins
      summary: Delete Admin
      description: >-
        "Elimina" o coloca como inactivo a un administrador dentro del sistema.
        Esta es una operación que está reservada únicamente para un

        solo administrador, el cual es llamado el SuperUsuario.

        Args:

            num_document (str): Número del documento de administrador que se va a "eliminar".
      operationId: admins-delete_admin
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/patient/{num_document}:
    put:
      tags:
        - admins
      summary: Update Patient
      description: Actualiza la información del responsable dado un determinado paciente
      operationId: admins-update_patient
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsablesInfo'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientInfo'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/users/{num_document}/{rol}:
    delete:
      tags:
        - admins
      summary: Delete User
      description: >-
        "Elimina" a un usuario dentro del sistema. En realidad, lo que se hace
        es colocar al usuario como inactivo

        Args:  
            num_document (str): Número de documento del usuario que se va a "eliminar".  
            rol (Literal["doctor", "patient"]): Se especifica el rol el cual se va a "eliminar". Únicamente puede ser doctores o pacientes.
      operationId: admins-delete_user
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
        - name: rol
          in: path
          required: true
          schema:
            enum:
              - doctor
              - patient
            type: string
            title: Rol
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/admin/beds/{room}:
    delete:
      tags:
        - admins
      summary: Delete Bed
      description: >-
        Elimina una cama dentro del hospital que no esté en uso, especificando
        el cuarto donde esté
      operationId: admins-delete_bed
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: room
          in: path
          required: true
          schema:
            type: string
            title: Room
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Beds'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/doctor/:
    get:
      tags:
        - doctors
      summary: Root
      operationId: doctors-root
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                title: Response Doctors-Root
  /api/v1/patient/:
    get:
      tags:
        - patients
      summary: Root
      operationId: patients-root
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                title: Response Patients-Root
  /api/v1/patient/documents:
    get:
      tags:
        - patients
      summary: Get Documents
      description: >-
        Devuelve todos los documentos asociados a un determinado paciente en un
        archivo zip
      operationId: patients-get_documents
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      security:
        - OAuth2PasswordBearer: []
  /api/v1/patient/responsable:
    get:
      tags:
        - patients
      summary: Get Responsables
      description: >-
        Devuelve toda la información del paciente, incluyendo la de los
        responsables
      operationId: patients-get_responsables
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientAll'
      security:
        - OAuth2PasswordBearer: []
  /api/v1/documents/:
    get:
      tags:
        - documents
      summary: Root
      operationId: documents-root
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                title: Response Documents-Root
  /api/v1/documents/all/{num_document}:
    get:
      tags:
        - documents
      summary: Get All Documents
      description: Obtiene todos los documentos asociados a un paciente en un archivo .zip
      operationId: documents-get_all_documents
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/documents/all:
    get:
      tags:
        - documents
      summary: Get All
      description: Obtiene todos los documentos de todos los pacientes en un archivo .zip
      operationId: documents-get_all
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      security:
        - OAuth2PasswordBearer: []
  /api/v1/documents/histories/{num_document}:
    get:
      tags:
        - documents
      summary: Get Clinical History
      description: >-
        Obtiene la historia clínica de un determinado paciente en un archivo
        .txt
      operationId: documents-get_history
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
        - documents
      summary: Update Clinical History
      description: Actualiza la historia clínica de un determinado paciente
      operationId: documents-update_history
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/documents/histories:
    get:
      tags:
        - documents
      summary: Get Clinical Histories
      description: >-
        Obtiene todas las historias clínicas de todos los pacientes en un
        archivo .zip
      operationId: documents-get_histories
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      security:
        - OAuth2PasswordBearer: []
  /api/v1/documents/orders/{num_document}:
    get:
      tags:
        - documents
      summary: Get Order
      description: >-
        Obtiene todas las órdenes médicas de un determinado paciente en un
        archivo .zip
      operationId: documents-get_order
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/documents/orders:
    get:
      tags:
        - documents
      summary: Get Orders
      description: >-
        Obtiene todas las órdenes médicas de todos los pacientes en un archivo
        .zip
      operationId: documents-get_orders
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      security:
        - OAuth2PasswordBearer: []
  /api/v1/documents/results/{num_document}:
    get:
      tags:
        - documents
      summary: Get Result
      description: >-
        Obtiene todos los resultados de los examenes médicos para un determinado
        paciente en un archivo .zip
      operationId: documents-get_result
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
        - documents
      summary: Delete File
      description: >-
        Elimina un archivo médico de un determinado paciente (no incluye la
        historia clínica)
      operationId: documents-delete_file
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
        - name: filename
          in: query
          required: true
          schema:
            type: string
            title: Filename
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/documents/results:
    get:
      tags:
        - documents
      summary: Get Results
      description: >-
        Obtiene todos los resultados de los examanes médicos de todos los
        pacientes en un archivo .zip
      operationId: documents-get_results
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      security:
        - OAuth2PasswordBearer: []
  /api/v1/documents/{num_document}:
    post:
      tags:
        - documents
      summary: Add Order
      description: >-
        Agrega un documento médico (ya sea orden o resultados de un examen) a un
        determinado paciente
      operationId: documents-add_order
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: num_document
          in: path
          required: true
          schema:
            type: string
            title: Num Document
        - name: type
          in: query
          required: true
          schema:
            enum:
              - orders
              - results
            type: string
            title: Type
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_documents-add_order'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/appointments/:
    get:
      tags:
        - appointments
      summary: Root
      operationId: appointments-root
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                title: Response Appointments-Root
  /api/v1/appointments/hospitalizations:
    get:
      tags:
        - appointments
        - admins
      summary: Get Hospitalizations
      description: Devuelve una lista con el historial de hospitalizaciones
      operationId: appointments-get_hospitalizations
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/Hospitalizations'
                type: array
                title: Response Appointments-Get Hospitalizations
      security:
        - OAuth2PasswordBearer: []
    post:
      tags:
        - appointments
      summary: Add Hospitalization
      description: Agrega una nueva hospitalización
      operationId: appointments-add_hospitalization
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterHospitalization'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hospitalizations'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
  /api/v1/appointments/consultations:
    get:
      tags:
        - appointments
        - admins
      summary: Get Consultations
      description: Devuelve una lista con el historial de consultas médicas
      operationId: appointments-get_consultations
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/MedicalConsults'
                type: array
                title: Response Appointments-Get Consultations
      security:
        - OAuth2PasswordBearer: []
    post:
      tags:
        - appointments
      summary: Add Consultation
      description: Agrega una nueva consulta médica
      operationId: appointments-add_consultation
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterConsult'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MedicalConsults'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
  /api/v1/appointments/hospitalizations/{id_patient}:
    put:
      tags:
        - appointments
      summary: Discharge Hospitalization
      description: Da el alta a un determinado paciente que esté actualmente hospitalizado
      operationId: appointments-discharge_hospitalization
      security:
        - OAuth2PasswordBearer: []
      parameters:
        - name: id_patient
          in: path
          required: true
          schema:
            type: string
            title: Id Patient
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DischargeHospitalization'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hospitalizations'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    BedBase:
      properties:
        room:
          type: string
          title: Room
      type: object
      required:
        - room
      title: BedBase
      description: |-
        Modelo base que representa una cama en un hospital.

        Attributes:
            room (str): Número o nombre de la habitación donde se encuentra la cama.
    Beds:
      properties:
        id:
          type: integer
          title: Id
        room:
          type: string
          title: Room
      type: object
      required:
        - id
        - room
      title: Beds
    Body_documents-add_order:
      properties:
        file:
          type: string
          format: binary
          title: File
      type: object
      required:
        - file
      title: Body_documents-add_order
    Body_login-login_access_token:
      properties:
        rol:
          type: string
          enum:
            - admin
            - doctor
            - patient
          title: Rol
        grant_type:
          anyOf:
            - type: string
              pattern: password
            - type: 'null'
          title: Grant Type
        username:
          type: string
          title: Username
        password:
          type: string
          title: Password
        scope:
          type: string
          title: Scope
          default: ''
        client_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Id
        client_secret:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Secret
      type: object
      required:
        - rol
        - username
        - password
      title: Body_login-login_access_token
    DischargeHospitalization:
      properties:
        last_day:
          type: string
          format: date
          title: Last Day
          default: '2024-09-19'
      type: object
      title: DischargeHospitalization
      description: |-
        Modelo de datos para registrar el alta hospitalaria de un paciente.

        Attributes:
            last_day (date): Último día de hospitalización, por defecto la fecha actual.
    DoctorAll:
      properties:
        num_document:
          type: string
          title: Num Document
        type_document:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Document
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        surname:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname
        sex:
          anyOf:
            - type: string
            - type: 'null'
          title: Sex
        birthday:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Birthday
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        rol:
          type: string
          enum:
            - admin
            - doctor
            - patient
          title: Rol
          default: doctor
        specialities:
          items:
            type: string
          type: array
          title: Specialities
      type: object
      required:
        - num_document
        - specialities
      title: DoctorAll
      description: >-
        Modelo que extiende UserBase para representar la información de un
        doctor.

        Inherits from:
            UserBase: Contiene los atributos comunes de un usuario.

        Attributes:
            rol (Roles): El rol del usuario, con valor predeterminado 'doctor'.
            specialities (list[str]): Lista de nombres de las especialidades del doctor.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Hospitalizations:
      properties:
        id:
          type: integer
          title: Id
        id_patient:
          type: integer
          title: Id Patient
        id_doctor:
          type: integer
          title: Id Doctor
        entry_day:
          type: string
          format: date
          title: Entry Day
          default: '2024-09-19'
        last_day:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Last Day
      type: object
      required:
        - id
        - id_patient
        - id_doctor
      title: Hospitalizations
    MedicalConsults:
      properties:
        id:
          type: integer
          title: Id
        id_patient:
          type: integer
          title: Id Patient
        id_doctor:
          type: integer
          title: Id Doctor
        area:
          type: string
          title: Area
        day:
          type: string
          format: date
          title: Day
          default: '2024-09-19'
      type: object
      required:
        - id
        - id_patient
        - id_doctor
        - area
      title: MedicalConsults
    PatientAll:
      properties:
        num_doc_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Num Doc Responsable
        type_doc_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Doc Responsable
        name_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Name Responsable
        surname_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname Responsable
        phone_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone Responsable
        relationship_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Relationship Responsable
        num_document:
          type: string
          title: Num Document
        type_document:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Document
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        surname:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname
        sex:
          anyOf:
            - type: string
            - type: 'null'
          title: Sex
        birthday:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Birthday
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        rol:
          type: string
          enum:
            - admin
            - doctor
            - patient
          title: Rol
          default: patient
      type: object
      required:
        - num_document
      title: PatientAll
      description: >-
        Modelo para representar a un paciente, incluyendo la base de usuario y
        la información del responsable.

        Inherits from:
            UserBase: Contiene los atributos comunes de un usuario.
            ResponsablesInfo: Contiene la información del responsable del paciente.

        Attributes:
            rol (Roles): El rol del usuario, con valor predeterminado 'patient'.
    PatientInfo:
      properties:
        patient_id:
          type: integer
          title: Patient Id
        num_doc_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Num Doc Responsable
        type_doc_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Doc Responsable
        name_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Name Responsable
        surname_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname Responsable
        phone_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone Responsable
        relationship_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Relationship Responsable
      type: object
      required:
        - patient_id
        - surname_responsable
        - phone_responsable
        - relationship_responsable
      title: PatientInfo
    RegisterConsult:
      properties:
        id_patient:
          type: string
          title: Id Patient
        id_doctor:
          type: string
          title: Id Doctor
        area:
          type: string
          title: Area
        day:
          type: string
          format: date
          title: Day
          default: '2024-09-19'
      type: object
      required:
        - id_patient
        - id_doctor
        - area
      title: RegisterConsult
      description: |-
        Modelo de datos para registrar una consulta médica.

        Attributes:
            id_patient (str): Identificación del paciente.
            id_doctor (str): Identificación del doctor.
            area (str): Área donde se realiza la consulta.
            day (datetime.date): Fecha de la consulta, por defecto la fecha actual.
    RegisterHospitalization:
      properties:
        id_patient:
          type: string
          title: Id Patient
        id_doctor:
          type: string
          title: Id Doctor
        entry_day:
          type: string
          format: date
          title: Entry Day
          default: '2024-09-19'
      type: object
      required:
        - id_patient
        - id_doctor
      title: RegisterHospitalization
      description: |-
        Modelo de datos para registrar la hospitalización de un paciente.

        Attributes:
            id_patient (str): Identificación del paciente.
            id_doctor (str): Identificación del doctor a cargo.
            entry_day (date): Fecha de ingreso al hospital, por defecto la fecha actual.
    ResponsablesInfo:
      properties:
        num_doc_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Num Doc Responsable
        type_doc_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Doc Responsable
        name_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Name Responsable
        surname_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname Responsable
        phone_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone Responsable
        relationship_responsable:
          anyOf:
            - type: string
            - type: 'null'
          title: Relationship Responsable
      type: object
      title: ResponsablesInfo
      description: |-
        Modelo para representar la información del responsable de un paciente.

        Attributes:
            num_doc_responsable (str | None): Número de documento del responsable.
            type_doc_responsable (str | None): Tipo de documento del responsable.
            name_responsable (str | None): Nombre del responsable.
            surname_responsable (str | None): Apellido del responsable.
            phone_responsable (str | None): Teléfono del responsable.
            relationship_responsable (str | None): Relación del responsable con el paciente.
    SpecialityBase:
      properties:
        name:
          type: string
          title: Name
      type: object
      required:
        - name
      title: SpecialityBase
      description: |-
        Modelo base que representa una especialidad médica.

        Attributes:
            name (str): Nombre de la especialidad.
            description (str): Descripción detallada de la especialidad.
    Token:
      properties:
        access_token:
          type: string
          title: Access Token
        token_type:
          type: string
          title: Token Type
      type: object
      required:
        - access_token
        - token_type
      title: Token
      description: |-
        Modelo que representa el token de acceso y su tipo.

        Attributes:
            access_token (str): El token de acceso en sí.
            token_type (str): El tipo de token (generalmente 'Bearer').
    User:
      properties:
        num_document:
          type: string
          title: Num Document
        type_document:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Document
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        surname:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname
        sex:
          anyOf:
            - type: string
            - type: 'null'
          title: Sex
        birthday:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Birthday
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        rol:
          type: string
          enum:
            - admin
            - doctor
            - patient
          title: Rol
      type: object
      required:
        - num_document
        - rol
      title: User
      description: |-
        Modelo de usuario con información para un rol específico.

        Inherits from:
            UserBase: Contiene los atributos comunes de un usuario.

        Attributes:
            rol (Roles): Rol del usuario, que debe ser uno de los valores de 'Roles'.
    UserAll:
      properties:
        num_document:
          type: string
          title: Num Document
        type_document:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Document
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        surname:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname
        sex:
          anyOf:
            - type: string
            - type: 'null'
          title: Sex
        birthday:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Birthday
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        roles:
          items:
            type: string
            enum:
              - admin
              - doctor
              - patient
          type: array
          title: Roles
      type: object
      required:
        - num_document
        - roles
      title: UserAll
      description: >-
        Modelo que extiende UserBase para representar un usuario con todos sus
        roles.

        Inherits from:
            UserBase: Contiene los atributos comunes de un usuario.

        Attributes:
            roles (list[Roles]): Lista de roles asociados al usuario.
    UserBase:
      properties:
        num_document:
          type: string
          title: Num Document
        type_document:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Document
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        surname:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname
        sex:
          anyOf:
            - type: string
            - type: 'null'
          title: Sex
        birthday:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Birthday
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
      type: object
      required:
        - num_document
      title: UserBase
      description: |-
        Clase base que contiene los atributos comunes de un usuario.

        Attributes:
            num_document (str): Número de documento de identificación del usuario.
            type_document (str | None): Tipo de documento (opcional).
            name (str | None): Nombre del usuario (opcional).
            surname (str | None): Apellido del usuario (opcional).
            sex (str | None): Sexo del usuario (opcional).
            birthday (datetime.date | None): Fecha de nacimiento del usuario (opcional).
            address (str | None): Dirección del usuario (opcional).
            phone (str | None): Teléfono del usuario (opcional).
            email (str | None): Email del usuario (opcional).
    UserCreate:
      properties:
        num_document:
          type: string
          title: Num Document
        type_document:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Document
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        surname:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname
        sex:
          anyOf:
            - type: string
            - type: 'null'
          title: Sex
        birthday:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Birthday
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        password:
          type: string
          title: Password
      type: object
      required:
        - num_document
        - password
      title: UserCreate
      description: |-
        Modelo para crear un usuario en el sistema

        Inherits from:
            UserBase: Contiene los atributos comunes de un usuario.

        Attributes:
            password: (str): Contraseño del nuevo usuario
    UserRoles:
      properties:
        id:
          type: integer
          title: Id
        num_document:
          type: string
          title: Num Document
        rol:
          type: string
          enum:
            - admin
            - doctor
            - patient
          title: Rol
        password:
          type: string
          title: Password
        is_active:
          type: boolean
          title: Is Active
          default: true
        inactivity:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Inactivity
      type: object
      required:
        - id
        - num_document
        - rol
        - password
      title: UserRoles
    UserUpdate:
      properties:
        password:
          anyOf:
            - type: string
            - type: 'null'
          title: Password
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
      type: object
      title: UserUpdate
      description: |-
        Modelo para la actualización de datos de un usuario.

        Attributes:
            password (str | None): Nueva contraseña (opcional).
            address (str | None): Nueva dirección (opcional).
            phone (str | None): Nuevo número de teléfono (opcional).
            email (str | None): Nuevo email (opcional)
    UsersInfo:
      properties:
        num_document:
          type: string
          title: Num Document
        type_document:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Document
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        surname:
          anyOf:
            - type: string
            - type: 'null'
          title: Surname
        sex:
          anyOf:
            - type: string
            - type: 'null'
          title: Sex
        birthday:
          anyOf:
            - type: string
            - type: 'null'
          title: Birthday
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
      type: object
      required:
        - num_document
      title: UsersInfo
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /api/v1/login/access-token
tags:
  - name: login
    description: Acceso al sistema
  - name: users
    description: Acciones de todos los usuarios
  - name: admins
    description: Acciones solo para administradores
  - name: doctors
    description: Acciones solo para doctores
  - name: patients
    description: Acciones solo para pacientes
  - name: documents
    description: Acciones para los documentos médicos de los pacientes
  - name: appointments
    description: >-
      Acciones sobre las citas médicas de los pacientes en el hospital. Incluye
      consultas normales y urgencias
jairoserrano commented 1 month ago

adelante