Skip to content

USEPA/EPADecon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

The Wide-Area Biodecon Resource Estimation Tool (WABRET) estimates the cost and time associated with a remediation effort following the release of a biological agent in human-usable indoor, outdoor, and underground areas. The WABRET utilizes a vairety of equations to calculate the cost and time associated with seven components of the decontamination process, including:

  1. Incident Command: the oversight of all personnel and processes
  2. Characterization Sampling: the initial sampling of surfaces to determine the contaminant levels present before decontamination
  3. Source Reduction: the removal of material from the site area prior to decontamination to save the cost of decontaminating said materials
  4. Decontamination: the treatment of surfaces to remove contaminant
  5. Verification Sampling: the sampling of surfaces after decontamination to determine if the decontamination approach was efficacious.
  6. Clearance Sampling: the sampling of surfaces after decontamination to determine if additional decon treatments are required to fully decon the area
  7. Waste Sampling: the sampling of waste materials generated by decontamination to ensure proper disposal procedures are followed
  8. Travel: personnel traveling to and from the site area

Getting Started

Software Dependencies

Running the Application

Each release's assets will contain an executable that can be downloaded and run. Click here to access the latest release. Please note that the software dependenices listed above will need to be installed for the application to work.

More Information

A report containing more information on the methodology used by this tool can be found here.

Contribute

Follow the standards set forth by the group for all .NET development.

Development Dependencies

It is recommended that development is completed in two enviroments:

  1. Changes to .NET code (backend functionality) in Visual Studio 2022
  2. Changes to VueJS code (frontend functionality) in Visual Studio Code

Visual Studio Code Extensions Required

To ensure consistency in refactoring and linting, please ensure the following extensions are installed to your Visual Studio Code:

  • ESLint (2.2.2)
  • Vetur (0.35.0)
  • Prettier - Code formatter (9.3.0)
  • Tasks (0.9.0)

Visual Studio Code Settings

To ensure consistency in refactoring and linting, please ensure your Visual Studio Code settings include the following:

{
  ...,
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  "editor.tabSize": 2,
  "editor.detectIndentation": false,
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "wrap_attributes": "force-expand-multiline",
    },
    "prettyhtml": {
      "printWidth": 100,
      "singleQuote": false,
      "wrapAttributes": true,
      "sortAttributes": false
    },
    "prettier": {
      "singleQuote": true,
      "trailingComma": "all"
    },
  },
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    {
      "prefixWithI": "always"
    },
    {
      "language": "typescript"
    },
    {
      "language": "typescriptreact"
    }
  ],
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  ...,
}

Running the Application in Development

The Wide-Area Biodecon Resource Estimation Tool is an ASP.Net Core application with a VueJs TypeScript frontend.

Ensure that all dependencies listed above are installed and configured appropriately. When first getting started with the application, clone the repository in the folder of your choice. This initial step should only be performed once:

  1. Open the Battelle.EPA.WideAreaDecon.Client folder in Visual Studio Code
  2. Click the "Run API Server" button on the bottom toolbar
  3. Once the API server is running, click the "Run and Debug" button on the lefthand side toolbar (or 'Ctrl + Shift + D') to open the correct toolbar
  4. Click the green 'Run and Debug' arrow at the top of the displayed toolbar
  5. This should open a web browser with the tool
  6. Alternatively, once the API server is running, you can navigate to localhost:5005 in a web browser

Unit Testing for .NET

Adding Tests

To add unit tests in .NET code:

  1. Open the Battelle.EPA.WideAreaDecon.sln solution in Visual Studio
  2. Select the 'Test' option in the top toolbar
  3. Open the Test Explorer by selecting the 'Test Explorer' option from the dropdown menu
  4. Add a test to the Battelle.EPA.WideAreaDecon.API.Tests, Battelle.EPA.WideAreaDecon.InterfaceData.Tests, or Battelle.EPA.WideAreaDecon.Model.Tests project by clicking the dropdown arrow next to the project in the Solution Explorer pane
  5. Add a new test file by right-clicking the desired location, hovering over the 'Add' option, and selecting the 'New Item..." option
  6. Add a Visual C# Class item, using the Test naming convention (adding 'Tests' to the end of the class name being tested)
  7. Follow the NUnit Testing Framework, documented here: - https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-nunit#creating-the-first-test
  8. Unit tests generally follow this pattern: - Setup: where conditions for the test are setup (i.e., creating parameters to pass to the method being tested) - Test: where the method being tested is called inside of an assert or similar statement, at which point the results returned by the method are verified

Running Tests

To run unit tests in .NET code:

  1. Open the Battelle.EPA.WideAreaDecon.sln solution in Visual Studio
  2. Select the 'Test' option in the top toolbar
  3. Open the Test Explorer by selecting the 'Test Explorer' option from the dropdown menu
  4. All tests will show up in the Test Explorer pane. Run an individual test by selecting the desired test and clicking the 'Run' button in the Test Explorer pane
  5. Alternately, run all tests by clicking the 'Run All Tests In View' button in the Test Explorer pane
  6. Test results should be printed to the Test Explorer pane

Unit Testing for VueJs Typescript

Adding Tests

To add unit tests in VueJs typescript:

  1. Open the Battelle.EPA.WideAreaDecon.Client folder in Visual Studio Code
  2. Add a test by dropping down the 'tests > unit > providers' structure in the Explorer pane and right-clicking to add a .spec.ts file
  3. Use the Test naming convention (adding 'Tested' to the end of the class name being tested)
  4. Follow the Mocha Testing Framework and Chai Library, documented here: - https://mochajs.org/#getting-started - https://www.chaijs.com/
  5. Unit tests generally follow this pattern: - Setup: where conditions for the test are setup (i.e., creating parameters to pass to the method being tested) - SUT (System Under Test): where the method being tested is called - Assert: where the results returned by the method are verified
  6. The test suite is written inside of a 'describe' method, which takes a description string (such as the name of the suite) and a function containing the unit tests as parameters. Inside the describe function (before the tests) you can define any variables that multiple tests will use
  7. Unit tests are then written inside of an 'it' method, which also takes a description string and a function containing the unit test steps

Running Tests

To run unit tests in VueJs typescript:

  1. Open the Battelle.EPA.WideAreaDecon.Client folder in Visual Studio Code
  2. Run an individual test by opening the test file in Visual Studio Code and clicking the 'Run and Debug' tab on the left toolbar. Then click the 'Debug Mocha Test File' at the top of the pane
  3. Alternately, run all tests by clicking the 'Run Unit Tests' button on the bottom toolbar
  4. Test results should be printed to the terminal under the 'Debug Console' tab at the bottom of the screen

Dependency Injection in Typescript

(Inversify)[http://inversify.io/] is used to enable dependency injection in typescript. Full information on the library can be found at the website, but the steps to add a new DI dependency are:

  1. Add the appropriate interface into the src/interfaces directory (example below)
// src/interfaces/example/INumberProvider.ts
export default interface INumberProvider {
  getValue(): number;
}
  1. Add the implementation of the interface into the src/implementations directory with the injectable marking
// src/implementations/example/ExampleNumberProvider.ts
import INumberProvider from '@/interfaces/INumberProvider.ts';
import { injectable } from 'inversify';

@injectable()
export default class ExampleNumberProvider implements INumberProvider {
  // Read the docs for information on how to provide injectable members
  getValue(): number {
    retrurn 1.0;
  }
}
  1. Add a type mapping to the object found in src/dependencyInjection/types.ts - Note - read the docs for more information on the displayed used here
// src/dependencyInjection/types.ts
export const TYPES= {
  ..., // other types
  NumberProvider: Symbol('INumberProvider'),
  ..., // other types
}
  1. Add a mapping of the interface to the implementation within src/dependencyInjection/inversify.config.ts
// src/dependencyInjection/inversify.config.ts
import { Container } from 'inversify';
import 'reflect-metadata';
import { TYPES } from './types';
... // other interface imports
import INumberProvider from '@/interfaces/INumberProvider.ts';
... // other implementation imports
import ExampleNumberProvider from '@/implementations/ExampleNumberProvider.ts';

let container = new Container();

... // other implementation mappings

container
  .bind<INumberProvider>(TYPES.NumberProvider)
  .to(ExampleNumberProvider); // read the docs for more details on options for this

... // other implementation mappings

export default container
  1. Access the class from the container provider wherever it is needed
// Some file needing number provider (can be ts or vue script)
import container from '@/dependencyInjection/inversify.config.ts';
import INumberProvider from '@interfaces/INumberProvider';

... // other code

const numberProvider = container.get<INumberProvider>(TYPES.NumberProvider);
let providedNumber = numberProvider.get();

... // other code

Disclaimer

The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity , confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.