| Title: | Multi-User Server, Honest Broker Custody, and Event Routing for 'DICOM' |
|---|---|
| Description: | Multi-user research server and honest-broker custody satellite for 'dicomtk'. Provides eight-role OpenID Connect ('OIDC') and 'Keycloak' role-based access control ('RBAC'), a tamper-evident SHA-256 hash-chained JSONL audit trail, a walled-off honest-broker key and crosswalk custody enclave with two-person ('honest_broker' and 'dpo') re-identification approval, 'mirai' asynchronous job queues, 3D segmentation quality assurance ('Dice', 'HD95', and surface 'Dice'), 'MONAI Label' active learning, event-driven routing, and 'plumber' REST and 'shiny' clinician portal interfaces. |
| Authors: | Yee How Lau [aut, cre, cph] |
| Maintainer: | Yee How Lau <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.0.0 |
| Built: | 2026-11-14 15:53:59 UTC |
| Source: | https://github.com/lauyeehow1986-hub/dicomtk.server |
Add an Unlabeled Study Candidate to the Active Learning Pool
active_learning_add_candidate( pool, project_id, study_uid, uncertainty_score = 0.5, metadata = list() )active_learning_add_candidate( pool, project_id, study_uid, uncertainty_score = 0.5, metadata = list() )
pool |
A |
project_id |
Project identifier. |
study_uid |
StudyInstanceUID string. |
uncertainty_score |
Model uncertainty score in |
metadata |
Optional named list of study metadata. |
Candidate record list.
Select Next Candidate(s) for Annotation
active_learning_next(pool, project_id = NULL, n = 1L)active_learning_next(pool, project_id = NULL, n = 1L)
pool |
A |
project_id |
Optional project filter. |
n |
Maximum number of candidates to return (default |
A tibble::tibble of prioritized unlabeled candidates.
Initialize a MONAI Label / Active Learning Candidate Pool
active_learning_pool_init( strategy = c("uncertainty", "fifo", "random"), logger = NULL )active_learning_pool_init( strategy = c("uncertainty", "fifo", "random"), logger = NULL )
strategy |
Selection strategy: |
logger |
Optional |
An S3 "dicom_active_learning_pool" object.
pool <- active_learning_pool_init(strategy = "uncertainty") pool$strategypool <- active_learning_pool_init(strategy = "uncertainty") pool$strategy
Requires "active_learning_submit" capability (annotator).
active_learning_submit( pool, principal, candidate_id, label_path = NULL, quality_score = NA_real_ )active_learning_submit( pool, principal, candidate_id, label_path = NULL, quality_score = NA_real_ )
pool |
A |
principal |
Authenticated |
candidate_id |
Candidate identifier from |
label_path |
Optional path to saved segmentation/label file. |
quality_score |
Optional numeric self-reported quality score. |
Updated candidate record list.
Append a Tamper-Evident Entry to the Hash-Chained Audit Log
audit_append(logger, actor, action, project_id = NULL, details = list())audit_append(logger, actor, action, project_id = NULL, details = list())
logger |
A |
actor |
Character user/principal identifier. |
action |
Character action name (e.g., |
project_id |
Optional project identifier string. |
details |
Optional named list of structured event metadata. |
The appended audit record list (including prev_hash and entry_hash).
Initializes a tamper-evident JSON Lines (.jsonl) audit log where each
appended entry commits to the cryptographic hash of the previous entry
(prev_hash -> entry_hash).
audit_logger(log_path = tempfile("dicomtk_audit_", fileext = ".jsonl"))audit_logger(log_path = tempfile("dicomtk_audit_", fileext = ".jsonl"))
log_path |
Path to the |
An S3 "dicom_audit_logger" object.
lp <- tempfile(fileext = ".jsonl") on.exit(unlink(lp), add = TRUE) lg <- audit_logger(lp) audit_append(lg, actor = "coord_1", action = "deid_ingest", project_id = "p1") audit_verify(lg)$passedlp <- tempfile(fileext = ".jsonl") on.exit(unlink(lp), add = TRUE) lg <- audit_logger(lp) audit_append(lg, actor = "coord_1", action = "deid_ingest", project_id = "p1") audit_verify(lg)$passed
Verify Cryptographic Continuity of a Hash-Chained Audit Log
audit_verify(logger)audit_verify(logger)
logger |
A |
A list with passed (logical), n_entries (integer), and
corrupted_line (NA_integer_ if valid, or 1-based line index of first failure).
Requires "deid_ingest" capability (coordinator, honest_broker, or
admin). Executes dicomtk::dicom_deid() using the enclave's sealed key
provider, records the reversible pseudonym_id -> original_patient_id
mapping inside the enclave crosswalk, and writes clean de-identified files
to out_dir.
broker_deid_study( enclave, principal, project_id, input_dir, out_dir, profile = "ps3.15" )broker_deid_study( enclave, principal, project_id, input_dir, out_dir, profile = "ps3.15" )
enclave |
A |
principal |
Authenticated |
project_id |
Target project identifier. |
input_dir |
Source directory containing identified DICOM files. |
out_dir |
Output directory in the research project workspace. |
profile |
Baseline PS3.15 profile name (default |
A list with project_id, pseudonym_id, out_dir, and n_files.
Creates a "dicom_broker_enclave" whose cryptographic master keys,
HashiCorp Vault / KMS credentials, and patient-identity crosswalks live
inside an isolated internal closure inaccessible to pi, coordinator,
annotator, auditor, admin, and site_admin principals.
broker_enclave_init( work_dir = tempfile("broker_enclave_"), backend = c("local_vault", "hashicorp_vault", "kms"), passphrase = NULL, vault_url = NULL, vault_token = NULL, logger = NULL )broker_enclave_init( work_dir = tempfile("broker_enclave_"), backend = c("local_vault", "hashicorp_vault", "kms"), passphrase = NULL, vault_url = NULL, vault_token = NULL, logger = NULL )
work_dir |
Walled broker workspace directory. |
backend |
Key custody backend: |
passphrase |
Optional passphrase for |
vault_url |
Optional HashiCorp Vault / KMS endpoint URL. |
vault_token |
Optional Vault token (never exposed by |
logger |
Optional |
An opaque S3 "dicom_broker_enclave" handle.
Guarded Crosswalk Lookup (Rejects All Unapproved or Non-Broker Access)
broker_lookup_crosswalk(enclave, principal, pseudonym_id)broker_lookup_crosswalk(enclave, principal, pseudonym_id)
enclave |
A |
principal |
Authenticated |
pseudonym_id |
Pseudonym identifier string. |
Never returns for unapproved access; aborts with permission error.
Check Role-Based Access Permission for a Principal
check_permission(principal, action, project_id = NULL, throw = TRUE)check_permission(principal, action, project_id = NULL, throw = TRUE)
principal |
A |
action |
Action capability string (e.g., |
project_id |
Optional project ID to check project-level scope. |
throw |
Logical. Abort with permission error if unauthorized ( |
Logical TRUE if authorized, FALSE otherwise (when throw = FALSE).
Clinical write-back (STOW-RS SEG/SR + FHIR DiagnosticReport +
Provenance) is disabled by default as a Software as a Medical Device (SaMD)
regulatory safeguard. Enable explicitly via
options(dicomtk.server.enable_clinical_writeback = TRUE) or environment
variable DICOMTK_ENABLE_CLINICAL_WRITEBACK=true.
clinical_writeback_enabled()clinical_writeback_enabled()
Logical scalar (TRUE if enabled, FALSE otherwise).
clinical_writeback_enabled()clinical_writeback_enabled()
Enforces both the server-wide SaMD feature flag
(clinical_writeback_enabled()) and RBAC "clinical_writeback"
permission (pi or admin) before dispatching or simulating STOW-RS and
FHIR DiagnosticReport + Provenance write-back, logging every event to
the SHA-256 hash-chained audit trail.
clinical_writeback_execute( ctx, principal, project_id, air_bundle, dicomweb_stow_url = NULL, fhir_base_url = NULL, dry_run = FALSE )clinical_writeback_execute( ctx, principal, project_id, air_bundle, dicomweb_stow_url = NULL, fhir_base_url = NULL, dry_run = FALSE )
ctx |
A |
principal |
Authenticated |
project_id |
Project identifier. |
air_bundle |
A |
dicomweb_stow_url |
Optional DICOMweb |
fhir_base_url |
Optional FHIR R4/R5 base URL for |
dry_run |
Logical; if |
A list with status, study_uid, dicom_sop_uid, and
audit_seq.
Compute 3D Segmentation QA Metrics (Dice, HD95, Surface Dice)
compute_seg_qa(pred_mask, ref_mask, spacing_mm = c(1, 1, 1), tolerance_mm = 1)compute_seg_qa(pred_mask, ref_mask, spacing_mm = c(1, 1, 1), tolerance_mm = 1)
pred_mask |
3D binary/logical predicted mask array. |
ref_mask |
3D binary/logical reference mask array of identical dims. |
spacing_mm |
Numeric vector of length 3 giving voxel spacing in mm. |
tolerance_mm |
Surface Dice tolerance in mm (default |
A list with dice, hd95_mm, and surface_dice.
m <- array(0L, dim = c(6L, 6L, 6L)) m[2:4, 2:4, 2:4] <- 1L compute_seg_qa(m, m)m <- array(0L, dim = c(6L, 6L, 6L)) m[2:4, 2:4, 2:4] <- 1L compute_seg_qa(m, m)
Packages a generated DICOM AI artifact (SEG or SR_TID1500) alongside a
FHIR DiagnosticReport and W3C/FHIR Provenance record with model version
and uncertainty metadata.
ihe_air_bundle( study_uid, model_name, model_version, dicom_artifact_type = c("SEG", "SR_TID1500"), dicom_sop_uid, fhir_report = list(), uncertainty_summary = list() )ihe_air_bundle( study_uid, model_name, model_version, dicom_artifact_type = c("SEG", "SR_TID1500"), dicom_sop_uid, fhir_report = list(), uncertainty_summary = list() )
study_uid |
StudyInstanceUID string. |
model_name |
AI model name. |
model_version |
AI model semantic version string. |
dicom_artifact_type |
Either |
dicom_sop_uid |
SOPInstanceUID of the generated DICOM AI object. |
fhir_report |
Named list of FHIR |
uncertainty_summary |
Named list of model uncertainty metrics. |
An S3 "dicom_ihe_air_bundle" object.
air <- ihe_air_bundle( study_uid = "1.2.3.4", model_name = "TotalSegmentator", model_version = "2.4.0", dicom_artifact_type = "SEG", dicom_sop_uid = "1.2.3.99" ) air$provenance$resourceTypeair <- ihe_air_bundle( study_uid = "1.2.3.4", model_name = "TotalSegmentator", model_version = "2.4.0", dicom_artifact_type = "SEG", dicom_sop_uid = "1.2.3.99" ) air$provenance$resourceType
Enforces valid UPS-RS state transitions:
"SCHEDULED" -> "IN PROGRESS" or "CANCELED";
"IN PROGRESS" -> "COMPLETED" or "CANCELED".
ihe_aiw_transition( workitem, to_state = c("IN PROGRESS", "COMPLETED", "CANCELED"), performer = NULL, output_refs = list() )ihe_aiw_transition( workitem, to_state = c("IN PROGRESS", "COMPLETED", "CANCELED"), performer = NULL, output_refs = list() )
workitem |
A |
to_state |
Target state: |
performer |
Optional AI worker/performer identifier. |
output_refs |
Optional named list of generated DICOM SOP UIDs. |
Updated "dicom_ihe_workitem" object.
Initializes a workitem in the "SCHEDULED" state following the IHE AIW-I
Unified Procedure Step (UPS-RS) state machine.
ihe_aiw_workitem(workitem_id, study_uid, model_name, input_series_uid = NULL)ihe_aiw_workitem(workitem_id, study_uid, model_name, input_series_uid = NULL)
workitem_id |
Unique workitem identifier string. |
study_uid |
StudyInstanceUID string. |
model_name |
AI model identifier string. |
input_series_uid |
Optional SeriesInstanceUID string. |
An S3 "dicom_ihe_workitem" object.
wi <- ihe_aiw_workitem("wi-001", study_uid = "1.2.3.4", model_name = "TotalSegmentator") wi$statewi <- ihe_aiw_workitem("wi-001", study_uid = "1.2.3.4", model_name = "TotalSegmentator") wi$state
Creates a job queue supporting synchronous in-process execution ("sync")
or non-blocking parallel worker execution via mirai ("mirai").
job_queue_init(backend = c("sync", "mirai"), workers = 2L, logger = NULL)job_queue_init(backend = c("sync", "mirai"), workers = 2L, logger = NULL)
backend |
Execution backend: |
workers |
Number of |
logger |
Optional |
An S3 "dicom_job_queue" object.
q <- job_queue_init(backend = "sync") q$backendq <- job_queue_init(backend = "sync") q$backend
Retrieve Job Result
job_result(queue, job_id, wait = TRUE)job_result(queue, job_id, wait = TRUE)
queue |
A |
job_id |
Job identifier returned by |
wait |
Logical; if |
The return value of the submitted job function.
Query Job Status
job_status(queue, job_id)job_status(queue, job_id)
queue |
A |
job_id |
Job identifier returned by |
A list with job_id, project_id, job_type, and status.
Requires "job_submit" permission on project_id.
job_submit( queue, principal, project_id, fn, args = list(), job_type = "generic" )job_submit( queue, principal, project_id, fn, args = list(), job_type = "generic" )
queue |
A |
principal |
Authenticated |
project_id |
Target project identifier. |
fn |
Function to execute. |
args |
Named list of arguments passed to |
job_type |
Short job category string (default |
A list with job_id, project_id, job_type, and status.
Mint a Signed Local Test OIDC JWT Token
mint_test_jwt( user_id, roles, project_ids = "*", secret = "dicomtk-test-secret", expires_in = 3600 )mint_test_jwt( user_id, roles, project_ids = "*", secret = "dicomtk-test-secret", expires_in = 3600 )
user_id |
Subject user ID ( |
roles |
Character vector of Keycloak |
project_ids |
Character vector of authorized project IDs. |
secret |
HMAC signing secret. |
expires_in |
Expiration offset in seconds (default |
A signed compact JWT string (header.payload.signature).
Create or Register a Research Imaging Project
project_create( registry, project_id, title = project_id, deid_profile = "ps3.15", custody_mode = c("broker", "ttp", "local") )project_create( registry, project_id, title = project_id, deid_profile = "ps3.15", custody_mode = c("broker", "ttp", "local") )
registry |
A |
project_id |
Unique project identifier string. |
title |
Human-readable project title. |
deid_profile |
Baseline PS3.15 de-identification profile name
(default |
custody_mode |
Key custody mode: |
A list describing the created project.
Retrieve a Registered Project
project_get(registry, project_id)project_get(registry, project_id)
registry |
A |
project_id |
Project identifier string. |
The project metadata list.
List Registered Projects
project_list(registry)project_list(registry)
registry |
A |
A tibble::tibble summarizing registered projects.
Initialize a Multi-Project Server Registry
project_registry_init()project_registry_init()
An S3 "dicom_project_registry" object.
reg <- project_registry_init() project_create(reg, "nsclc_01", title = "Lung AI") project_list(reg)reg <- project_registry_init() project_create(reg, "nsclc_01", title = "Lung AI") project_list(reg)
Enqueue a Study or Segmentation into the QA Review Queue
qa_enqueue( qa_queue, project_id, study_uid, pred_mask = NULL, ref_mask = NULL, spacing_mm = c(1, 1, 1), tolerance_mm = 1, metrics = NULL, priority = "normal" )qa_enqueue( qa_queue, project_id, study_uid, pred_mask = NULL, ref_mask = NULL, spacing_mm = c(1, 1, 1), tolerance_mm = 1, metrics = NULL, priority = "normal" )
qa_queue |
A |
project_id |
Project identifier. |
study_uid |
StudyInstanceUID string. |
pred_mask |
Optional 3D predicted mask array. |
ref_mask |
Optional 3D reference mask array. |
spacing_mm |
Voxel spacing in mm (default |
tolerance_mm |
Surface Dice tolerance in mm (default |
metrics |
Optional pre-computed list of QA metrics. |
priority |
Priority label ( |
Enqueued QA item list.
List QA Queue Items
qa_list(qa_queue, project_id = NULL, status = NULL)qa_list(qa_queue, project_id = NULL, status = NULL)
qa_queue |
A |
project_id |
Optional project filter. |
status |
Optional status filter ( |
A tibble::tibble of QA items.
Initialize a QA Review Queue
qa_queue_init(logger = NULL)qa_queue_init(logger = NULL)
logger |
Optional |
An S3 "dicom_qa_queue" object.
Requires "qa_review" capability (pi, annotator, or admin).
qa_submit_review( qa_queue, principal, item_id, decision = c("approve", "reject", "revise"), notes = NULL )qa_submit_review( qa_queue, principal, item_id, decision = c("approve", "reject", "revise"), notes = NULL )
qa_queue |
A |
principal |
Authenticated |
item_id |
QA item identifier returned by |
decision |
Review decision: |
notes |
Optional reviewer notes. |
Updated QA item list.
Requires both an honest_broker ("reid_approve_broker") and a distinct
dpo ("reid_approve_dpo") principal to approve before disclosure is
unlocked.
reid_approve(enclave, principal, request_id)reid_approve(enclave, principal, request_id)
enclave |
A |
principal |
Authenticated |
request_id |
Request identifier returned by |
Updated re-identification request list.
Requires "reid_disclose" capability (honest_broker), completed
two-person approval, and an unexpired TTL window.
reid_disclose(enclave, principal, request_id)reid_disclose(enclave, principal, request_id)
enclave |
A |
principal |
Authenticated |
request_id |
Request identifier returned by |
A list containing original_patient_id, pseudonym_id, study_uid,
and expires_at.
Requires "reid_request" capability (pi, coordinator, or
honest_broker). Records a pending re-identification request inside the
walled honest-broker enclave.
reid_request( enclave, principal, project_id, pseudonym_id, reason, ttl_seconds = 3600L )reid_request( enclave, principal, project_id, pseudonym_id, reason, ttl_seconds = 3600L )
enclave |
A |
principal |
Authenticated |
project_id |
Project identifier matching the pseudonymized study. |
pseudonym_id |
Pseudonym identifier recorded in the enclave crosswalk. |
reason |
Clinical or regulatory justification string. |
ttl_seconds |
Time-to-live in seconds once both approvals complete
(default |
A list describing the pending re-identification request.
Requires "routing_run" capability (coordinator, honest_broker, or admin).
routing_execute(rules, principal, event, logger = NULL)routing_execute(rules, principal, event, logger = NULL)
rules |
List of |
principal |
Authenticated |
event |
Named list with |
logger |
Optional |
A tibble::tibble summarizing matched and dispatched rules.
Define an Event-Driven Study Routing Rule
routing_rule( rule_id, when_modality = NULL, when_event = "study_ingested", action = c("enqueue_qa", "deid_forward", "notify", "custom"), target = NULL, handler = NULL )routing_rule( rule_id, when_modality = NULL, when_event = "study_ingested", action = c("enqueue_qa", "deid_forward", "notify", "custom"), target = NULL, handler = NULL )
rule_id |
Unique rule identifier string. |
when_modality |
Optional modality filter (e.g. |
when_event |
Event type filter (default |
action |
Action to execute: |
target |
Optional target queue/endpoint name. |
handler |
Optional callback |
An S3 "dicom_routing_rule" object.
r <- routing_rule("ct_qa", when_modality = "CT", action = "enqueue_qa", target = "qa_default") r$rule_idr <- routing_rule("ct_qa", when_modality = "CT", action = "enqueue_qa", target = "qa_default") r$rule_id
dicomtk.server Runtime ContextBundles the project registry, SHA-256 hash-chained audit logger, walled-off honest-broker custody enclave, job queue, QA review queue, and active learning pool into a single server context.
server_create_context( work_dir = tempfile("dicomtk_srv_"), jwt_secret = "change-me-in-production", enclave_passphrase = NULL )server_create_context( work_dir = tempfile("dicomtk_srv_"), jwt_secret = "change-me-in-production", enclave_passphrase = NULL )
work_dir |
Base directory for server state and audit logs. |
jwt_secret |
Secret key for HS256 JWT verification. |
enclave_passphrase |
Optional passphrase for the honest-broker enclave. |
An S3 "dicom_server_context" object.
tmp <- tempfile("srv_ctx_") ctx <- server_create_context(work_dir = tmp, jwt_secret = "demo-secret") server_handle_request(ctx, "GET", "/health") unlink(tmp, recursive = TRUE)tmp <- tempfile("srv_ctx_") ctx <- server_create_context(work_dir = tmp, jwt_secret = "demo-secret") server_handle_request(ctx, "GET", "/health") unlink(tmp, recursive = TRUE)
Inspects the installed or source DESCRIPTION of pkg and its R package
dependencies to emit a CycloneDX 1.5 JSON Software Bill of Materials with
pkg:cran/ Package URLs (purl).
server_generate_sbom(pkg = "dicomtk.server", out_path = NULL)server_generate_sbom(pkg = "dicomtk.server", out_path = NULL)
pkg |
Package name (default |
out_path |
Optional file path to write the CycloneDX JSON document. |
A list representing the CycloneDX 1.5 BOM.
sbom <- server_generate_sbom("dicomtk.server") sbom$bomFormatsbom <- server_generate_sbom("dicomtk.server") sbom$bomFormat
dicom_server_context
Provides a pure-R, test-friendly REST dispatcher enforcing JWT authentication and RBAC permissions before delegating to server subsystems.
server_handle_request( ctx, method = "GET", path = "/health", headers = list(), body = list() )server_handle_request( ctx, method = "GET", path = "/health", headers = list(), body = list() )
ctx |
A |
method |
HTTP method ( |
path |
Request path (e.g. |
headers |
Named list of HTTP headers (including |
body |
Named list representing parsed JSON request body. |
A list with status (integer HTTP code) and body (response list).
plumber REST Router for dicomtk.server
Build a plumber REST Router for dicomtk.server
server_plumber_api(ctx)server_plumber_api(ctx)
ctx |
A |
A plumber::Plumber router instance.
Construct an Authenticated Server Principal
server_principal(user_id, roles, project_ids = "*")server_principal(user_id, roles, project_ids = "*")
user_id |
Unique user identifier string. |
roles |
Character vector of roles from |
project_ids |
Character vector of authorized project IDs (or |
An S3 "dicom_server_principal" object.
dicomtk.server RBAC RolesList Standard dicomtk.server RBAC Roles
server_roles()server_roles()
Character vector of the 8 standard server roles.
server_roles()server_roles()
shiny Server Function for dicomtk.server
Build the shiny Server Function for dicomtk.server
server_shiny_server(ctx)server_shiny_server(ctx)
ctx |
A |
A shiny server function(input, output, session).
shiny Portal UI for dicomtk.server
Build the shiny Portal UI for dicomtk.server
server_shiny_ui(ctx)server_shiny_ui(ctx)
ctx |
A |
A shiny UI tag list.
dicomtk.server STRIDE Threat Model MatrixDocuments security threats, architectural mitigations, and automated
verification controls across all six STRIDE categories (Spoofing,
Tampering, Repudiation, Information Disclosure, Denial of Service,
and Elevation of Privilege).
server_threat_model()server_threat_model()
A tibble::tibble describing the threat model.
tm <- server_threat_model() tm$stride_categorytm <- server_threat_model() tm$stride_category
Produces a lightweight HTML5 container configured for Cornerstone3D (DICOMweb WADO-RS) or NiiVue (NIfTI / 3D overlay QA).
server_viewer_html( study_uid = "", viewer = c("cornerstone3d", "niivue"), dicomweb_url = "/dicomweb" )server_viewer_html( study_uid = "", viewer = c("cornerstone3d", "niivue"), dicomweb_url = "/dicomweb" )
study_uid |
StudyInstanceUID to display. |
viewer |
Viewer engine: |
dicomweb_url |
Base DICOMweb endpoint URL. |
Character string containing the HTML5 viewer fragment.
html <- server_viewer_html("1.2.840.113619.2.55", viewer = "cornerstone3d") grepl("cornerstone3d", html)html <- server_viewer_html("1.2.840.113619.2.55", viewer = "cornerstone3d") grepl("cornerstone3d", html)
Build a SMART on FHIR v2 EHR-Launch Authorization URL
smart_build_auth_url( config, client_id, redirect_uri, launch = NULL, scopes = c("launch", "openid", "fhirUser", "patient/Patient.rs", "patient/ImagingStudy.rs", "patient/DiagnosticReport.rs"), state = NULL, pkce = smart_pkce_challenge() )smart_build_auth_url( config, client_id, redirect_uri, launch = NULL, scopes = c("launch", "openid", "fhirUser", "patient/Patient.rs", "patient/ImagingStudy.rs", "patient/DiagnosticReport.rs"), state = NULL, pkce = smart_pkce_challenge() )
config |
SMART configuration list from |
client_id |
Registered OAuth2 client identifier. |
redirect_uri |
Callback redirect URI. |
launch |
Optional EHR launch context token. |
scopes |
Character vector of SMART v2 scopes. |
state |
Optional CSRF state token (auto-generated if |
pkce |
PKCE challenge list from |
A list with url, state, and pkce.
Queries <fhir_base_url>/.well-known/smart-configuration (or validates a
supplied mock_config list) and verifies that "S256" PKCE is supported.
smart_discover_config(fhir_base_url, mock_config = NULL)smart_discover_config(fhir_base_url, mock_config = NULL)
fhir_base_url |
Base URL of the FHIR R4/R5 server. |
mock_config |
Optional named list for offline/unit testing. |
A list with fhir_base_url, authorization_endpoint,
token_endpoint, and code_challenge_methods_supported.
cfg <- smart_discover_config( "https://fhir.example.org/r4", mock_config = list( authorization_endpoint = "https://auth.example.org/authorize", token_endpoint = "https://auth.example.org/token", code_challenge_methods_supported = "S256" ) ) cfg$authorization_endpointcfg <- smart_discover_config( "https://fhir.example.org/r4", mock_config = list( authorization_endpoint = "https://auth.example.org/authorize", token_endpoint = "https://auth.example.org/token", code_challenge_methods_supported = "S256" ) ) cfg$authorization_endpoint
Verifies CSRF state equality and RFC 7636 code_verifier length before
exchanging the authorization code at config$token_endpoint.
smart_exchange_token( config, code, redirect_uri, client_id, code_verifier, expected_state = NULL, received_state = NULL, mock_response = NULL )smart_exchange_token( config, code, redirect_uri, client_id, code_verifier, expected_state = NULL, received_state = NULL, mock_response = NULL )
config |
SMART configuration list from |
code |
Authorization code received at |
redirect_uri |
Callback redirect URI. |
client_id |
Registered OAuth2 client identifier. |
code_verifier |
PKCE |
expected_state |
Expected CSRF |
received_state |
|
mock_response |
Optional named list for offline/unit testing. |
An S3 "dicom_smart_session" object.
Generate an RFC 7636 S256 PKCE Verifier and Challenge Pair
smart_pkce_challenge(verifier = NULL)smart_pkce_challenge(verifier = NULL)
verifier |
Optional PKCE |
A list with code_verifier, code_challenge, and
code_challenge_method = "S256".
pkce <- smart_pkce_challenge() pkce$code_challenge_methodpkce <- smart_pkce_challenge() pkce$code_challenge_method
Requires "deid_ingest" permission (coordinator, honest_broker, or
admin). Pseudonymizes the EHR patient_id inside the walled enclave
crosswalk and returns only de-identified imaging/report counts and UIDs.
smart_pull_patient_context( session, enclave, principal, project_id, fhir_bundle = NULL )smart_pull_patient_context( session, enclave, principal, project_id, fhir_bundle = NULL )
session |
A |
enclave |
A |
principal |
Authenticated |
project_id |
Target project identifier. |
fhir_bundle |
Optional parsed FHIR Bundle list for offline testing. |
A de-identified summary list containing project_id,
pseudonym_id, n_imaging_studies, n_diagnostic_reports, and
study_uids.
Verify an OIDC / Keycloak Bearer Token and Return a Server Principal
verify_bearer_token(token, secret = NULL, oidc_userinfo_url = NULL)verify_bearer_token(token, secret = NULL, oidc_userinfo_url = NULL)
token |
Bearer token string (with or without |
secret |
HMAC secret for verifying local test JWTs. |
oidc_userinfo_url |
Optional Keycloak OIDC |
A "dicom_server_principal" object.