See this video to get a 3 min intro to CouchDB.
I have decided to use one week for this. My project is to implement the server side of the following solution using CouchDB:
To briefly summarize this system development process; I am doing my one-year master thesis on the creation of a self-reporting system for people who suffer from bipolar disorder, where the patient is prompted or notified on his or hers smartphone to input various self-reported data related to the disease at various times of the day. The data is then transmitted via a secure connection to a server. The server has a web interface where both patients and medical professionals involved in the therapeutical treatment of the patient can view reports and analyze the data as it aggregates over time to discover patterns and guide the treatment.
I am as mentioned building the server side of the application using a standard Apache web server with PHP and MySQL, supported by the Symfony2 framework. As the work so far perhaps has been unnecessarily tedious and sometimes painful, this “spike” is introduced to figure out if CouchDB and the development of a Couch App is easier for this use case. So I fire up some jazz on Spotify and start my VM with Ubuntu (my dev env).
The documentation I follow is located here . My starting point is their wiki. I also start their IRC channel so that I can ask questions if needed. Further, I have a tendency of asking questions on Stackoverflow and I might do that for this work as well.
There is an installation guide in the wiki, and for my case the installation is done in Ubuntu. It is quite easy, just run the command:
sudo apt-get install couchdb -y
In my dev env it was already there. I don’t know what I have installed that installed it, but something is possibly depending on it.
Then I went to http://localhost:5984/_utils/ to set up a database. For my use I created a database named “mood”. Then I click the security button, and I can see that there are some users I can set up here. Here my first question arises: Is it possible for me to port my design considering the structure when it comes to users and access control?
The model can be illustrated in this way in a model I created a few months ago:
A user can have two different roles: It can be a patient or it can be a medical professional. A patient can log data concerning himself and view reports based on these data. A medical can have access to reading patient reports on specific patients he has been granted access to, but not other patients. I browsed the web but ended up asking at stackoverflow.
While waiting for input from the community I started browsing myself. I found Access Control Lists (ACLs) in the wiki. But this articles requires some prerequisites. Therefore I spend the rest of the day reading and watching videos on CouchDB.
Access Control Lists was a page concerning the wiki itself it seems. And what I have to conclude from readings in the wiki is that I will not use CouchDB for this case. It is not possible to give users read and write access to only parts of the database.
I could create it so that every patient has his own database. The doctors could be users of these databases, with only read abilities: http://wiki.apache.org/couchdb/PerDocumentAuthorization