# Query Modelling Problem Ruth Kidd, Ian Townend and Meena Pillai NHS Connecting for Health.

## Presentation on theme: "Query Modelling Problem Ruth Kidd, Ian Townend and Meena Pillai NHS Connecting for Health."— Presentation transcript:

Query Modelling Problem Ruth Kidd, Ian Townend and Meena Pillai NHS Connecting for Health

Business Requirements Background Two users involved: General Practitioner (GP) and Patient (P) 1.P is referred to a urologist for recurrent urinary infection by the GP. 2.GP searches for urologist service using simple keywords and operator: 3.(urologist AND West London). 3.The search criteria is saved for future use.

The Modelling Problem Review Referral Detailed Information 1. DetailedReferralQuery This is a query which the GP may use to obtain all the details about a particular referral. Return Referral Details and Change referral Detailed Information 2. DetailedReferralResponse The Response to the query containing all the referral detailed information. However the business requirement includes wanting to change the response which may lead to selecting another service.

Problem The query mechanism provided within HL7 allows for the representation of a wide range of queries which can also vary in their complexity. The problem faced is in designing a a single query message which is able to deal a range of expressions which may vary greatly in their complexity. Take for example the following expressions: –(A AND B) OR (C AND D) –(A AND B) OR (C AND (D OR E)) The first expression can be expressed easily, the second may be expression but it would involved linking multiple LogicalExpressions together. It is not possible to create a single message which is able to express both the above as well as more complex queries. It is the nested logical statements which pose a problem as the query mechanism does not allow for recursion (i.e. a RelationalExpression cannot have a component which is a RelationalExpression).

Possible Solutions for Expression (A AND B) OR (C AND (D OR E)) Solution 1 – Use of query to represent the Keyword / Operator relationship –The limitation to this design is that as it does not incorporate recursion; the levels of nesting need to known prior to design and cannot be created dynamically. Solution 2 - Use of Acts to represent the recursive Keyword / Operator relationship. –This solution is a non-standard way to represent queries. –It is included to show how the required functionality can be achieved within the HL7 RIM. –It is also included to demonstrate the functionality which could be added to the Query Mechanism to allow for complex queries to be expressed. Solution 3 – Use of query which has been amended to include choice box and recursion – This method demonstrates how the problem can be solved by combining solutions 1 and 2.

Problem 1 - Solution 1 Use a query to model the keyword/operator relationship. (A AND B) OR (C AND D) This model allows us to easily represent the above expression. 1 2 3 4 5 5 A 5 6 6 B 6 4 7 8 8 C 8 9 9 D 9 7 2 1 1 2 3 4 5689 7

Problem 2 - Solution 1 Use a query to model the keyword/operator relationship. (A AND B) OR (C AND (D OR E)) This model does not allow us to represent the final section of this query. It is not possible to express the nested statement. 1 2 3 4 5 5 A 5 6 6 B 6 4 7 8 8 C 8 9 9 D 9 7 2 1 1 2 3 4 5689 7

1 2 3 Problem 1 - Solution 2 Use a query to model the keyword/operator relationship. (A AND B) OR (C AND D) This model allows us to easily represent the above expression. a b c d 1 2 3 3 3 2 3

1 1 2 2 3 3 3 3 3 3 2 2 a b c d e Problem 2 - Solution 2 Use a query to model the keyword/operator relationship. (A AND B) OR (C AND (D OR E)) This model allows us to easily represent the above expression.

Problems 1 and 2 - Solution 3 Amend Query Mechanism to cater for recursion and choice. (A AND B) OR (C AND D) - (A AND B) OR (C AND (D OR E)) In a similar way to Solution 2, this method allows for the representation of both statements.

Questions

Similar presentations