const mongoose = require('mongoose'); const { DataElementSchema } = require('./basetypes/DataElement'); const Code = require('./basetypes/Code'); const Interval = require('./basetypes/Interval'); const Quantity = require('./basetypes/Quantity'); const DateTime = require('./basetypes/DateTime'); const [Number, String] = [ mongoose.Schema.Types.Number, mongoose.Schema.Types.String, ]; const <%= datatype -%>Schema = DataElementSchema({ <%- for attribute in attrs_with_extras -%> <%= attribute[:name] %>: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>, <%- end %> }); module.exports.<%= datatype %>Schema = <%= datatype %>Schema; module.exports.<%= datatype %> = mongoose.model('<%= datatype %>', <%= datatype %>Schema);