Giter Club home page Giter Club logo

airslie / renalware-core Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 2.0 36.51 MB

Renalware uses demographic, clinical, pathology, and nephrology datasets to improve patient care, undertake clinical and administrative audits and share data with external systems.

Home Page: http://www.airslie.com/renalware.html

License: MIT License

Ruby 60.50% HTML 0.37% JavaScript 22.79% CSS 0.18% Shell 0.13% Gherkin 1.40% PLpgSQL 1.09% Dockerfile 0.05% Rich Text Format 0.01% SCSS 2.23% Slim 11.24% Procfile 0.01%
renal ruby rails

renalware-core's Introduction

Renalware

Renalware uses demographic, clinical, pathology, and nephrology datasets to improve patient care, undertake clinical and administrative audits and share data with external systems.

Technical Overview

renalware-core is a Ruby On Rails engine encapsulating the majority of Renalware's features in a re-usable gem. When a renal unit deploys Renalware, it will create its own host Rails application, and configure it to include the Renalware engine. The host application may be extremely thin, adding no custom features other than site-specific configuration, or it may include Ruby, HTML and JavaScript to override or augment renalware-core's features.

While the engine is intended to be deployed inside a host application in production, it can be run stand-alone in a local development environment (or indeed deployed in a limited way to somewhere like Heroku) by employing the demo host application that ships inside the engine. This demo app (in ./demo) allows a developer to quickly mount the engine, and is used also used by Rails integration tests (which is why it is in the ./spec folder)

Get up and running locally

An alternative Docker approach will be available shortly

As a Rails developer we assume you are using OS X or Linux (natively or inside a VM on Windows), and have the following installed:

  • Git
  • Postgres 12+
  • a ruby version manager (e.g. rbenv or RVM)
  • NodeJS

Postgres setup

Set up Postgres user with a password - for development purposes this can be your system login.

sudo su - postgres
psql template1

At the psql prompt run the following (replacing <username> and <password> accordingly):

CREATE USER renalware WITH PASSWORD 'renalware';
ALTER USER renalware WITH SUPERUSER;
ALTER USER renalware WITH LOGIN;

Configure Ruby

Check the ruby declaration at the top of the Gemfile to see which version of Ruby to install using your preferred Ruby version manager. If using rbenv for example:

rbenv install <version>
cd renalware-core
rbenv local <version>

Install app dependencies and seed the database with demo data

gem install bundler --conservative
bundle exec rake db:setup

Run the server

$ bin/dev

Note bin/dev starts a sever in the demo directory. Just executing rails server will not work.

Visit http://localhost:3000

Login in one of the demo users (in order of role permissiveness):

  • superkch
  • kchdoc
  • kchnurse
  • kchguest

They all share the password renalware

Running tests

Install chromedriver

MacOS

  • Install Chrome
  • Download chromedriver from eg here
  • Unzip and place in location in your PATH eh /usr/local/bin
  • If you have chromedriver errors it maybe your installed version of Chrome is not compatible your chromedriver version. In this case check your versions with:
chromedriver -v
chrome -v

and consult the driver release notee eg for 2.38 to check compatibility

Ubuntu

sudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
sudo echo "deb [arch=amd64]  http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
sudo apt-get -y update
sudo apt-get -y install google-chrome-stable

Download latest chromedriver from wget https://chromedriver.storage.googleapis.com/index.html e.g.

wget https://chromedriver.storage.googleapis.com/81.0.4044.69/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver

RSpec unit and integration tests

bundle exec rspec

Cucumber acceptance tests

Run domain tests which bypass the UI:

bundle exec cucumber

Run web tests exercising the UI:

bundle exec cucumber TEST_DEPTH=web --profile rake_web

Test coverage reports can be found in coverage/

Code Quality

Code quality can be analyzed using by running codeclimate analyze. To setup CodeClimate locally read the setup instructions:

https://github.com/codeclimate/codeclimate

Deploying

General notes

Engine migrations

config.active_record.schema_format = :sql in application.rb is used the engine uses Postgres views and functions which are not properly supported in a schema.rb

Creating scenic views

As we are an engine this is the workaround for now.

  bundle exec demo/bin/rails generate scenic:view my_view_name

Then copy the new files from demo/db/views and demo/db/migrations to ./db/views and ./db/migrations

Throttling login attempts

rack-attack is configured to throttle login attempts. Only 10 attempts per username as permitted in any one minute in an attempt to thwart login attacks.

Test Configuration

RSpec is configured to silence backtrace from third-party gems. This can be configured in .rspec with --backtrace which will display the full backtrace.

Docker - WIP

docker-compose run web bundle exec rake db:setup
docker-compose up -d

Browser testing

Browserstack logo

renalware-core's People

Contributors

dependabot[bot] avatar dmgarland avatar evanrolfe avatar frahugo avatar mtomov avatar narkoz avatar nicholasjhenry avatar op48 avatar paulnordstromaugust avatar steventux avatar woodpigeon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

tomkirby

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.