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/patient_nums/expire_old_patient_sets.sql @ 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: 886 bytes
Line 
1/**********************
2 * Script 5: ID
3 *
4 * Script 5 does user visible modifications to the database (i.e.
5 * Sets the description of query results to (Expired) if they are expired).
6 *
7 * But is idempotent, so it can be run multiple times to no ill effect.
8 *
9 * Change the description to -> (expired) for all expired query results
10 * Expired when:
11 * 1) A result_instance_id is missing a patient mapping
12 * 2) The querie is older than the release date window
13 *
14 * Also, don't change the name if it is already set as expired.
15 ***********************/
16update blueherondata.qt_query_result_instance@deid
17set description = description || ' (Expired Patient Set)'
18where (result_instance_id in (select result_instance_id from expired_queries_bc_no_map)
19       or start_date < (select release_date from release_date_of_previous)
20      )
21and description not like '%Expired Patient Set%)';
Note: See TracBrowser for help on using the repository browser.