Git Product home page Git Product logo

hmda-frontend's Introduction

HMDA Frontend Projects

The HDMA Frontend monorepo hosts the public facing applications for the collection, publication, and navigation of millions of HMDA records per year. This repository combines six, previously separate, React application repos in order to simplify component sharing, synchronize versioning of common dependencies, and improve rendering efficiency when navigating between apps.

Contents

Technical Overview

Each React application lives in it's own sub-directory of the /src folder, with shared assets and components housed in /common. All sub-applications are rendered as asynchronous components within an application shell /App.jsx that provides a common header. This approach eliminates unneccesary reloading of the site-wide navigation, giving the separate apps a more connected feel. React Router is used for client side routing with React Redux integrated for state management of the more complex apps, such as Filing. Unit tests are developed using Enzyme and end-to-end testing performed with Cypress. Dependencies are managed with yarn.

Applications

HMDA Homepage

HMDA Homepage is a single-page app providing easy access to the HMDA applications, tools, data products, and documentation.

HMDA Filing

The HMDA Filing Platform UI allows lending institutions to submit HMDA records, resolve errors, verify edits, review submission status and history, and sign submissions.

HMDA Data Browser

The HMDA Data Browser enables users to easily filter and download aggregated HMDA datasets.

HMDA Platform Tools

The HMDA Platform Tools assist filers in the preparation of submission data, including calculation of Rate Spread, generation and validation of Check Digits, as well as submission file generation and format verification.

HMDA Documentation

The HMDA Documentation site provides product FAQs, detailed Filing instructions, data publication schema and usage guides, as well as direction for using the HMDA Tools. Documentation content is hosted as easily editable Markdown files, loaded on-demand with the Fetch API, and rendered dynamically using the markdown-to-jsx library. This allows updates to be pushed to Production without a project redeployment.

HMDA Data Publication

HMDA Data Publication provides datasets and reports of HMDA data collected in or after 2017 which, combined with Census demographic data, can be used for data analysis purposes.

Development

Requirements

  • Node >= v12.4.1
  • Yarn

Installation

  • Clone repo
  • Run yarn from repo root to install depencencies

Running Locally

Several components of the Frontend (ex. Filing, Data Browser) require a connection to the HMDA Platform in order to operate. You can find instructions for the running the HMDA Platform locally here.

HMDA Help requires a connection to the HMDA Institutions API in order to operate. You can find instructions for the running the HMDA Institutions API locally in the README. Note that having the HMDA Platform running is a pre-requisite to starting the HDMA Institutions API.

If your development does not require this integration, yarn start will run the development server, opening a browser window to http://localhost:3000.

Integrating with the Filing application

By default, the locally running Frontend is configured to use the Filing API from the locally running Platform. In order to go through the Filing process, there are a few elements that need to be completed first:

  • Create Institutions (Platform)
  • Bypass API authentication (Platform)
  • Configure the UI (Frontend)
Create Institutions

Before you can submit a Filing you need to have an Institution created on the Platform for each year you want to test. The following command will generate the required data for the default test Institution, for all currently available filing periods. You need to have the HMDA Platform started before running this command:

yarn ci-data

To create data for an Institution other than the default FRONTENDTESTBANK9999, you can modify cypress/ci/config/institutions.json and rerun the above command.

This Institution loading needs to be done each time the HMDA Platform is restarted.

Bypass API Authentication

On the Platform, you will need to set an environment variable to prevent the API from requiring an authentication token for incoming requests. If already running, you will need to restart the Platform.

export HMDA_RUNTIME_MODE=dev
Configure the UI

If you will be testing against an Institution that is not the default, you can configure this via a REACT_APP_* variable:

REACT_APP_LEIS=INSTITUTION1,INSTITUTION2

Second, you will need to bypass Frontend authentication. This is most easily done by running the Frontend the way we do in a Continuous Integration environment:

yarn ci

To combine these configuration options

REACT_APP_LEIS=INSTITUTION1,INSTITUTION2 yarn ci

You can now visit the filing application at http://localhost:3000/filing.

Running via Docker

To see the application running in a container you can run:

docker build -t hmda/hmda-frontend .
docker run -p 8080:8080 hmda/hmda-frontend

To build using docker-compose:

docker-compose build

Testing

Unit Tests

yarn test

Enzyme enables isolated testing of React components. Unit tests providing verification of feature implementation while also serving as suite of regression tests.

End-to-End Testing

yarn run cypress run

Cypress is used to perform end-to-end testing of the filing application, tools, data publication products, and data browser. It mimicks a user's interaction with the site and allows for rapid, automated system validation of project deployments.

Cypress automated filing test

Running in TravisCI

TravisCI is configured to automatically build and test each pull request to the Frontend repo. This includes running the HMDA Platform within the TravisCI virtual machine to enable testing of the Filing application. All mandatory environment variables are configured in the .travis.yml file.

Generation of video recordings is disabled by default using TravisCI environment variables.

CONFIG="--config video=false"

In the event that you need to review video to help debug CI failures, update the environment configuration as follows. This will save the video output to the Cypress Dashboard.

CONFIG="--config video=true"
RECORD="--record"
CYPRESS_RECORD_KEY=<Configured in TravisCI>

hmda-frontend's People

Contributors

audayshankar avatar barakstout avatar chynnakeys avatar kgudel avatar kibrael avatar mattperrine avatar meissadia avatar mikeroachj avatar omnipresent07 avatar patrickgoraft avatar roachmj avatar wpears avatar zencircle 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.