Skip to content

Commit

Permalink
Merge pull request tech-by-design#971 from alan-francis/main
Browse files Browse the repository at this point in the history
feat: add valid bundle field to table & update the procedure to insert it tech-by-design#969
  • Loading branch information
alan-francis authored Jan 1, 2025
2 parents 9a23d81 + 8f7fc56 commit ba3088d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Binary file modified hub-prime/lib/techbd-udi-jooq-ingress.auto.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ AS SELECT hub_interaction_id AS interaction_id,
WHEN (source_type = 'FHIR') then 'FHIR'
ELSE 'FHIR'
END as source_type,
source_hub_interaction_id
source_hub_interaction_id,
is_bundle_valid
FROM techbd_udi_ingress.sat_interaction_fhir_request htt_req
WHERE uri != '/api/expect/fhir/bundle';

Expand Down Expand Up @@ -1586,6 +1587,7 @@ DECLARE
v_techbd_disposition_action TEXT := NULL;
v_elaboration JSONB := NULL;
v_diagnostic_id TEXT := gen_random_uuid()::text;
v_is_bundle_valid BOOLEAN := NULL;

BEGIN

Expand Down Expand Up @@ -1627,15 +1629,15 @@ BEGIN
fhir_req.validation_initiated_at, fhir_req.validation_completed_at, fhir_req.validation_engine,
fhir_req.ig_version, fhir_req.profile_url, fhir_req.medicaid_cin,
fhir_req.interaction_start_time, fhir_req.interaction_end_time, fhir_req.bundle_session_id,
fhir_req.patient_mrn_source_system
fhir_req.patient_mrn_source_system, fhir_req.is_bundle_valid
INTO
v_client_ip_address, v_user_agent, v_bundle_id,
v_bundle_last_updated, v_organization_id, v_organization_name,
v_patient_id, v_patient_mrn, v_resource_type_set,
v_validation_initiated_at, v_validation_completed_at, v_validation_engine,
v_ig_version, v_profile_url, v_medicaid_cin,
v_interaction_start_time, v_interaction_end_time, v_bundle_session_id,
v_patient_mrn_source_system
v_patient_mrn_source_system, v_is_bundle_valid
FROM
techbd_udi_ingress.sat_interaction_fhir_request fhir_req
WHERE 1 = 1
Expand All @@ -1653,6 +1655,7 @@ BEGIN
v_validation_engine := (sat_interaction_fhir_request_upserted.payload->'response'->'responseBody'->'OperationOutcome'->'validationResults'->0->'observability'->>'name');
v_ig_version := (sat_interaction_fhir_request_upserted.payload->'response'->'responseBody'->'OperationOutcome'->'validationResults'->0->>'igVersion');
v_profile_url := (sat_interaction_fhir_request_upserted.payload->'response'->'responseBody'->'OperationOutcome'->'validationResults'->0->>'profileUrl');
v_is_bundle_valid := (sat_interaction_fhir_request_upserted.payload->'response'->'responseBody'->'OperationOutcome'->'validationResults'->0->>'valid');
v_validation_initiated_at := to_timestamp((sat_interaction_fhir_request_upserted.payload->'response'->'responseBody'->'OperationOutcome'->'validationResults'->0->>'initiatedAt')::NUMERIC);
v_validation_completed_at := to_timestamp((sat_interaction_fhir_request_upserted.payload->'response'->'responseBody'->'OperationOutcome'->'validationResults'->0->>'completedAt')::NUMERIC);

Expand Down Expand Up @@ -1800,7 +1803,8 @@ BEGIN
patient_mrn_source_system,
source_type,
source_hub_interaction_id,
group_hub_interaction_id
group_hub_interaction_id,
is_bundle_valid
)
VALUES (
gen_random_uuid()::TEXT, -- Generate a unique UUID for the primary key
Expand Down Expand Up @@ -1842,7 +1846,8 @@ BEGIN
v_patient_mrn_source_system,
source_type,
source_hub_interaction_id,
group_hub_interaction_id
group_hub_interaction_id,
v_is_bundle_valid
) RETURNING sat_interaction_fhir_request_id INTO v_return; -- Return the generated UUID

IF (v_return IS NOT NULL) THEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,9 @@ const migrateSP = pgSQLa.storedProcedure(
ALTER TABLE techbd_udi_ingress.sat_interaction_fhir_request
ADD COLUMN IF NOT EXISTS group_hub_interaction_id TEXT NULL;
ALTER TABLE techbd_udi_ingress.sat_interaction_fhir_request
ADD COLUMN IF NOT EXISTS is_bundle_valid BOOLEAN NULL;
Expand Down

0 comments on commit ba3088d

Please sign in to comment.