Coder Social home page Coder Social logo

eunicekokor / medic-webapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from medic/cht-core

0.0 2.0 0.0 33.54 MB

A web based SMS data collection and analytics tool focused on community health workers.

Home Page: http://medicmobile.org/platform

JavaScript 81.90% HTML 11.24% CSS 3.26% Perl 3.34% Shell 0.11% Python 0.14%

medic-webapp's Introduction

Medic Mobile

These instructions should help you get setup to run or develop on Medic Mobile. For latest changes and release announcements see the change log.

Dependencies

You will need to install the following:

Nodejs

CouchDB

couchdb-lucene v1.0.2 or greater

Setup CouchDB

Setup admin access

curl -X PUT http://localhost:5984/_config/admins/admin -d '"pass"'

In CouchDB's local.ini, force authentication

[couch_httpd_auth]
require_valid_user = true

Create an admin user

curl -X POST http://admin:pass@localhost:5984/_users -d '{"_id": "org.couchdb.user:admin", "name": "admin", "password":"pass", "type":"user", "roles":[]}' -H "Content-Type: application/json"

Kanso

Kanso is required to build and deploy.

npm install kanso -g

Grunt

Grunt is required to build.

npm install grunt-cli -g

Configure Lucene

Add the following to CouchDB config httpd_global_handlers:

_fti = {couch_httpd_proxy, handle_proxy_req, <<"http://127.0.0.1:5985">>}

Update $lucene_home/conf/couchdb-lucene.ini so the URL has credentials, eg:

url=http://admin:pass@localhost:5984/

Start lucene: $lucene_home/bin/run

You should now see the same welcome message at:

curl http://localhost:5985
{"couchdb-lucene":"Welcome","version":"1.0.2"}
curl http://localhost:5984/_fti
{"couchdb-lucene":"Welcome","version":"1.0.2"}

Develop

Build

git clone --recursive https://github.com/medic/medic-webapp
cd medic-webapp
npm install

Create a .kansorc file in the app directory with your credentials, eg:

exports.env = {
  default: {
    db: "http://admin:pass@localhost:5984/medic",
    overrides: {loglevel:"debug"}
  }
};

Push the couchapp

grunt dev will build and deploy the webapp and also watch for changes and refresh the deploy if any are detected.

Start medic-sentinel

cd sentinel
npm install
export COUCH_URL=http://admin:pass@localhost:5984/medic
node ./server.js

See Medic Sentinel for more information.

Start medic-api

cd api
npm install
export COUCH_URL=http://admin:pass@localhost:5984/medic
node ./server.js

See Medic API for more information.

Push the dashboard

Dashboard is required to load Medic Mobile. To install Dashboard:

First change the couch db configuration secure_rewrites to false.

git clone https://github.com/garden20/dashboard
cd dashboard
kanso install
kanso push http://admin:pass@localhost:5984/dashboard

Try it out

Navigate your browser to:

http://localhost:5988/medic/_design/medic/_rewrite/

Tests

To run the basic linting and unit tests, run:

grunt precommit

Some tests are run in browser, you can run them manually if you browse to /test after a push. To run them from commandline you will need to install phantomjs.

npm install phantomjs -g
grunt test

Loading Data

Loading your form definitions in the settings interface is supported but you can also do that from command line.

node scripts/load_forms.js

To bulk load messages from a CSV file run:

node scripts/load_messages.js

Use curl to submit a single message:

curl -i -u gateway:123qwe \
    --data-urlencode 'message=Test One two' \
    --data-urlencode 'from=+13125551212' \
    --data-urlencode 'sent_timestamp=1403965605868' \
    -X POST \
    http://medic.local/medic/_design/medic/_rewrite/add

Deploy to Market

When deploying to market include the sentinel package in the couchapp so gardener can manage the process. This is already automated in the CI scripts and runs on Travis CI but here is the manual process.

First clone the repo recursively so you get both submodules api and sentinel, then change directories:

git clone --recursive https://github.com/medic/medic-webapp
cd medic-webapp

Then edit kanso.json and add "kanso-gardener":null to the end of the list of dependencies. You can use your editor but jsontool has an edit mode that works to:

cat kanso.json |json \
  -e 'this.dependencies["kanso-gardener"] = null; this.dependencies_included = true;' \
  > new.json && \
mv new.json kanso.json

Finally push to the Medic Alpha Market run:

kanso push https://staging.dev.medicmobile.org/markets-alpha/upload

Help

Join our Google Group or file an issue on Github.

Build Status

Builds brought to you courtesy of Travis CI.

Develop Testing Master
Build Status Build Status Build Status

License & Copyright

Copyright 2013 Medic Mobile, 501(c)(3) [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

medic-webapp's People

Contributors

mandric avatar garethbowen avatar wombleton avatar endor avatar ryanramage avatar abbyad avatar henokgetachew avatar catherinewong avatar puertea avatar

Watchers

James Cloos avatar Eunice Emefa Kokor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.