Skip to content

NATS ‐ WebEOC Integration

afwilcox edited this page Dec 5, 2024 · 4 revisions

Integration with WebEOC is provided via the WebEOC component and the NATS container.

To start the NATS container, issue the command docker-compose up nats

To start WebEOC, navigate to the webeoc directory and exetute npm start

Note that an .env file is required to start WebEOC. Here are the required parameters:

  • WEBEOC_USERNAME="COS_Integration"
  • WEBEOC_PASSWORD=
  • WEBEOC_POSITION="COS Integration Service - API"
  • WEBEOC_INCIDENT="Daily Operations"
  • WEBEOC_URL="https://bc.demo.webeocasp.com/bc/api/rest.svc"
  • WEBEOC_COMPLAINT_HISTORY_DAYS=1
  • WEBEOC_CRON_EXPRESSION="*/5 * * * *"
  • NATS_HOST="nats://localhost:4222"

Also note that if you're starting this via docker-compose that you'll want the .env file in your root directory.

High level process overview

  • The webEOC scheduler has a cron job that will poll the webEOC APIs on a set interval
  • When items are found, they are published to a Staging NATS Topic
  • The subscriber to that topic calls the backend REST api to stage the complaint and then publishes a message to a Processing NATS Topic
  • The subscriber to the processing topic calls the backend REST api to load the complaint into the live tables

Troubleshooting

  • If an item gets stuck in the processing state the stored procedures to load them into the live tables can be re-executed
  • If an item never made it to the processing state but you have the JSON from the webEOC API you can insert the JSON into the staging_complaint table and then execute the stored procedure as per above.