source: heron_load/test_heron_query.py

heron-michigan
Last change on this file was 0:42ad7288920a, checked in by Matt Hoag <mhoag@…>, 2 years ago

Merge with demo_concepts_3800

File size: 23.5 KB
Line 
1r'''test_heron_query.py -- Test HERON queries at the HTTP level.
2
3Usage::
4
5  $ python test_heron_query.py https://heron.kumc.edu/
6
7Given the address of the HERON login page, let's get a query user agent::
8
9>>> heron_pg = sys.argv[1]
10>>> ua = HeronTestUA(heron_pg, 'BlueHeron')
11
12Login (perhaps in demo mode)::
13
14>>> ua.setUp('--demo' in sys.argv,
15...          [os.environ[c] for c in sys.argv[2:4]
16...           if len(sys.argv) >= 4] or None)
17
18ICD10 query (#3527)
19*******************
20>>> ua.saved_query('ICD10 diagnosis query',
21...                '2015-08-31_1026_demo') > 0
22True
23
24
25Drug-Dosage Alerts (#3505)
26***************************************
27>>> ua.saved_query('DRUG_DOSAGE_3505',
28...                '2015-08-12_839_demo') > 0
29True
30
31NCDR (#3739)
32************
33Make sure have to stenosis in at least one artery.
34>>> ua.saved_query('NCDR query #3739',
35...                '2015-09-10_101_demo') > 0
36True
37
38NCDR (#3734)
39************
40Make sure Pre-PCI Left Ventricular Ejection Fraction prompts for numeric results.
41>>> ua.saved_query('NCDR query #3734',
42...                '2015-09-10_135_demo') > 0
43True
44
45NCDR (#3739_3734)
46*****************
47Make sure to have <35 EF No MI No CABG stenosis>70 in three arteries.
48>>> ua.saved_query('NCDR query #3739_3734',
49...                '2015-09-10_116_demo') > 0
50True
51
52ICD10 query (#3527)
53*******************
54>>> ua.saved_query('ICD10 diagnosis query',
55...                '2015-08-31_1026_demo') > 0
56True
57
58
59Drug-Dosage Alerts (#3505)
60***************************************
61>>> ua.saved_query('DRUG_DOSAGE_3505',
62...                '2015-08-12_839_demo') > 0
63True
64
65NCDR (#3224)
66************
67Make sure have at least one fact for PriorPCI.
68>>> ua.saved_query('NCDR PriorPCI Query #3224',
69...                '2015-08-13_891_demo') > 0
70True
71
72Make sure have at least one age fact.
73>>> ua.saved_query('NCDR Age Query #3224',
74...                '2015-08-13_896_demo') > 0
75True
76
77Epic Billing Diagnoses Modifiers
78******************************
79>>> ua.saved_query('Billing Diagnosis - Present on Admission',
80...                '2015-08-12_813_demo') > 0
81True
82
83
84>>> ua.saved_query('Admit billing diagnosis primary',
85...                '2015-07-17_206_demo') > 0
86True
87
88>>> ua.saved_query('Discharge billing diagnosis non-primary',
89...                '2015-07-17_207_demo') > 0
90True
91
92>>> ua.saved_query('Professional billing diagnosis primary',
93...                '2015-07-17_208_demo') > 0
94True
95
96Old DX paths (#2610)
97********************
98>>> ua.saved_query('Old diagnosis path',
99...                '2015-07-10_76_demo') > 0
100True
101
102Drug-Drug Interaction Alerts (#3357)
103***************************************
104>>> ua.saved_query('Drug_Drug_Interaction_Alerts',
105...                '2015-06-05_22_demo') > 0
106True
107
108Email Address as a Fact in Heron (#2896)
109*********************************
110>>> ua.saved_query('Email Address as a Fact in Heron',
111...                '2015-05-08_69_demo') > 0
112True
113
114Expected Length of Stay (#3275)
115*******************************
116>>> ua.saved_query('Expected Length of Stay: At least one patient',
117...                '2015-03-27_433_demo') > 0
118True
119
120Emergency Department Episode ID (#3083)
121***************************************
122>>> ua.saved_query('ED Episode ID: At least one patient.',
123...                '2015-03-20_395_demo') > 0
124True
125
126Alert Dose Med Interaction Checking (#578)
127*********************************
128>>> ua.saved_query('Dose_Med_Interaction_Checking', '2015-03-19_387_demo') > 0
129True
130
131IDX Epic Encounter Mapping (#333)
132*********************************
133>>> ua.saved_query('IDX-Epic_EncounterMapping', '2015-03-19_60_demo') > 0
134True
135
136IDX Place of Service (#2933)
137***************************
138>>> ua.saved_query('IDX-PlaceOfService', '2015-01-12_20_vleonardo') > 0
139True
140
141Simple Reference Ranges (#1267)   
142*******************************
143Make sure have at least one fact showing a 'Normal' result for Potassium.
144>>> ua.saved_query('Normal Potassium Lab Result',
145...                '2014-11-07_633_demo') > 0
146True
147
148Make sure have at least one fact showing a 'High' result for Potassium.
149>>> ua.saved_query('High Potassium Lab Result',
150...                '2014-11-07_634_demo') > 0
151True
152
153Make sure have at least one fact showing a 'Low' result for Potassium.
154>>> ua.saved_query('Low Potassium Lab Result',
155...                '2014-11-07_636_demo') > 0
156True
157
158Test "New" medication hierarchy (GPC #78, #152)
159***********************************************
160>>> ua.saved_query('Medication in new hierarchy', '2014-10-17_552_demo') > 0
161True
162
163BMI Percentile (#2473)
164**********************
165Make sure we have at least one fact showing BMI < 30
166
167>>> ua.saved_query('BMI Percentile', '2014-06-12_10_demo') > 0
168True
169
170Historical Medication Modifier (#1004, #1575)
171*********************************************
172Make sure we have at least one fact when selecting the "Historical Medications"
173modifier. Note that we also cite #1575 since this test exhibited a bug in the
174de-identification code.
175
176>>> ua.saved_query('Historical Medication Modifier',
177...                '2014-05-28_52_ngraham') > 0
178True
179
180Cardiology Labs #2713
181*********************
182Make sure have at least one 2-D DOPPLER ECHO QUERY result.
183>>> ua.saved_query('Cardiology query #2713',
184...                '2014-06-16_21_demo') > 0
185True
186
187
188Numeric Lab Prompt #2006
189************************
190>>> ua.get_term_meta_datatype() == 'PosFloat'
191True
192
193Microbiology Positive Results(without sensitivity test)  #2595
194*******************************************************
195
196Make sure have at least one C DIFF by PCR positive result.
197>>> ua.saved_query('Micro Positive Test',
198...                '2014-04-14_3_demo') > 0
199True
200
201
202Discharge Disposition Codes #2505
203***********************
204
205Make sure have at least one discharge disposition code of 'alive'.
206>>> ua.saved_query('Discharge Disposition Code',
207...                '2014-04-14_7_demo') > 0
208True
209
210Make sure have at least one discharge disposition code of "Not recorded".
211>>> ua.saved_query('Discharge Disposition Not Recorded',
212...                '2014-04-14_1_demo') > 0
213True
214
215
216IDX Service Lines #2398
217***********************
218
219Make sure have at lest a outpatient encounter in the Anesthesiology line.
220>>> ua.saved_query('Outpatient encounter in the Anesthesiology',
221...                '2014-01-21_3_demo') > 0
222True
223
224Billing service area #2655
225**************************
226>>> ua.saved_query('Billing area: IM General Medicine',
227...                '2014-05-09_18_demo') > 0
228True
229
230
231Procedure Order bug #1967
232*************************
233
234Make sure we have at least one inpatient proc order after 2012.08.01
235>>> ua.saved_query('Inpatient proc order after 2012.08',
236...                '2013-12-09_1_demo') > 0
237True
238
239
240Term Navigation Performance
241***************************
242
243Tests REDCap terms if and only if operator has relevant REDCap
244permissions:
245>>> redcap_projects = [p for p in ua._projects if 'REDCap' in p]
246>>> project = (redcap_projects if redcap_projects else ua._projects)[0]
247>>> log.info('using project: %s', project)
248
249Not sure what the correct response is; so far we're getting
250a "Remote server timed out" error:
251
252>>> start = datetime.datetime.now()
253>>> ua.saved_message(project, 'mr_orderables_term_query')
254['DONE']
255>>> end = datetime.datetime.now()
256>>> log.info('REDCap term navigation took %s', end - start)
257>>> end - start < datetime.timedelta(seconds=10)
258True
259
260
261Lab Values and Lab Modifiers
262****************************
263>>> tsh = ua.saved_query('TSH value < 1',
264...                      '2013-10-31_195_demo')
265>>> tshlast = ua.saved_query('(Last) TSH value < 1',
266...                          '2013-11-04_404_demo')
267>>> tshmedian = ua.saved_query('(Median) TSH value > 1',
268...                            '2013-11-04_363_demo')
269>>> tsh > 0
270True
271>>> tshlast > 0
272True
273>>> tshmedian > 0
274True
275
276Allergy/Reactions
277*****************
278>>> hives = ua.saved_query('Hives from Penicillin',
279...                        '2013-07-18_112_demo')
280>>> penicillin = ua.saved_query('Hives from Penicillin',
281...                             '2013-07-18_113_demo')
282>>> hives > 0
283True
284>>> penicillin > hives
285True
286
287
288Smart Notes
289***********
290>>> assoc_symptoms = ua.saved_query('Associated Symptoms',
291...                                 '2013-07-18_9_demo')
292>>> assoc_fever = ua.saved_query('Associated Symptoms: Fever',
293...                              '2013-07-18_10_demo')
294>>> assoc_fever > 0
295True
296>>> assoc_symptoms > assoc_fever
297True
298
299
300Dispensed Medication Modifier
301*****************************
302
303>>> dispensed_med = ua.saved_query('Dispensed medication',
304...                                '2013-03-08_110_demo')
305>>> dispensed_med > 0
306True
307
308
309Dose from the MAR
310*****************
311
312>>> aceta_mar_eq_500mg = ua.saved_query('Aceta 500mg Dose MAR',
313...                                     '2013-03-08_94_demo')
314>>> aceta_mar_all = ua.saved_query('Aceta 500mg all facts',
315...                                '2013-03-08_95_demo')
316>>> 0 < aceta_mar_eq_500mg <= aceta_mar_all
317True
318
319
320"No Home Medication" orders exist
321*********************************
322
323Make sure we have at least one order
324>>> no_hmed = ua.saved_query('No Home Medication Order', '2013-02-07_131_demo')
325>>> 0 < no_hmed
326True
327
328Attempt to get concept info for Frontiers Registry
329>>> term_name = ua.get_term_name()
330>>> 'Frontiers Research Participant Registry' in term_name
331True
332
333Surgical History - Verify that the number of patients with a surgical history
334is greater than the number of patients with a history of shoulder surgery.
335>>> surg_hist = ua.saved_query('Surgical History Validation',
336...                            '2013-01-17_695_demo')
337>>> shoulder_hist = ua.saved_query('Surgical History Validation',
338...                            '2013-03-19_159_demo')
339>>> shoulder_hist > 0
340True
341
342>>> surg_hist > shoulder_hist
343True
344
345
346Social History
347**************
348
349Verify that the number of patients with a social history about tobacco
350is greater than the number of patients with that have never used
351tobacco.
352
353>>> tob_hist = ua.saved_query('Social History Validation',
354...                           '2013-01-09_545_demo')
355>>> tob_never_hist = ua.saved_query('Social History Validation',
356...                                 '2013-01-09_546_demo')
357>>> tob_hist > tob_never_hist
358True
359
360
361Medical History
362***************
363
364Verify that the number of patients with a diagnosis in past medical
365history is greater than the number of patients with a diagnosis for
366diseases of the blood and blood-forming organs.
367
368>>> med_hist = ua.saved_query('Medical History Validation',
369...                           '2013-01-09_495_demo')
370>>> blood_hist = ua.saved_query('Medical History Validation',
371...                             '2013-01-09_496_demo')
372>>> med_hist > blood_hist
373True
374
375
376Family History
377**************
378
379Verify that the number of patients with a Family History of Cancer and
380Tumors is greater than the number of patients with a Parent who has
381had Cancer.
382
383>>> family_canc = ua.saved_query('Family History Validation',
384...                              '2013-01-09_388_demo')
385>>> parent_canc = ua.saved_query('Family History Validation',
386...                              '2013-01-09_390_demo')
387>>> family_canc > parent_canc
388True
389
390
391Age at visit
392************
393
394We have more 2 year-olds at visit facts than patients who are 2 now
395>>> age_2_now = ua.saved_query('2yo now', '2012-12-14_270_demo')
396>>> age_2_visit = ua.saved_query('2yo at visit', '2012-12-14_271_demo')
397>>> age_2_visit > age_2_now or ('--demo' in sys.argv and
398...                             age_2_visit > 0)
399True
400
401We have more 0-9 year-olds at visit than 2 year-olds at visit
402>>> age_0_9_visit = ua.saved_query('0-9 at visit', '2012-12-14_272_demo')
403>>> age_0_9_visit > age_2_visit
404True
405
406
407Deceased per SSA - Make sure we have some patients
408**************************************************
409
410>>> dead_per_ssa = ua.saved_query('Deceased per SSA', '2012-12-14_234_demo')
411>>> dead_per_ssa > 0
412True
413
414
415UHC Service Line Regression Test
416********************************
417
418>>> qty = ua.saved_query('UHC Service line #1359', '2012-09-19_16_mnair')
419>>> qty > (10000 if ('--demo' not in sys.argv) else 1)
420True
421
422
423Postal Codes Regression Test
424****************************
425
426>>> ua.query_by_path('check postal codes other than states: DC',
427...                  r'\\i2b2\i2b2\Demographics\State\DC' + '\\') >= 1
428True
429
430.. todo:: reduce redundancy between doctest and test description args.
431
432
433Procedure Order
434***************
435
436Patients that have in-patient procedure orders should be higher
437than patients with no record of in-patient vs. out-patient.
438
439>>> proc_order_inpat = ua.saved_query('Procedure orders with inpatient',
440...                               '2013-02-07_100_demo')
441>>> proc_order_notrec = ua.saved_query('Procedure orders with no modifiers',
442...                               '2013-02-07_101_demo')
443>>> proc_order_inpat > proc_order_notrec
444True
445
446
447Encounter Vitals
448****************
449
450Patients with LMP data should be female:
451
452>>> lmp_fem = ua.saved_query('testing vitals from encounters',
453...                               '2013-01-14_683_demo')
454>>> lmp_fem > 18
455True
456
457
458Encounter Type
459**************
460There should be patients with the Inpatient Encounter Type
461
462>>> inpatient_enc = ua.saved_query('testing for inpatient encounter types',
463...                                '2014-07-09_102_demo')
464>>> inpatient_enc > 0
465True
466
467>>> all_enc = ua.saved_query('testing for all encounter types',
468...                          '2014-07-09_101_demo')
469>>> all_enc > inpatient_enc
470True
471
472
473Notes
474*****
475
476dc_summaries = ua.saved_query('Epic DC summary validation',
477                              '2012-08-15_16_demo')
478    # check for at least a few; we'd expect above 1k in production,
479    # but we'd like the test to pass in test too.
480    assert(dc_summaries > 3)
481
482
483Tumor Registry Vocabulary Evolution
484***********************************
485
486>>> ua.saved_query('tumor registry vocabulary evolution #804, #733',
487...                '2013-03-19_51_dconnolly') >= 1
488True
489
490See also resulting problems: #1084, #1840.
491
492
493MAR Validation
494**************
495
496>>> va_meds_all = ua.saved_query('MAR validation', '2012-10-23_59_ngraham')
497>>> va_meds_gvn = ua.saved_query('MAR validation', '2013-01-03_15230_ngraham')
498>>> 0 < va_meds_gvn < va_meds_all
499True
500
501
502Dose Validation
503***************
504
505>>> diphen_lt_200mg = ua.saved_query('Dose validation', '2013-01-03_297_demo')
506>>> diphen_fact = ua.saved_query('Dose validation', '2012-11-07_53_demo')
507>>> 0 < diphen_lt_200mg <= diphen_fact
508True
509
510
511Value Constraint Performance
512****************************
513
514>>> ua.query_by_def('check Potassium < 4, a set value query',
515...                 set_value_query) >= 1
516True
517
518
519Basic Demographics
520******************
521
522>>> all_pats = ua.query_by_path(
523...                 'We should have gender on (nearly) all patients.',
524...                 r'\\i2b2\i2b2\Demographics\Gender' + '\\')
525>>> male_pats = ua.query_by_path(
526...                 'roughly half should be male',
527...                 r'\\i2b2\i2b2\Demographics\Gender\Male' + '\\')
528>>> abs(all_pats * 1.0 / male_pats - 2.0) < 0.3
529True
530
531
532Exclusion Logic
533***************
534
535At least 1,736 out of ~2M
536>>> excluded = ua.saved_query('exclusion testing', '2012-04-30_6546_ngraham')
537>>> excluded >= (1 + all_pats * (1736.0 / 2000000.0))
538True
539
540
541Same-Encounter Performance
542**************************
543
544.. todo:: fail if performance is bad
545
546>>> se = ua.saved_query('same-encounter performance', '2012-06-29_7383_mnair')
547>>> se > 0
548True
549
550:copyright: Copyright 2010-2013 University of Kansas Medical Center
551            part of the `HERON open source codebase`__;
552            see NOTICE file for license details.
553
554__ http://informatics.kumc.edu/work/wiki/HERON
555'''
556
557import sys
558import datetime
559import logging
560import pkg_resources
561import os
562
563from test_heron_login import TestDeveloper, HeronUA
564
565log = logging.getLogger(__name__)
566
567
568def main(argv):
569    import doctest
570    doctest.testmod(raise_on_error=True)
571
572
573class HeronQueryUA(HeronUA):
574    def __init__(self, home, project_id):
575        HeronUA.__init__(self, home)
576        self.project_id = project_id
577
578    def patient_count(self, project_id, path):
579        return self.patient_count_query(simple_query(path))
580
581    def patient_count_query(self, query_def):
582        '''Run a patient count query.
583
584        .. todo:: check for unfinished query status
585        '''
586
587        doc = self._post_to_hive(MSG_Q0 % {
588            'USERNAME': self._authz[0],
589            'PASSWORD': self._sessionkey,
590            'QUERY_DEFINITION': query_def,
591            'PROJECT_ID': self.project_id})
592
593        # todo: handle other than 'DONE'
594        log.debug('patient_count_query status: %s',
595                  [n for n in doc.xpath('/*/message_body/*'
596                                        '/query_instance'
597                                        '/query_status_type/name')])
598        log.debug('patient_count_query status type: %s',
599                  [n for n in doc.xpath('/*/response_header'
600                                        '/result_status/status/@type')])
601
602        return int(doc.xpath('/*/message_body/*/query_result_instance/'
603                             'set_size')[0].text)
604
605    def get_term_name(self,
606                      term_path='\\\\i2b2_Demographics\\i2b2'
607                      '\\Demographics\\HICTR Participant\\'):
608        doc = self.get_term_info(term_path=term_path)
609        return doc.xpath('/*/message_body/*/concept/name')[0].text
610
611    def get_term_meta_datatype(self,
612                               term_path='\\\\i2b2_Labtests\\i2b2\\Labtests'
613                               '\\KUH\\CHEMISTRY\\198-GENERAL CHEMISTRY\\2002:'
614                               ' POTASSIUM\\'):
615        doc = self.get_term_info(term_path=term_path)
616        return doc.xpath('/*/message_body/*/concept/metadataxml/'
617                         'ValueMetadata/DataType')[0].text
618
619    def get_term_info(self, term_path):
620        '''Get concept term information.'''
621        doc = self._post_to_hive(MSG_get_term_info % {
622            'USERNAME': self._authz[0],
623            'PASSWORD': self._sessionkey,
624            'TERM_PATH': term_path,
625            'PROJECT_ID': self.project_id})
626
627        log.debug('get_term_info status type: %s',
628                  [n for n in doc.xpath('/*/response_header'
629                                        '/result_status/status/@type')])
630
631        return doc
632
633
634class HeronTestUA(HeronQueryUA):
635    def setUp(self, demo=False, creds=None):
636        log.info("opening Heron homepage...")
637        self.go_home()
638        log.info("Found page with title: %s", self.title())
639
640        if demo:
641            self._authz = ('demo', 'demouser')
642        else:
643            td = TestDeveloper()
644            u, p = creds if creds is not None else td.creds()
645
646            log.info("Submitting CAS login form...")
647            self.login(u, p)
648            log.info("Found page with title: %s", self.title())
649
650            log.info("Following link to i2b2 query tool...")
651            self.go_i2b2()
652            log.info("Found page with title: %s", self.title())
653
654        log.info("Getting user configuration...")
655        self.get_user_configuration()
656        log.info("Got it.")
657
658    def query_by_def(self, test_description, query_def):
659        log.info("\nTesting: %s", test_description)
660        start = datetime.datetime.now()
661        log.debug("Sending...")
662        num = self.patient_count_query(query_def)
663        log.info('Found: %s', num)
664        end = datetime.datetime.now()
665        log.info('timing: %s, %s, %s', start, end, end - start)
666        sys.stdout.flush()  # TODO: don't refer to sys here
667        sys.stderr.flush()
668        return int(num)
669
670    def query_by_path(self, test_description, path):
671        return self.query_by_def(test_description, simple_query(path))
672
673    def saved_query(self, test_description, name):
674        # TODO: get description from .json
675        i2b2xml = pkg_resources.resource_string(
676            __name__, 'test_queries/' + name + '.xml')
677        # tee hee... quick-n-dirty XML parsing
678        qdef_ = i2b2xml.split('<query_definition>', 1)[1].split(
679            '</query_definition>', 1)[0]
680        qdef = '<query_definition>' + qdef_ + '</query_definition>'
681        return self.query_by_def(test_description, qdef)
682
683    def saved_message(self, project, name):
684        '''Re-send a saved message.
685
686        @param project: one of the project names from get_user_configuration()
687        @param name: base name of one of an .xml message file in test_queries
688        @return: a list of statuses (strings)
689        TODO: consider returning just one status.
690        '''
691        i2b2xml = pkg_resources.resource_string(
692            __name__, 'test_queries/' + name + '.xml')
693
694        msg_body = i2b2xml % dict(USERNAME=self._authz[0],
695                                  PASSWORD=self._sessionkey,
696                                  PROJECT=project)
697        log.info('re-playing saved message: %s', name)
698        reply = self._post_to_hive(msg_body)
699
700        status = [t for t in reply.xpath('/*/response_header'
701                                         '/result_status/status/@type')]
702        log.info('reply status: %s', status)
703        return status
704
705
706MSG_get_term_info = ('''
707<ns3:request
708    xmlns:ns3="http://www.i2b2.org/xsd/hive/msg/1.1/"
709    xmlns:ns4="http://www.i2b2.org/xsd/cell/ont/1.1/"
710    xmlns:ns2="http://www.i2b2.org/xsd/hive/plugin/">
711  <message_header>
712    <proxy>
713      <redirect_url>http://localhost:9090/i2b2/services/'''
714'''OntologyService/getTermInfo</redirect_url>
715    </proxy>
716    <i2b2_version_compatible>1.1</i2b2_version_compatible>
717    <hl7_version_compatible>2.4</hl7_version_compatible>
718    <sending_application>
719      <application_name>i2b2 Ontology</application_name>
720      <application_version>1.6</application_version>
721    </sending_application>
722    <sending_facility>
723      <facility_name>i2b2 Hive</facility_name>
724    </sending_facility>
725    <receiving_application>
726      <application_name>Ontology Cell</application_name>
727      <application_version>1.6</application_version>
728    </receiving_application>
729    <receiving_facility>
730      <facility_name>i2b2 Hive</facility_name>
731    </receiving_facility>
732    <datetime_of_message>2012-12-28T11:26:28-06:00</datetime_of_message>
733    <security>
734      <domain>i2b2demo</domain>
735      <username>%(USERNAME)s</username>
736      <password token_ms_timeout="1800000" is_token="true">'''
737'''SessionKey:%(PASSWORD)s</password>
738    </security>
739    <message_control_id>
740      <message_num>03nR6lztWjwdlHJq6KSVM</message_num>
741      <instance_num>0</instance_num>
742    </message_control_id>
743    <processing_id>
744      <processing_id>P</processing_id>
745      <processing_mode>I</processing_mode>
746    </processing_id>
747    <accept_acknowledgement_type>AL</accept_acknowledgement_type>
748    <application_acknowledgement_type>AL</application_acknowledgement_type>
749    <country_code>US</country_code>
750    <project_id>%(PROJECT_ID)s</project_id>
751  </message_header>
752  <request_header>
753    <result_waittime_ms>180000</result_waittime_ms>
754  </request_header>
755  <message_body>
756    <ns4:get_term_info blob="true" type="core"  synonyms="true" hiddens="true">
757      <self>%(TERM_PATH)s</self>
758    </ns4:get_term_info>
759  </message_body>
760</ns3:request>''')
761
762
763MSG_Q0 = pkg_resources.resource_string(__name__, 'test_query_definition.xml')
764
765
766def simple_query(path):
767    return QDEF0 % {'CONCEPT_PATH': path}
768
769QDEF0 = r'''<query_definition>
770  <query_name>test_heron_query.py@@</query_name>
771  <specificity_scale>0</specificity_scale>
772  <panel>
773    <panel_number>1</panel_number>
774    <invert>0</invert>
775    <total_item_occurrences>1</total_item_occurrences>
776    <item>
777      <hlevel>-1</hlevel>
778      <item_name>ITEM_NAME</item_name>
779      <item_key>%(CONCEPT_PATH)s</item_key>
780      <tooltip>undefined</tooltip>
781      <class>ENC</class>
782      <constrain_by_date></constrain_by_date>
783      <item_icon>LA</item_icon>
784      <item_is_synonym>false</item_is_synonym>
785    </item>
786  </panel>
787</query_definition>
788'''
789
790
791set_value_query = pkg_resources.resource_string(__name__,
792                                                'test_set_value.xml')
793
794
795if __name__ == '__main__':
796    logging.basicConfig(level=logging.INFO)
797    main(sys.argv)
Note: See TracBrowser for help on using the repository browser.