Skip to content

feat: add FHIR dispensing authorization (REMS-893) - #191

Merged
smalho01 merged 5 commits into
devfrom
REMS-893-add-fhir-dispense-authorization
Dec 2, 2026
Merged

smalho01 merged 5 commits into
devfrom
REMS-893-add-fhir-dispense-authorization

Conversation

@dlowenthal18

@dlowenthal18 dlowenthal18 commented Dec 2, 2026 •

Copy link
Copy Markdown

Describe your changes

Adds POST /4_0_0/GuidanceResponse/$rems-rda so pharmacy clients can request a REMS Dispensing Authorization over FHIR. Clients supply a pharmacy and identify the case in one of two ways: by case number, or by the patient’s first name, last name, date of birth, and medication RxNorm code.

Approvals return an RDA number and authorization period. RDA_VALIDITY_DAYS sets the validity period and defaults to 7 in .env.

Both $rems-rda and the existing $rems-etasu status check return coded OperationOutcome issues explaining denials. The FHIR and NCPDP authorization handlers share the check for outstanding dispensing requirements.

REMS Admin saves each RDA decision as a GuidanceResponse. Decisions can be read by resource ID, and issued authorizations can be searched by RDA number. Case-linked approvals also update the case’s authorization and pharmacy history.

Testing

I performed limited testing of the endpoint by sending curl requests from the terminal to a local REMS Admin instance. This PR is in draft because more testing is needed. In particular, I still need to verify that a request can travel from the pharmacy to REMS Admin and that the pharmacy receives the correct authorization number or denial reason.

Follow-ups.

When a prescription moves to another pharmacy: Suppose Pharmacy A completed its certification and Pharmacy B later asks to fill the same prescription. REMS Admin can count Pharmacy A’s certification when approving Pharmacy B. Once that approval lists B as the current pharmacy, the next time the prescriber signs the order, the system may skip the pharmacy check because B is already on the case.

When saving an approval is interrupted: REMS Admin first saves the authorization number, then adds it to the patient’s case history. If the server stops between those steps, someone can look up the authorization by number even though it is missing from the case history.

Looking up an approval issued without a case: A pharmacy requesting authorization by patient name and date of birth must also send the medication’s RxNorm code. REMS Admin uses that code to check the medication’s dispensing requirements. If there are none, it can issue an authorization even when no case exists for that patient and medication. The saved approval omits the medication code and, if the request did not include a FHIR patient ID, has no link to the patient. A later lookup by authorization number will succeed, but the approval alone cannot confirm which medication it covered or, in that situation, which patient it was for.

Issue ticket number and Jira link

REMS-893 — FDA-REMS

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.

Support `$rems-rda` requests by case number or by patient demographics and medication. Return coded denial reasons from `$rems-rda` and `$rems-etasu`.

Store each dispensing decision and support FHIR search by authorization number.
@dlowenthal18 dlowenthal18 self-assigned this Dec 2, 2026
@dlowenthal18 dlowenthal18 added the enhancement New feature or request label Dec 2, 2026
@dlowenthal18
dlowenthal18 requested a review from smalho01 December 2, 2026 06:02
@dlowenthal18 dlowenthal18 reopened this Dec 2, 2026
@dlowenthal18

Copy link
Copy Markdown
Author

I manually tested the new FHIR $rems-rda endpoint with Bruno. I also tested the existing NCPDP authorization workflow against this PR branch using the demo. For John Snow’s Turalio order, I completed the enrollment forms, sent the prescription to the pharmacy, and confirmed that Verify Order returned an approval.

The Docker demo required one local configuration adjustment. I set the pharmacy’s INTERMEDIARY_URL to http://rems-intermediary:3003 so it could reach the intermediary.

@dlowenthal18
dlowenthal18 marked this pull request as ready for review December 2, 2026 18:54
@dlowenthal18

Copy link
Copy Markdown
Author

One acceptance criterion remains partially open, from REMS-893:

$rems-etasu returns the same reason codes for the same case and never issues or stores an RDA.

I reproduced a case marked Approved with an incomplete pharmacy requirement. For that same case, $rems-etasu returned success with no denial reason, while $rems-rda returned pharmacy-not-certified and did not issue an authorization.

@smalho01
smalho01 merged commit 6b2d269 into dev Dec 2, 2026
12 checks passed
@smalho01
smalho01 deleted the REMS-893-add-fhir-dispense-authorization branch December 2, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants