Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15 from HL7-DaVinci/fork-sync
Browse files Browse the repository at this point in the history
Fork Auto Sync
  • Loading branch information
smalho01 authored Mar 1, 2022
2 parents 1adf3ef + ca351a5 commit 439e53d
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 80 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ jobs:
context: .
push: true
tags: codexrems/crd:REMSvlatest

22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM gradle:6.9.0-jdk11
# Copy app files to container
COPY --chown=gradle:gradle . /CRD/
# Set working directory so that all subsequent command runs in this folder
WORKDIR /CRD
# Embed CDS Library
RUN gradle embedCdsLibrary
# Expose port to access the app
RUN gradle build
EXPOSE 8090
# Command to run our app
CMD gradle bootRun
# Copy app files to container
COPY --chown=gradle:gradle . /CRD/
# Set working directory so that all subsequent command runs in this folder
WORKDIR /CRD/server/
# Embed CDS Library
RUN gradle embedCdsLibrary
# Expose port to access the app
RUN gradle build
EXPOSE 8090
# Command to run our app
CMD gradle bootRun
26 changes: 13 additions & 13 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Base image
FROM gradle:6.9.0-jdk11
# Copy app files to container
COPY --chown=gradle:gradle . /CRD/
# Set working directory so that all subsequent command runs in this folder
WORKDIR /CRD
# Embed CDS Library
# RUN gradle embedCdsLibrary
RUN gradle build
# Expose port to access the app
EXPOSE 8090
EXPOSE 8091
# Command to run our app
CMD ./dockerRunnerDev.sh
FROM gradle:6.9.0-jdk11
# Copy app files to container
COPY --chown=gradle:gradle . /CRD/
# Set working directory so that all subsequent command runs in this folder
WORKDIR /CRD
# Embed CDS Library
# RUN gradle embedCdsLibrary
RUN gradle build
# Expose port to access the app
EXPOSE 8090
EXPOSE 8091
# Command to run our app
CMD ./dockerRunnerDev.sh
40 changes: 20 additions & 20 deletions dockerRunnerDev.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#!/bin/bash

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

mkdir logs
# Reset log file content for new application boot
echo "*** Logs for 'gradle installBootDist --continuous' ***" > ./logs/builder.log
echo "*** Logs for 'gradle bootRun' ***" > ./logs/runner.log
mkdir logs
# Reset log file content for new application boot
echo "*** Logs for 'gradle installBootDist --continuous' ***" > ./logs/builder.log
echo "*** Logs for 'gradle bootRun' ***" > ./logs/runner.log

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

# Start the continious build listener process
echo "starting continuous build listener..."
gradle build --continuous 2>&1 | tee ./logs/builder.log & CONTINUOUS_BUILD_PID=$!
# Start the continious build listener process
echo "starting continuous build listener..."
gradle build --continuous 2>&1 | tee ./logs/builder.log & CONTINUOUS_BUILD_PID=$!

# Start server process once initial build finishes
( while ! grep -m1 'BUILD SUCCESSFUL' < ./logs/builder.log; do
sleep 1
done
echo "starting crd server in debug mode..."
gradle bootRun -Pdebug | tee ./logs/runner.log ) & SERVER_PID=$!
# Start server process once initial build finishes
( while ! grep -m1 'BUILD SUCCESSFUL' < ./logs/builder.log; do
sleep 1
done
echo "starting crd server in debug mode..."
gradle bootRun -Pdebug 2>&1 | tee ./logs/runner.log ) & SERVER_PID=$!

# Handle application background process exiting
wait $CONTINUOUS_BUILD_PID $SERVER_PID
EXIT_CODE=$?
echo "application exited with exit code $EXIT_CODE..."
# Handle application background process exiting
wait $CONTINUOUS_BUILD_PID $SERVER_PID
EXIT_CODE=$?
echo "application exited with exit code $EXIT_CODE..."
19 changes: 19 additions & 0 deletions resources/src/main/java/org/cdshooks/Coding.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.cdshooks;

public class Coding {

private String code;

private String system = null;

private String display = null;

public String getCode() { return code; }
public void setCode(String code) { this.code = code; }

public String getSystem() { return system; }
public void setSystem(String system) { this.system = system; }

public String getDisplay() { return display; }
public void setDisplay(String display) { this.display = display; }
}
16 changes: 13 additions & 3 deletions resources/src/main/java/org/cdshooks/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ public class Source {

private String url = null;

private String icon = null;

private Coding topic = null;

public String getLabel() {
return label;
}

public void setLabel(String label) {
this.label = label;
}
public void setLabel(String label) { this.label = label; }

public String getUrl() {
return url;
Expand All @@ -20,4 +22,12 @@ public String getUrl() {
public void setUrl(String url) {
this.url = url;
}

public String getIcon() { return icon; }

public void setIcon(String icon) { this.icon = icon; }

public Coding getTopic() { return topic; }

public void setTopic(Coding topic) { this.topic = topic; }
}
44 changes: 44 additions & 0 deletions resources/src/main/java/org/hl7/davinci/r4/CardTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.hl7.davinci.r4;

import org.cdshooks.Coding;

public enum CardTypes {
COVERAGE("coverage", "Coverage"),
PRIOR_AUTH("prior-auth", "Prior Authorization"),
DTR_CLIN("dtr-clin", "DTR Clin"),
DTR_ADMIN("dtr-admin", "DTR Admin"),
CLAIM("claim", "Claim"),
INSURANCE("insurance", "Insurance"),
LIMITS("limits", "Limits"),
NETWORK("network", "Network"),
APPROPRIATE_USE("appropriate-use", "Appropriate Use"),
COST("cost", "Cost"),
THERAPY_ALTERNATIVES_OPT("therapy-alternatives-opt", "Therapy Alternatives Opt"),
THERAPY_ALTERNATIVES_REG("therapy-alternatives-req", "Therapy Alternatives Req"),
CLINICAL_REMINDER("clinical-reminder", "Clinical Reminder"),
DUPLICATE_THERAPY("duplicate-therapy", "Duplicate Therapy"),
CONTRAINDICATION("contraindication", "Contraindication"),
GUIDELINE("guideline", "Guideline"),
OFF_GUIDELINE("off-guideline", "Off Guideline");

private String code;
private String display;
private static String codeSystem = "http://hl7.org/fhir/us/davinci-crd/CodeSystem/cardType";

CardTypes(String code, String display) {
this.code = code;
this.display = display;
}

public String getCode() { return code; }
public String getDisplay() { return display; }
public String getCodeSystem() { return codeSystem; }

public Coding getCoding() {
Coding coding = new Coding();
coding.setSystem(codeSystem);
coding.setCode(code);
coding.setDisplay(display);
return coding;
}
}
4 changes: 3 additions & 1 deletion resources/src/main/java/org/hl7/davinci/r4/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ public static List<Organization> getPayors(List<Coverage> coverages) {
for (Coverage coverage: coverages){
for (Reference ref: coverage.getPayor()){
Organization organization = (Organization) ref.getResource();
payors.add(organization);
if (organization != null) {
payors.add(organization);
}
}
}
return payors;
Expand Down
2 changes: 2 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ bootRun {
if (project.hasProperty('debug')) {
jvmArgs=["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8091"]
}

}


dependencies {
developmentOnly("org.springframework.boot:spring-boot-devtools")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.hl7.davinci.endpoint.database.RequestService;
import org.hl7.davinci.endpoint.files.FileStore;
import org.hl7.davinci.endpoint.rules.CoverageRequirementRuleResult;
import org.hl7.davinci.r4.CardTypes;
import org.hl7.davinci.r4.crdhook.DiscoveryExtension;
import org.hl7.davinci.r4.crdhook.orderselect.OrderSelectRequest;
import org.hl7.davinci.endpoint.database.FhirResourceRepository;
Expand Down Expand Up @@ -85,7 +86,7 @@ public CdsResponse handleRequest(@Valid @RequestBody requestTypeT request, URL a
requestLog.advanceTimeline(requestService);
} catch (RequestIncompleteException e) {
logger.warn(e.getMessage() + "; summary card sent to client");
response.addCard(CardBuilder.summaryCard(e.getMessage()));
response.addCard(CardBuilder.summaryCard(CardTypes.COVERAGE, e.getMessage()));
requestLog.setCardListFromCards(response.getCards());
requestLog.setResults(e.getMessage());
requestService.edit(requestLog);
Expand Down Expand Up @@ -133,7 +134,12 @@ public CdsResponse handleRequest(@Valid @RequestBody requestTypeT request, URL a
|| StringUtils.isNotEmpty(coverageRequirements.getQuestionnaireDispenseUri())
|| StringUtils.isNotEmpty(coverageRequirements.getQuestionnaireAdditionalUri())) {
List<Link> smartAppLinks = createQuestionnaireLinks(request, applicationBaseUrl, lookupResult, results);
response.addCard(CardBuilder.transform(results, smartAppLinks));

if (coverageRequirements.isPriorAuthRequired()) {
response.addCard(CardBuilder.transform(CardTypes.PRIOR_AUTH, results, smartAppLinks));
} else if (coverageRequirements.isDocumentationRequired()) {
response.addCard(CardBuilder.transform(CardTypes.DTR_CLIN, results, smartAppLinks));
}

// add a card for an alternative therapy if there is one
if (results.getAlternativeTherapy().getApplies() && hookConfiguration.getAlternativeTherapy()) {
Expand All @@ -146,12 +152,12 @@ public CdsResponse handleRequest(@Valid @RequestBody requestTypeT request, URL a
}
} else {
logger.warn("Unspecified Questionnaire URI; summary card sent to client");
response.addCard(CardBuilder.transform(results));
response.addCard(CardBuilder.transform(CardTypes.COVERAGE, results));
}
} else {
// no prior auth or documentation required
logger.info("Add the no doc or prior auth required card");
Card card = CardBuilder.transform(results);
Card card = CardBuilder.transform(CardTypes.COVERAGE, results);
card.addSuggestionsItem(CardBuilder.createSuggestionWithNote(card, results.getRequest(), fhirComponents,
"Save Update To EHR", "Update original " + results.getRequest().fhirType() + " to add note",
true));
Expand All @@ -174,9 +180,9 @@ public CdsResponse handleRequest(@Valid @RequestBody requestTypeT request, URL a
if (!foundApplicableRule) {
String msg = "No documentation rules found";
logger.warn(msg + "; summary card sent to client");
response.addCard(CardBuilder.summaryCard(msg));
response.addCard(CardBuilder.summaryCard(CardTypes.COVERAGE, msg));
}
CardBuilder.errorCardIfNonePresent(response);
CardBuilder.errorCardIfNonePresent(CardTypes.COVERAGE, response);
}

// Adding card to requestLog
Expand Down Expand Up @@ -251,7 +257,6 @@ protected Object evaluateStatement(String statement, Context context) {
}



// Implement these in child class
public abstract List<CoverageRequirementRuleResult> createCqlExecutionContexts(requestTypeT request,
FileStore fileStore, String baseUrl) throws RequestIncompleteException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.hl7.davinci.endpoint.cdshooks.services.crd;

import org.cdshooks.Card;
import org.hl7.davinci.r4.CardTypes;
import org.cdshooks.CdsRequest;
import org.cdshooks.CdsResponse;
import org.cdshooks.Hook;
Expand Down Expand Up @@ -61,7 +62,7 @@ public CdsResponse handleRequest(@Valid @RequestBody requestTypeT request, URL a
CdsResponse response = new CdsResponse();
List<Coding> medications = getMedications(request);
for (Coding medication : medications) {
Card card = CardBuilder.summaryCard("");
Card card = CardBuilder.summaryCard(CardTypes.COVERAGE, "");
if (isRemsDrug(medication)) {
card.setSummary(String.format("%s has REMS", medication.getDisplay()));
} else {
Expand Down
Loading

0 comments on commit 439e53d

Please sign in to comment.