Skip to content
luzlab edited this page Jun 2, 2017 · 2 revisions

Here is the database structure for the UI frontend.

devices:
{
  amputationLevels: { slug: "transradial",
                       name: "Transradial" },
  slug: 'xrp-arm',
  name: 'XRP arm',
  icon:  'https://www.AWSurlhere',
  creator: 'limbforge',
  componentType: 'passive',
  weight: '250 g - 350 g',
  description: 'The XRP Arm is a lightweight, highly cosmetic passive device with several terminal device options.',
  tags: [ 'social occasions', 'supporting objects', ... ],
  printTime: '14 hrs - 20 hrs',
  measurements: [ {   name: 'c1'
                      step: 0.5,
                      upper_range: 28,
                      measurement_unit: "cm",
                      lower_range: 20,
                      default: 25,
                      instructions: 'instructions go here'
                    }, ...
               ],
  terminalDevices: [ { slug: "active-device",
                       name: "Active device" } , ...
                   ]
}

Endpoint 3: Return Amputation Levels (AL)

MongoCollection.distinct('amputationLevels'); // returns an array of objects

Endpoint 4: Return Devices for a given AL

const fields = { slug: true, name: true, icon: true, creator: true, component_type: true, weight: true, description: true , uses: true, printTime: true };
MongoCollection.find({slug : { $eq : <AL> }}, {fields});

Endpoint 5: Return Measurements for a given a Device

MongoCollection.find({slug : { $eq : <DEVICE> }}, {fields {measurements: true}});

Endpoint 6: Return Terminal Devices for a given Device

MongoCollection.find({slug : { $eq : <DEVICE> }}, {fields {terminalDevices: true}});