Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
SERVER_PORT=33333
SERVER_HOST=127.0.0.1
SERVER_PORT=3323
SERVER_HOST=0.0.0.0
SPL_ZIP_PATH=/src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip
REMS_ADMIN_1_URL=http://localhost:8090/
REMS_ADMIN_2_URL=http://localhost:8095/
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Describe your changes

Please include a summary of the changes and the related issue/task. Please also include relevant motivation and context. List any dependencies that are required for this change, including links to other pull requests/branches in other repositories if applicable.

## Issue ticket number and Jira link

Please include the Jira Ticket Number and Link for this issue/task.

## Checklist before requesting a review
- [ ] I have performed a self-review of my code
- [ ] Ensure the target / base branch for any feature PR is set to `dev` not main (the only exception to this is releases from `dev` and hotfix branches)

## Checklist for conducting a review
- [ ] Review the code changes and make sure they all make sense and are necessary.
- [ ] Pull the PR branch locally and test by running through workflow and making sure everything works as it is supposed to.

## Workflow

Owner of the Pull Request will be responsible for merge after all requirements are met, including approval from at least one reviewer. Additional changes made after a review will dismiss any approvals and require re-review of the additional updates. Auto merging can be enabled below if additional changes are likely not to be needed. The bot will auto assign reviewers to your Pull Request for you.

40 changes: 40 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# name: Lint and Test

# on: [push, pull_request]

# jobs:
# lint:
# name: Check tsc, lint, and prettier
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
# - name: Checkout Repository
# uses: actions/checkout@v3
# with:
# submodules: true
# node-version: '18.x'

# - run: npm install
# - run: npm run lint
# - run: npm run prettier
# env:
# CI: true
# test:
# name: Test on node ${{ matrix.node-version }} and ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]
# node-version: [18]

# steps:
# - uses: actions/checkout@v1
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - run: npm install
# - run: git submodule update --init
# - run: npm test
# env:
# CI: true
41 changes: 41 additions & 0 deletions .github/workflows/docker-cd-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Development Image CD

on:
push:
branches: [ dev ]
workflow_dispatch:

jobs:
docker-cd:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta data
id: docker-meta-data
uses: docker/metadata-action@v4
with:
images: codexrems/rems-directory
flavor: latest=false

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push Server Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: codexrems/rems-directory:experimental
labels: ${{ steps.docker-meta-data.outputs.labels }}
41 changes: 41 additions & 0 deletions .github/workflows/docker-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Image CD

on:
push:
branches: [ main ]
workflow_dispatch:

jobs:
docker-cd:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta data
id: docker-meta-data
uses: docker/metadata-action@v4
with:
images: codexrems/rems-directory
flavor: latest=false

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push Server Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: codexrems/rems-directory:latest
labels: ${{ steps.docker-meta-data.outputs.labels }}
20 changes: 20 additions & 0 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Docker Image CI

on:
pull_request:
branches: [ main, dev ]
workflow_dispatch:


jobs:
docker-ci:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true

- name: Test Server Docker image Builds
run: docker build .
41 changes: 41 additions & 0 deletions .github/workflows/docker-tag-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Tagged Image CD
on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
docker:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta data
id: docker-meta-data
uses: docker/metadata-action@v4
with:
images: codexrems/rems-directory
flavor: latest=false

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker-meta-data.outputs.tags }}
labels: ${{ steps.docker-meta-data.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
logs
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:21-alpine
WORKDIR /home/node/app/rems-directory

COPY --chown=node:node . .
RUN npm install
EXPOSE 3323

HEALTHCHECK --interval=30s --start-period=15s --timeout=10m --retries=10 CMD wget --no-verbose --tries=1 --spider http://localhost:33333/health || exit 1
CMD npm run dev
10 changes: 10 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:21-alpine
WORKDIR /home/node/app/rems-directory

COPY --chown=node:node . .
RUN npm install
EXPOSE 3323
EXPOSE 3324

HEALTHCHECK --interval=30s --start-period=15s --timeout=10m --retries=10 CMD wget --no-verbose --tries=1 --spider http://localhost:33333/health || exit 1
CMD ./dockerRunnerDev.sh
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Description

The [REMS](https://www.fda.gov/drugs/drug-safety-and-availability/risk-evaluation-and-mitigation-strategies-rems) directory application is an app that acts as a API endpoint similar to the FDA API. It returns medication information when queried at the /drug/ndc.json endpoint. It adds the rems_endpoint that identifies the CDS Hooks server used by the REMS program.
The [REMS](https://www.fda.gov/drugs/drug-safety-and-availability/risk-evaluation-and-mitigation-strategies-rems) directory application is an app that acts as a API endpoint similar to the FDA API. It returns medication information when queried at the /drug/ndc.json endpoint. It adds the rems_endpoint that identifies the CDS Hooks server used by the REMS program. The /drugs/spl.zip returns spl information for the drugs it has spl info for, providing a zip file similar to the one from the FDA's website. The /health endpoint is a simple health check endpoint to make sure the server is live and online.

Disclaimer: The SPL Zip file information is test data not to be representative of real world SPL information. While they are based on the actual SPL Zip from FDA, the files have been modified for the purposes of the prototype and may even be out of date. The data in these files are not intended for medical use.

# Getting Started with REMS Administrator

Expand Down Expand Up @@ -49,4 +51,7 @@ Following are a list of modifiable paths:
| URI Name | Default | Description |
| --------------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| SERVER_PORT | 33333 | The port to run the server on. |
| SERVER_HOST | `127.0.0.1` | The hostname of the server. |
| SERVER_HOST | `127.0.0.1` | The hostname of the server. |
| SPL_ZIP_PATH | /src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip | the path to the spl zip |
| REMS_ADMIN_1_URL | http://localhost:8090/ | the base url for the first rems admin |
| REMS_ADMIN_2_URL | http://localhost:8095/ | the base url for the second rems admin |
44 changes: 44 additions & 0 deletions dockerRunnerDev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh

# Handle closing application on signal interrupt (ctrl + c)
trap 'kill $CONTINUOUS_INSTALL_PID $SERVER_PID; gradle --stop; exit' INT

mkdir logs
# Reset log file content for new application boot
echo "*** Logs for continuous installer ***" > ./logs/installer.log
echo "*** Logs for 'npm run start' ***" > ./logs/runner.log

# Print that the application is starting in watch mode
echo "starting application in watch mode..."

# Start the continious build listener process
echo "starting continuous installer..."
npm install

( package_modify_time=$(stat -c %Y package.json)
package_lock_modify_time=$(stat -c %Y package-lock.json)
while sleep 1
do
new_package_modify_time=$(stat -c %Y package.json)
new_package_lock_modify_time=$(stat -c %Y package-lock.json)

if [[ "$package_modify_time" != "$new_package_modify_time" ]] || [[ "$package_lock_modify_time" != "$new_package_lock_modify_time" ]]
then
echo "running npm install..."
npm install | tee ./logs/installer.log
fi

package_modify_time=$new_package_modify_time
package_lock_modify_time=$new_package_lock_modify_time

done ) & CONTINUOUS_INSTALL_PID=$!

# Start server process once initial build finishes
( npm run dev | tee ./logs/runner.log ) & SERVER_PID=$!

# Handle application background process exiting
wait $CONTINUOUS_INSTALL_PID $SERVER_PID
EXIT_CODE=$?
echo "application exited with exit code $EXIT_CODE..."


22 changes: 13 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^22.13.13",
"tsc-watch": "^6.2.1",
"typescript": "^5.6.3"
},
"dependencies": {
"@types/node": "^22.10.0",
"dotenv": "^16.4.7",
"env-var": "^7.5.0",
"runner": "^4.0.1"
Expand Down
Loading
Loading