| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
cMatchProvider --+
|
cMatchProvider_SQL2
Match provider which searches matches
in possibly several database tables.
queries:
- a list of unicode strings
- each string is a query
- each string must contain: "... WHERE <column> %(fragment_condition)s ..."
- each string can contain in the where clause: "... %(<ctxt_key1>)s ..."
- each query must return (data, list_label, field_label)
context definitions to be used in the queries, example:
{'ctxt_key1': {'where_part': 'AND country = %(country)s', 'placeholder': 'country'}}
client code using .set_context() must use the 'placeholder':
<phrasewheel>/<match provider>.set_context('country', 'Germany')
full example query:
query = u" " "
SELECT DISTINCT ON (list_label)
pk_encounter
AS data,
to_char(started, 'YYYY Mon DD (HH24:MI)') || ': ' || l10n_type || ' [#' || pk_encounter || ']'
AS list_label,
to_char(started, 'YYYY Mon DD') || ': ' || l10n_type
AS field_label
FROM
clin.v_pat_encounters
WHERE
(
l10n_type %(fragment_condition)s
OR
type %(fragment_condition)s
) %(ctxt_patient)s
ORDER BY
list_label
LIMIT
30
" " "
context = {'ctxt_patient': {
'where_part': u'AND pk_patient = %(PLACEHOLDER)s',
'placeholder': u'PLACEHOLDER'
}}
self.mp = gmMatchProvider.cMatchProvider_SQL2(queries = query, context = context)
self.set_context(context = 'PLACEHOLDER', val = '<THE VALUE>')
_SQL_data2match:
SQL to retrieve a match by, say, primary key
wherein the only keyword argument is 'pk'
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
| Class Variables | |
|
Inherited from |
| Properties | |
|
Inherited from |
| Method Details |
x.__init__(...) initializes x; see help(type(x)) for signature
|
Return matches for aFragment at start of phrases.
|
Return matches for aFragment at start of words inside phrases.
|
Return matches for aFragment as a true substring.
|
Return all items.
|
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Jan 25 02:55:27 2019 | http://epydoc.sourceforge.net |