Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: heron_load/qt_patient_update.py @ 0:42ad7288920a

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

Merge with demo_concepts_3800

File size: 1.8 KB
Line 
1'''qt_patient_update.py -- update the patient numbers in the QT results
2-----------------------------------------------------------------------
3
4:copyright: Copyright 2010-2013 University of Kansas Medical Center
5            part of the `HERON open source codebase`__;
6            see NOTICE file for license details.
7
8__ http://informatics.kumc.edu/work/wiki/HERON
9'''
10
11from paver.easy import task, needs, might_call
12
13import sys
14import os  # work around paver-wierdness
15sys.path.append(os.path.dirname(__file__))
16
17from db_util import run_script
18
19
20@task
21@might_call('backup_pat_enc_mappings')
22def update_qt_patient_num_prep(options,
23      construct_qt_patient_map='patient_nums/update_patient_set_numbers.sql',
24      create_deid_patient_map='patient_nums/create_deid_patient_mapping.sql',
25      insert_deid_patient_map='patient_nums/insert_deid_patient_mapping.sql',
26      ):
27    '''
28    Preparation work for updating the qt patient numbers for a new release.
29    The prep work is non-destructive.
30    '''
31    run_script(options.id_db, fn=construct_qt_patient_map)
32    run_script(options.deid_db, fn=create_deid_patient_map)
33    run_script(options.id_db, fn=insert_deid_patient_map)
34
35
36def _update_qt_patient_num(options,
37      update_qt_patient_map='patient_nums/update_patient_numbers_in_patient_set_collection.sql',
38      expire_old_patient_sets='patient_nums/expire_old_patient_sets.sql'
39      ):
40    run_script(options.deid_db, fn=update_qt_patient_map)
41    run_script(options.id_db, fn=expire_old_patient_sets)
42
43
44@task
45@needs('update_qt_patient_num_prep')
46def update_qt_patient_num(options):
47    '''Run preparation and update of the qt patient numbers for a new release.
48
49    WARNING: This should only be run once at the beginning of a
50    release and cannot be easily reversed.
51    '''
52    _update_qt_patient_num(options)
Note: See TracBrowser for help on using the repository browser.