@@ -71,6 +71,16 @@ We define endpoints for getting patients, devices, and readings that have been p
This codebase is intended to showcase a small variety of ways in which you can write a simple data storage webapp. The intention here is for you to ingest the documentation here, download this repository, and start tweaking it to your use case. There are many topics that are not covered here such as uploading large binary files, dealing with spotty internet connections, etc... but this is at least a good place to start.
## A note on API design
The API displayed here (the collection of `GET` and `POST` requests that you can send to the various API endpoints) is simplistic, but not completely unrealistic. It's good practice to structure your API endpoints in some reasonable way, that gives the user a consistent, well-defined way of interacting with your webapp. Additionally, it's good to lock down access to the bare minimum, so instead of allowing both `GET` and `POST` requests to an endpoint that is a "read-only" style endpoint (such as listing all the registered patients, etc...), it's better to lock it down to only `GET` requests and explicitly error on the `POST` requests. This will reduce confusion in the future when you accidentally send a `POST` request and are confused by the errors you get when you try to load in parameters from what you think is a `GET` request, etc...
API design is more of an art than a science, so experiment, and don't be afraid to rewrite things a few times if your initial experimentation results in something that feels "clunky".
## Where to go from here
In order to turn this repository into something useful, first define the data types you want to store in the database. This will involve editing the [`models.py`](django_app/data_app/models.py) file to store everything you're interested in. Then, write views within [`views.py`](django_app/data_app/views.py) to allow access to those models. Then, once you're satisfied that the API you've written is meaningful and implemented correctly, write clients for it in Python, on Android, on iOS, using Javascript in webpages, whatever. The world is your burrito.
# Client examples
I have provided two examples of how to request data from this server; [one set using the Postman app](client_examples/postman), and [one set using Python](client_examples/python). Read their respective READMEs to see how to run them and how to look at the results.