Rhubarb
Rhubarb is a
Ruby on Rails application we're working on that is designed to be a data capture tool for the web. Below is a short explanation about how things work.
Application Layout
Here's a diagram:
Projects have users and forms. Each user has a role of manager, data entry, read-only, or guest. Each role has a set of permissions that define what that role can do. Each form has questions and/or sections, the latter having questions and other sections.
The data for each project is stored in a separate database to avoid name conflicts. One of our major desires for Rhubarb is to separate the data and the application as much as possible. This is advantageous for many reasons, one being that data is still accessible if the application goes down.
YAML Specification
Rhubarb uses YAML as its main format to import project information. See
RhubarbYAML for more information.
Exporting Features
Rhubarb has the capability to export its data to a compressed R data file. Exporting data to an R data file will create different R objects depending on the structures of a project's forms. Forms with no sections are converted into data frames, whereas forms with sections are converted into lists of data frames and other lists if those included sections also have sections, etc. Questions that can have multiple values of a categorical variable are stored as delimited strings with a class of 'mChoice' and a 'levels' attribute, which is a character vector of all the possible answers. Questions that require one categorical answer are stored as factors. A sample data set is
attached below. Example
results of running
load( ); html(contents())
in
R
on an exported dataset are also below. Users with appropriate access privileges can access the source dataset at
https://biostat3.mc.vanderbilt.edu/rhubarb.
Current Status
Rhubarb is currently being rewritten to be much more robust and to fit the latest Rails specifications. Development is proceeding by using the RSpec library with a technique called Test Driven Development, which ensures that as much code as possible is thoroughly tested. It's a slow process, but the result will be well worth it.
Trac
Rhubarb's trac can be found at:
https://biostat.mc.vanderbilt.edu/trac/rhubarb. Please contact
Jeremy Stephens if you'd like permission to browse the source.
Other Notes
The Ubuntu (Fiesty) version of the sqlite3 gem for Ruby is outdated and doesn't work with Rhubarb. Install it directly with rubygems with the following commands:
sudo apt-get install ruby1.8-dev libsqlite3-dev
sudo gem install -y sqlite3-ruby
Subversion Log
Note: In the interest of keeping this page from getting monstrously long, only the last 10 logs are shown.
Log
Generated subjects/forms controller
- moved before_filter to the application controller
Files
- A branches/organic/app/controllers/subjects/
- A branches/organic/app/controllers/subjects/forms_controller.rb
- A branches/organic/app/helpers/subjects/
- A branches/organic/app/helpers/subjects/forms_helper.rb
- A branches/organic/app/views/subjects/forms/
- A branches/organic/app/views/subjects/forms/edit.rhtml
- A branches/organic/app/views/subjects/forms/index.rhtml
- A branches/organic/app/views/subjects/forms/new.rhtml
- A branches/organic/app/views/subjects/forms/show.rhtml
- A branches/organic/spec/controllers/subjects/
- A branches/organic/spec/controllers/subjects/forms_controller_spec.rb
- A branches/organic/spec/helpers/subjects/
- A branches/organic/spec/helpers/subjects/forms_helper_spec.rb
- A branches/organic/spec/views/subjects/forms/
- A branches/organic/spec/views/subjects/forms/edit.rhtml_spec.rb
- A branches/organic/spec/views/subjects/forms/index.rhtml_spec.rb
- A branches/organic/spec/views/subjects/forms/new.rhtml_spec.rb
- A branches/organic/spec/views/subjects/forms/show.rhtml_spec.rb
- M branches/organic/app/controllers/application.rb
- M branches/organic/app/controllers/main_controller.rb
- M branches/organic/app/controllers/projects_controller.rb
- M branches/organic/app/controllers/sessions_controller.rb
- M branches/organic/app/controllers/specification_controller.rb
- M branches/organic/spec/controllers/contents_controller_spec.rb
- M branches/organic/spec/controllers/definitions_controller_spec.rb
- M branches/organic/spec/controllers/forms_controller_spec.rb
- M branches/organic/spec/controllers/questions_controller_spec.rb
- M branches/organic/spec/controllers/subjects_controller_spec.rb
- M branches/organic/spec/controllers/views_controller_spec.rb
Log
- Reworked the subject form helper; abandoned testing on that, since it was getting on my nerves
- Fixed subject editing/updating
Files
- A branches/organic/spec/libs/echo_form_builder_spec.rb
- M branches/organic/app/controllers/subjects_controller.rb
- M branches/organic/app/helpers/application_helper.rb
- M branches/organic/app/helpers/subjects_helper.rb
- M branches/organic/app/views/subjects/edit.rhtml
- M branches/organic/app/views/subjects/new.rhtml
- M branches/organic/app/views/subjects/show.rhtml
- M branches/organic/spec/controllers/subjects_controller_spec.rb
- M branches/organic/spec/helpers/application_helper_spec.rb
- M branches/organic/spec/views/subjects/edit.rhtml_spec.rb
- M branches/organic/spec/views/subjects/new.rhtml_spec.rb
- M branches/organic/spec/views/subjects/show.rhtml_spec.rb
- D branches/organic/spec/views/render_generated_view_spec.rb
Log
Way overdue commit. Finally had some time to get some work done on this.
Details:
- Updated
render_generated_view
to accept more options
- Added more validations on Form#name
- Project now creates a Subject class on creation, along with a Subject table
- Project no longer tries to delete its database when it's destroyed, since that doesn't work
- Changed Definition#to_select_options to always use strings for values
- Added subjects' show view
- Bit o' sprucing up views here and there
- Added a rake task to help with testing
Files
- A branches/organic/lib/tasks/rhubarb.rake
- A branches/organic/themes/professional/images/delete.gif
- A branches/organic/themes/professional/images/edit.gif
- A branches/organic/themes/professional/images/show.gif
- A branches/organic/themes/professional/stylesheets/subjects.css
- M branches/organic/app/controllers/projects_controller.rb
- M branches/organic/app/controllers/subjects_controller.rb
- M branches/organic/app/helpers/application_helper.rb
- M branches/organic/app/models/definition.rb
- M branches/organic/app/models/form.rb
- M branches/organic/app/models/project.rb
- M branches/organic/app/views/main/welcome.rhtml
- M branches/organic/app/views/projects/index.rhtml
- M branches/organic/app/views/projects/new.rhtml
- M branches/organic/app/views/specification/new.rhtml
- M branches/organic/app/views/subjects/new.rhtml
- M branches/organic/app/views/subjects/show.rhtml
- M branches/organic/config/environment.rb
- M branches/organic/config/routes.rb
- M branches/organic/lib/container_extensions.rb
- M branches/organic/lib/view_generator.rb
- M branches/organic/spec/controllers/projects_controller_spec.rb
- M branches/organic/spec/controllers/subjects_controller_spec.rb
- M branches/organic/spec/fixtures/schematics.yml
- M branches/organic/spec/fixtures/views.yml
- M branches/organic/spec/helpers/application_helper_spec.rb
- M branches/organic/spec/libs/view_generator_spec.rb
- M branches/organic/spec/models/definition_spec.rb
- M branches/organic/spec/models/form_spec.rb
- M branches/organic/spec/models/project_spec.rb
- M branches/organic/spec/spec_helper.rb
- M branches/organic/spec/views/layouts/application_view_spec.rb
- M branches/organic/spec/views/subjects/new.rhtml_spec.rb
- M branches/organic/spec/views/subjects/show.rhtml_spec.rb
- M branches/organic/stories/all.rb
- M branches/organic/stories/helper.rb
- M branches/organic/themes/professional/layouts/application.rhtml
- M branches/organic/themes/professional/stylesheets/rhubarb.css
- D branches/organic/previous_failures.txt
Log
More work on rendering Form's. You can actually create a subject through the GUI now!
- added
render_generated_view
to the application helper
- added some assigns to the subjects controller for the generated view
- added a name field to View and fixed the (created|updated)_by field type
- updated the building story to check for View's
- ViewGenerator changes
- removed form_for from the template because bad things would have happened during template nesting
- added scoping for sub-sections!
- Rhubarb::Builder now generates views
- added ScopedFormBuilder class to make it easier to build forms for models that have relationships
Stuff to do next:
- handle subforms in the subjects controller via glob routing
- write methods to handle saving scoped data in the controller
- dance
Files
- A branches/organic/lib/scoped_form_builder.rb
- A branches/organic/spec/resources/views/render_generated_view_example.rhtml
- A branches/organic/spec/resources/views/scoped_form_builder_example.rhtml
- A branches/organic/spec/views/render_generated_view_spec.rb
- A branches/organic/spec/views/scoped_form_builder_spec.rb
- M branches/organic/app/controllers/subjects_controller.rb
- M branches/organic/app/helpers/application_helper.rb
- M branches/organic/app/views/subjects/new.rhtml
- M branches/organic/db/migrate/021_create_views.rb
- M branches/organic/lib/rhubarb/builder.rb
- M branches/organic/lib/view_generator.rb
- M branches/organic/spec/controllers/subjects_controller_spec.rb
- M branches/organic/spec/helpers/application_helper_spec.rb
- M branches/organic/spec/libs/rhubarb/builder_spec.rb
- M branches/organic/spec/libs/view_generator_spec.rb
- M branches/organic/spec/views/subjects/edit.rhtml_spec.rb
- M branches/organic/spec/views/subjects/new.rhtml_spec.rb
- M branches/organic/spec/views/subjects/show.rhtml_spec.rb
- M branches/organic/stories/building/building.story
- M branches/organic/stories/building/steps.rb
- M branches/organic/themes/professional/stylesheets/rhubarb.css
- D branches/organic/spec/resources/views/subject_form_for_example.rhtml
Log
Form rendering-related stuff:
- removed SubjectsHelper#subject_form_for
- added Definition#to_select_options
- created the ViewGenerator module with methods to generate a View from a Form or Section
- removed Rhubarb::FormBuilder
Next up is making Rhubarb::Builder call Form#generate_view for each Form.
Files
- A branches/organic/lib/view_generator.rb
- A branches/organic/spec/libs/view_generator_spec.rb
- M branches/organic/app/helpers/subjects_helper.rb
- M branches/organic/app/models/definition.rb
- M branches/organic/app/models/form.rb
- M branches/organic/app/models/section.rb
- M branches/organic/app/views/subjects/new.rhtml
- M branches/organic/spec/helpers/subjects_helper_spec.rb
- M branches/organic/spec/libs/rhubarb/builder_spec.rb
- M branches/organic/spec/models/definition_spec.rb
- M branches/organic/spec/models/form_spec.rb
- M branches/organic/spec/models/section_spec.rb
- M branches/organic/spec/views/subjects/new.rhtml_spec.rb
- D branches/organic/lib/rhubarb/form_builder.rb
- D branches/organic/spec/libs/rhubarb/form_builder_spec.rb
Log
- Messed around with SubjectsHelper#subject_form_for and Rhubarb::FormBuilder, which will probably be abandoned in favor of pre-generated views
- Generated the scaffold for View, which will probably end up causing problems
- Connected View to Form and Section through relationships
The actual HTML rendering of a Form only needs to happen whenever its contents are changed. I'm already storing Schematics in the database, so why not Views? It should make for an interesting time anyway.
Files
- A branches/organic/app/controllers/views_controller.rb
- A branches/organic/app/helpers/views_helper.rb
- A branches/organic/app/models/view.rb
- A branches/organic/app/views/views/
- A branches/organic/app/views/views/edit.rhtml
- A branches/organic/app/views/views/index.rhtml
- A branches/organic/app/views/views/new.rhtml
- A branches/organic/app/views/views/show.rhtml
- A branches/organic/db/migrate/021_create_views.rb
- A branches/organic/spec/controllers/views_controller_spec.rb
- A branches/organic/spec/controllers/views_routing_spec.rb
- A branches/organic/spec/fixtures/views.yml
- A branches/organic/spec/helpers/views_helper_spec.rb
- A branches/organic/spec/models/view_spec.rb
- A branches/organic/spec/resources/
- A branches/organic/spec/resources/views/
- A branches/organic/spec/resources/views/subject_form_for_example.rhtml
- A branches/organic/spec/views/views/
- A branches/organic/spec/views/views/edit.rhtml_spec.rb
- A branches/organic/spec/views/views/index.rhtml_spec.rb
- A branches/organic/spec/views/views/new.rhtml_spec.rb
- A branches/organic/spec/views/views/show.rhtml_spec.rb
- M branches/organic/app/controllers/subjects_controller.rb
- M branches/organic/app/helpers/subjects_helper.rb
- M branches/organic/app/models/form.rb
- M branches/organic/app/models/section.rb
- M branches/organic/app/views/subjects/new.rhtml
- M branches/organic/config/routes.rb
- M branches/organic/spec/controllers/subjects_controller_spec.rb
- M branches/organic/spec/helpers/subjects_helper_spec.rb
- M branches/organic/spec/libs/rhubarb/form_builder_spec.rb
- M branches/organic/spec/models/form_spec.rb
- M branches/organic/spec/models/section_spec.rb
- M branches/organic/spec/views/subjects/new.rhtml_spec.rb
Log
- Added the
derived_from
class method for the generated classes so I can get back to the Form/Section they're derived from
- Added the beginnings of the Rhubarb::FormBuilder class
- Various theme-related changes
Files
- A branches/organic/lib/rhubarb/form_builder.rb
- A branches/organic/spec/libs/rhubarb/form_builder_spec.rb
- M branches/organic/app/models/form.rb
- M branches/organic/app/models/section.rb
- M branches/organic/app/views/projects/show.rhtml
- M branches/organic/app/views/subjects/index.rhtml
- M branches/organic/spec/fixtures/files/remembrall.yml
- M branches/organic/spec/models/form_spec.rb
- M branches/organic/spec/views/layouts/application_view_spec.rb
- M branches/organic/spec/views/projects/show_view_spec.rb
- M branches/organic/spec/views/specification/new_view_spec.rb
- M branches/organic/spec/views/subjects/index.rhtml_spec.rb
- M branches/organic/themes/professional/layouts/application.rhtml
- M branches/organic/themes/professional/stylesheets/rhubarb.css
Log
Added theme images; made a few changes to professional theme.
Files
- A branches/organic/public/images
- A branches/organic/themes/curvy/images/
- A branches/organic/themes/curvy/images/bfill.gif
- A branches/organic/themes/curvy/images/bl.gif
- A branches/organic/themes/curvy/images/br.gif
- A branches/organic/themes/curvy/images/rfill.gif
- A branches/organic/themes/curvy/images/spinner.gif
- A branches/organic/themes/curvy/images/tfill.gif
- A branches/organic/themes/curvy/images/tl.gif
- A branches/organic/themes/curvy/images/tr.gif
- A branches/organic/themes/professional/images/
- A branches/organic/themes/professional/images/banner.png
- A branches/organic/themes/professional/images/spinner.gif
- M branches/organic/themes/professional/layouts/application.rhtml
- M branches/organic/themes/professional/stylesheets/rhubarb.css
Log
Removing images so I can link it back to a theme.
Files
- A branches/organic/public/stylesheets
- D branches/organic/public/images/
Log
One more commit for theme support.
Files
- A branches/organic/app/views/layouts
- D branches/organic/public/stylesheets/