# GNUmed database system bootstrapping config file
#-------------------------------------------------
# license: GPL v2 or later
# author: Karsten Hilbert@gmx.net

#----------------------------------
[installation]
interactive = yes

keep temp files = no

description = $description$
This will update an existing GNUmed version 14
database to the version 15 schema. It does not do
any harm to the data contained within.

The existing database will be cloned first. The copy is
then modified. The original database remains unchanged.
$description$


bundles = $bundles$
v14-v15-static
v14-v15-dynamic
$bundles$

#----------------------------------
[bundle v14_fixups-pre_v15]
database alias = gnumed_v15
minimum postgresql version = 8.3
schema base directory = ../sql/v14-v15/fixups/
schema = $schema$
$schema$

#----------------------------------
[bundle v14-v15-static]
database alias = gnumed_v15
minimum postgresql version = 8.4
schema base directory = ../sql/v14-v15/static/
schema = $schema$
v15-cfg-cfg_data-static.sql
v15-ref-consumable_substance-static.sql
v15-ref-lnk_substance2brand-static.sql
v15-ref-tag_image-static.sql
v15-dem-identity-static.sql
v15-dem-identity_tag-static.sql
v15-dem-enum_ext_id_types-static.sql
v15-dem-org_handling-static.sql
v15-dem-message_inbox-static.sql
v15-clin-health_issue-static.sql
v15-clin-episode-static.sql
v15-clin-substance_intake-static.sql
v15-clin-test_result-static.sql
v15-clin-procedure-static.sql
v15-clin-incoming_data_unmatched-static.sql
v15-staging-hl7-static.sql
v15-ref-icpc2-static.sql
$schema$

#----------------------------------
[bundle v14-v15-dynamic]
database alias = gnumed_v15
minimum postgresql version = 8.4
schema base directory = ../sql/v14-v15/dynamic/
schema = $schema$
v15-audit-register_table_for_auditing.sql
v15-gm-register_notifying_table.sql
v15-i18n-dynamic.sql
v15-i18n-de.sql
v15-cfg-report_query-dynamic.sql
v15-ref-paperwork_templates.sql
v15-ref-consumable_substance-dynamic.sql
v15-ref-lnk_substance2brand-dynamic.sql
v15-ref-v_drug_components.sql
v15-ref-v_branded_drugs.sql
v15-ref-substance_in_brand-dynamic.sql
v15-ref-tag_image-dynamic.sql
v15-dem-identity-dynamic.sql
v15-dem-identity_tag-dynamic.sql
v15-dem-enum_ext_id_types-dynamic.sql
v15-dem-org_handling-dynamic.sql
v15-dem-v_basic_person.sql
v15-dem-v_staff.sql
v15-dem-v_pat_addresses.sql
v15-dem-v_person_names.sql
v15-clin-health_issue-dynamic.sql
v15-clin-episode-dynamic.sql
v15-clin-test_result-dynamic.sql
v15-clin-reviewed_test_results-dynamic.sql
v15-clin-procedure-dynamic.sql
v15-clin-substance_intake-dynamic.sql
v15-clin-consumed_substance-dynamic.sql
v15-clin-v_pat_substance_intake.sql
v15-clin-v_pat_substance_intake_journal.sql
v15-clin-v_pat_procedures.sql
v15-clin-v_health_issues.sql
v15-clin-v_health_issues_journal.sql
v15-clin-v_pat_episodes.sql
v15-clin-v_pat_episodes_journal.sql
v15-clin-v_test_results.sql
v15-clin-v_test_results_journal.sql
v15-clin-v_problem_list.sql
v15-clin-v_potential_problem_list.sql
v15-clin-v_pat_narrative_journal.sql
v15-clin-v_emr_journal.sql
v15-clin-incoming_data_unmatched-dynamic.sql
v15-clin-vaccination-dynamic.sql
v15-dem-v_message_inbox.sql
v15-ref-icpc2-dynamic.sql
v15-ref-icpc2_de-data.sql
v15-staging-hl7-dynamic.sql
v15-clin-keyword_expansion-data.sql
v15-ref-v_coded_terms.sql
v15-release_notes-dynamic.sql
$schema$

#v15-ref-icpc2-data.sql
#v15-ref-icpc2_de-thesaurus.sql

#----------------------------------
[database gnumed_v15]
name = gnumed_v15
drop target database = 1
target version = v15
transfer users = 1
source database = gnumed_v14
source version = v14
audit disable = 0
schema base directory = ../sql/v14-v15/
schema = $schema$
$schema$

superuser schema = $superuser schema$
$superuser schema$

script base directory = ../sql/v14-v15/python/
data import scripts = $data import scripts$
v15-import-form-templates.py
v15-import-tag-images.py
v15-import-atc.py
$data import scripts$

upgrade plausibility checks = $upgrade plausibility checks$
identities::::select count(1) from dem.identity
	select count(1) from dem.identity
names::::select count(1) from dem.names
	select count(1) from dem.names
addresses::::select count(1) + 3 from dem.address
	select count(1) from dem.address
episodes::::select count(1) from clin.episode
	select count(1) from clin.episode
encounters::::select count(1) from clin.encounter
	select count(1) from clin.v_pat_encounters
issues::::select count(1) from clin.health_issue
	select count(1) from clin.health_issue
documents::::select count(1) from blobs.doc_med
	select count(1) from blobs.doc_med
document pages::::select count(1) from blobs.doc_obj
	select count(1) from blobs.doc_obj
allergies::::select count(1) from clin.allergy
	select count(1) from clin.allergy
clinical items::::select count(1) from clin.clin_root_item
	select count(1) from clin.clin_root_item
communication channels::::select count(1) from dem.lnk_identity2comm
	select count(1) from dem.lnk_identity2comm
test results::::select count(1) from clin.test_result
	select count(1) from clin.test_result
unmatched test results::::select count(1) from clin.incoming_data_unmatched
	select count(1) from clin.incoming_data_unmatched
unmatchable test results::::select count(1) from clin.incoming_data_unmatchable
	select count(1) from clin.incoming_data_unmatchable
denormalized test results::::select count(1) from clin.v_test_results
	select count(1) from clin.v_test_results
allergy states::::select count(1) from clin.allergy_state
	select count(1) from clin.allergy_state
waiting list entries::::select count(1) from clin.waiting_list
	select count(1) from clin.waiting_list
messages::::select count(1) + 1 from dem.message_inbox
	select count(1) from dem.message_inbox
operations::::select count(1) from clin.operation
	select count(1) from clin.operation
test orgs::::select count(1) from clin.test_org
	select count(1) from clin.test_org
organisations::::select count(1) + 3 from dem.org
	select count(1) from dem.org
branded drug component intakes::::select count(1) from clin.substance_intake where fk_brand is not null
	select count(1) from clin.substance_intake where fk_drug_component is not null
substance intakes::::select count(1) from clin.substance_intake where fk_brand is null
	select count(1) from clin.substance_intake where fk_drug_component is null
vaccines::::select count(1) from clin.vaccine
	select count(1) from clin.vaccine
vaccines (must have indications)::::select 0
	select count(1) from clin.v_vaccines where indications is NULL
vaccinations::::select count(1) from clin.vaccination
	select count(1) from clin.vaccination
requests on results::::select count(1) from clin.lnk_result2lab_req
	select count(1) from clin.test_result where fk_request is not NULL
$upgrade plausibility checks$


#generic codes::::select count(1) + 2752 from ref.coding_system_root
#	select count(1) from ref.coding_system_root
#data sources::::select count(1) + 2 from ref.data_source
#	select count(1) from ref.data_source


#----------------------------------
[cluster]
host name = 
port = 5432
maintenance database = template1
schema base directory = ../sql/v14-v15/
schema = $schema$
$schema$

#----------------------------------
# these really shouldn't be changed
#----------------------------------
[GnuMed defaults]

groups = $groups$
$groups$

#----------------------------------
