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
22 changes: 19 additions & 3 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ jobs:
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: '14.x'
clean: true

- uses: actions/setup-node@v1
with:
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 }}
Expand All @@ -29,12 +33,24 @@ jobs:

steps:
- uses: actions/checkout@v1

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install OpenSSL 1.1 on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libssl1.1 || {
# Fallback for newer Ubuntu versions
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
}

- run: npm install
- run: git submodule update --init
- run: npm test
env:
CI: true
CI: true
1 change: 1 addition & 0 deletions .github/workflows/docker-cd-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
clean: true

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
clean: true

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
clean: true

- name: Test Server Docker image Builds
run: docker build .
3 changes: 2 additions & 1 deletion .github/workflows/docker-tag-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true

clean: true

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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The FHIR server built into the REMS Admin can be queried for the questionnaire p
- Input requires a parameter containing the following:
- `patient` - Patient FHIR Resource, must include `medication` with `patient`
- `medication` - Medication or MedicationRequest FHIR Resource, must include `patient` with `medication`
- `authNumber` - String containing the REMS Authorization Number, may be sent without `patient` or `medication`
- `caseNumber` - String containing the REMS Case Number, may be sent without `patient` or `medication`
- Returns a GuidanceResponse within a Parameter with the status
- Contains Nested GuidanceResponse resources for each ETASU requirement with their status
- `/4_0_0/Questionnaire/\<form-name\>/$questionnaire-package` - The endpoint for the FHIR Operation used for retrieving the Questionnaire package for a given form
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/views/DataViews/CaseCollection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import FormPopup from '../FormPopup';

export type RemsCase = {
case_number?: string;
auth_number?: string;
patientFirstName?: string;
patientLastName?: string;
patientDOB?: string;
Expand Down Expand Up @@ -162,7 +161,6 @@ const CaseCollection = (props: { refresh: boolean }) => {
<TableCell align="right">Patient DOB</TableCell>
<TableCell align="right">Status</TableCell>
<TableCell align="right">Dispense Status</TableCell>
<TableCell align="left">Authorization Number</TableCell>
<TableCell align="right">Met Requirements</TableCell>
<TableCell align="right">Delete</TableCell>
</TableRow>
Expand All @@ -180,7 +178,6 @@ const CaseCollection = (props: { refresh: boolean }) => {
<TableCell align="right">{row.patientDOB}</TableCell>
<TableCell align="right">{row.status}</TableCell>
<TableCell align="right">{row.dispenseStatus}</TableCell>
<TableCell align="right">{row.auth_number}</TableCell>
<TableCell align="center">{metReq}</TableCell>
<TableCell align="right">
<IconButton
Expand Down
2 changes: 1 addition & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
base: '',
plugins: [react()],
preview: {
allowedHosts: ['.mitre.org', '.us-east-1.elb.amazonaws.com'],
allowedHosts: ['.mitre.org', '.us-east-1.elb.amazonaws.com']
},
define: {
'process.env': process.env
},
server: {
port: parseInt(process.env.FRONTEND_PORT!),

Check warning on line 18 in frontend/vite.config.ts

View workflow job for this annotation

GitHub Actions / Check tsc, lint, and prettier

Forbidden non-null assertion

Check warning on line 18 in frontend/vite.config.ts

View workflow job for this annotation

GitHub Actions / Check tsc, lint, and prettier

Forbidden non-null assertion
open: false,
host: true
}
Expand Down
6 changes: 3 additions & 3 deletions src/fhir/guidanceResponseUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class GuidanceResponseUtilities {
etasu: Pick<
RemsCase,
| 'drugName'
| 'auth_number'
| 'case_number'
| 'status'
| 'drugCode'
| 'patientFirstName'
Expand Down Expand Up @@ -78,15 +78,15 @@ export class GuidanceResponseUtilities {
outputParameters.parameter?.push(parameter);
}
});
outputParameters.parameter?.push({ name: 'auth_number', valueString: etasu?.auth_number });
outputParameters.parameter?.push({ name: 'case_number', valueString: etasu?.case_number });
return outputParameters;
}

static createEtasuGuidanceResponse(
etasu: Pick<
RemsCase,
| 'drugName'
| 'auth_number'
| 'case_number'
| 'status'
| 'drugCode'
| 'patientFirstName'
Expand Down
2 changes: 0 additions & 2 deletions src/fhir/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export interface MetRequirements extends Document {

export interface RemsCase extends Document {
case_number: string;
auth_number: string;
status: string;
dispenseStatus: string;
drugName: string;
Expand Down Expand Up @@ -90,7 +89,6 @@ export const metRequirementsCollection = model<MetRequirements>(

const remsCaseCollectionSchema = new Schema<RemsCase>({
case_number: { type: String },
auth_number: { type: String },
status: { type: String },
dispenseStatus: { type: String },
drugName: { type: String },
Expand Down
14 changes: 3 additions & 11 deletions src/lib/etasu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,14 @@
res.send(await remsCaseCollection.findOne({ case_number: req.params.caseId }));
});

router.get('/met/auth/:authNumber', async (req: Request, res: Response) => {
console.log('get etasu by authnumber: ' + req.params.authNumber);
res.send(await remsCaseCollection.findOne({ auth_number: req.params.authNumber }));
});

export const getCaseInfo = async (
remsCaseSearchDict: FilterQuery<RemsCase>,
medicationSearchDict: FilterQuery<Medication>
): Promise<Pick<
RemsCase,
| 'status'
| 'drugName'
| 'auth_number'
| 'case_number'
| 'drugCode'
| 'patientFirstName'
| 'patientLastName'
Expand All @@ -66,7 +61,7 @@
RemsCase,
| 'status'
| 'drugName'
| 'auth_number'
| 'case_number'
| 'drugCode'
| 'patientFirstName'
| 'patientLastName'
Expand All @@ -75,7 +70,7 @@
> = {
status: 'Approved',
drugName: drug?.name,
auth_number: remsCaseSearchDict.auth_number || '',
case_number: remsCaseSearchDict.case_number || '',
drugCode: drug?.code,
patientFirstName: remsCaseSearchDict.patientFirstName || '',
patientLastName: remsCaseSearchDict.patientLastName || '',
Expand Down Expand Up @@ -230,7 +225,6 @@
const remsRequest: Pick<
RemsCase,
| 'case_number'
| 'auth_number'
| 'status'
| 'dispenseStatus'
| 'drugName'
Expand All @@ -241,7 +235,6 @@
| 'metRequirements'
> = {
case_number: case_number,
auth_number: '',
status: remsRequestCompletedStatus,
dispenseStatus: dispenseStatusDefault,
drugName: drug?.name,
Expand Down Expand Up @@ -377,7 +370,7 @@
// _id comparison would not work for some reason
if (req4?.requirementName === matchedMetReq.requirementName) {
metReqArray[i].completed = true;
req4!.completed = true;

Check warning on line 373 in src/lib/etasu.ts

View workflow job for this annotation

GitHub Actions / Check tsc, lint, and prettier

Forbidden non-null assertion

Check warning on line 373 in src/lib/etasu.ts

View workflow job for this annotation

GitHub Actions / Check tsc, lint, and prettier

Forbidden non-null assertion
await remsCaseCollection.updateOne(
{ _id: remsRequestToUpdate?._id },
{ $set: { metRequirements: metReqArray } }
Expand All @@ -390,7 +383,6 @@

if (!foundUncompleted && remsRequestToUpdate?.status === 'Pending') {
remsRequestToUpdate.status = 'Approved';
remsRequestToUpdate.auth_number = uid();
await remsRequestToUpdate.save();
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/services/guidanceresponse.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports.remsEtasu = async (args: any, context: any, logger: any) => {
const parameters: Parameters = args?.resource;
let patient: Patient | undefined;
let medication: Medication | MedicationRequest | undefined;
let authNumber: string | undefined;
let caseNumber: string | undefined;

parameters?.parameter?.forEach(param => {
if (param?.name === 'patient' && param?.resource?.resourceType === 'Patient') {
Expand All @@ -69,15 +69,15 @@ module.exports.remsEtasu = async (args: any, context: any, logger: any) => {
param.resource?.resourceType === 'MedicationRequest')
) {
medication = param.resource;
} else if (param?.name === 'authNumber') {
authNumber = param.valueString;
} else if (param?.name === 'caseNumber') {
caseNumber = param.valueString;
}
});

let etasu: Pick<
RemsCase,
| 'drugName'
| 'auth_number'
| 'case_number'
| 'status'
| 'drugCode'
| 'patientFirstName'
Expand All @@ -86,9 +86,9 @@ module.exports.remsEtasu = async (args: any, context: any, logger: any) => {
| 'metRequirements'
> | null;

if (authNumber) {
if (caseNumber) {
const remsCaseSearchDict = {
auth_number: authNumber
case_number: caseNumber
};

const medicationSearchDict = {};
Expand Down
18 changes: 9 additions & 9 deletions test/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('REMSServer class', () => {
const set = sinon.spy(server.app, 'set');
const use = sinon.spy(server.app, 'use');

server.configureMiddleware();
server.configureMiddleware({});
expect(set.callCount).to.equal(6);
expect(set.getCall(4).args[0]).to.equal('showStackError');
expect(set.getCall(4).args[1]).to.be.true;
Expand Down Expand Up @@ -87,20 +87,20 @@ describe('REMSServer class', () => {
});

it('should be able to prepopulate data without error', async () => {
expect(await metRequirementsCollection.count({})).to.equal(0);
expect(await medicationCollection.count({})).to.equal(0);
expect(await metRequirementsCollection.countDocuments({})).to.equal(0);
expect(await medicationCollection.countDocuments({})).to.equal(0);
await FhirUtilities.populateDB();
expect(await metRequirementsCollection.count({})).to.not.equal(0);
expect(await medicationCollection.count({})).to.not.equal(0);
expect(await metRequirementsCollection.countDocuments({})).to.not.equal(0);
expect(await medicationCollection.countDocuments({})).to.not.equal(0);
await FhirUtilities.populateDB();
});

it('should be able to load artifacts from filesystem', async () => {
expect(await LibraryModel.count({})).to.equal(0);
expect(await QuestionnaireModel.count({})).to.equal(0);
expect(await LibraryModel.countDocuments({})).to.equal(0);
expect(await QuestionnaireModel.countDocuments({})).to.equal(0);
await FhirUtilities.loadResources('./test/fixtures/cds-library');
expect(await LibraryModel.count({})).to.not.equal(0);
expect(await QuestionnaireModel.count({})).to.not.equal(0);
expect(await LibraryModel.countDocuments({})).to.not.equal(0);
expect(await QuestionnaireModel.countDocuments({})).to.not.equal(0);
await FhirUtilities.loadResources('./test/fixtures/cds-library');
});
});