========== USER ==========
POST /users
{
"name": name,
"profession_code": profession code,
"cpf": cpf number,
"phone": phone number,
"email": email@mail.com,
"profession": profession,
"password": password,
"address": {
"street": street,
"cep": cep number,
"number_house": number house,
"complement": complement
}
}
{
"_id": user_id,
"name": name,
"profession": profession,
"cpf": cpf,
"phone": phone,
"email": email,
"profession_code": profession_code,
"address": address
}
{
"msg": "Error creating user",
"user": data,
"address": address
}
POST /users/login
{
"email": email@mail.com,
"password": password
}
{
"access_token": access_token
}
{
"error": "Unauthorized"
}
GET /users
no request
[
{
"_id": user_id,
"name": name,
"profession": profession,
"cpf": cpf,
"phone": phone,
"email": email,
"profession_code": profession_code,
"address": address
}
]
GET /users/<user_id>
Arg: user_id
{
"_id": user_id,
"name": name,
"profession": profession,
"cpf": cpf,
"phone": phone,
"email": email,
"profession_code": profession_code,
"address": address,
"workspaces": [name, workspace_id]
}
{
"msg": "User not Found"
}
PATCH /users/<user_id>
Arg: user_id
{
"_id": user_id,
"name": name,
"profession": profession,
"cpf": cpf,
"phone": phone,
"email": email,
"profession_code": profession_code,
"address": address,
"workspaces": [name, workspace_id]
}
{
"msg": "User not Found"
}
DELETE /users/<user_id>
Arg: user_id
{
"msg": "User name deleted"
}
{
"msg": "User not Found"
}
========== WORKSPACE ==========
POST /workspaces
{
"owner_id": number,
"name": name,
"local": local,
"categories": [category 1 , category 2]
}
{
"name": name,
"owner_id": owner_id,
"workspace_id": workspace_id,
"local": local,
"categories": categories
}
KeyError
GET /workspaces
no request
[
{
"name": name,
"owner_id": owner_id,
"workspace_id": workspace_id,
"local": local,
"categories": categories,
"workers": users
}
]
GET /workspaces/<workspace_id>
Arg: workspace_id
{
"name": name,
"owner_id": owner_id,
"workspace_id": workspace_id,
"local": local,
"categories": categories,
"workers": users,
"patients": [
{
"info": {
"_id": patient_id,
"name": name,
"gender": gender,
"patient_code": patient_code,
"profession": profession,
"marital_status": marital_status,
"responsible_guardian": responsible_guardian,
"responsible_contact": responsible_contact,
"birth_date": birth_date,
"workspace_id": workspace_id,
"address": address,
"tags": tags,
"allergies": allergies,
},
"datas": [
{
"data_id": data_id,
"description": description,
"date": date,
"status": status,
"category_id": category_id,
"category_name": category,
"tags": tags,
}
],
"comments": [
{
"comment_id": comment_id,
"comment": comment,
"user_name": user.name,
"date_time": date_time,
"category_name": category,
}
],
}
],
}
{
"msg": "Workspace not Found"
}
PATCH /workspaces/<workspace_id>
Arg: workspace_id
{
"name": name,
"owner_id": owner_id,
"workspace_id": workspace_id,
"local": local,
"categories": categories,
"workers": users
}
{
"msg": "Workspace not Found"
}
DELETE /workspaces/<workspace_id>
Arg: workspace_id
{
"msg": "Workspace name deleted"
}
{
"msg": "Workspace not Found"
}
POST /workspaces/<workspace_id>
Arg: workspace_id
Request:
{
"user_id": 6
}
{
"name": name,
"owner_id": owner_id,
"workspace_id": workspace_id,
"local": local,
"categories": categories,
"workers": users
}
{
"msg": "Workspace not Found"
}
GET /workspaces/<workspace_id>/patients
Arg: workspace_id
{
"workspace_id": workspace_id,
"name": name,
"local": local,
"owner_id": owner_id,
"patients": patients,
"categories": categories
}
{
"msg": "Workspace not Found"
}
========== PATIENT ==========
POST /patients
{
"name" : name,
"gender": gender,
"cpf" : cpf number,
"profession" : profession,
"marital_status" : marital status,
"responsible_guardian" : responsible guardian,
"responsible_contact" : responsible contact,
"birth_date" : birth date,
"workspace_id" : workspace id,
"address": {
"street": street,
"cep": cep number,
"number_house": house number,
"complement": complement,
},
"allergies": [allergy 1, allergy 2],
"tags": [tag 1, tag 2],
"alerts": [alert 1, alert 2]
}
{
"_id": patient_id,
"name": name,
"gender": gender,
"patient_code": patient_code,
"profession": profession,
"marital_status": marital_status,
"responsible_guardian": responsible_guardian,
"responsible_contact": responsible_contact,
"birth_date": birth_date,
"workspace": workspace,
"address": address,
"allergies": allergies,
"tags": tags
}
KeyError
{
"error": "Error creating patient"
}
GET /patients
no request
[
{
"_id": patient_id,
"name": name,
"gender": gender,
"patient_code": patient_code,
"profession": profession,
"marital_status": marital_status,
"responsible_guardian": responsible_guardian,
"responsible_contact": responsible_contact,
"birth_date": birth_date,
"workspace": workspace,
"address": address,
"allergies": allergies,
"tags": tags
}
]
GET /patients/<patient_id>
Arg: patient_id
{
"_id": patient_id,
"name": name,
"gender": gender,
"patient_code": patient_code,
"profession": profession,
"marital_status": marital_status,
"responsible_guardian": responsible_guardian,
"responsible_contact": responsible_contact,
"birth_date": birth_date,
"workspace": workspace,
"address": address,
"allergies": allergies,
"tags": tags
}
{
"msg": "Patient not Found"
}
PATCH /patients/<patient_id>
Arg: patient_id Request: any patient field.
{
"_id": patient_id,
"name": name,
"gender": gender,
"patient_code": patient_code,
"profession": profession,
"marital_status": marital_status,
"responsible_guardian": responsible_guardian,
"responsible_contact": responsible_contact,
"birth_date": birth_date,
"workspace": workspace,
"address": address,
"allergies": allergies,
"tags": tags
}
{
"msg": "UPatient not Found"
}
{
"error": "Error updating patient"
}
DELETE /patients/<patient_id>
Arg: patient_id
{
"error": "Patient not Found"
}
========== DATA ==========
POST /datas
{
"description": data_description,
"patient_id": patient_id,
"category_id": category_id,
"tags": [data_tags],
"alerts": [alert_data_tags]
}
{
"data_id": data_id
"status": Boolean
"description": description
"date": datetime
"patient_id": patient_id
"category_id": category_id
}
{
"error": "Error creating data for patient"
}
GET /datas
no request
[
{
"data_id": data_id,
"status": status,
"description": description,
"date": date,
"patient": patient,
"tags": tags
}
]
GET /datas/<data_id>
Arg: data_id
{
"data_id": data_id,
"status": status,
"description": description,
"date": date,
"patient": patient,
"tags": tags
}
{
"msg": "Data not Found"
}
PATCH /datas/<data_id>
Arg: data_id Request: any data field.
{
"data_id": data_id,
"status": status,
"description": description,
"date": date,
"patient": patient,
"tags": tags
}
{
"msg": "Data not Found"
}
{
"error": "Error updating data"
}
DELETE /datas/<data_id>
Arg: data_id
{
"msg": "data description deleted"
}
{
"msg": "Data not Found"
}
========== COMMENTS ==========
POST /comments
{
"patient_id": patient id,
"user_id": user id,
"category_id": category id,
"comment": comment
}
{
"comment_id": comment id,
"comment": comment,
"date_time": date time,
"user_id": user id,
"patient_id": patient id,
"category_id": category id
}
{
"error": "User not Found"
}
{
"error": "Category not Found"
}
{
"error": "Patient not Found"
}
ValidationError
{
"msg": """Error creating comment,
give the give the appropriate keys""",
"appropriate_keys": {
"comment": "string",
"patient_id": "integer",
"user_id": "integer",
"category_id": "integer",
},
}
PATCH /comments/<comment_id>
Arg: comment_id Request:
{
"comment": "tESTE"
}
{
"comment_id": comment id,
"comment": comment,
"date_time": date time,
"user_id": user id,
"patient_id": patient id,
"category_id": category id
}
ValidationError
{
"msg": """Error updating comment,
give the give the appropriate keys""",
"appropriate_keys": {"comment": "string"},
}
DELETE /comments/<comment_id>
Arg: data_id
{
"msg": "Comment deleted"
}
{
"error": "Comment not Found"
}