5 Using Advanced Conditions to Create Queries on Insight Mart

The advanced conditions querying tool is designed to allow the greatest flexibility in designing the most advanced queries. You can use advanced conditions to create complex queries that involve Boolean and Set operations and use Structured Query Language (SQL).

You create advanced conditions in the Advanced Conditions Editor, which employs a spreadsheet-like approach for adding query conditions (fields and their values) and conditional operators (Boolean or Set).

Besides, Argus Insight also supports queries for analysis of the historical case data based on specific date/time through Argus Mart. To enable access to this data in Argus Mart, you need to set specific attributes.

See Chapter 6, "Using Advanced Conditions to Create Point-in-Time Queries on Argus Mart."

Note:

The labels for the advanced conditions field are displayed as per the field labels configured in Argus Safety.

5.1 Creating a New Advanced Condition

To start a new Insight Mart advanced condition:

  1. Navigate to Queries > Advanced Conditions > New (Insight Mart).

    The ADVANCED CONDITIONS EDITOR page appears with the data source.

    Note:

    You may also start an advanced condition by converting a QBE or a filter value set to an advanced condition. See "Converting a QBE to an Advanced Condition" and "Converting a Value Set to an Advanced Condition" for details.
  2. Enter the attributes (fields and values) for the advanced condition.

  3. Click the context menu icon (Add Advanced Condition Element Above/Below icon).

    In the context menu, the categories (Activities, Additional Info, Analysis, Events, General, Patients, and Products) represent the Argus case form tabs. In these categories, the data mart fields that pertain to case information are organized in this hierarchy:

    • Argus case form tab

    • Sections within the tab

    • Fields within the section

    You may browse through the appropriate hierarchy and select the required field as an advanced condition attribute.

    The AC Library category lists all the advanced conditions stored in the system. You may browse through the AC Library category and select a stored advanced condition as an attribute for the new advanced condition.

    Surrounding text describes actadv.jpg.

  4. Browse through a category hierarchy, and select the required attribute.

    The selected attribute appears as a row in the editor.

    Note:

    The user defined fields in Argus Safety which have been converted as a look up are also available as attributes for the advanced condition search.
  5. In the Value field, enter the value for the selected attribute.

    Depending on the type of the selected attribute, the Value field populates a:

    • Drop-down list to select from a set of predefined values

    • Text box to enter text strings or numerals

    • Date field to enter dates

    • Browser to select MedDRA dictionary terms, company products, WHO drugs, clinical study IDs, Drugs in Study (incl. Comparators) and Investigational Drugs.

      To use a browser to populate the Value field, click the ellipsis button next to the Value field. From the context menu, select the option corresponding to the browser you want to start. For example, you can start the MedDRA Browser and enter criteria to search for a preferred term based on a specific code or description. You can add a selected term to the Value field.

  6. Click the Conditions field, and select a condition for the attribute value.

    See Table 5-1 for a description of each condition. The availability of the conditions depends on the selected attribute.

    Table 5-1 Conditions for Defining an Advanced Condition

    Condition Select this option if you want to…

    equal to

    Retrieve cases where the selected attribute's value is equal to what the Value field specifies

    not equal to

    Retrieve cases where the selected attribute's value is not equal to what the Value field specifies

    greater than

    Retrieve cases where the selected attribute's value is greater than what the Value field specifies

    greater than or equal to

    Retrieve cases where the selected attribute's value is greater than or equal to what the Value field specifies

    less than

    Retrieve cases where the selected attribute's value is less than what the Value field specifies

    less than or equal to

    Retrieve cases where the selected attribute's value is less than or equal to the Value that the field specifies

    missing

    Retrieve cases where the selected attribute's value has not been specified

    exists

    Retrieve cases where the selected attribute has any value

    begins with

    Retrieve cases where the selected attribute's value begins with what the Value field specifies

    contains

    Retrieve cases where the selected attribute's value contains what the Value field specifies

    does not contain

    Retrieve cases where the selected attribute's value does not contain what the Value field specifies

    in

    Retrieve cases where the selected attribute's value exists in what the Value field specifies

    not in

    Retrieve cases where the selected attribute's value does not exist in what the Value field specifies


    Tip:

    To change the structure of the query by changing the order of the attribute rows, select a row and then click the arrow icons to move the row up or down. To delete a row from the editor, select the row and click the Delete icon.
  7. Specify the operator.

    Use the Operator drop-down list to specify the Boolean or Set operator to join the attribute with another attribute.

  8. To add more attributes to your advanced condition, click the icons on the left bar to insert another attribute above or below the existing attribute.

  9. Specify runtime parameters.

    Note:

    Argus Insight lets you create advanced conditions which when executed, ask for user-specified values for certain attributes to generate the case series. For example, you may create an advanced condition in which the Case Number or the Product name may be specified only at the time of execution. In this case, the advanced condition would only retrieve those cases where the Case Number/Product Name is as specified at the time of execution.

    Creating an advanced condition using same field name multiple times requires to change the Parameter name so that while executing the advanced condition different parameters values can be entered.

  10. Identify the attribute row to specify runtime parameters.

  11. Click the ellipsis button next to the Value field, and then select Parameters from the menu.

    Surrounding text describes advd.jpg.
  12. Click Parameter.

    The Parameter dialog box appears.

  13. To pass multiple runtime values for a single attribute, select the Multi Select check box.

    For example, you might want to pass more than one case number or product name as runtime parameters.

  14. Click OK.

    If the field is configured to accept single runtime parameter, the field you configured as a runtime parameter is displayed in the Value text box enclosed within % symbol. For example, %Product Type%.

    If the field is configured to accept multiple runtime parameters, the field name appears in the Value text box enclosed within %% symbol. For example, %%Product Type%%.

  15. To determine the order of execution for the selected advanced conditions, enter parentheses in the ( and ) columns.

  16. Examine the advanced condition results.

  17. Click Execute.

    Tip:

    To cancel the query execution at this point and return to the Advanced Conditions Editor, click Cancel Query.
    • If any runtime parameter is configured, the Parameters dialog box appears with all the fields available based on the categorization of different fields from the tree view.

      • Specify the parameter values by using the options in the dialog box, and click Execute.

        Select at least one parameter for query execution.

        The ACTIVE CASE SERIES page appears with the matching cases from the data mart.

        Tip:

        If you select one runtime parameter and execute the search, you must enter a field.

        If you select multiple runtime parameters and execute the search, you have the option to ignore the runtime parameters.

      • To ignore the field criteria for query execution, select All.

      • To save the selected values on the Advanced Condition Parameters screen, click Save.

        Note:

        • When the Save button is clicked, the values of the current Advance Condition only are saved, and not for the Nested Advance Conditions.

        • The Save button is enabled only when Advance Condition is saved, and not when the Advanced Condition is executed from Query By Example, Filter, or Advance Condition Library page.

        You may enter value for one or more parameters.

        If no value is selected for any parameter that is if you try to save a parameterized advanced condition without providing any value, then an error message appears as 'You must select values in order to save.'

        All the fields where value is been provided are stored for the future use.

      • Upon execution of these advanced conditions again, the previously selected values will appear by default on the Advanced Condition Parameters page.

        Note:

        On the Advanced Condition Editor page, the parameterized advanced conditions appears in their original structure, and the saved parameter values are not available. These values appear only while executing the advanced condition.
      • Query criteria for the case series generated using such advanced conditions will only display fields for which values for the parameter were provided.

      • The selective use of parameters can also be used while converting existing filters into advanced conditions.

    • If no cases are found that match the querying criteria, a warning message appears.

      Click View Query to return to the Advanced Conditions Editor, modify the criteria and execute again.

    • If the cases that match the query criteria are found, the ACTIVE CASE SERIES page appears with the list of such cases.

  18. Examine the case series. If the case series is too large, you may want to modify the advanced condition by specifying additional attributes or changing values.

    Alternatively, if you find the case series to be appropriate, you can save the advanced condition to the system.

    The system retrieves the matching cases from the data mart and displays them in the ACTIVE CASE SERIES page.

    Note:

    If the Argus Insight case series are created by using the Argus Mart advanced condition, then these case series records only case IDs, case revision effective start dates, and query criteria (as a text string).

5.1.1 Returning to the Advanced Conditions Editor

  1. On the ACTIVE CASE SERIES page, click View Query.

    The ACTIVE ADVANCED CONDITIONS EDITOR page appears.

    Note:

    When you save the modifications to an advanced condition or execute it, the system assigns the active status to the advanced condition. Therefore, when you return to the editor after executing the advanced condition, the page title changes to ACTIVE ADVANCED CONDITIONS EDITOR. The field values you specified in the editor before executing are retained. See "Working with the Last Modified or Saved Advanced Condition" for details.
  2. If required, modify the advanced condition and examine the results again or proceed to save the advanced condition.

  3. Save the advanced condition.

5.1.2 Assigning a Category to an Advanced Condition

A category indicates the reporting aspect to which your advanced condition pertains:

  • Case Processing

  • Compliance

  • Configuration

  • General

  • Management

  • Pharmacovigilance

Specifying the category also helps in searching the relevant advanced conditions from a list of all the advanced conditions saved in the system.

To assign a category to an advanced condition:

  1. On the ACTIVE ADVANCED CONDITIONS EDITOR page, from the Category drop-down list, select a category.

  2. In the Description field, enter a description of the advanced condition.

    For example, you may describe the type of cases the advanced condition retrieves.

  3. Click Save.

    The Advanced Condition - Save dialog box appears.

  4. In the Name field, enter the name of the advanced condition.

  5. Click OK to save the advanced condition and refresh the ACTIVE ADVANCED CONDITIONS EDITOR page.

    Note that:

    • The Active Query Name field in the upper-right corner of the page now displays the name of the advanced condition you specified while saving the advanced condition.

    • The Save As, View SQL, and Permissions buttons are now enabled.

      Note:

      The ADVANCED CONDITION LIBRARY page lists all the advanced conditions saved to the system. See "Working with Saved Advanced Conditions" for more information.

      Tip:

      If the field values are modified after saving the advanced condition to the system, click Save to save the changed field values.
  6. Click View SQL to view the underlying SQL query for the advanced condition.

    1. Modify the SQL, if necessary.

    2. Click Save SQL after editing the query.

      Note:

      When using the Save SQL functionality, the advanced condition can be executed only from the ADVANCED CONDITIONS LIBRARY page.

      Tip:

      Revert to Original lets you to revert back to the original advanced condition. This button is enabled only when you edit the SQL.
    3. Click Close.

  7. To assign group-level permissions on the saved advanced condition, click Permissions.

    The Permissions dialog box appears with the names of all the groups (except the Administrator group) that the system administrator has created.

  8. To assign permissions to the group members on the advanced condition you have created, use the drop-down list next to a group name. The available options are:

    Permission Description
    R/W/D/P Group members will be able to view, modify, delete, and assign permission on the advanced condition.
    R/W/D Group members will be able to view, modify, and delete the advanced condition.
    R/W Group members will be able to view and modify the advanced condition.
    R Group members will be able to only view the advanced condition.
    No Access (Default) No group members will be able to access the advanced condition.

    Note:

    The author of the advanced condition always has the highest level of permission (R/W/D/P) on it. For example, suppose you belong to the Data Entry group and you assign the No Access permission level to the Data Entry group on an advanced condition that you create. In this case, you will continue to have the highest level of permission on your advanced condition; other members in your group cannot access your advanced condition.
  9. Click OK to save the permission settings.

  10. Click Execute to generate the case series.

    • The ACTIVE CASE SERIES page appears with the matching cases from the data mart.

    • If any runtime parameters are configured, the Parameters dialog box appears.

      Specify the parameter values by using the options in the dialog box, and click Execute.

      The ACTIVE CASE SERIES page appears with the matching cases from the data mart.

      See Chapter 7, "Working with Case Series" for more information.

5.1.3 Using and Ordering Advanced Condition Operators

Use the following order of precedence for the operators you can select when creating an advanced condition.

Order Operator Use
1 AND Use with all fields available in an advanced condition.
2 OR Use with all fields available in an advanced condition.
3 INTERSECT Use between queries (AC Library Attributes)
4 MINUS Use between queries (AC Library Attributes)
5 UNION Use between queries (AC Library Attributes)

Using an INTERSECT, MINUS, or UNION operator results in the creation of two separate select clauses. Therefore, use these operators between different queries.

Be sure to use correct PL/SQL syntax:

SELECT 
table1.common_column
FROM
Table1, table2, table3
WHERE 
Table1.column2 = table2.column2
AND 
Table2.column3 = table3.column3 
INTERSECT 
SELECT 
Table4.common_column
FROM
Table4, table5, table6
WHERE
Table4.column2 = table5.column2
AND
Table5.column3 = table6.column3

5.1.3.1 Advanced Condition Example

Suppose you want to create an advanced condition as follows:

WHERE Country = "Australia" AND Co-Drug Code w Study = "LAS + TAB" OR Co-Drug Code w Study = "LAS+" AND Overdose = "Yes" AND Interaction? = "Yes"

AND

You want to INTERSECT the results of this advanced condition with the existing advanced condition:

WHERE Country = "United States" OR Country = "Australia"

Table 5-2 lists the values that you enter to create the advanced condition specified in the previous example.

Table 5-2 Values Entered for the Advanced Condition Example

( Attributes Condition Value ) Operator

(

Country

equal to

AUSTRALIA

 

AND

(

Co-Drug Code w Study

equal to

LAS + TAB

 

OR

 

Co-Drug Code w Study

equal to

LAS+

)

AND

 

Overdose

equal to

Yes

 

AND

 

Interaction?

equal to

Yes

)

INTERSECT

 

COI USA OR AUSTRALIA

 

(Advanced Condition)

   

You do not need to include the parentheses if the PL/SQL syntax, the order and precedence of operators are correct.

5.1.3.2 Sample SQL Generated

The following SQL is generated for the previous example:

SELECT DISTINCT v_rpt_case.case_id
FROM v_rpt_case, rpt_product
WHERE v_rpt_case.case_id = rpt_product.case_id
AND ( (v_rpt_case.country_id = 13)
AND ( UPPER (rpt_product.co_drug_code) = 'LAS+TAB'
OR (pat_exposure IN (
SELECT product_id
FROM lm_product
WHERE UPPER (lm_product.drug_code) ='LAS+TAB')))
OR (UPPER (rpt_product.co_drug_code) = 'LAS+'
OR (pat_exposure IN (SELECT product_id FROM lm_product
WHERE UPPER (lm_product.drug_code) ='LAS+')))
AND (rpt_product.is_overdose = 1)
AND (rpt_product.interaction = 1))
INTERSECT
SELECT DISTINCT v_rpt_case.case_id
FROM v_rpt_case
WHERE v_rpt_case.case_id IN (
SELECT DISTINCT v_rpt_case.case_id
FROM v_rpt_case
WHERE (v_rpt_case.country_id = 13)
OR (v_rpt_case.country_id = 223))

Note:

While creating a new Advanced Condition using the saved Advanced Condition, always enclose the saved Advanced Condition within the parenthesis as using Union, Minus, or Intersect will create different select statements and if you use parenthesis with the saved Advanced Condition with new fields, wrong SQL will be generated.

This is the desired and correct SQL.

The following SQL gets generated in this case.

(SELECT DISTINCT v_rpt_case.case_id                FROM v_rpt_case                WHERE v_rpt_case.case_id IN (                                              SELECT DISTINCT v_rpt_case.case_id                                         FROM v_rpt_case                                         WHERE (v_rpt_case.case_num IS NOT NULL)))
UNION
(SELECT DISTINCT v_rpt_case.case_id                FROM v_rpt_case, rpt_event, rpt_product                WHERE v_rpt_case.case_id = rpt_event.case_id                AND v_rpt_case.case_id = rpt_product.case_id                AND ((rpt_event.agent_seq_num = 1)))

Below Query will execute fine but parenthesis will not be at right place. Following is the SQL generated.

SELECT DISTINCT v_rpt_case.case_id              
FROM v_rpt_case, rpt_product
               WHERE v_rpt_case.case_id = rpt_product.case_id
                 AND ( (UPPER (rpt_product.co_drug_code) = 'RELVAC1'
                              OR (pat_exposure IN (
                                   SELECT product_id
                                   FROM lm_product
                                   WHERE UPPER (lm_product.drug_code) = 'RELVAC1')
))
OR ( UPPER (rpt_product.co_drug_code) = 'C_TEST DRUG 1'
OR (pat_exposure IN (
        SELECT product_id
            FROM lm_product
            WHERE UPPER (lm_product.drug_code) = 'C_TEST DRUG 1')
)
)
)
INTERSECT
(SELECT DISTINCT v_rpt_case.case_id
                 FROM v_rpt_case
                WHERE (v_rpt_case.country_id = 81)
UNION
SELECT DISTINCT v_rpt_case.case_id
              FROM v_rpt_case, rpt_followup
              WHERE v_rpt_case.case_id = rpt_followup.case_id
                 AND (( (TRUNC (rpt_followup.receipt_date) =
TO_DATE ('17-MAR-2009', 'DD-MON-YYYY')
)
                 AND rpt_followup.seq_num > 0
)
)
UNION
SELECT DISTINCT v_rpt_case.case_id
               FROM v_rpt_case, rpt_reporters
               WHERE v_rpt_case.case_id = rpt_reporters.case_id
                   AND ((v_rpt_case.state_id = 3))
                   OR (rpt_reporters.primary_contact = 1))

Note: Parenthesis shown in red are not at correct place as compared to AC created. Last parenthesis will come only after complete query creation.

5.2 Working with the Last Modified or Saved Advanced Condition

The system assigns an active status to a advanced condition when you modify and save it or when you execute it. Unless you save the modifications to another advanced condition or execute another advanced condition, the last advanced condition you modified or executed remains active. This is helpful in situations when you want to access a frequently used advanced condition.

To work with last modified or saved advanced condition:

  • For Argus Insight database, select Active (Insight Mart)

  • For Argus Mart database, select Active (Argus Mart)

To view an active advanced condition:

  1. Navigate to Queries > Advanced Condition > Active (Insight Mart).

    The ACTIVE ADVANCED CONDITIONS EDITOR page appears with data source and the advanced condition you executed or modified last.

  2. If the active advanced condition was saved to the system before executing, the name of the advanced condition appears next to the Active Query Name and in the Name field.

    However, if the active advanced condition was not saved to the system before executing, the text <Not Saved> is displayed next to the Active Query Name label.

    You can enter the name of the advanced condition in the Name field and click Save.

    To rename an already saved advanced condition, in the Name field, enter the new name, and click Save.

    From the ACTIVE ADVANCED CONDITION page, you can perform the following tasks:

    Task Description
    Modify the attributes in the Advanced Conditions Editor If required, you can modify the attributes (fields and values) in the Advanced Conditions Editor. See "Creating a New Advanced Condition" for more information.

    Click Save to save the changed field values. This button is only available for a saved active advanced condition.

    Save Active Advanced Condition with another name Click Save As to save the active advanced condition by a different name.

    The ADVANCED CONDITIONS LIBRARY page lists all the advanced conditions saved to the system. See "Working with Saved Advanced Conditions" for more information.

    View the Advanced Condition in SQL Click View SQL to view the underlying SQL query for the advanced condition.

    In this SQL, manually replace the V_RPT_CASE with RPT_CASE. This is required to execute the query in the Oracle database.

    Assign Permissions Click Permissions to set the group-level access permissions on the advanced condition. See "Creating a New Advanced Condition" for more information.

    The Permissions button is only available for saved active advanced conditions.

    Change the Description of the Active Advanced Condition You can change the description of the active advanced condition by modifying the text displayed in the Description field.

    Click Save to store the changed description.

    Execute the Active Advanced Condition Click Execute to generate a case series by using the active advanced condition.

Note that modifying the field values in the Advanced Conditions Editor for an active advanced condition or saving the active advanced condition by a different name changes the active advanced condition to reflect the most recent changes. The active advanced condition also changes in case you modify the field values in the Advanced Conditions Editor and execute the advanced condition without saving the modifications.

5.3 Working with Saved Advanced Conditions

The ADVANCED CONDITIONS LIBRARY page lists all the advanced conditions saved to the system.

To access this page, navigate to Queries > Advanced Conditions > Library.

The ADVANCED CONDITIONS LIBRARY page appears with the following information about each saved advanced condition:

  • Name of the advanced condition.

  • Description of the advanced condition.

  • Date when the advanced condition was last modified.

  • Full name of the user who created the advanced condition.

  • Category assigned to the advanced condition.

  • Data source (Insight Mart/Argus Mart) of the advanced condition.

  • Query type and Date (Current/Historical) for Argus Mart data source only.

5.3.1 Searching Saved Advanced Conditions

  1. Specify the search criteria:

    • To search for an advanced condition by its name, type the advanced condition name in the Name text box.

    • To search for an advanced condition by its description, type the first few words of the description in the Description text box. The system searches for the specified search string in all advanced condition descriptions.

    • To search for an advanced condition by its date of modification, enter the modification date in the first Last Modified date field. You can specify a date range by typing the start and end dates in the first and second date fields, respectively.

    • To search for an advanced condition by its author, select the author name from the User Full Name drop-down list.

    • To search for an advanced condition by its category, select the category from the Category drop-down list.

    Note:

    If you search for a text comprising an underscore, it is treated as a wildcard and is replaced by a letter in the displayed results. For example, If you have queries with names - CURE, CORE, and CARE and you search for C_RE, all three queries are displayed in the result.
  2. Click Search.

    The search results appear based the search criteria.

    • To sort the search results, click the sort icon next to the column headers in the list.

    • To clear the search results and display all the advanced conditions in the list, click Clear.

5.3.2 Creating a New Advanced Condition

See "Creating a New Advanced Condition" for details.

5.3.3 Modifying an Advanced Condition

  1. Navigate to the ADVANCED CONDITIONS LIBRARY page.

  2. Select the advanced condition you want to modify.

  3. Click Modify.

  4. Make your modifications to the advanced condition.

  5. Click Save to save your changes.

    Alternatively, click Save As to save the modified advanced condition by another name.

5.3.4 Modifying the SQL of an Advanced Condition

  1. Navigate to the ADVANCED CONDITIONS LIBRARY page.

  2. Select the advanced condition.

  3. Click Modify.

    The ACTIVE ADVANCED CONDITIONS EDITOR page appears.

  4. Click View SQL.

    The Advanced Conditions SQL dialog appears.

  5. Modify the SQL as per your requirement.

  6. Click Save SQL to save your changes.

  7. Click Close to return to the ADVANCED CONDITIONS LIBRARY page.

  8. Select the modified advanced condition.

  9. Click Execute.

    The search results appear based on your modified SQL.

    Note:

    You cannot modify an advanced condition once you have added user defined SQL in that, you can modify SQL but cannot add new items in advanced condition.

    If you want to add new items, you have to revert the SQL to original by clicking Revert to Original.

5.3.5 Deleting an Advanced Condition

  1. Navigate to the ADVANCED CONDITIONS LIBRARY page.

  2. Select the advanced condition you want to delete.

  3. Click Delete.

    A confirmation dialog box appears.

  4. Click OK.

5.3.6 Executing an Advanced Condition

  1. Navigate to the ADVANCED CONDITIONS LIBRARY page.

  2. Select an advanced condition.

  3. Click Execute.

    The ACTIVE CASE SERIES page appears with the results of the executed advanced condition.

After generating the case series, you can manually modify it or save it. See Chapter 7, "Working with Case Series" for more information.

5.3.7 Executing a Saved Advanced Condition on the Active Case Series

Just as the system assigns the active status to an advanced condition when you save modifications to it or execute it, the last saved or generated case series becomes the active case series.

You may want to run an advanced condition on an active case series.

To narrow down the list of cases in the active case series:

  1. Generate the case series to run another Value Set:

    • You may generate the case series by either using QBE, filters, or advanced conditions. This case series becomes the active case series and remains so until you execute another query to generate a different case series.

    • Alternatively, if the case series on which you want to run another Value Set is already saved in the system, navigate to Case Series > Open Case Series > Library.

      The CASE SERIES LIBRARY page appears.

      Select the case series, and click Make Active.

  2. Navigate to Queries > Advanced Conditions > Library.

    The ADVANCED CONDITIONS LIBRARY page appears.

  3. Select the advanced condition to run on the active case series you generated in Step 1.

  4. Select the Limit Query to Active Case Series check box.

    Note:

    The Limit Query to Active Case Series check box is enabled only when the selected active case series and advance condition are of same type (Insight Mart/Argus Mart).
  5. Click Execute.

    The ACTIVE CASE SERIES page appears with the execution results of the selected advanced condition on the active case series.

    Note that the case series you just generated becomes the active case series.