-
Notifications
You must be signed in to change notification settings - Fork 7
API: Procedures
A Procedure is the root document that the protocol builder creates. In a sense, it is the protocol itself. It contains information about the document and is made up of a series of pages.
/api/procedures
Only the user that owns the procedure may access or modify it.
| Field Name | Type | Required? | Default Value | Read Only? | Description |
|---|---|---|---|---|---|
title |
string |
Yes | No | The name for this procedure | |
author |
string |
No | owner.first_name + ' ' + owner.last_name |
No | The creator of this procedure |
owner |
User |
Yes | No | The user that owns this procedure. This is inferred from the authorization token. | |
uuid |
uuid |
Yes | Yes | A unique identifier for this procedure. This value is auto-generated | |
created |
datetime |
Yes | Yes | The time that this object was created. This value is auto-generated | |
last_modified |
datetime |
Yes | Yes | The last time that this object was updated. This value is auto-generated. | |
pages |
list<Page> |
No | [] |
No | The pages that are contained within this procedure. This is auto-updated when a page is created that belongs to this procedure. |
To create a procedure POST to /api/procedures.
201: Object Created Successfully
400: Bad value in the request body. Check the response for errors
401: Invalid Request Token
POST /api/procedures
Host: sanaprotocolbuilder.me
Authorization: Token <token>{
"title":"Untitled Procedure"
}{
"id":7,
"title":"Untitled Procedure",
"author":"John Smith",
"uuid":"bed18172-1723-4072-85b8-798616097667",
"owner":6,
"pages":[],
"last_modified":"2016-03-05T18:44:51.230744Z",
"created":"2016-03-05T18:44:51.230806Z"
}To update a procedure PUT to /api/procedures/{id}, where id is the id of the procedure. You only need to send the fields that are to be updated in the body of the request. Sending up other fields that are not modified, will not do anything.
200: Object Updated Successfully
400: Bad value in the request body. Check the response for errors
401: Invalid Request Token
404: Procedure does not exist
PUT /api/procedures/7
Host: sanaprotocolbuilder.me
Authorization: Token <token>{
"title":"My Procedure"
}{
"id":7,
"title":"My Procedure",
"author":"John Smith",
"uuid":"bed18172-1723-4072-85b8-798616097667",
"owner":6,
"pages":[],
"last_modified":"2016-03-05T18:48:37.515686Z",
"created":"2016-03-05T18:44:51.230806Z"
}To delete a procedure send a DELETE request to /api/procedures/{id} where the id is the id of the procedure to be deleted.
203: Object successfully deleted
401: Invalid Request Token
404: Procedure does not exist
DELETE /api/procedures/7
Host: sanaprotocolbuilder.me
Authorization: Token <token>No response body
To get all procedures that you own GET to /api/procedures.
200: Success
401: Invalid Request Token
GET /api/procedures
Host: sanaprotocolbuilder.me
Authorization: Token <token>[
{
"id":5,
"title":"Untitled Procedure",
"author":"No author specified",
"uuid":"6841a13e-275d-4b17-a6f3-b0c2e8512d49",
"owner":6,
"pages":[
{
"id":12,
"display_index":0,
"last_modified":"2016-03-05T00:42:38.880071Z",
"created":"2016-03-05T00:41:54.141476Z",
"procedure":5
},
{
"id":13,
"display_index":1,
"last_modified":"2016-03-05T00:42:53.808247Z",
"created":"2016-03-05T00:42:53.808288Z",
"procedure":5
},
{
"id":14,
"display_index":2,
"last_modified":"2016-03-05T00:42:54.518141Z",
"created":"2016-03-05T00:42:54.518178Z",
"procedure":5
}
],
"last_modified":"2016-03-05T00:43:02.622411Z",
"created":"2016-03-04T18:18:21.549666Z"
},
{
"id":6,
"title":"Untitled Procedure",
"author":"a",
"uuid":"3d66f932-9c43-4cb1-8c2d-3fb6eb23aa56",
"owner":6,
"pages":[
],
"last_modified":"2016-03-05T18:44:20.723130Z",
"created":"2016-03-05T18:37:58.466792Z"
},
{
"id":7,
"title":"My Procedure",
"author":"John Smith",
"uuid":"bed18172-1723-4072-85b8-798616097667",
"owner":6,
"pages":[
],
"last_modified":"2016-03-05T18:48:37.515686Z",
"created":"2016-03-05T18:44:51.230806Z"
}
]To get all procedures that you own GET to /api/procedures/{id}, Where id is the procedure's id.
200: Success
401: Invalid Request Token
404: Procedure does not exist
GET /api/procedures/7
Host: sanaprotocolbuilder.me
Authorization: Token <token>{
"id":7,
"title":"My Procedure",
"author":"John Smith",
"uuid":"bed18172-1723-4072-85b8-798616097667",
"owner":6,
"pages":[],
"last_modified":"2016-03-05T18:48:37.515686Z",
"created":"2016-03-05T18:44:51.230806Z"
}To generate the XML protocol that a procedure represents, send a GET request to /api/procedures/{id}/generate, where id is the procedure id.
200: Success
400: Error in generation. See message for details.
401: Invalid Request Token
404: Procedure does not exist
GET /api/procedures/7/generate
Host: sanaprotocolbuilder.me
Authorization: Token <token><Procedure title="Radiology Examination" author="UP Manilla National Telehealth Center", uuid="bed18172-1723-4072-85b8-798616097667" version="2016-03-05T18:48:37.515686Z">
<Page>
<Element type="ENTRY" id="1" concept="CHIEF COMPLAINT" question="Chief Complaint:" answer=""/>
</Page>
<Page>
<Element type="ENTRY" id="2" concept="HISTORY" question="Short History of Present Illness:" answer=""/>
</Page>
<Page>
<Element type="ENTRY" id="3" concept="PHYSICAL FINDINGS" question="Physical Findings:" answer=""/>
</Page>
<Page>
<Element type="ENTRY" id="4" concept="INITIAL DIAGNOSIS" question="Diagnosis:" answer=""/>
</Page>
</Procedure>