Skip to content
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Pictures for Wiki
Data Element1.PNG
Images for wiki

Home Meteor App

Build Status


How to Run on local machine

Maker a local copy settings.local.json of the file settings.json

git clone
cd home-app
git checkout master
meteor npm install
meteor run --settings settings.local.json


To run tests:

npm run test

Deploy instructions

Meteor Up is used to deploy this app. Ref:

Deploy configs

  • ./deploy/cta-home-aws
    • This is for AWS server for
    • This server is behind http auth. Following are the user credentials.
    • easyengine / bLGMpn
    • You need to have CTA AWS server's home.pem key.
    • Once you have it, rename it and put the file under ~/.ssh/home.pem path. Because it is configured this way for deploy config.
    • Change file permissions of home.pem. chmod 400 ~/.ssh/home.pem

First time steps

  • Install meteor-up. npm install -g mup

Deploy steps

  • Go to directory ./.deploy/<server-dir>.
  • Run mup deploy. This command will initiate the deployment of the current version of project in your filesystem.

SSL Certificate

Login to Server with SSH using home.pem key to perform following actions.


sudo ee site update --letsencrypt


sudo ee site update --letsencrypt=off


sudo ee site update --letsencrypt=renew

Mongo DB Backup & Restore from Docker Server


docker run \
 --rm \
 --link mongodb:mongo \
 -v /home/ubuntu/backup-dir:/backup \
 mongo \
 bash -c 'mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR'


docker run \
 --rm \
 --link mongodb:mongo \
 -v /home/ubuntu/home-app/meteor-mongodb\ backup/dump-2016-08-15:/backup \
 mongo \
 bash -c 'mongorestore --drop -d home-monterey /backup/home-cta --host $MONGO_PORT_27017_TCP_ADDR'


Access MongoDB on the Server

  • Login to the server with SSH.
  • docker exec -it mongodb mongo home-cta


Coding guidelines

Each publication and method should log its details:`PUB[${this.userId}]: name`, params);`METHOD[${this.userId}]: name`, params);

Each method call should use Alert to report succes/error as below. err can be a string or an exception.

import Alert from '/imports/ui/alert';

Alert.success('Question updated');

Reading data from API

Conform to the following schema when returning data from HSLYNK.

clientDetails = {
  clientId: '1234',
  schema: 'v2017',
  firstName: 'John',
  error: {
    message: 'Client not found',
    statusCode: 404

If you make a call to edit/remove HMIS item you need to update local (client side) collection to reflect the changes. Ie.

Clients._collection.update(client._id, { $set: result }); // eslint-disable-line

Use authorize key in a router to check user permissions:

  authorize: {
    allow() {
      return Roles.userIsInRole(Meteor.userId(), ResponsesAccessRoles);

Survey definition

Survey definition describes the elements of the survey and its interal logic. Survey definition is written using JSON format and consists of the following fields:

  "title": "Test Survey",
  "variables": { ... },
  "items": [ ... ]

Survey logic

Form values are current question responses. If there is question with id = question1 and a change occurs for this question (i.e. text is entered), values.question1 will hold a response given to this question.

Form variables are recalculated on each value change. When a change occurs (i.e. user types a response), variables are first initialized with initial values provided in form.variables, then rules are fired which may change the variables. Rules are fired from top to bottom.

Form props are similar to values because the are persistent - when a change occurs, props are not reset to default values like variables do. In contrast to values, props are not submitted when the form is submitted. So far props are used to implement skipping sections.

Special variables

Some variables have special meaning. Set variables.ID.hidden equal to 1 to hide element with a given ID.


Survey item can have any number of associated rules that handle survey logic. Each rule consists of conditions and actions. If conditions are satisfied then actions are fired. All rules are evaluated from top to bottom of the survey definition, before any update in UI takes place.


Checking for a question response value

[OPERATOR, values.ID|variables.ID|props.ID|CONST, values.ID|variables.ID|props.ID|CONST]
['==', 'values.pregnantMember', 'Yes']
['>=', 'variables.numChildren', 3],
['==', 'props.parent2.skip', 1],


Setting a variable:

['set', 'score2', 1]

Now there will be a variable variables.score2 with value of 1.

Setting element property:

['pset', 'question1.skip', 1]

This sets question1 as skipped (value is erased, question cannot be edited)

Operand reducers


Reduces will apply transformations to the value of an operand. Reducers can be chained using : notation.

As an example client.dob:age will return age based on the date of birth of a client

Reducers can be applied to arrays (set of values for a certain column in a grid):

['set', 'youngestChildAge', 'values.children.age:min'],

will set a variables.youngestChildAge equal to smallest value in age column of a children grid

Avaliable reducers:

  • date: transforms timestamp (number) to a date,
  • age: calculates age given the value (date) and the current date
  • min: returns min value from an array
  • max: returns max value from an array

Scoring responses

Each variable that starts with score. is treated as a scoring variable and it's value will be submitted to HMIS when surevy responses are uploaded. Keep in mind that HMIS calculates the sum of all scores automatically, so there is no need to send a variable that hold the total survey score.

Survey items


The following survey is made of 2 questions (number inputs)

  "title": "Test Survey",
  "id": "dummy",
  "variables": {
    "score.A": 0,
    "score.B": 0,
    "grandtotal": 0
  "items": [
      "id": "question1",
      "title": "Enter first number",
      "type": "question",
      "category": "number"
      "id": "question2",
      "title": "Enter second number",
      "type": "question",
      "category": "number"
      "id": "summary",
      "type": "text",
      "title": "Scoring Summary",
      "text": "First score: {{variables.score.A}}<br />Second score: {{variables.score.B}}<br /><strong>GRAND TOTAL: {{variables.grandtotal}}</strong>",
      "rules": [
          "always": [


Submission Uploader

To enable submission uploader an "uploader": true must be added to settings.json file E.G:

  "public": {
    "features": {
      "appProfile": "home",
      "uploader": true

Currently the Submission Uploader is only available by direct links: /submissionUploader/list /submissionUploader/new


See exampleUploadConfig.json for the example of config to be input for Submission Uploader

Meteor Components in use

You can’t perform that action at this time.