Monday, May 28, 2012

HandsForScience CMS Uses mongodb

HandsForScience is a non-profit which helps teachers do hands-on, science activities more easily. I'm using mongodb for the HandsForScience CMS: http://www.handsforscience.org/activities

The stack is rails 3, mongoid, cancan, & jquery hosted via Heroku, mongolab, S3 (for attachments).

Any CMS will have User, Article, Link, & Attachment classes--in our case, Activity takes the place of Article. Our schema adds:
  • Standard: A curriculum standard which the activity cross-references. So far we include the California K-5 standards.
  • Material: An activity includes materials. The list is crowdsourced.
  • Term: An activity includes vocabulary terms. The vocab is crowdsourced.
Instead of a Grade class, an activity's grades are an array-valued field. Instead of a Subject class, an activity's subject has a string-valued field validated as an enum: life, earth, physical sciences.

The most interesting tradeoff is the Activity/Material relationship. There must be enough material for each activity. The quantities are classroom, small group, student. Instead of creating a join class ActivityMaterialQty, there are three many-many relationships.

Another tradeoff is object creator fields are string-valued instead of many-many-User relationships. I should probably switch to BSON::ObjectId.

It would be nice if mongodb supported case-insensitive sorting. I'm working around this by sorting in memory. I should switch to denormalized, lowercase fields.




No comments:

Post a Comment