todo: switch datacontext.ready to a promise; move metadata fetching to model.js