Surveillance Data Platform Content Based Routing (SDP-CBR)
This Github organization was created for use by CDC programs to collaborate on public health surveillance related projects in support of the CDC Surveillance Strategy. This third party web application is not hosted by the CDC, but is used by CDC and its partners to share information and collaborate on software.
This repository serves as a template for other repositories to follow in order to provide the appropriate notices for users in regards to privacy protection, contribution, licensing, copyright, records management and collaboration.
This project constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication. All contributions to this project will be released under the CC0 dedication. By submitting a pull request you are agreeing to comply with this waiver of copyright interest.
The project utilizes code licensed under the terms of the Apache Software License and therefore is licensed under ASL v2 or later.
This program is free software: you can redistribute it and/or modify it under the terms of the Apache Software License version 2, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache Software License for more details.
You should have received a copy of the Apache Software License along with this program. If not, see http://www.apache.org/licenses/LICENSE-2.0.html
Anyone is encouraged to contribute to the project by forking and submitting a pull request. (If you are new to GitHub, you might start with a basic tutorial.) By contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users under the terms of the Apache Software License v2 or later.
All comments, messages, pull requests, and other submissions received through CDC including this GitHub page are subject to the Presidential Records Act and may be archived. Learn more at http://www.cdc.gov/other/privacy.html.
This project is not a source of government records, but is a copy to increase collaboration and collaborative potential. All government records will be published through the CDC web site
Thanks to 18F's open source policy and code of conduct that were very useful in setting up this GitHub organization. Thanks to CDC's Informatics Innovation Unit that was helpful in modeling the code of conduct.
This example demonstrates how to configure Camel routes in Spring Boot via a Spring XML configuration file.
The application can be built with the following command
mvn clean package
The application depends on a number of databases and connections in order to run. All databases are defined in the application properties, which should be configured for the environment.
Required databases for deployment are the phinMsDataSource and sdpqDataSource. The phinMsDataSource should have the table message_inq, which can be created in SQLServer using the script at main/db/MSSQL_message_inq.sql. The other tables will be created as needed by the application.
The application unit tests can be run with the following command
In order for the tests to succeed, the test datasources must be properly configured. All test datasources are specified in the test properties file at src/test/resources/application.properties. If any of the datasources are not configured, the tests will fail.
Required databases for tests are nndssDataSource, sdpqDataSource, and phinMsDataSource. The phinMsDataSource should have the table message_inq, which can be created in SQLServer using the script at main/db/MSSQL_message_inq.sql. The other tables will be created as needed by the application.
Running the application in OpenShift
The application is setup as a series of maven sub modules. The sub modules comprise both reusable components such as the database queue component as well as modules that comprise portions of the application that are meant to be run. The two modules that are meant to be run are the phinms and foodnet modules. You can run either of these on OpenShift with the following description provided the commands are executed from within the modules sub directory. It is assumed that:
- OpenShift platform is already running, if not you can find details how to Install OpenShift at your site.
- Your system is configured for Fabric8 Maven Workflow, if not you can find a Get Started Guide
The application can be built and run on OpenShift using a single goal:
To list all the running pods:
oc get pods
Then find the name of the pod that runs this quickstart, and output the logs from the running pods with:
oc logs <name of pod>
You can also use the OpenShift web console to manage the running pods, and view logs and much more.
Running via an S2I Application Template
Application templates allow you deploy applications to OpenShift by filling out a form in the OpenShift console that allows you to adjust deployment parameters. This template uses an S2I source build so that it handle building and deploying the application for you.
First, import the Fuse image streams:
oc create -f https://raw.githubusercontent.com/jboss-fuse/application-templates/GA/fis-image-streams.json
Then create the quickstart template:
oc create -f https://raw.githubusercontent.com/jboss-fuse/application-templates/GA/quickstarts/spring-boot-camel-xml-template.json
Now when you use "Add to Project" button in the OpenShift console, you should see a template for this quickstart.
The s2i templates will build the entire project and assumes that the resulting build will place the application in a single jar file in the top level target directory of the project. As this is not the case for this project's setup you will need to add an environment variable that will inform the s2i template where to look for the resulting jar file to run. The variable is ARTIFACT_DIRECTORY and it must be set to either phinms/target or foodNet/target depending on which route is being deployed.
Deploying SDP-CBR in an empty OpenShift project
A repository of scripts and templates has been created which can be used to generate a deployment of CBR in an empty OpenShift project. The command used to generate the initial (un-parameterized) version of the main CBR template is the following:
oc export is,bc,dc,svc,cm,secret,pvc -l promotion-group=cbr -o yaml --as-template="cbr" > sdp-cbr-project-template.yaml
In order to replicate the resource quotas/constraints present across environments, the following commands were used to generate the Quota and LimitRange files:
oc export quota/sdpcbr-quota -o yaml > sdpcbr-quota.yaml oc export LimitRange/sdpcbr-limits -o yaml > sdpcbr-limits.yaml
Running the application locally
The maven command to build the application described above produces an all-in-one jar file that can be run locally for both the foodnet and phinms sub modules. The jar files are created in the target directory of the individual sub projects and can be run with the following commands.
java -jar foodNet/target/sdp-cbr-foodnet-1.1.0.jar java -jar phinms/target/sdp-cbr-phinms-1.1.0.jar
When running locally, the application can be configured through extenal properties files according to the spring boot framework conventions. Information on this external configuration can be found in the Spring Boot documentation in the chapter Externalized Configuration.
The base properties for the application are contained in the src/main/resources/application.properties file. This file is basically a template for fields that will need to be filled out in order for the routes to run. Please review the file in order to understand the configuration parameters that are required.
Running CBR in Minishift or Red Hat Container Development Kit (CDK)
It does not seem possible to run CBR successfully in Minishift or CDK while connected to a VPN and behind a corporate firewall. The workaround suggested in Minishift and CBR documentation is to shutdown the VPN, but this may be a violation of your orgainization's policies.
Filtering on HL7 message contents
The HL7Terser is designed to allow for complex filter parameters to be defined via the routes in the camel-context.xml file. For more information on filter syntax, please review the syntax instruction in [Definitions.txt](Filter Definitions.txt).