/hmis-frontend

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

HMIS Front End

Developer Installation

Install Node, NPM, and Yarn

  1. Install NVM

    brew update
    brew install nvm
    # Follow the instructions to update your shell configuration file.
  2. Install the Node version specified in .nvmrc

    nvm install
    nvm use
  3. Enable Yarn

    corepack enable

Run local development server

  1. Add to /etc/hosts:

    ::1         hmis.dev.test
    127.0.0.1   hmis.dev.test
  2. Install npm dependencies

    yarn install
  3. Run dev server with live reload

    yarn dev

Test, lint, format, and type check

yarn test
yarn lint
yarn format
yarn tsc

Build for Production

Preview production build

yarn build && yarn preview

Updating Codegen

Use the graphql:codegen script to update generated types.

SCHEMA_PATH=<path to schema.graphql> yarn graphql:codegen

Upgrading NPM Packages

To add or grade an NPM package, you can edit the package.json OR run yarn add OR run yarn upgrade OR run yarn upgrade-interactive.

# 1. edit package.json, or run yarn add/upgrade
# 2. download packages and update the yarn.lock
yarn install
# 3. remove duplicate packages
yarn yarn-deduplicate
# 4. always commit changes to these files
git add yarn.lock package.json

E2E tests

See the HMIS README in the Warehouse repo for instructions on running end-to-end tests.

Backend configuration

The frontend communicates with the OpenPath warehouse. Once you have the warehouse development environment up, follow the steps below to configure it for HMIS.

Open Path Warehouse Setup for HMIS

Set these variables in hmis-warehouse/.env.local to enable the HMIS GraphQL endpoints:

ENABLE_HMIS_API=true
HMIS_HOSTNAME=hmis.dev.test

Next, run the db seed to set up the HMIS Data Source and an HMIS Administrator user.

rails db:seed

You should see the HMIS data source here: https://hmis-warehouse.dev.test/data_sources

HMIS Admin

The above will enable the warehouse API and grant a user access to HMIS Admin in the right-rail of the warehouse UI, and the remaining configuration is done via the UI.

Use this tool to grant yourself further access by enabling additional permissions on the "HMIS Administrator" role.

Tips & Tricks

Assessment Forms Configuration

The HMIS asesssment form definitions are created with the command

rails driver:hmis:seed_definitions

This must be run once to populate the database, and re-run any time the form definitions are changed.

Custom Services Seed

Run this to setup custom services:

rails driver:hmis:seed_service_types

Changing the GraphQL Schema

After making any change to the GraphQL schema, run this:

rails driver:hmis:dump_graphql_schema

To pick up the local schema changes on the frontend, run the graphql:codegen script (see above).