BaderLab / GenomeClinic-PGX

Web application for clinical pharmacogenomic interpretation
GNU Lesser General Public License v3.0
9 stars 2 forks source link

Db restruct #131

Closed patmagee closed 9 years ago

patmagee commented 9 years ago

Restructuring of DB for for drug Dosing

The initial restructuring of the database created an extremely nested and unusable central document that stored large amounts of information in a gene wise fashion. The nesting of the Documents as well as the non standard naming schema for the keys made it next to impossible to easily access the nested values.

In order to address this, I decided created 4 separate collections:

  1. The Dosing Collection. there is exactly one document per gene, and the document contains references to the associated haplotypes, recommendations, and future considerations.
  2. drugRecommendations collection. This collection contains all the recommendations and suggestions.
  3. Future collection.
  4. Haplotype Collection.

Within the dosing collection, there are three arrays which contain references to other collections. Each array contains mongo ObjectIDs which are a UNIQUE & INDEXED key that can be used for rapid search through many documents. By using this method, you do not have to worry about traversing nested documents. If you want to associate a new recommendation, simply push the new objectID into the attributed array. If you want to remove it, simply delete the objectID.

To compliment the DB changes, I updated the client side JS and node Routes in order to easily add and remove documents to the database. Such changes include a better recommendation generator, a better haplotype guesser, etc. Additionally, I added a new Future Considerations field to the drug recommendations page that allows the user to one-time modify the current future considerations. I also included the ability to remove a consideration from use.

Restructuring of Gulpfile, Bower, and client side JS

In order to streamline both development and setup for the app, I completely restructured the gulpfile. First of all, Bower is now being used to install up-to-date client side dependency packages. This is extremely important in ensuring all dependencies are kept safe and up-to-date.

To reduce the load per page, I have split the bundle.js that was originally being sent with each page load (containing templates, and ALL js), into the templates and a separate JS page per base route. The templates are now required separately within a script tag in the layout.html to make them globally accessible. Additionally, I have converted each separate JS package into an anonymous package that is loaded into the DOM once the document is ready. When the server compiles the layout.html the user can pass a script array that will be included in the compilation, and loaded with the html.