Tips and Techniques for Improving the Performance of Validation Procedures in Oracle Clinical

Ensuring the validity of patient data in your clinical data management and EDC system is essential. However, without a way to programmatically identify discrepancies and inconsistencies, such a task
…

Ensuring the validity of patient data in your clinical data management and EDC system is essential. However, without a way to programmatically identify discrepancies and inconsistencies, such a task can inadvertently leave bad data in your system. Through validation procedures, an endless assortment of expressions and formulas, Oracle Clinical offers the powerful ability to clean and compare patient data.

In this slideshare, Perficient's Dr. Steve Rifkin, a leading expert in Oracle Clinical, demonstrates the structure of validation procedures, as well as provides various tips and techniques for developing procedures that improve the performance of edit checks.

3.
Perficient is a leading information technology consulting firm serving clients throughout
North America and Europe.
We help clients implement business-driven technology solutions that integrate business
processes, improve worker productivity, increase customer loyalty and create a more agile
enterprise to better respond to new business opportunities.
About Perficient

10.
• Procedure templates are completed
• Procedure is “generated” and
What is an Oracle Clinical Procedure?
A PL/SQL Program is created!
To get the most out of OC procedures, you need to understand the
structure of the program you create.

11.
Review of PL/SQL Concepts
• Detailed knowledge of PL/SQL syntax is not required
for understanding the overall program structure.
– However, knowledge of PL/SQL cursors and of the
PL/SQL Package structure is required.

12.
PL/SQL Cursors
In SQL*Plus, a “select statement” retrieves an entire set of records:
SQL> select patient, patient_position_id from patient_positions;
PATIENT PATIENT_POSITION_ID
---------- -------------------
100 5001
101 5101
102 5201
103 5301
104 5401
105 5501
106 5601
107 5701
108 5801
109 5901
Cursors also retrieve of a set of
records; but unlike SQL*Plus,
cursors allow access to one record
at a time for procedural operations
on data within the record.

13.
• Cursors are objects in a PL/SQL program
• To use, cursors must be
1. Declared (to define the set of results)
2. Opened (to initialize)
3. Fetched (to retrieve one row for operations)
4. Closed (to release)
PL/SQL Cursors

14.
• Cursor declaration defines the set of records to be
retrieved from the database:
• Like a “file” a cursor must be opened before it can be
used:
CURSOR cHeight IS
SELECT height, height_unit
FROM height_table WHERE
patient=‘100’
ORDER BY visit_number;
OPEN cHeight;
PL/SQL Cursors

15.
PL/SQL Cursors
• A “fetch” on the cursor retrieves a single row from the
set of selected records and places the result into
program variables:
FETCH cHeight INTO height_var, height_unit_var;
CLOSE cHeight;
• Cursors are closed to release memory and perform
internal cleanup:

16.
PL/SQL Cursors
• Cursors are often fetched in a “loop” which processes
the record:
LOOP
FETCH cHeight INTO height_var, height_unit_var ;
IF cHeight%NOTFOUND THEN
EXIT LOOP;
ELSE
<process current height_var, height_unit_var>
END IF;
END LOOP;

18.
Cursors used by Oracle Clinical
• Patient Information Cursor
– Retrieves a record with all the information recorded for a
single patient
• DCM Cursor(s)
– A DCM cursor for each “alias” listed on the procedure
question group form
– Retrieves the DCM responses (for the questions on the
procedure question screen) and DCM header
information

21.
Using Patient Cursor Fields
• To use a value for a “V_” field, prefix the field name
with “rxcpdstd.”
– e.g., rxcpdstd.v_data_modified_flag
• To use all other variables, prefix the name with
“rxcpdstd.patients_rec.”
– e.g., rxcpdstd.patients_rec.reported_birth_date
Fields retrieved in the patient information cursor can be used
to perform tests or calculations in your procedures or can be
used as arguments to custom functions you may write.

22.
Structure of PL/SQL Packages
• Generation of an Oracle Clinical procedure results in a
PL/SQL package
• PL/SQL packages contain one or more functions
and/or procedures and have two sections
– Specification
• Lists all procedures and functions in the package
• Declares all cursors and variables to be available to all the
functions and procedures (i.e. the “common” area)
– Body
• Contains all the procedural code for the procedures and
functions listed in the specification

23.
Package Specification in Oracle Clinical
CREATE PACKAGE rxcpd_xxx_xx as
CURSOR 1 is . . . .
CURSOR 2 is . . . .
CURSOR n is . . . .
PROCEDURE main (… … …); PROCEDURE
insert_discrepancy(… … …); PROCEDURE
exception_handling (… … …); END rxcpd_xxx_xx;
. . .
Package is named
with internal id and
version numbers
Definition and number of cursors declared
depends on the number of “aliases” on the
procedure question group form
Three PL/SQL procedures
are part of each Oracle
Clinical package

25.
• MAIN procedure is a series of nested loops
• For a simple procedure, outermost loop fetches the
patient information
– Next loop fetches DCM information as defined by the
first procedure question group definition
• After fetching the innermost loop, the expression
details are evaluated
Simplified Structure of a MAIN Procedure

29.
Correlations
• Can correlate on events
– Inner cursor retrieves only a visit retrieved by the outer correlated cursor
• Can correlate on qualifying questions
– Inner cursor only retrieves DCMs which have the same value for the DCM
qualifying question
• Can correlate on question values
– Inner cursor fetches only if a question’s value is equal to a question’s value
in the outer cursor
Correlation limits the fetches for inner cursors based
on data obtained by a fetch in a more outer cursor.

36.
Definition => Validation Procs => Procedures, Press [Q-Groups],
[Correlating Questions]
Inner loop will fetch records only if the values of the
responses to the two pairs of questions are the same!
Outer LoopOuter LoopInner Loop
Correlating Questions

37.
Correlations
• Can correlate on Events
– Inner cursor retrieves only a visit retrieved by the outer correlated cursor
• Can correlate on Qualifying Questions
– Inner cursor only retrieves DCMs which have the same value for the DCM
Qualifying Question
• Can correlate on Questions
– Inner cursor fetches only if a question’s value is equal to a question’s value
in the outer cursor
Correlation limits the fetches for inner cursors based
on data obtained by a fetch in a more outer cursor

38.
Effect of Correlation on Event
ACTUAL_EVENT_ID is retrieved as part
of the standard cursor variables in the
outer cursor
…….
Outer Cursor Definition

39.
Cursor variable i_actual_event_id
specified when cursor is opened
used in the where clause
…….
Inner Cursor Definition
Effect of Correlation on Event

40.
Call to open inner (CM) cursor uses
the actual_event_id retrieved by the
outer_cursor
Fetch on the outer (AE) cursor
retrieves a value of actual_event_id
);
Effect of Correlation on Event

41.
Effect of Qualifying Question Value and
Question Value Correlation
• Other types of correlation (on qualifying question
value or question values) work in the same way
– When procedure compiled using these techniques, the
procedure question group cursors are restricted
– Opening of cursors in the MAIN procedure use cursor
variables

42.
Qualifying Expressions
• Allow selection of records based on any information
retrieved by the current or any more outer cursor
– Can join values between cursors in the qualifying
expression
Continue only if medication
on the AE form is not null

43.
Qualifying Expressions
• Allow selection of records based on any information retrieved
by the current or any more outer cursor
– Can join values between cursors in the qualifying expression
Continue only if Medication
on the AE form is not null

46.
• Limit cursor fetch with SQL expression comprised of
key DCM fields
– An LOV is available for fields which can be used in the
Extension
– With caution, can use other variables in the
RECEIVED_DCMS and RESPONSES tables, but only
for the current cursor
• One way to limit retrievals to specific visits
WHERE Clause Extension

47.
Can join only fields from the
current cursor
WHERE Clause Extension

48.
• Limit cursor fetch with SQL expression comprised of
key DCM fields
– An LOV is available for fields which can be used in the
Extension
– With caution, can use other variables in the
RECEIVED_DCMS and RESPONSES tables, but only
for the current cursor
• One way to limit retrievals to specific visits
WHERE Clause Extension …

49.
Extension of “where visit_number=1”
Added to the default cursor definition
Effect of Where Clause Extensions

50.
• Can limit to a range of visits fetched by providing the
names of the first and last visits on the procedure
question group form
By default, all patient visits will be
retrieved by the DCM cursor
Controlling Range of Visits

51.
Definition => Validation Procs => Procedures, Press [Q-Groups]
Only DCMs recorded for visits starting at “Visit 1”
and going through “Visit 3” will be retrieved
Controlling Range of Visits

52.
• Can limit to a range of visits fetched by providing the
names of the first and last visits on the Procedure
Question Group form
By default, all patient visits will be
retrieved by the DCM cursor
Controlling Range of Visits …

53.
Effect of Range of Visits Control
These are passed as input when the DCM cursor is opened by the
main procedure

54.
Performance
• Generated PL/SQL code contains a multitude of loops
– Cursors are opened, fetched and closed many times in
the internal fetch loops
• Use as much correlation as possible to improve
performance
– Some types of correlations affect performance more
than others
– Correlation may be necessary to make sure the
procedure does what is expected

55.
Effecting Performance
Event Range In DCM Cursors Large
Correlation
Event In DCM Cursor Large
Qualifying Value In DCM Cursor Large
Correlating Questions In DCM Cursor Large
Where Clause Extension In DCM Cursor Large
Qualifying Expression Test after DCM Fetch Smaller
Where Effect on
Parameter Implemented Performance
Note: In many cases, parameters must be changed so procedure
performs correctly

56.
Summary
• Procedure generation produces a complex PL/SQL
program
• Program makes extensive use of cursors and looping
structure
• Program performance can be changed by correct use
of many techniques available from the form templates