Skip to content

Commit

Permalink
Updated releaseClaim debug to validate the id in the request. Updated…
Browse files Browse the repository at this point in the history
… readme.
  • Loading branch information
dvargaslantana committed Sep 7, 2023
1 parent 32203ca commit 09f2485
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,17 @@ The service endpoints in the table below are relative to `http://localhost:9015/
If debug mode is enabled the following endpoints are available for use at `http://localhost:9015/fhir`:

| Service | Methods | Description |
| --------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/debug/Bundle` | `GET` | HTML page to view the Bundle table in the database |
| `/debug/Claim` | `GET` | HTML page to view the Claim table in the database |
| `/debug/ClaimResponse` | `GET` | HTML page to view the ClaimResponse table in the database |
| `/debug/ClaimItem` | `GET` | HTML page to view the ClaimItem table in the database |
| `/debug/Subscription` | `GET` | HTML page to view the Subscription table in the database |
| `/debug/PopulateDatabaseTestData` | `POST` | Insert test data into the database. Remove any of the existing test data and insert a fresh copy. All test data has a timestamp in 2200 so it can easily be identifier |
| `/debug/Convert` | `POST` | Convert a CQL body (string) into Elm (xml) |
| `/$expunge` | `POST` | Delete all entried in all tables |
| Service | Methods | Description |
|---------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `/debug/Bundle` | `GET` | HTML page to view the Bundle table in the database |
| `/debug/Claim` | `GET` | HTML page to view the Claim table in the database |
| `/debug/ClaimResponse` | `GET` | HTML page to view the ClaimResponse table in the database |
| `/debug/ClaimItem` | `GET` | HTML page to view the ClaimItem table in the database |
| `/debug/Subscription` | `GET` | HTML page to view the Subscription table in the database |
| `/debug/PopulateDatabaseTestData` | `POST` | Insert test data into the database. Remove any of the existing test data and insert a fresh copy. All test data has a timestamp in 2200 so it can easily be identifier |
| `/debug/Convert` | `POST` | Convert a CQL body (string) into Elm (xml) |
| `/debug/ReleaseClaim?identifier={id}` | `GET` | Releases a claim by `id` from a pended state and triggers the subscription workflow. |
| `/$expunge` | `POST` | Delete all entried in all tables |

## Authorization

Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/hl7/davinci/priorauth/UpdateClaimTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ public UpdateClaimTask(Bundle bundle, String claimId, String patient) {
this.patient = patient;
}

public UpdateClaimTask(String claimId) {
this.claimId = claimId;
Map<String, Object> constraintMap = new HashMap<>();
constraintMap.put("id", claimId);

IBaseResource bundle = App.getDB().read(Table.BUNDLE, constraintMap);
String patient = FhirUtils.getPatientIdentifierFromBundle((Bundle)bundle);

this.bundle = (Bundle)bundle;
this.patient = patient;
}

/**
* Update the pended claim and generate a new ClaimResponse.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.servlet.http.HttpServletRequest;

import org.hl7.davinci.priorauth.*;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand Down Expand Up @@ -79,11 +80,23 @@ public ResponseEntity<String> getClient(HttpServletRequest request) {
@GetMapping("/ReleaseClaim")
public ResponseEntity<String> releaseClaim(HttpServletRequest request, @RequestParam(name = "identifier", required = false) String id)
{
Timer timer = new Timer();
timer.schedule(new UpdateClaimTask(id), 1);
Map<String, Object> constraintMap = new HashMap<>();
constraintMap.put("id", id);
IBaseResource bundle = App.getDB().read(Table.BUNDLE, constraintMap);

ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
return response;
if (bundle == null) {
return new ResponseEntity<>("Bundle not found for " + id, HttpStatus.BAD_REQUEST);
}

String patient = FhirUtils.getPatientIdentifierFromBundle((Bundle)bundle);

if (patient == null || patient.isEmpty()) {
return new ResponseEntity<>("Patient resource not found in " + id, HttpStatus.BAD_REQUEST);
}

new UpdateClaimTask((Bundle)bundle, id, patient).run();

return new ResponseEntity<>("Release for " + id + " scheduled.", HttpStatus.OK);
}

@PostMapping("/PopulateDatabaseTestData")
Expand Down

0 comments on commit 09f2485

Please sign in to comment.