Skip to content

NUBIC/LatticeGrid

Repository files navigation

LatticeGrid is getting easier to install, although creating the organizational units, importing investigators, and creating the membership lists is still a bit more 'fussy' than it should be. Here is the quick skinny. Please open and review all the files so you get an overview of the full installation and customization process.

*Configuring your machine to deploy the LatticeGrid code* 
I don't really describe how to run a rails app - if this is something new for you or your organization please read some of the excellent documentation available though the Ruby on Rails project at http://rubyonrails.org/. If you are familiar with Rails, go through the '/doc/rails_installation.txt' file.

*Installing PostgreSQL and configuration*  
Again, I don't cover actually installing Postgres - please read the excellent Postgres documentation. Once you have Postgres installed (LatticeGrid has been tested on 7.1 through 8.2 and the dependencies are only limited by the rails drivers), follow the instructions in the '/doc/database_initiation.txt' file. I list some various practices for Postgres configuration - for the public data available from LatticeGrid I don't believe it is necessary to password protect the Postgres account. However, be aware that as of Rails 2.2, running the test scripts requires your Postgres user run as the superadmin - this is the equivalent to root for the postgres account, so if you want to run tests you should be aware of this. In production you shouldn't be running the testing framework anyway, so not giving your Postgres user superadmin privileges should be fine.

*Customizing LatticeGrid for your organization*
There are only a handful of files you will need to edit, including the config/database.yml file where you configure how to access the Postgres database, lib/config.rb where you configure default information and messages from your organization and of course images and stylesheets to customize the look&feel of LatticeGrid. The files are described in the file '/doc/customization.txt'.

*Loading organizational units and investigators* 
As I mentioned, this is the most 'tweaky' part of setting up LatticeGrid. You can either write your own migration scripts for directly inserting your organization structure, your investigators, and the membership or appointment relationships, or use the file importing rake tasks to populate these tables, or a hybrid. I will put some additional information about these structures and methods on the wiki shortly. In the meantime, please look at the sample migration scripts in /db/sample_migrations/ and at the files to import using rake tasks in /db/imports  A list of the tasks for importing organizations and people is given in '/doc/orgs_and_people_setup.txt' file

*Running the publications import and configuration process*
If you have made it this far, it now becomes pretty easy. If you want to import 10 years worth of data, run the rake task:
	rake insertAllAbstracts
That will query PubMed for all the investigators in LatticeGrid, optionally using the PubMed search string for each investigator in pubmed_search_name or a synthetic search string comprised of last_name first_name first letter and middle_name first letter. You can limit the search globally to your institution in the 'lib/pubmed_config.rb' file by setting the variable @limit_to_institution to true or false. You can override this for a specific investigator by setting Investigator.pubmed_limit_to_institution to true for that individual. Please note that currently the switch is conservative - that is, if either @limit_to_institution or Investigator.pubmed_limit_to_institution is true, the search will be limited to publications listing your institution. You need to set the PubMed institutional search string variable @institutional_limit_search_string in the '/lib/pubmed_config.rb' file. The Northwestern search string is shown below:

@institutional_limit_search_string = '( "Northwestern University"[affil] OR "Feinberg School"[affil] OR "Robert H. Lurie Comprehensive Cancer Center"[affil] OR "Northwestern Healthcare"[affil] OR "Children''s Memorial"[affil] OR "Northwestern Memorial"[affil] OR "Northwestern Medical"[affil])'

After populating the abstracts, you can run the nightly import tasks.

rake nightlyBuild

The first time you run LatticeGrid, you will also want to build the more complex MeSH information content relationships. These are encapsulated in the 'monthlyBuild' rake task, which as the name indicates you only need to run monthly. Depending on the number of investigators and publications, this may take more the 20 hours to run.

rake monthlyBuild

Once you have confirmed that the data is what you expect, you will want to run these tasks as a cron job. You can use the example shell file, '/update_publication.sh', for some of the example commands you will want to have in your cron shell script. The full description of the import and run tasks are in the file '/doc/publications_scripts.txt'. 

*Production tasks*
Finally, as you move to production with LatticeGrid, you will want to build a full set of cached pages. There are rake tasks to do this. The cached pages provide two benefits: LatticeGrid is exceptionally responsive when the pages have been cached, and secondly it is still available during the extensive monthly rebuild process. After each nightly or monthly build, you will want to run the following tasks to rebuild the cache:

cd /*LatticeGrid home directory*

rake RAILS_ENV=production nightlyBuild >> rake_results.txt

#clean up the database to keep queries running smoothly
vacuumdb -fz latticegrid_production -U latticegrid

# monthly run this in another shell script
# rake RAILS_ENV=production monthlyBuild >> monthly_rake_results.txt

#rebuild the application cache
rake RAILS_ENV=production tmp:cache:clear 
rake RAILS_ENV=production cache:clear
rake RAILS_ENV=production cache:populate taskname=abstracts > buildCache.txt
rake RAILS_ENV=production cache:populate taskname=investigators >> buildCache.txt
rake RAILS_ENV=production cache:populate taskname=orgs >> buildCache.txt
rake RAILS_ENV=production cache:populate taskname=investigator_graphs >> buildCache.txt
rake RAILS_ENV=production cache:populate taskname=org_graphs >> buildCache.txt

You can review the results of the cache process in the file 'buildCache.txt' in your LatticeGrid home directory. Run this manually the first time so you can review any errors