diff --git a/.gitignore b/.gitignore index 3a0b1bc5..c07bb442 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,4 @@ outputGlobal *.RData REDCap-app/html/redcap REDCap-app/html/redcapdocs -REDCap-app/build/config/msmtprc REDCap-app/log \ No newline at end of file diff --git a/Dockerfile_R b/Dockerfile_R index 883bd06f..01e442d7 100644 --- a/Dockerfile_R +++ b/Dockerfile_R @@ -27,7 +27,7 @@ RUN R CMD INSTALL --preclean --no-multiarch --with-keep.source R-kds2db/kds2db # db2frontend -RUN apt-get install -y libsodium-dev +RUN apt-get install -y libsodium-dev libsecret-1-0 RUN /rocker_scripts/bin/install2.r redcapAPI dplyr diff --git a/Install.md b/Install.md new file mode 100644 index 00000000..ef25f8b5 --- /dev/null +++ b/Install.md @@ -0,0 +1,24 @@ +# Installationsanleitung bzw. Anleitung zur Einrichtung der INTERPOLAR IT Tools + + * Checkout des INTERPOLAR Repositories \ + ```git clone git@github.com:medizininformatik-initiative/INTERPOLAR.git``` + * Wechsel in das geclonte Verzeichnis \ + ```cd INTERPOLAR``` + * den Branch 'release' auschecken \ + ```git checkout release``` + * Konfigurationsdateien aus den Vorlagen (Templates) erstellen + * Postgres-amts_db/template_env_amts_db_admin.password nach Postgres-amts_db/.env_amts_db_admin.password kopieren und ein Passwort-String einfügen. Dieses Passwort ist für den Admin-Nutzer der amts-Datenbank. \ + ```cp Postgres-amts_db/template_env_amts_db_admin.password Postgres-amts_db/.env_amts_db_admin.password``` + * REDCap-db/template_env-redcap-db kopieren nach REDCap-db/.env-redcap-db \ + ```cp REDCap-db/template_env-redcap-db REDCap-db/.env-redcap-db``` + * REDCap-db/template_env_redcap_db.password kopieren nach REDCap-db/.env_redcap_db.password und tragen Sie ein Passwort für den Nutzer der redcap Datenbank ein \ + ```cp REDCap-db/template_env_redcap_db.password REDCap-db/.env_redcap_db.password``` + * REDCap-db/template_env_redcap_db_root.password kopieren nach REDCap-db/.env_redcap_db_root.password und tragen Sie ein Passwort für den root-Nutzer der Datenbank ein \ + ```cp REDCap-db/template_env_redcap_db_root.password REDCap-db/.env_redcap_db_root.password``` + * Führen Sie die Anweisungen in [REDCap-app/Readme.md](REDCap-app/Readme.md) aus + * Führen Sie die Anweisungen in [REDCap-app/html/Readme.md](REDCap-app/html/Readme.md) aus + * Führen Sie docker-compose aus: \ + ```docker-compose up``` + * Die amts_db (Postges-Datenbank) erreichen Sie im Browser (PGAdmin) über die URL: [http://127.0.0.1:8089/](http://127.0.0.1:8089/) + * Das Frontend (REDCap) erreichen Sie im Browser über die URL: [http://127.0.0.1:8082/redcap](http://127.0.0.1:8082/redcap) + diff --git a/Postgres-amts_db/Readme.md b/Postgres-amts_db/Readme.md new file mode 100644 index 00000000..e366f3e5 --- /dev/null +++ b/Postgres-amts_db/Readme.md @@ -0,0 +1,4 @@ +# AMTS Datenbank (amts_db) + +Mit dem docker-compose wird ein PGAdmin zur Verfügung gestellt, welches unter der folgenden URL verfügbar ist: \ +[http://127.0.0.1:8089/](http://127.0.0.1:8089/) diff --git a/Postgres-amts_db/init/init-db.sql b/Postgres-amts_db/init/init-db.sql index 4be88533..28218c7d 100644 --- a/Postgres-amts_db/init/init-db.sql +++ b/Postgres-amts_db/init/init-db.sql @@ -4,7 +4,7 @@ CREATE EXTENSION pg_cron; -- optionally, grant usage to regular users: -GRANT USAGE ON SCHEMA cron TO interpolar_admin; +GRANT USAGE ON SCHEMA cron TO amts_db_admin; -- Create USER SQL CREATE USER kds2db_user WITH PASSWORD 'kds2db' CONNECTION LIMIT 20; @@ -53,125 +53,1244 @@ GRANT USAGE ON SCHEMA cron TO db_user; --Create SQL Table in Schema kds2db_in CREATE TABLE IF NOT EXISTS kds2db_in.encounter ( encounter_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität -enc_id varchar (70), -- id (70 x 1 varchar)" -enc_pat_id varchar (70), -- subject/reference (70 x 1 varchar) +enc_id varchar (70), -- id (70 x 1 varchar) +enc_patient_id varchar (70), -- subject/reference (70 x 1 varchar) enc_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) -enc_identifier_use varchar (90), -- identifier/use (30 x 3 varchar) -enc_identifier_type_system varchar (210), -- identifier/type/coding/system (70 x 3 varchar) -enc_identifier_type_version varchar (150), -- identifier/type/coding/version (50 x 3 varchar) -enc_identifier_type_code varchar (90), -- identifier/type/coding/code (30 x 3 varchar) -enc_identifier_type_display varchar (300), -- identifier/type/coding/display (100 x 3 varchar) -enc_identifier_type_text varchar (1500), -- identifier/type/text (500 x 3 varchar) -enc_identifier_system varchar (210), -- identifier/system (70 x 3 varchar) -enc_identifier_value varchar (150), -- identifier/value (50 x 3 varchar) -enc_identifier_period_start varchar (90), -- identifier/period/start (30 x 3 varchar) -enc_identifier_period_end varchar (90), -- identifier/period/end (30 x 3 varchar) -enc_identifier_assigner_id varchar (150), -- identifier/assigner/reference (50 x 3 varchar) -enc_identifier_assigner_type varchar (90), -- identifier/assigner/type (30 x 3 varchar) -enc_identifier_assigner_identifier_type_use varchar (60), -- identifier/assigner/identifier/use (20 x 3 varchar) -enc_identifier_assigner_identifier_type_system varchar (210), -- identifier/assigner/identifier/type/coding/system (70 x 3 varchar) -enc_identifier_assigner_identifier_type_version varchar (90), -- identifier/assigner/identifier/type/coding/version (30 x 3 varchar) -enc_identifier_assigner_identifier_type_code varchar (90), -- identifier/assigner/identifier/type/coding/code (30 x 3 varchar) -enc_identifier_assigner_identifier_type_display varchar (300), -- identifier/assigner/identifier/type/coding/display (100 x 3 varchar) -enc_identifier_assigner_identifier_type_text varchar (1500), -- identifier/assigner/identifier/type/text (500 x 3 varchar) -enc_identifier_assigner_identifier_system varchar (150), -- identifier/assigner/identifier/system (50 x 3 varchar) -enc_identifier_assigner_identifier_value varchar (300), -- identifier/assigner/identifier/value (100 x 3 varchar) -enc_identifier_assigner_identifier_period_start varchar (90), -- identifier/assigner/identifier/period/start (30 x 3 varchar) -enc_identifier_assigner_identifier_period_end varchar (90), -- identifier/assigner/identifier/period/end (30 x 3 varchar) -enc_status varchar (20), -- status (20 x 1 varchar) -enc_class_system varchar (70), -- class/system (70 x 1 varchar) -enc_class_version varchar (30), -- class/version (30 x 1 varchar) -enc_class_code varchar (30), -- class/code (30 x 1 varchar) -enc_class_display varchar (100), -- class/display (100 x 1 varchar) -enc_type_system varchar (700), -- type/coding/system (70 x 10 varchar) -enc_type_version varchar (300), -- type/coding/version (30 x 10 varchar) -enc_type_code varchar (300), -- type/coding/code (30 x 10 varchar) -enc_type_display varchar (500), -- type/coding/display (50 x 10 varchar) -enc_type_text varchar (3000), -- type/text (300 x 10 varchar) -enc_servicetype_system varchar (210), -- serviceType/coding/system (70 x 3 varchar) -enc_servicetype_version varchar (90), -- serviceType/coding/version (30 x 3 varchar) -enc_servicetype_code varchar (90), -- serviceType/coding/code (30 x 3 varchar) -enc_servicetype_display varchar (300), -- serviceType/coding/display (100 x 3 varchar) +enc_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +enc_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +enc_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +enc_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +enc_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +enc_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +enc_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +enc_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +enc_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +enc_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +enc_status varchar (30), -- status (30 x 1 varchar) +enc_class_system varchar (70), -- class/coding/system (70 x 1 varchar) +enc_class_version varchar (50), -- class/coding/version (50 x 1 varchar) +enc_class_code varchar (30), -- class/coding/code (30 x 1 varchar) +enc_class_display varchar (100), -- class/coding/display (100 x 1 varchar) +enc_type_system varchar (630), -- type/coding/system (70 x 9 varchar) +enc_type_version varchar (450), -- type/coding/version (50 x 9 varchar) +enc_type_code varchar (270), -- type/coding/code (30 x 9 varchar) +enc_type_display varchar (900), -- type/coding/display (100 x 9 varchar) +enc_type_text varchar (1500), -- type/text (500 x 3 varchar) +enc_servicetype_system varchar (70), -- serviceType/coding/system (70 x 1 varchar) +enc_servicetype_version varchar (50), -- serviceType/coding/version (50 x 1 varchar) +enc_servicetype_code varchar (30), -- serviceType/coding/code (30 x 1 varchar) +enc_servicetype_display varchar (100), -- serviceType/coding/display (100 x 1 varchar) +enc_servicetype_text varchar (500), -- serviceType/text (500 x 1 varchar) enc_period_start varchar (30), -- period/start (30 x 1 varchar) enc_period_end varchar (30), -- period/end (30 x 1 varchar) -enc_diagnosis_condition_id varchar (1050), -- diagnosis/condition/reference (70 x 15 varchar) -enc_diagnosis_use_system varchar (1050), -- diagnosis/use/coding/system (70 x 15 varchar) -enc_diagnosis_use_version varchar (450), -- diagnosis/use/coding/version (30 x 15 varchar) -enc_diagnosis_use_code varchar (450), -- diagnosis/use/coding/code (30 x 15 varchar) -enc_diagnosis_use_display varchar (1500), -- diagnosis/use/coding/display (100 x 15 varchar) -enc_diagnosis_use_text varchar (7500), -- diagnosis/use/text (500 x 15 varchar) -enc_diagnosis_rank varchar (75), -- diagnosis/rank (5 x 15 varchar) -enc_hospitalization_admitsource_system varchar (140), -- hospitalization/admitSource/coding/system (70 x 2 varchar) -enc_hospitalization_admitsource_version varchar (60), -- hospitalization/admitSource/coding/version (30 x 2 varchar) -enc_hospitalization_admitsource_code varchar (60), -- hospitalization/admitSource/coding/code (30 x 2 varchar) -enc_hospitalization_admitsource_display varchar (200), -- hospitalization/admitSource/coding/display (100 x 2 varchar) -enc_hospitalization_admitsource_text varchar (1000), -- hospitalization/admitSource/text (500 x 2 varchar) -enc_hospitalization_dischargedisposition_system varchar (140), -- hospitalization/dischargeDisposition/coding/system (70 x 2 varchar) -enc_hospitalization_dischargedisposition_version varchar (60), -- hospitalization/dischargeDisposition/coding/version (30 x 2 varchar) -enc_hospitalization_dischargedisposition_code varchar (60), -- hospitalization/dischargeDisposition/coding/code (30 x 2 varchar) -enc_hospitalization_dischargedisposition_display varchar (200), -- hospitalization/dischargeDisposition/coding/display (100 x 2 varchar) -enc_hospitalization_dischargedisposition_text varchar (1000), -- hospitalization/dischargeDisposition/text (500 x 2 varchar) -enc_location_id varchar (210), -- location/location/reference (70 x 3 varchar) -enc_location_type varchar (150), -- location/location/type (50 x 3 varchar) -enc_location_identifier_type_use varchar (90), -- location/location/identifier/use (30 x 3 varchar) -enc_location_identifier_type_system varchar (210), -- location/location/identifier/type/coding/system (70 x 3 varchar) -enc_location_identifier_type_version varchar (150), -- location/location/identifier/type/coding/version (50 x 3 varchar) -enc_location_identifier_type_code varchar (90), -- location/location/identifier/type/coding/code (30 x 3 varchar) -enc_location_identifier_type_display varchar (300), -- location/location/identifier/type/coding/display (100 x 3 varchar) -enc_location_identifier_type_text varchar (1500), -- location/location/identifier/type/text (500 x 3 varchar) -enc_location_identifier_system varchar (210), -- location/location/identifier/system (70 x 3 varchar) -enc_location_identifier_value varchar (150), -- location/location/identifier/value (50 x 3 varchar) -enc_location_identifier_period_start varchar (90), -- location/location/identifier/period/start (30 x 3 varchar) -enc_location_identifier_period_end varchar (90), -- location/location/identifier/period/end (30 x 3 varchar) -enc_location_display varchar (150), -- location/location/display (50 x 3 varchar) -enc_location_physicaltype_system varchar (210), -- location/location/physicalType/coding/system (70 x 3 varchar) -enc_location_physicaltype_version varchar (90), -- location/location/physicalType/coding/version (30 x 3 varchar) -enc_location_physicaltype_code varchar (150), -- location/location/physicalType/coding/code (50 x 3 varchar) -enc_location_physicaltype_display varchar (300), -- location/location/physicalType/coding/display (100 x 3 varchar) -enc_location_physicaltype_text varchar (1500), -- location/location/physicalType/text (500 x 3 varchar) +enc_diagnosis_condition_id varchar (490), -- diagnosis/condition/reference (70 x 7 varchar) +enc_diagnosis_use_system varchar (1470), -- diagnosis/use/coding/system (70 x 21 varchar) +enc_diagnosis_use_version varchar (1050), -- diagnosis/use/coding/version (50 x 21 varchar) +enc_diagnosis_use_code varchar (630), -- diagnosis/use/coding/code (30 x 21 varchar) +enc_diagnosis_use_display varchar (2100), -- diagnosis/use/coding/display (100 x 21 varchar) +enc_diagnosis_use_text varchar (3500), -- diagnosis/use/text (500 x 7 varchar) +enc_diagnosis_rank varchar (14), -- diagnosis/rank (2 x 7 varchar) +enc_hospitalization_admitsource_system varchar (70), -- hospitalization/admitSource/coding/system (70 x 1 varchar) +enc_hospitalization_admitsource_version varchar (50), -- hospitalization/admitSource/coding/version (50 x 1 varchar) +enc_hospitalization_admitsource_code varchar (30), -- hospitalization/admitSource/coding/code (30 x 1 varchar) +enc_hospitalization_admitsource_display varchar (100), -- hospitalization/admitSource/coding/display (100 x 1 varchar) +enc_hospitalization_admitsource_text varchar (500), -- hospitalization/admitSource/text (500 x 1 varchar) +enc_hospitalization_dischargedisposition_system varchar (70), -- hospitalization/dischargeDisposition/coding/system (70 x 1 varchar) +enc_hospitalization_dischargedisposition_version varchar (50), -- hospitalization/dischargeDisposition/coding/version (50 x 1 varchar) +enc_hospitalization_dischargedisposition_code varchar (30), -- hospitalization/dischargeDisposition/coding/code (30 x 1 varchar) +enc_hospitalization_dischargedisposition_display varchar (100), -- hospitalization/dischargeDisposition/coding/display (100 x 1 varchar) +enc_hospitalization_dischargedisposition_text varchar (500), -- hospitalization/dischargeDisposition/text (500 x 1 varchar) +enc_location_id varchar (140), -- location/location/reference (70 x 2 varchar) +enc_location_type varchar (60), -- location/location/type (30 x 2 varchar) +enc_location_identifier_use varchar (60), -- location/location/identifier/use (30 x 2 varchar) +enc_location_identifier_type_system varchar (420), -- location/location/identifier/type/coding/system (70 x 6 varchar) +enc_location_identifier_type_version varchar (300), -- location/location/identifier/type/coding/version (50 x 6 varchar) +enc_location_identifier_type_code varchar (180), -- location/location/identifier/type/coding/code (30 x 6 varchar) +enc_location_identifier_type_display varchar (600), -- location/location/identifier/type/coding/display (100 x 6 varchar) +enc_location_identifier_type_text varchar (1000), -- location/location/identifier/type/text (500 x 2 varchar) +enc_location_display varchar (200), -- location/location/display (100 x 2 varchar) +enc_location_status varchar (20), -- location/location/status (10 x 2 varchar) +enc_location_physicaltype_system varchar (420), -- location/location/physicalType/coding/system (70 x 6 varchar) +enc_location_physicaltype_version varchar (300), -- location/location/physicalType/coding/version (50 x 6 varchar) +enc_location_physicaltype_code varchar (180), -- location/location/physicalType/coding/code (30 x 6 varchar) +enc_location_physicaltype_display varchar (600), -- location/location/physicalType/coding/display (100 x 6 varchar) +enc_location_physicaltype_text varchar (1000), -- location/location/physicalType/text (500 x 2 varchar) enc_serviceprovider_id varchar (70), -- serviceProvider/reference (70 x 1 varchar) -enc_serviceprovider_type varchar (500), -- serviceProvider/type (500 x 1 varchar) -enc_serviceprovider_identifier_type_use varchar (50), -- serviceProvider/identifier/use (50 x 1 varchar) +enc_serviceprovider_type varchar (30), -- serviceProvider/type (30 x 1 varchar) +enc_serviceprovider_identifier_use varchar (30), -- serviceProvider/identifier/use (30 x 1 varchar) enc_serviceprovider_identifier_type_system varchar (70), -- serviceProvider/identifier/type/coding/system (70 x 1 varchar) -enc_serviceprovider_identifier_type_version varchar (30), -- serviceProvider/identifier/type/coding/version (30 x 1 varchar) +enc_serviceprovider_identifier_type_version varchar (50), -- serviceProvider/identifier/type/coding/version (50 x 1 varchar) enc_serviceprovider_identifier_type_code varchar (30), -- serviceProvider/identifier/type/coding/code (30 x 1 varchar) enc_serviceprovider_identifier_type_display varchar (100), -- serviceProvider/identifier/type/coding/display (100 x 1 varchar) enc_serviceprovider_identifier_type_text varchar (500), -- serviceProvider/identifier/type/text (500 x 1 varchar) -enc_serviceprovider_identifier_system varchar (100), -- serviceProvider/identifier/system (100 x 1 varchar) -enc_serviceprovider_identifier_value varchar (50), -- serviceProvider/identifier/value (50 x 1 varchar) -enc_serviceprovider_identifier_period_start varchar (30), -- serviceProvider/identifier/period/start (30 x 1 varchar) -enc_serviceprovider_identifier_period_end varchar (30), -- serviceProvider/identifier/period/end (30 x 1 varchar) enc_serviceprovider_display varchar (100), -- serviceProvider/display (100 x 1 varchar) input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes ); + CREATE TABLE IF NOT EXISTS kds2db_in.patient ( patient_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität -pat_id varchar (70), -- id (70 x 1 varchar)" -pat_identifier_value varchar (150), -- identifier/value (50 x 3 varchar) -pat_identifier_system varchar (210), -- identifier/system (70 x 3 varchar) -pat_identifier_type_system varchar (210), -- identifier/type/coding/system (70 x 3 varchar) -pat_identifier_type_version varchar (150), -- identifier/type/coding/version (50 x 3 varchar) -pat_identifier_type_code varchar (150), -- identifier/type/coding/code (50 x 3 varchar) -pat_identifier_type_display varchar (300), -- identifier/type/coding/display (100 x 3 varchar) -pat_identifier_type_text varchar (1500), -- identifier/type/text (500 x 3 varchar) -pat_name_given varchar (100), -- name/given (100 x 1 varchar) -pat_name_family varchar (50), -- name/family (50 x 1 varchar) +pat_id varchar (70), -- id (70 x 1 varchar) +pat_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +pat_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +pat_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +pat_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +pat_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +pat_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +pat_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +pat_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +pat_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +pat_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +pat_name_given varchar (100), -- name/given (50 x 2 varchar) +pat_name_family varchar (100), -- name/family (50 x 2 varchar) pat_gender varchar (10), -- gender (10 x 1 varchar) pat_birthdate varchar (30), -- birthDate (30 x 1 varchar) -pat_adress_postalcode varchar (10), -- address/postalCode (10 x 1 varchar) +pat_address_postalcode varchar (30), -- address/postalCode (10 x 3 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.condition ( +condition_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +con_id varchar (70), -- id (70 x 1 varchar) +con_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +con_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +con_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +con_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +con_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +con_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +con_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +con_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +con_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +con_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +con_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +con_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +con_clinicalstatus_system varchar (70), -- clinicalStatus/coding/system (70 x 1 varchar) +con_clinicalstatus_version varchar (50), -- clinicalStatus/coding/version (50 x 1 varchar) +con_clinicalstatus_code varchar (30), -- clinicalStatus/coding/code (30 x 1 varchar) +con_clinicalstatus_display varchar (100), -- clinicalStatus/coding/display (100 x 1 varchar) +con_clinicalstatus_text varchar (500), -- clinicalStatus/text (500 x 1 varchar) +con_verificationstatus_system varchar (70), -- verificationStatus/coding/system (70 x 1 varchar) +con_verificationstatus_version varchar (50), -- verificationStatus/coding/version (50 x 1 varchar) +con_verificationstatus_code varchar (30), -- verificationStatus/coding/code (30 x 1 varchar) +con_verificationstatus_display varchar (100), -- verificationStatus/coding/display (100 x 1 varchar) +con_verificationstatus_text varchar (500), -- verificationStatus/text (500 x 1 varchar) +con_category_system varchar (420), -- category/coding/system (70 x 6 varchar) +con_category_version varchar (300), -- category/coding/version (50 x 6 varchar) +con_category_code varchar (180), -- category/coding/code (30 x 6 varchar) +con_category_display varchar (600), -- category/coding/display (100 x 6 varchar) +con_category_text varchar (1000), -- category/text (500 x 2 varchar) +con_severity_system varchar (70), -- severity/coding/system (70 x 1 varchar) +con_severity_version varchar (50), -- severity/coding/version (50 x 1 varchar) +con_severity_code varchar (30), -- severity/coding/code (30 x 1 varchar) +con_severity_display varchar (100), -- severity/coding/display (100 x 1 varchar) +con_severity_text varchar (500), -- severity/text (500 x 1 varchar) +con_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +con_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +con_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +con_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +con_code_text varchar (500), -- code/text (500 x 1 varchar) +con_bodysite_system varchar (630), -- bodySite/coding/system (70 x 9 varchar) +con_bodysite_version varchar (450), -- bodySite/coding/version (50 x 9 varchar) +con_bodysite_code varchar (270), -- bodySite/coding/code (30 x 9 varchar) +con_bodysite_display varchar (900), -- bodySite/coding/display (100 x 9 varchar) +con_bodysite_text varchar (1500), -- bodySite/text (500 x 3 varchar) +con_onsetperiod_start varchar (30), -- onsetPeriod/start (30 x 1 varchar) +con_onsetperiod_end varchar (30), -- onsetPeriod/end (30 x 1 varchar) +con_onsetdatetime varchar (30), -- onsetDateTime (30 x 1 varchar) +con_abatementdatetime varchar (30), -- abatementDateTime (30 x 1 varchar) +con_abatementage_value varchar (10), -- abatementAge/value (10 x 1 varchar) +con_abatementage_comparator varchar (3), -- abatementAge/comparator (3 x 1 varchar) +con_abatementage_unit varchar (30), -- abatementAge/unit (30 x 1 varchar) +con_abatementage_system varchar (70), -- abatementAge/system (70 x 1 varchar) +con_abatementage_code varchar (30), -- abatementAge/code (30 x 1 varchar) +con_abatementperiod_start varchar (30), -- abatementPeriod/start (30 x 1 varchar) +con_abatementperiod_end varchar (30), -- abatementPeriod/end (30 x 1 varchar) +con_abatementrange_low_value varchar (10), -- abatementRange/low/value (10 x 1 varchar) +con_abatementrange_low_unit varchar (30), -- abatementRange/low/unit (30 x 1 varchar) +con_abatementrange_low_system varchar (70), -- abatementRange/low/system (70 x 1 varchar) +con_abatementrange_low_code varchar (30), -- abatementRange/low/code (30 x 1 varchar) +con_abatementrange_high_value varchar (10), -- abatementRange/high/value (10 x 1 varchar) +con_abatementrange_high_unit varchar (30), -- abatementRange/high/unit (30 x 1 varchar) +con_abatementrange_high_system varchar (70), -- abatementRange/high/system (70 x 1 varchar) +con_abatementrange_high_code varchar (30), -- abatementRange/high/code (30 x 1 varchar) +con_abatementstring varchar (300), -- abatementString (300 x 1 varchar) +con_recordeddate varchar (30), -- recordedDate (30 x 1 varchar) +con_recorder_id varchar (70), -- recorder/reference (70 x 1 varchar) +con_recorder_type varchar (30), -- recorder/type (30 x 1 varchar) +con_recorder_identifier_use varchar (30), -- recorder/identifier/use (30 x 1 varchar) +con_recorder_identifier_type_system varchar (70), -- recorder/identifier/type/coding/system (70 x 1 varchar) +con_recorder_identifier_type_version varchar (50), -- recorder/identifier/type/coding/version (50 x 1 varchar) +con_recorder_identifier_type_code varchar (30), -- recorder/identifier/type/coding/code (30 x 1 varchar) +con_recorder_identifier_type_display varchar (100), -- recorder/identifier/type/coding/display (100 x 1 varchar) +con_recorder_identifier_type_text varchar (500), -- recorder/identifier/type/text (500 x 1 varchar) +con_recorder_display varchar (100), -- recorder/display (100 x 1 varchar) +con_asserter_id varchar (70), -- asserter/reference (70 x 1 varchar) +con_asserter_type varchar (30), -- asserter/type (30 x 1 varchar) +con_asserter_identifier_use varchar (30), -- asserter/identifier/use (30 x 1 varchar) +con_asserter_identifier_type_system varchar (70), -- asserter/identifier/type/coding/system (70 x 1 varchar) +con_asserter_identifier_type_version varchar (50), -- asserter/identifier/type/coding/version (50 x 1 varchar) +con_asserter_identifier_type_code varchar (30), -- asserter/identifier/type/coding/code (30 x 1 varchar) +con_asserter_identifier_type_display varchar (100), -- asserter/identifier/type/coding/display (100 x 1 varchar) +con_asserter_identifier_type_text varchar (500), -- asserter/identifier/type/text (500 x 1 varchar) +con_asserter_display varchar (100), -- asserter/display (100 x 1 varchar) +con_stage_summary_system varchar (420), -- stage/summary/coding/system (70 x 6 varchar) +con_stage_summary_version varchar (300), -- stage/summary/coding/version (50 x 6 varchar) +con_stage_summary_code varchar (180), -- stage/summary/coding/code (30 x 6 varchar) +con_stage_summary_display varchar (600), -- stage/summary/coding/display (100 x 6 varchar) +con_stage_summary_text varchar (1000), -- stage/summary/text (500 x 2 varchar) +con_stage_assessment_id varchar (280), -- stage/assessment/reference (70 x 4 varchar) +con_stage_assessment_type varchar (120), -- stage/assessment/type (30 x 4 varchar) +con_stage_assessment_identifier_use varchar (120), -- stage/assessment/identifier/use (30 x 4 varchar) +con_stage_assessment_identifier_type_system varchar (840), -- stage/assessment/identifier/type/coding/system (70 x 12 varchar) +con_stage_assessment_identifier_type_version varchar (600), -- stage/assessment/identifier/type/coding/version (50 x 12 varchar) +con_stage_assessment_identifier_type_code varchar (360), -- stage/assessment/identifier/type/coding/code (30 x 12 varchar) +con_stage_assessment_identifier_type_display varchar (1200), -- stage/assessment/identifier/type/coding/display (100 x 12 varchar) +con_stage_assessment_identifier_type_text varchar (2000), -- stage/assessment/identifier/type/text (500 x 4 varchar) +con_stage_assessment_display varchar (400), -- stage/assessment/display (100 x 4 varchar) +con_stage_type_system varchar (420), -- stage/type/coding/system (70 x 6 varchar) +con_stage_type_version varchar (300), -- stage/type/coding/version (50 x 6 varchar) +con_stage_type_code varchar (180), -- stage/type/coding/code (30 x 6 varchar) +con_stage_type_display varchar (600), -- stage/type/coding/display (100 x 6 varchar) +con_stage_type_text varchar (1000), -- stage/type/text (500 x 2 varchar) +con_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +con_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +con_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +con_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +con_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +con_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +con_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +con_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +con_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +con_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +con_note_time varchar (60), -- note/time (30 x 2 varchar) +con_note_text varchar (10000), -- note/text (5000 x 2 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.medication ( +medication_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +med_id varchar (70), -- id (70 x 1 varchar) +med_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +med_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +med_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +med_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +med_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +med_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +med_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +med_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +med_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +med_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +med_code_system varchar (1000), -- code/coding/system (70 x 1 varchar) +med_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +med_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +med_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +med_code_text varchar (500), -- code/text (500 x 1 varchar) +med_status varchar (20), -- status (20 x 1 varchar) +med_form_system varchar (70), -- form/coding/system (70 x 1 varchar) +med_form_version varchar (50), -- form/coding/version (50 x 1 varchar) +med_form_code varchar (30), -- form/coding/code (30 x 1 varchar) +med_form_display varchar (100), -- form/coding/display (100 x 1 varchar) +med_form_text varchar (500), -- form/text (500 x 1 varchar) +med_amount_numerator_value varchar (10), -- amount/numerator/value (10 x 1 varchar) +med_amount_numerator_comparator varchar (10), -- amount/numerator/comparator (10 x 1 varchar) +med_amount_numerator_unit varchar (30), -- amount/numerator/unit (30 x 1 varchar) +med_amount_numerator_system varchar (70), -- amount/numerator/system (70 x 1 varchar) +med_amount_numerator_code varchar (30), -- amount/numerator/code (30 x 1 varchar) +med_amount_denominator_value varchar (10), -- amount/denominator/value (10 x 1 varchar) +med_amount_denominator_comparator varchar (10), -- amount/denominator/comparator (10 x 1 varchar) +med_amount_denominator_unit varchar (30), -- amount/denominator/unit (30 x 1 varchar) +med_amount_denominator_system varchar (70), -- amount/denominator/system (70 x 1 varchar) +med_amount_denominator_code varchar (30), -- amount/denominator/code (30 x 1 varchar) +med_ingredient_strength_numerator_value varchar (150), -- ingredient/strength/numerator/value (10 x 15 varchar) +med_ingredient_strength_numerator_comparator varchar (150), -- ingredient/strength/numerator/comparator (10 x 15 varchar) +med_ingredient_strength_numerator_unit varchar (450), -- ingredient/strength/numerator/unit (30 x 15 varchar) +med_ingredient_strength_numerator_system varchar (1050), -- ingredient/strength/numerator/system (70 x 15 varchar) +med_ingredient_strength_numerator_code varchar (450), -- ingredient/strength/numerator/code (30 x 15 varchar) +med_ingredient_strength_denominator_value varchar (150), -- ingredient/strength/denominator/value (10 x 15 varchar) +med_ingredient_strength_denominator_comparator varchar (150), -- ingredient/strength/denominator/comparator (10 x 15 varchar) +med_ingredient_strength_denominator_unit varchar (450), -- ingredient/strength/denominator/unit (30 x 15 varchar) +med_ingredient_strength_denominator_system varchar (1050), -- ingredient/strength/denominator/system (70 x 15 varchar) +med_ingredient_strength_denominator_code varchar (450), -- ingredient/strength/denominator/code (30 x 15 varchar) +med_ingredient_itemcodeableconcept_system varchar (3150), -- ingredient/itemCodeableConcept/coding/system (70 x 45 varchar) +med_ingredient_itemcodeableconcept_version varchar (2250), -- ingredient/itemCodeableConcept/coding/version (50 x 45 varchar) +med_ingredient_itemcodeableconcept_code varchar (1350), -- ingredient/itemCodeableConcept/coding/code (30 x 45 varchar) +med_ingredient_itemcodeableconcept_display varchar (4500), -- ingredient/itemCodeableConcept/coding/display (100 x 45 varchar) +med_ingredient_itemcodeableconcept_text varchar (7500), -- ingredient/itemCodeableConcept/text (500 x 15 varchar) +med_ingredient_itemreference_id varchar (1050), -- ingredient/itemReference/reference (70 x 15 varchar) +med_ingredient_itemreference_type varchar (450), -- ingredient/itemReference/type (30 x 15 varchar) +med_ingredient_itemreference_identifier_use varchar (450), -- ingredient/itemReference/identifier/use (30 x 15 varchar) +med_ingredient_itemreference_identifier_type_system varchar (3150), -- ingredient/itemReference/identifier/type/coding/system (70 x 45 varchar) +med_ingredient_itemreference_identifier_type_version varchar (2250), -- ingredient/itemReference/identifier/type/coding/version (50 x 45 varchar) +med_ingredient_itemreference_identifier_type_code varchar (1350), -- ingredient/itemReference/identifier/type/coding/code (30 x 45 varchar) +med_ingredient_itemreference_identifier_type_display varchar (4500), -- ingredient/itemReference/identifier/type/coding/display (100 x 45 varchar) +med_ingredient_itemreference_identifier_type_text varchar (7500), -- ingredient/itemReference/identifier/type/text (500 x 15 varchar) +med_ingredient_itemreference_display varchar (1500), -- ingredient/itemReference/display (100 x 15 varchar) +med_ingredient_isactive varchar (150), -- ingredient/isActive (10 x 15 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.medicationrequest ( +medicationrequest_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +medreq_id varchar (70), -- id (70 x 1 varchar) +medreq_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +medreq_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +medreq_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +medreq_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +medreq_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +medreq_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +medreq_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +medreq_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +medreq_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +medreq_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +medreq_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +medreq_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +medreq_medicationreference_id varchar (70), -- medicationReference/reference (70 x 1 varchar) +medreq_status varchar (20), -- status (20 x 1 varchar) +medreq_statusreason_system varchar (70), -- statusReason/coding/system (70 x 1 varchar) +medreq_statusreason_version varchar (50), -- statusReason/coding/version (50 x 1 varchar) +medreq_statusreason_code varchar (30), -- statusReason/coding/code (30 x 1 varchar) +medreq_statusreason_display varchar (100), -- statusReason/coding/display (100 x 1 varchar) +medreq_statusreason_text varchar (500), -- statusReason/text (500 x 1 varchar) +medreq_intend varchar (20), -- intend (20 x 1 varchar) +medreq_category_system varchar (420), -- category/coding/system (70 x 6 varchar) +medreq_category_version varchar (300), -- category/coding/version (50 x 6 varchar) +medreq_category_code varchar (180), -- category/coding/code (30 x 6 varchar) +medreq_category_display varchar (600), -- category/coding/display (100 x 6 varchar) +medreq_category_text varchar (1000), -- category/text (500 x 2 varchar) +medreq_priority varchar (10), -- priority (10 x 1 varchar) +medreq_reportedboolean varchar (10), -- reportedBoolean (10 x 1 varchar) +medreq_reportedreference_id varchar (70), -- reportedReference/reference (70 x 1 varchar) +medreq_reportedreference_type varchar (30), -- reportedReference/type (30 x 1 varchar) +medreq_reportedreference_identifier_use varchar (30), -- reportedReference/identifier/use (30 x 1 varchar) +medreq_reportedreference_identifier_type_system varchar (70), -- reportedReference/identifier/type/coding/system (70 x 1 varchar) +medreq_reportedreference_identifier_type_version varchar (50), -- reportedReference/identifier/type/coding/version (50 x 1 varchar) +medreq_reportedreference_identifier_type_code varchar (30), -- reportedReference/identifier/type/coding/code (30 x 1 varchar) +medreq_reportedreference_identifier_type_display varchar (100), -- reportedReference/identifier/type/coding/display (100 x 1 varchar) +medreq_reportedreference_identifier_type_text varchar (500), -- reportedReference/identifier/type/text (500 x 1 varchar) +medreq_reportedreference_display varchar (100), -- reportedReference/display (100 x 1 varchar) +medreq_medicationcodeableconcept_system varchar (70), -- medicationCodeableConcept/coding/system (70 x 1 varchar) +medreq_medicationcodeableconcept_version varchar (50), -- medicationCodeableConcept/coding/version (50 x 1 varchar) +medreq_medicationcodeableconcept_code varchar (30), -- medicationCodeableConcept/coding/code (30 x 1 varchar) +medreq_medicationcodeableconcept_display varchar (100), -- medicationCodeableConcept/coding/display (100 x 1 varchar) +medreq_medicationcodeableconcept_text varchar (500), -- medicationCodeableConcept/text (500 x 1 varchar) +medreq_supportinginformation_id varchar (140), -- supportingInformation/reference (70 x 2 varchar) +medreq_supportinginformation_type varchar (60), -- supportingInformation/type (30 x 2 varchar) +medreq_supportinginformation_identifier_use varchar (60), -- supportingInformation/identifier/use (30 x 2 varchar) +medreq_supportinginformation_identifier_type_system varchar (420), -- supportingInformation/identifier/type/coding/system (70 x 6 varchar) +medreq_supportinginformation_identifier_type_version varchar (300), -- supportingInformation/identifier/type/coding/version (50 x 6 varchar) +medreq_supportinginformation_identifier_type_code varchar (180), -- supportingInformation/identifier/type/coding/code (30 x 6 varchar) +medreq_supportinginformation_identifier_type_display varchar (600), -- supportingInformation/identifier/type/coding/display (100 x 6 varchar) +medreq_supportinginformation_identifier_type_text varchar (1000), -- supportingInformation/identifier/type/text (500 x 2 varchar) +medreq_supportinginformation_display varchar (200), -- supportingInformation/display (100 x 2 varchar) +medreq_authoredon varchar (30), -- authoredOn (30 x 1 varchar) +medreq_requester_id varchar (70), -- requester/reference (70 x 1 varchar) +medreq_requester_type varchar (30), -- requester/type (30 x 1 varchar) +medreq_requester_identifier_use varchar (30), -- requester/identifier/use (30 x 1 varchar) +medreq_requester_identifier_type_system varchar (70), -- requester/identifier/type/coding/system (70 x 1 varchar) +medreq_requester_identifier_type_version varchar (50), -- requester/identifier/type/coding/version (50 x 1 varchar) +medreq_requester_identifier_type_code varchar (30), -- requester/identifier/type/coding/code (30 x 1 varchar) +medreq_requester_identifier_type_display varchar (100), -- requester/identifier/type/coding/display (100 x 1 varchar) +medreq_requester_identifier_type_text varchar (500), -- requester/identifier/type/text (500 x 1 varchar) +medreq_requester_display varchar (100), -- requester/display (100 x 1 varchar) +medreq_reasoncode_system varchar (420), -- reasonCode/coding/system (70 x 6 varchar) +medreq_reasoncode_version varchar (300), -- reasonCode/coding/version (50 x 6 varchar) +medreq_reasoncode_code varchar (180), -- reasonCode/coding/code (30 x 6 varchar) +medreq_reasoncode_display varchar (600), -- reasonCode/coding/display (100 x 6 varchar) +medreq_reasoncode_text varchar (1000), -- reasonCode/text (500 x 2 varchar) +medreq_reasonreference_id varchar (140), -- reasonReference/reference (70 x 2 varchar) +medreq_reasonreference_type varchar (60), -- reasonReference/type (30 x 2 varchar) +medreq_reasonreference_identifier_use varchar (60), -- reasonReference/identifier/use (30 x 2 varchar) +medreq_reasonreference_identifier_type_system varchar (420), -- reasonReference/identifier/type/coding/system (70 x 6 varchar) +medreq_reasonreference_identifier_type_version varchar (300), -- reasonReference/identifier/type/coding/version (50 x 6 varchar) +medreq_reasonreference_identifier_type_code varchar (180), -- reasonReference/identifier/type/coding/code (30 x 6 varchar) +medreq_reasonreference_identifier_type_display varchar (600), -- reasonReference/identifier/type/coding/display (100 x 6 varchar) +medreq_reasonreference_identifier_type_text varchar (1000), -- reasonReference/identifier/type/text (500 x 2 varchar) +medreq_reasonreference_display varchar (200), -- reasonReference/display (100 x 2 varchar) +medreq_basedon_id varchar (140), -- basedOn/reference (70 x 2 varchar) +medreq_basedon_type varchar (60), -- basedOn/type (30 x 2 varchar) +medreq_basedon_identifier_use varchar (60), -- basedOn/identifier/use (30 x 2 varchar) +medreq_basedon_identifier_type_system varchar (420), -- basedOn/identifier/type/coding/system (70 x 6 varchar) +medreq_basedon_identifier_type_version varchar (300), -- basedOn/identifier/type/coding/version (50 x 6 varchar) +medreq_basedon_identifier_type_code varchar (180), -- basedOn/identifier/type/coding/code (30 x 6 varchar) +medreq_basedon_identifier_type_display varchar (600), -- basedOn/identifier/type/coding/display (100 x 6 varchar) +medreq_basedon_identifier_type_text varchar (1000), -- basedOn/identifier/type/text (500 x 2 varchar) +medreq_basedon_display varchar (200), -- basedOn/display (100 x 2 varchar) +medreq_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +medreq_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +medreq_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +medreq_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +medreq_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +medreq_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +medreq_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +medreq_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +medreq_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +medreq_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +medreq_note_time varchar (60), -- note/time (30 x 2 varchar) +medreq_note_text varchar (10000), -- note/text (5000 x 2 varchar) +medreq_doseinstruc_sequence varchar (20), -- dosageInstruction/sequence (10 x 2 varchar) +medreq_doseinstruc_text varchar (1000), -- dosageInstruction/text (500 x 2 varchar) +medreq_doseinstruc_additionalinstruction_system varchar (840), -- dosageInstruction/additionalInstruction/coding/system (70 x 12 varchar) +medreq_doseinstruc_additionalinstruction_version varchar (600), -- dosageInstruction/additionalInstruction/coding/version (50 x 12 varchar) +medreq_doseinstruc_additionalinstruction_code varchar (360), -- dosageInstruction/additionalInstruction/coding/code (30 x 12 varchar) +medreq_doseinstruc_additionalinstruction_display varchar (1200), -- dosageInstruction/additionalInstruction/coding/display (100 x 12 varchar) +medreq_doseinstruc_additionalinstruction_text varchar (2000), -- dosageInstruction/additionalInstruction/text (500 x 4 varchar) +medreq_doseinstruc_patientinstruction varchar (200), -- dosageInstruction/patientInstruction (100 x 2 varchar) +medreq_doseinstruc_timing_event varchar (240), -- dosageInstruction/timing/event (30 x 8 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_value varchar (60), -- dosageInstruction/timing/repeat/boundsDuration/value (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_comparator varchar (20), -- dosageInstruction/timing/repeat/boundsDuration/comparator (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_unit varchar (60), -- dosageInstruction/timing/repeat/boundsDuration/unit (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_system varchar (140), -- dosageInstruction/timing/repeat/boundsDuration/system (70 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_code varchar (60), -- dosageInstruction/timing/repeat/boundsDuration/code (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_low_value varchar (20), -- dosageInstruction/timing/repeat/boundsRange/low/value (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_low_unit varchar (60), -- dosageInstruction/timing/repeat/boundsRange/low/unit (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_low_system varchar (140), -- dosageInstruction/timing/repeat/boundsRange/low/system (70 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_low_code varchar (60), -- dosageInstruction/timing/repeat/boundsRange/low/code (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_high_value varchar (20), -- dosageInstruction/timing/repeat/boundsRange/high/value (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_high_unit varchar (60), -- dosageInstruction/timing/repeat/boundsRange/high/unit (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_high_system varchar (140), -- dosageInstruction/timing/repeat/boundsRange/high/system (70 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_high_code varchar (60), -- dosageInstruction/timing/repeat/boundsRange/high/code (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsperiod_start varchar (60), -- dosageInstruction/timing/repeat/boundsPeriod/start (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsperiod_end varchar (60), -- dosageInstruction/timing/repeat/boundsPeriod/end (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_count varchar (20), -- dosageInstruction/timing/repeat/count (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_countmax varchar (20), -- dosageInstruction/timing/repeat/countMax (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_duration varchar (20), -- dosageInstruction/timing/repeat/duration (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_durationmax varchar (20), -- dosageInstruction/timing/repeat/durationMax (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_durationunit varchar (40), -- dosageInstruction/timing/repeat/durationUnit (20 x 2 varchar) +medreq_doseinstruc_timing_repeat_frequency varchar (20), -- dosageInstruction/timing/repeat/frequency (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_frequencymax varchar (20), -- dosageInstruction/timing/repeat/frequencyMax (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_period varchar (20), -- dosageInstruction/timing/repeat/period (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_periodmax varchar (20), -- dosageInstruction/timing/repeat/periodMax (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_periodunit varchar (40), -- dosageInstruction/timing/repeat/periodUnit (20 x 2 varchar) +medreq_doseinstruc_timing_repeat_dayofweek varchar (140), -- dosageInstruction/timing/repeat/dayOfWeek (10 x 14 varchar) +medreq_doseinstruc_timing_repeat_timeofday varchar (160), -- dosageInstruction/timing/repeat/timeOfDay (20 x 8 varchar) +medreq_doseinstruc_timing_repeat_when varchar (160), -- dosageInstruction/timing/repeat/when (20 x 8 varchar) +medreq_doseinstruc_timing_repeat_offset varchar (20), -- dosageInstruction/timing/repeat/offset (10 x 2 varchar) +medreq_doseinstruc_timing_code_system varchar (420), -- dosageInstruction/timing/code/coding/system (70 x 6 varchar) +medreq_doseinstruc_timing_code_version varchar (300), -- dosageInstruction/timing/code/coding/version (50 x 6 varchar) +medreq_doseinstruc_timing_code_code varchar (180), -- dosageInstruction/timing/code/coding/code (30 x 6 varchar) +medreq_doseinstruc_timing_code_display varchar (600), -- dosageInstruction/timing/code/coding/display (100 x 6 varchar) +medreq_doseinstruc_timing_code_text varchar (1000), -- dosageInstruction/timing/code/text (500 x 2 varchar) +medreq_doseinstruc_asneededboolean varchar (20), -- dosageInstruction/asNeededBoolean (10 x 2 varchar) +medreq_doseinstruc_asneededcodeableconcept_system varchar (420), -- dosageInstruction/asNeededCodeableConcept/coding/system (70 x 6 varchar) +medreq_doseinstruc_asneededcodeableconcept_version varchar (300), -- dosageInstruction/asNeededCodeableConcept/coding/version (50 x 6 varchar) +medreq_doseinstruc_asneededcodeableconcept_code varchar (180), -- dosageInstruction/asNeededCodeableConcept/coding/code (30 x 6 varchar) +medreq_doseinstruc_asneededcodeableconcept_display varchar (600), -- dosageInstruction/asNeededCodeableConcept/coding/display (100 x 6 varchar) +medreq_doseinstruc_asneededcodeableconcept_text varchar (1000), -- dosageInstruction/asNeededCodeableConcept/text (500 x 2 varchar) +medreq_doseinstruc_site_system varchar (420), -- dosageInstruction/site/coding/system (70 x 6 varchar) +medreq_doseinstruc_site_version varchar (300), -- dosageInstruction/site/coding/version (50 x 6 varchar) +medreq_doseinstruc_site_code varchar (180), -- dosageInstruction/site/coding/code (30 x 6 varchar) +medreq_doseinstruc_site_display varchar (600), -- dosageInstruction/site/coding/display (100 x 6 varchar) +medreq_doseinstruc_site_text varchar (1000), -- dosageInstruction/site/text (500 x 2 varchar) +medreq_doseinstruc_route_system varchar (420), -- dosageInstruction/route/coding/system (70 x 6 varchar) +medreq_doseinstruc_route_version varchar (300), -- dosageInstruction/route/coding/version (50 x 6 varchar) +medreq_doseinstruc_route_code varchar (180), -- dosageInstruction/route/coding/code (30 x 6 varchar) +medreq_doseinstruc_route_display varchar (600), -- dosageInstruction/route/coding/display (100 x 6 varchar) +medreq_doseinstruc_route_text varchar (1000), -- dosageInstruction/route/text (500 x 2 varchar) +medreq_doseinstruc_method_system varchar (420), -- dosageInstruction/method/coding/system (70 x 6 varchar) +medreq_doseinstruc_method_version varchar (300), -- dosageInstruction/method/coding/version (50 x 6 varchar) +medreq_doseinstruc_method_code varchar (180), -- dosageInstruction/method/coding/code (30 x 6 varchar) +medreq_doseinstruc_method_display varchar (600), -- dosageInstruction/method/coding/display (100 x 6 varchar) +medreq_doseinstruc_method_text varchar (1000), -- dosageInstruction/method/text (500 x 2 varchar) +medreq_doseinstruc_doseandrate_type_system varchar (420), -- dosageInstruction/doseAndRate/type/coding/system (70 x 6 varchar) +medreq_doseinstruc_doseandrate_type_version varchar (300), -- dosageInstruction/doseAndRate/type/coding/version (50 x 6 varchar) +medreq_doseinstruc_doseandrate_type_code varchar (180), -- dosageInstruction/doseAndRate/type/coding/code (30 x 6 varchar) +medreq_doseinstruc_doseandrate_type_display varchar (600), -- dosageInstruction/doseAndRate/type/coding/display (100 x 6 varchar) +medreq_doseinstruc_doseandrate_type_text varchar (1000), -- dosageInstruction/doseAndRate/type/text (500 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_low_value varchar (20), -- dosageInstruction/doseAndRate/doseRange/low/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_low_unit varchar (60), -- dosageInstruction/doseAndRate/doseRange/low/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_low_system varchar (140), -- dosageInstruction/doseAndRate/doseRange/low/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_low_code varchar (60), -- dosageInstruction/doseAndRate/doseRange/low/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_high_value varchar (20), -- dosageInstruction/doseAndRate/doseRange/high/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_high_unit varchar (60), -- dosageInstruction/doseAndRate/doseRange/high/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_high_system varchar (140), -- dosageInstruction/doseAndRate/doseRange/high/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_high_code varchar (60), -- dosageInstruction/doseAndRate/doseRange/high/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_value varchar (20), -- dosageInstruction/doseAndRate/doseQuantity/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_comparator varchar (20), -- dosageInstruction/doseAndRate/doseQuantity/comparator (10 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_unit varchar (60), -- dosageInstruction/doseAndRate/doseQuantity/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_system varchar (140), -- dosageInstruction/doseAndRate/doseQuantity/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_code varchar (60), -- dosageInstruction/doseAndRate/doseQuantity/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_value varchar (20), -- dosageInstruction/doseAndRate/rateRatio/numerator/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_comparator varchar (20), -- dosageInstruction/doseAndRate/rateRatio/numerator/comparator (10 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_unit varchar (60), -- dosageInstruction/doseAndRate/rateRatio/numerator/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_system varchar (140), -- dosageInstruction/doseAndRate/rateRatio/numerator/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_code varchar (60), -- dosageInstruction/doseAndRate/rateRatio/numerator/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_value varchar (20), -- dosageInstruction/doseAndRate/rateRatio/denominator/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_comparator varchar (20), -- dosageInstruction/doseAndRate/rateRatio/denominator/comparator (10 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_unit varchar (60), -- dosageInstruction/doseAndRate/rateRatio/denominator/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_system varchar (140), -- dosageInstruction/doseAndRate/rateRatio/denominator/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_code varchar (60), -- dosageInstruction/doseAndRate/rateRatio/denominator/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_low_value varchar (20), -- dosageInstruction/doseAndRate/rateRange/low/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_low_unit varchar (60), -- dosageInstruction/doseAndRate/rateRange/low/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_low_system varchar (140), -- dosageInstruction/doseAndRate/rateRange/low/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_low_code varchar (60), -- dosageInstruction/doseAndRate/rateRange/low/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_high_value varchar (20), -- dosageInstruction/doseAndRate/rateRange/high/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_high_unit varchar (60), -- dosageInstruction/doseAndRate/rateRange/high/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_high_system varchar (140), -- dosageInstruction/doseAndRate/rateRange/high/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_high_code varchar (60), -- dosageInstruction/doseAndRate/rateRange/high/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_ratequantity_value varchar (20), -- dosageInstruction/doseAndRate/rateQuantity/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_ratequantity_unit varchar (60), -- dosageInstruction/doseAndRate/rateQuantity/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_ratequantity_system varchar (140), -- dosageInstruction/doseAndRate/rateQuantity/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_ratequantity_code varchar (60), -- dosageInstruction/doseAndRate/rateQuantity/code (30 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_value varchar (20), -- dosageInstruction/maxDosePerPeriod/numerator/value (10 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_comparator varchar (20), -- dosageInstruction/maxDosePerPeriod/numerator/comparator (10 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_unit varchar (60), -- dosageInstruction/maxDosePerPeriod/numerator/unit (30 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_system varchar (140), -- dosageInstruction/maxDosePerPeriod/numerator/system (70 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_code varchar (60), -- dosageInstruction/maxDosePerPeriod/numerator/code (30 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_value varchar (20), -- dosageInstruction/maxDosePerPeriod/denominator/value (10 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_comparator varchar (20), -- dosageInstruction/maxDosePerPeriod/denominator/comparator (10 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_unit varchar (60), -- dosageInstruction/maxDosePerPeriod/denominator/unit (30 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_system varchar (140), -- dosageInstruction/maxDosePerPeriod/denominator/system (70 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_code varchar (60), -- dosageInstruction/maxDosePerPeriod/denominator/code (30 x 2 varchar) +medreq_doseinstruc_maxdoseperadministration_value varchar (20), -- dosageInstruction/maxDosePerAdministration/value (10 x 2 varchar) +medreq_doseinstruc_maxdoseperadministration_unit varchar (60), -- dosageInstruction/maxDosePerAdministration/unit (30 x 2 varchar) +medreq_doseinstruc_maxdoseperadministration_system varchar (140), -- dosageInstruction/maxDosePerAdministration/system (70 x 2 varchar) +medreq_doseinstruc_maxdoseperadministration_code varchar (60), -- dosageInstruction/maxDosePerAdministration/code (30 x 2 varchar) +medreq_doseinstruc_maxdoseperlifetime_value varchar (20), -- dosageInstruction/maxDosePerLifetime/value (10 x 2 varchar) +medreq_doseinstruc_maxdoseperlifetime_unit varchar (60), -- dosageInstruction/maxDosePerLifetime/unit (30 x 2 varchar) +medreq_doseinstruc_maxdoseperlifetime_system varchar (140), -- dosageInstruction/maxDosePerLifetime/system (70 x 2 varchar) +medreq_doseinstruc_maxdoseperlifetime_code varchar (60), -- dosageInstruction/maxDosePerLifetime/code (30 x 2 varchar) +medreq_substitution_reason_system varchar (70), -- substitution/reason/coding/system (70 x 1 varchar) +medreq_substitution_reason_version varchar (50), -- substitution/reason/coding/version (50 x 1 varchar) +medreq_substitution_reason_code varchar (30), -- substitution/reason/coding/code (30 x 1 varchar) +medreq_substitution_reason_display varchar (100), -- substitution/reason/coding/display (100 x 1 varchar) +medreq_substitution_reason_text varchar (500), -- substitution/reason/text (500 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.medicationadministration ( +medicationadministration_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +medadm_id varchar (70), -- id (70 x 1 varchar) +medadm_encounter_id varchar (70), -- context/reference (70 x 1 varchar) +medadm_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +medadm_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +medadm_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +medadm_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +medadm_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +medadm_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +medadm_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +medadm_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +medadm_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +medadm_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +medadm_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +medadm_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +medadm_status varchar (30), -- status (30 x 1 varchar) +medadm_statusreason_system varchar (70), -- statusReason/coding/system (70 x 1 varchar) +medadm_statusreason_version varchar (50), -- statusReason/coding/version (50 x 1 varchar) +medadm_statusreason_code varchar (30), -- statusReason/coding/code (30 x 1 varchar) +medadm_statusreason_display varchar (100), -- statusReason/coding/display (100 x 1 varchar) +medadm_statusreason_text varchar (500), -- statusReason/text (500 x 1 varchar) +medadm_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +medadm_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +medadm_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +medadm_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +medadm_category_text varchar (500), -- category/text (500 x 1 varchar) +medadm_medicationreference_id varchar (70), -- medicationReference/reference (70 x 1 varchar) +medadm_medicationcodeableconcept_system varchar (70), -- medicationCodeableConcept/coding/system (70 x 1 varchar) +medadm_medicationcodeableconcept_version varchar (50), -- medicationCodeableConcept/coding/version (50 x 1 varchar) +medadm_medicationcodeableconcept_code varchar (30), -- medicationCodeableConcept/coding/code (30 x 1 varchar) +medadm_medicationcodeableconcept_display varchar (100), -- medicationCodeableConcept/coding/display (100 x 1 varchar) +medadm_medicationcodeableconcept_text varchar (500), -- medicationCodeableConcept/text (500 x 1 varchar) +medadm_supportinginformation_id varchar (140), -- supportingInformation/reference (70 x 2 varchar) +medadm_supportinginformation_type varchar (60), -- supportingInformation/type (30 x 2 varchar) +medadm_supportinginformation_identifier_use varchar (60), -- supportingInformation/identifier/use (30 x 2 varchar) +medadm_supportinginformation_identifier_type_system varchar (420), -- supportingInformation/identifier/type/coding/system (70 x 6 varchar) +medadm_supportinginformation_identifier_type_version varchar (300), -- supportingInformation/identifier/type/coding/version (50 x 6 varchar) +medadm_supportinginformation_identifier_type_code varchar (180), -- supportingInformation/identifier/type/coding/code (30 x 6 varchar) +medadm_supportinginformation_identifier_type_display varchar (600), -- supportingInformation/identifier/type/coding/display (100 x 6 varchar) +medadm_supportinginformation_identifier_type_text varchar (1000), -- supportingInformation/identifier/type/text (500 x 2 varchar) +medadm_supportinginformation_display varchar (200), -- supportingInformation/display (100 x 2 varchar) +medadm_effectivedatetime varchar (30), -- effectiveDateTime (30 x 1 varchar) +medadm_effectiveperiod_start varchar (30), -- effectivePeriod/start (30 x 1 varchar) +medadm_effectiveperiod_end varchar (30), -- effectivePeriod/end (30 x 1 varchar) +medadm_performer_function_system varchar (70), -- performer/function/coding/system (70 x 1 varchar) +medadm_performer_function_version varchar (50), -- performer/function/coding/version (50 x 1 varchar) +medadm_performer_function_code varchar (30), -- performer/function/coding/code (30 x 1 varchar) +medadm_performer_function_display varchar (100), -- performer/function/coding/display (100 x 1 varchar) +medadm_performer_function_text varchar (500), -- performer/function/text (500 x 1 varchar) +medadm_reasoncode_system varchar (420), -- reasonCode/coding/system (70 x 6 varchar) +medadm_reasoncode_version varchar (300), -- reasonCode/coding/version (50 x 6 varchar) +medadm_reasoncode_code varchar (180), -- reasonCode/coding/code (30 x 6 varchar) +medadm_reasoncode_display varchar (600), -- reasonCode/coding/display (100 x 6 varchar) +medadm_reasoncode_text varchar (1000), -- reasonCode/text (500 x 2 varchar) +medadm_reasonreference_id varchar (140), -- reasonReference/reference (70 x 2 varchar) +medadm_reasonreference_type varchar (60), -- reasonReference/type (30 x 2 varchar) +medadm_reasonreference_identifier_use varchar (60), -- reasonReference/identifier/use (30 x 2 varchar) +medadm_reasonreference_identifier_type_system varchar (420), -- reasonReference/identifier/type/coding/system (70 x 6 varchar) +medadm_reasonreference_identifier_type_version varchar (300), -- reasonReference/identifier/type/coding/version (50 x 6 varchar) +medadm_reasonreference_identifier_type_code varchar (180), -- reasonReference/identifier/type/coding/code (30 x 6 varchar) +medadm_reasonreference_identifier_type_display varchar (600), -- reasonReference/identifier/type/coding/display (100 x 6 varchar) +medadm_reasonreference_identifier_type_text varchar (1000), -- reasonReference/identifier/type/text (500 x 2 varchar) +medadm_reasonreference_display varchar (200), -- reasonReference/display (100 x 2 varchar) +medadm_request_id varchar (70), -- request/reference (70 x 1 varchar) +medadm_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +medadm_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +medadm_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +medadm_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +medadm_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +medadm_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +medadm_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +medadm_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +medadm_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +medadm_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +medadm_note_time varchar (60), -- note/time (30 x 2 varchar) +medadm_note_text varchar (10000), -- note/text (5000 x 2 varchar) +medadm_dosage_text varchar (100), -- dosage/text (100 x 1 varchar) +medadm_dosage_site_system varchar (70), -- dosage/site/coding/system (70 x 1 varchar) +medadm_dosage_site_version varchar (50), -- dosage/site/coding/version (50 x 1 varchar) +medadm_dosage_site_code varchar (30), -- dosage/site/coding/code (30 x 1 varchar) +medadm_dosage_site_display varchar (100), -- dosage/site/coding/display (100 x 1 varchar) +medadm_dosage_site_text varchar (500), -- dosage/site/text (500 x 1 varchar) +medadm_dosage_route_system varchar (70), -- dosage/route/coding/system (70 x 1 varchar) +medadm_dosage_route_version varchar (50), -- dosage/route/coding/version (50 x 1 varchar) +medadm_dosage_route_code varchar (30), -- dosage/route/coding/code (30 x 1 varchar) +medadm_dosage_route_display varchar (100), -- dosage/route/coding/display (100 x 1 varchar) +medadm_dosage_route_text varchar (500), -- dosage/route/text (500 x 1 varchar) +medadm_dosage_method_system varchar (70), -- dosage/method/coding/system (70 x 1 varchar) +medadm_dosage_method_version varchar (50), -- dosage/method/coding/version (50 x 1 varchar) +medadm_dosage_method_code varchar (30), -- dosage/method/coding/code (30 x 1 varchar) +medadm_dosage_method_display varchar (100), -- dosage/method/coding/display (100 x 1 varchar) +medadm_dosage_method_text varchar (500), -- dosage/method/text (500 x 1 varchar) +medadm_dosage_dose_value varchar (10), -- dosage/dose/value (10 x 1 varchar) +medadm_dosage_dose_unit varchar (30), -- dosage/dose/unit (30 x 1 varchar) +medadm_dosage_dose_system varchar (70), -- dosage/dose/system (70 x 1 varchar) +medadm_dosage_dose_code varchar (30), -- dosage/dose/code (30 x 1 varchar) +medadm_dosage_rateratio_numerator_value varchar (10), -- dosage/rateRatio/numerator/value (10 x 1 varchar) +medadm_dosage_rateratio_numerator_comparator varchar (10), -- dosage/rateRatio/numerator/comparator (10 x 1 varchar) +medadm_dosage_rateratio_numerator_unit varchar (30), -- dosage/rateRatio/numerator/unit (30 x 1 varchar) +medadm_dosage_rateratio_numerator_system varchar (70), -- dosage/rateRatio/numerator/system (70 x 1 varchar) +medadm_dosage_rateratio_numerator_code varchar (30), -- dosage/rateRatio/numerator/code (30 x 1 varchar) +medadm_dosage_rateratio_denominator_value varchar (10), -- dosage/rateRatio/denominator/value (10 x 1 varchar) +medadm_dosage_rateratio_denominator_comparator varchar (10), -- dosage/rateRatio/denominator/comparator (10 x 1 varchar) +medadm_dosage_rateratio_denominator_unit varchar (30), -- dosage/rateRatio/denominator/unit (30 x 1 varchar) +medadm_dosage_rateratio_denominator_system varchar (70), -- dosage/rateRatio/denominator/system (70 x 1 varchar) +medadm_dosage_rateratio_denominator_code varchar (30), -- dosage/rateRatio/denominator/code (30 x 1 varchar) +medadm_dosage_ratequantity_value varchar (10), -- dosage/rateQuantity/value (10 x 1 varchar) +medadm_dosage_ratequantity_unit varchar (30), -- dosage/rateQuantity/unit (30 x 1 varchar) +medadm_dosage_ratequantity_system varchar (70), -- dosage/rateQuantity/system (70 x 1 varchar) +medadm_dosage_ratequantity_code varchar (30), -- dosage/rateQuantity/code (30 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.medicationstatement ( +medicationstatement_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +medstat_id varchar (70), -- id (70 x 1 varchar) +medstat_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +medstat_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +medstat_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +medstat_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +medstat_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +medstat_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +medstat_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +medstat_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +medstat_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +medstat_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +medstat_encounter_id varchar (70), -- context/reference (70 x 1 varchar) +medstat_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +medstat_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +medstat_basedon_id varchar (140), -- basedOn/reference (70 x 2 varchar) +medstat_basedon_type varchar (60), -- basedOn/type (30 x 2 varchar) +medstat_basedon_identifier_use varchar (60), -- basedOn/identifier/use (30 x 2 varchar) +medstat_basedon_identifier_type_system varchar (420), -- basedOn/identifier/type/coding/system (70 x 6 varchar) +medstat_basedon_identifier_type_version varchar (300), -- basedOn/identifier/type/coding/version (50 x 6 varchar) +medstat_basedon_identifier_type_code varchar (180), -- basedOn/identifier/type/coding/code (30 x 6 varchar) +medstat_basedon_identifier_type_display varchar (600), -- basedOn/identifier/type/coding/display (100 x 6 varchar) +medstat_basedon_identifier_type_text varchar (1000), -- basedOn/identifier/type/text (500 x 2 varchar) +medstat_basedon_display varchar (200), -- basedOn/display (100 x 2 varchar) +medstat_status varchar (30), -- status (30 x 1 varchar) +medstat_statusreason_system varchar (70), -- statusReason/coding/system (70 x 1 varchar) +medstat_statusreason_version varchar (50), -- statusReason/coding/version (50 x 1 varchar) +medstat_statusreason_code varchar (30), -- statusReason/coding/code (30 x 1 varchar) +medstat_statusreason_display varchar (100), -- statusReason/coding/display (100 x 1 varchar) +medstat_statusreason_text varchar (500), -- statusReason/text (500 x 1 varchar) +medstat_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +medstat_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +medstat_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +medstat_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +medstat_category_text varchar (500), -- category/text (500 x 1 varchar) +medstat_medicationreference_id varchar (100), -- medicationReference/reference ( x 1 varchar) +medstat_medicationcodeableconcept_system varchar (70), -- medicationCodeableConcept/coding/system (70 x 1 varchar) +medstat_medicationcodeableconcept_version varchar (50), -- medicationCodeableConcept/coding/version (50 x 1 varchar) +medstat_medicationcodeableconcept_code varchar (30), -- medicationCodeableConcept/coding/code (30 x 1 varchar) +medstat_medicationcodeableconcept_display varchar (100), -- medicationCodeableConcept/coding/display (100 x 1 varchar) +medstat_medicationcodeableconcept_text varchar (500), -- medicationCodeableConcept/text (500 x 1 varchar) +medstat_effectivedatetime varchar (30), -- effectiveDateTime (30 x 1 varchar) +medstat_effectiveperiod_start varchar (30), -- effectivePeriod/start (30 x 1 varchar) +medstat_effectiveperiod_end varchar (30), -- effectivePeriod/end (30 x 1 varchar) +medstat_dateasserted varchar (30), -- dateAsserted (30 x 1 varchar) +medstat_informationsource_id varchar (70), -- informationSource/reference (70 x 1 varchar) +medstat_informationsource_type varchar (30), -- informationSource/type (30 x 1 varchar) +medstat_informationsource_identifier_use varchar (30), -- informationSource/identifier/use (30 x 1 varchar) +medstat_informationsource_identifier_type_system varchar (70), -- informationSource/identifier/type/coding/system (70 x 1 varchar) +medstat_informationsource_identifier_type_version varchar (50), -- informationSource/identifier/type/coding/version (50 x 1 varchar) +medstat_informationsource_identifier_type_code varchar (30), -- informationSource/identifier/type/coding/code (30 x 1 varchar) +medstat_informationsource_identifier_type_display varchar (100), -- informationSource/identifier/type/coding/display (100 x 1 varchar) +medstat_informationsource_identifier_type_text varchar (500), -- informationSource/identifier/type/text (500 x 1 varchar) +medstat_informationsource_display varchar (100), -- informationSource/display (100 x 1 varchar) +medstat_derivedfrom_id varchar (70), -- derivedFrom/reference (70 x 1 varchar) +medstat_derivedfrom_type varchar (30), -- derivedFrom/type (30 x 1 varchar) +medstat_derivedfrom_identifier_use varchar (30), -- derivedFrom/identifier/use (30 x 1 varchar) +medstat_derivedfrom_identifier_type_system varchar (70), -- derivedFrom/identifier/type/coding/system (70 x 1 varchar) +medstat_derivedfrom_identifier_type_version varchar (50), -- derivedFrom/identifier/type/coding/version (50 x 1 varchar) +medstat_derivedfrom_identifier_type_code varchar (30), -- derivedFrom/identifier/type/coding/code (30 x 1 varchar) +medstat_derivedfrom_identifier_type_display varchar (100), -- derivedFrom/identifier/type/coding/display (100 x 1 varchar) +medstat_derivedfrom_identifier_type_text varchar (500), -- derivedFrom/identifier/type/text (500 x 1 varchar) +medstat_derivedfrom_display varchar (100), -- derivedFrom/display (100 x 1 varchar) +medstat_reasoncode_system varchar (70), -- reasonCode/coding/system (70 x 1 varchar) +medstat_reasoncode_version varchar (50), -- reasonCode/coding/version (50 x 1 varchar) +medstat_reasoncode_code varchar (30), -- reasonCode/coding/code (30 x 1 varchar) +medstat_reasoncode_display varchar (100), -- reasonCode/coding/display (100 x 1 varchar) +medstat_reasoncode_text varchar (500), -- reasonCode/text (500 x 1 varchar) +medstat_reasonreference_id varchar (210), -- reasonReference/reference (70 x 3 varchar) +medstat_reasonreference_type varchar (90), -- reasonReference/type (30 x 3 varchar) +medstat_reasonreference_identifier_use varchar (90), -- reasonReference/identifier/use (30 x 3 varchar) +medstat_reasonreference_identifier_type_system varchar (630), -- reasonReference/identifier/type/coding/system (70 x 9 varchar) +medstat_reasonreference_identifier_type_version varchar (450), -- reasonReference/identifier/type/coding/version (50 x 9 varchar) +medstat_reasonreference_identifier_type_code varchar (270), -- reasonReference/identifier/type/coding/code (30 x 9 varchar) +medstat_reasonreference_identifier_type_display varchar (900), -- reasonReference/identifier/type/coding/display (100 x 9 varchar) +medstat_reasonreference_identifier_type_text varchar (1500), -- reasonReference/identifier/type/text (500 x 3 varchar) +medstat_reasonreference_display varchar (300), -- reasonReference/display (100 x 3 varchar) +medstat_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +medstat_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +medstat_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +medstat_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +medstat_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +medstat_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +medstat_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +medstat_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +medstat_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +medstat_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +medstat_note_time varchar (60), -- note/time (30 x 2 varchar) +medstat_note_text varchar (10000), -- note/text (5000 x 2 varchar) +medstat_dosage_sequence varchar (20), -- dosage/sequence (10 x 2 varchar) +medstat_dosage_text varchar (1000), -- dosage/text (500 x 2 varchar) +medstat_dosage_additionalinstruction_system varchar (840), -- dosage/additionalInstruction/coding/system (70 x 12 varchar) +medstat_dosage_additionalinstruction_version varchar (600), -- dosage/additionalInstruction/coding/version (50 x 12 varchar) +medstat_dosage_additionalinstruction_code varchar (360), -- dosage/additionalInstruction/coding/code (30 x 12 varchar) +medstat_dosage_additionalinstruction_display varchar (1200), -- dosage/additionalInstruction/coding/display (100 x 12 varchar) +medstat_dosage_additionalinstruction_text varchar (2000), -- dosage/additionalInstruction/text (500 x 4 varchar) +medstat_dosage_patientinstruction varchar (200), -- dosage/patientInstruction (100 x 2 varchar) +medstat_dosage_timing_event varchar (240), -- dosage/timing/event (30 x 8 varchar) +medstat_dosage_timing_repeat_boundsduration_value varchar (60), -- dosage/timing/repeat/boundsDuration/value (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsduration_comparator varchar (20), -- dosage/timing/repeat/boundsDuration/comparator (10 x 2 varchar) +medstat_dosage_timing_repeat_boundsduration_unit varchar (60), -- dosage/timing/repeat/boundsDuration/unit (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsduration_system varchar (140), -- dosage/timing/repeat/boundsDuration/system (70 x 2 varchar) +medstat_dosage_timing_repeat_boundsduration_code varchar (60), -- dosage/timing/repeat/boundsDuration/code (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_low_value varchar (20), -- dosage/timing/repeat/boundsRange/low/value (10 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_low_unit varchar (60), -- dosage/timing/repeat/boundsRange/low/unit (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_low_system varchar (140), -- dosage/timing/repeat/boundsRange/low/system (70 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_low_code varchar (60), -- dosage/timing/repeat/boundsRange/low/code (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_high_value varchar (20), -- dosage/timing/repeat/boundsRange/high/value (10 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_high_unit varchar (60), -- dosage/timing/repeat/boundsRange/high/unit (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_high_system varchar (140), -- dosage/timing/repeat/boundsRange/high/system (70 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_high_code varchar (60), -- dosage/timing/repeat/boundsRange/high/code (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsperiod_start varchar (60), -- dosage/timing/repeat/boundsPeriod/start (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsperiod_end varchar (60), -- dosage/timing/repeat/boundsPeriod/end (30 x 2 varchar) +medstat_dosage_timing_repeat_count varchar (20), -- dosage/timing/repeat/count (10 x 2 varchar) +medstat_dosage_timing_repeat_countmax varchar (20), -- dosage/timing/repeat/countMax (10 x 2 varchar) +medstat_dosage_timing_repeat_duration varchar (20), -- dosage/timing/repeat/duration (10 x 2 varchar) +medstat_dosage_timing_repeat_durationmax varchar (20), -- dosage/timing/repeat/durationMax (10 x 2 varchar) +medstat_dosage_timing_repeat_durationunit varchar (40), -- dosage/timing/repeat/durationUnit (20 x 2 varchar) +medstat_dosage_timing_repeat_frequency varchar (20), -- dosage/timing/repeat/frequency (10 x 2 varchar) +medstat_dosage_timing_repeat_frequencymax varchar (20), -- dosage/timing/repeat/frequencyMax (10 x 2 varchar) +medstat_dosage_timing_repeat_period varchar (20), -- dosage/timing/repeat/period (10 x 2 varchar) +medstat_dosage_timing_repeat_periodmax varchar (20), -- dosage/timing/repeat/periodMax (10 x 2 varchar) +medstat_dosage_timing_repeat_periodunit varchar (40), -- dosage/timing/repeat/periodUnit (20 x 2 varchar) +medstat_dosage_timing_repeat_dayofweek varchar (140), -- dosage/timing/repeat/dayOfWeek (10 x 14 varchar) +medstat_dosage_timing_repeat_timeofday varchar (160), -- dosage/timing/repeat/timeOfDay (20 x 8 varchar) +medstat_dosage_timing_repeat_when varchar (160), -- dosage/timing/repeat/when (20 x 8 varchar) +medstat_dosage_timing_repeat_offset varchar (20), -- dosage/timing/repeat/offset (10 x 2 varchar) +medstat_dosage_timing_code_system varchar (420), -- dosage/timing/code/coding/system (70 x 6 varchar) +medstat_dosage_timing_code_version varchar (300), -- dosage/timing/code/coding/version (50 x 6 varchar) +medstat_dosage_timing_code_code varchar (180), -- dosage/timing/code/coding/code (30 x 6 varchar) +medstat_dosage_timing_code_display varchar (600), -- dosage/timing/code/coding/display (100 x 6 varchar) +medstat_dosage_timing_code_text varchar (1000), -- dosage/timing/code/text (500 x 2 varchar) +medstat_dosage_asneededboolean varchar (20), -- dosage/asNeededBoolean (10 x 2 varchar) +medstat_dosage_asneededcodeableconcept_system varchar (420), -- dosage/asNeededCodeableConcept/coding/system (70 x 6 varchar) +medstat_dosage_asneededcodeableconcept_version varchar (300), -- dosage/asNeededCodeableConcept/coding/version (50 x 6 varchar) +medstat_dosage_asneededcodeableconcept_code varchar (180), -- dosage/asNeededCodeableConcept/coding/code (30 x 6 varchar) +medstat_dosage_asneededcodeableconcept_display varchar (600), -- dosage/asNeededCodeableConcept/coding/display (100 x 6 varchar) +medstat_dosage_asneededcodeableconcept_text varchar (1000), -- dosage/asNeededCodeableConcept/text (500 x 2 varchar) +medstat_dosage_site_system varchar (420), -- dosage/site/coding/system (70 x 6 varchar) +medstat_dosage_site_version varchar (300), -- dosage/site/coding/version (50 x 6 varchar) +medstat_dosage_site_code varchar (180), -- dosage/site/coding/code (30 x 6 varchar) +medstat_dosage_site_display varchar (600), -- dosage/site/coding/display (100 x 6 varchar) +medstat_dosage_site_text varchar (1000), -- dosage/site/text (500 x 2 varchar) +medstat_dosage_route_system varchar (420), -- dosage/route/coding/system (70 x 6 varchar) +medstat_dosage_route_version varchar (300), -- dosage/route/coding/version (50 x 6 varchar) +medstat_dosage_route_code varchar (180), -- dosage/route/coding/code (30 x 6 varchar) +medstat_dosage_route_display varchar (600), -- dosage/route/coding/display (100 x 6 varchar) +medstat_dosage_route_text varchar (1000), -- dosage/route/text (500 x 2 varchar) +medstat_dosage_method_system varchar (420), -- dosage/method/coding/system (70 x 6 varchar) +medstat_dosage_method_version varchar (300), -- dosage/method/coding/version (50 x 6 varchar) +medstat_dosage_method_code varchar (180), -- dosage/method/coding/code (30 x 6 varchar) +medstat_dosage_method_display varchar (600), -- dosage/method/coding/display (100 x 6 varchar) +medstat_dosage_method_text varchar (1000), -- dosage/method/text (500 x 2 varchar) +medstat_dosage_doseandrate_type_system varchar (420), -- dosage/doseAndRate/type/coding/system (70 x 6 varchar) +medstat_dosage_doseandrate_type_version varchar (300), -- dosage/doseAndRate/type/coding/version (50 x 6 varchar) +medstat_dosage_doseandrate_type_code varchar (180), -- dosage/doseAndRate/type/coding/code (30 x 6 varchar) +medstat_dosage_doseandrate_type_display varchar (600), -- dosage/doseAndRate/type/coding/display (100 x 6 varchar) +medstat_dosage_doseandrate_type_text varchar (1000), -- dosage/doseAndRate/type/text (500 x 2 varchar) +medstat_dosage_doseandrate_doserange_low_value varchar (20), -- dosage/doseAndRate/doseRange/low/value (10 x 2 varchar) +medstat_dosage_doseandrate_doserange_low_unit varchar (60), -- dosage/doseAndRate/doseRange/low/unit (30 x 2 varchar) +medstat_dosage_doseandrate_doserange_low_system varchar (140), -- dosage/doseAndRate/doseRange/low/system (70 x 2 varchar) +medstat_dosage_doseandrate_doserange_low_code varchar (60), -- dosage/doseAndRate/doseRange/low/code (30 x 2 varchar) +medstat_dosage_doseandrate_doserange_high_value varchar (20), -- dosage/doseAndRate/doseRange/high/value (10 x 2 varchar) +medstat_dosage_doseandrate_doserange_high_unit varchar (60), -- dosage/doseAndRate/doseRange/high/unit (30 x 2 varchar) +medstat_dosage_doseandrate_doserange_high_system varchar (140), -- dosage/doseAndRate/doseRange/high/system (70 x 2 varchar) +medstat_dosage_doseandrate_doserange_high_code varchar (60), -- dosage/doseAndRate/doseRange/high/code (30 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_value varchar (20), -- dosage/doseAndRate/doseQuantity/value (10 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_comparator varchar (20), -- dosage/doseAndRate/doseQuantity/comparator (10 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_unit varchar (60), -- dosage/doseAndRate/doseQuantity/unit (30 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_system varchar (140), -- dosage/doseAndRate/doseQuantity/system (70 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_code varchar (60), -- dosage/doseAndRate/doseQuantity/code (30 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_value varchar (20), -- dosage/doseAndRate/rateRatio/numerator/value (10 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_comparator varchar (20), -- dosage/doseAndRate/rateRatio/numerator/comparator (10 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_unit varchar (60), -- dosage/doseAndRate/rateRatio/numerator/unit (30 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_system varchar (140), -- dosage/doseAndRate/rateRatio/numerator/system (70 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_code varchar (60), -- dosage/doseAndRate/rateRatio/numerator/code (30 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_value varchar (20), -- dosage/doseAndRate/rateRatio/denominator/value (10 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_comparator varchar (20), -- dosage/doseAndRate/rateRatio/denominator/comparator (10 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_unit varchar (60), -- dosage/doseAndRate/rateRatio/denominator/unit (30 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_system varchar (140), -- dosage/doseAndRate/rateRatio/denominator/system (70 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_code varchar (60), -- dosage/doseAndRate/rateRatio/denominator/code (30 x 2 varchar) +medstat_dosage_doseandrate_raterange_low_value varchar (20), -- dosage/doseAndRate/rateRange/low/value (10 x 2 varchar) +medstat_dosage_doseandrate_raterange_low_unit varchar (60), -- dosage/doseAndRate/rateRange/low/unit (30 x 2 varchar) +medstat_dosage_doseandrate_raterange_low_system varchar (140), -- dosage/doseAndRate/rateRange/low/system (70 x 2 varchar) +medstat_dosage_doseandrate_raterange_low_code varchar (60), -- dosage/doseAndRate/rateRange/low/code (30 x 2 varchar) +medstat_dosage_doseandrate_raterange_high_value varchar (20), -- dosage/doseAndRate/rateRange/high/value (10 x 2 varchar) +medstat_dosage_doseandrate_raterange_high_unit varchar (60), -- dosage/doseAndRate/rateRange/high/unit (30 x 2 varchar) +medstat_dosage_doseandrate_raterange_high_system varchar (140), -- dosage/doseAndRate/rateRange/high/system (70 x 2 varchar) +medstat_dosage_doseandrate_raterange_high_code varchar (60), -- dosage/doseAndRate/rateRange/high/code (30 x 2 varchar) +medstat_dosage_doseandrate_ratequantity_value varchar (20), -- dosage/doseAndRate/rateQuantity/value (10 x 2 varchar) +medstat_dosage_doseandrate_ratequantity_unit varchar (60), -- dosage/doseAndRate/rateQuantity/unit (30 x 2 varchar) +medstat_dosage_doseandrate_ratequantity_system varchar (140), -- dosage/doseAndRate/rateQuantity/system (70 x 2 varchar) +medstat_dosage_doseandrate_ratequantity_code varchar (60), -- dosage/doseAndRate/rateQuantity/code (30 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_value varchar (20), -- dosage/maxDosePerPeriod/numerator/value (10 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_comparator varchar (20), -- dosage/maxDosePerPeriod/numerator/comparator (10 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_unit varchar (60), -- dosage/maxDosePerPeriod/numerator/unit (30 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_system varchar (140), -- dosage/maxDosePerPeriod/numerator/system (70 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_code varchar (60), -- dosage/maxDosePerPeriod/numerator/code (30 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_value varchar (20), -- dosage/maxDosePerPeriod/denominator/value (10 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_comparator varchar (20), -- dosage/maxDosePerPeriod/denominator/comparator (10 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_unit varchar (60), -- dosage/maxDosePerPeriod/denominator/unit (30 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_system varchar (140), -- dosage/maxDosePerPeriod/denominator/system (70 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_code varchar (60), -- dosage/maxDosePerPeriod/denominator/code (30 x 2 varchar) +medstat_dosage_maxdoseperadministration_value varchar (20), -- dosage/maxDosePerAdministration/value (10 x 2 varchar) +medstat_dosage_maxdoseperadministration_unit varchar (60), -- dosage/maxDosePerAdministration/unit (30 x 2 varchar) +medstat_dosage_maxdoseperadministration_system varchar (140), -- dosage/maxDosePerAdministration/system (70 x 2 varchar) +medstat_dosage_maxdoseperadministration_code varchar (60), -- dosage/maxDosePerAdministration/code (30 x 2 varchar) +medstat_dosage_maxdoseperlifetime_value varchar (20), -- dosage/maxDosePerLifetime/value (10 x 2 varchar) +medstat_dosage_maxdoseperlifetime_unit varchar (60), -- dosage/maxDosePerLifetime/unit (30 x 2 varchar) +medstat_dosage_maxdoseperlifetime_system varchar (140), -- dosage/maxDosePerLifetime/system (70 x 2 varchar) +medstat_dosage_maxdoseperlifetime_code varchar (60), -- dosage/maxDosePerLifetime/code (30 x 2 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.observation ( +observation_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +obs_id varchar (70), -- id (70 x 1 varchar) +obs_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +obs_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +obs_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +obs_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +obs_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +obs_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +obs_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +obs_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +obs_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +obs_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +obs_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +obs_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +obs_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +obs_basedon_id varchar (70), -- basedOn/reference (70 x 1 varchar) +obs_basedon_type varchar (30), -- basedOn/type (30 x 1 varchar) +obs_basedon_identifier_use varchar (30), -- basedOn/identifier/use (30 x 1 varchar) +obs_basedon_identifier_type_system varchar (70), -- basedOn/identifier/type/coding/system (70 x 1 varchar) +obs_basedon_identifier_type_version varchar (50), -- basedOn/identifier/type/coding/version (50 x 1 varchar) +obs_basedon_identifier_type_code varchar (30), -- basedOn/identifier/type/coding/code (30 x 1 varchar) +obs_basedon_identifier_type_display varchar (100), -- basedOn/identifier/type/coding/display (100 x 1 varchar) +obs_basedon_identifier_type_text varchar (500), -- basedOn/identifier/type/text (500 x 1 varchar) +obs_basedon_display varchar (100), -- basedOn/display (100 x 1 varchar) +obs_status varchar (30), -- status (30 x 1 varchar) +obs_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +obs_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +obs_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +obs_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +obs_category_text varchar (500), -- category/text (500 x 1 varchar) +obs_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +obs_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +obs_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +obs_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +obs_code_text varchar (500), -- code/text (500 x 1 varchar) +obs_effectivedatetime varchar (30), -- effectiveDateTime (30 x 1 varchar) +obs_issued varchar (30), -- issued (30 x 1 varchar) +obs_valuerange_low_value varchar (20), -- valueRange/low/value (10 x 2 varchar) +obs_valuerange_low_unit varchar (60), -- valueRange/low/unit (30 x 2 varchar) +obs_valuerange_low_system varchar (140), -- valueRange/low/system (70 x 2 varchar) +obs_valuerange_low_code varchar (60), -- valueRange/low/code (30 x 2 varchar) +obs_valuerange_high_value varchar (20), -- valueRange/high/value (10 x 2 varchar) +obs_valuerange_high_unit varchar (60), -- valueRange/high/unit (30 x 2 varchar) +obs_valuerange_high_system varchar (140), -- valueRange/high/system (70 x 2 varchar) +obs_valuerange_high_code varchar (60), -- valueRange/high/code (30 x 2 varchar) +obs_valueratio_numerator_value varchar (20), -- valueRatio/numerator/value (10 x 2 varchar) +obs_valueratio_numerator_comparator varchar (20), -- valueRatio/numerator/comparator (10 x 2 varchar) +obs_valueratio_numerator_unit varchar (60), -- valueRatio/numerator/unit (30 x 2 varchar) +obs_valueratio_numerator_system varchar (140), -- valueRatio/numerator/system (70 x 2 varchar) +obs_valueratio_numerator_code varchar (60), -- valueRatio/numerator/code (30 x 2 varchar) +obs_valueratio_denominator_value varchar (20), -- valueRatio/denominator/value (10 x 2 varchar) +obs_valueratio_denominator_comparator varchar (20), -- valueRatio/denominator/comparator (10 x 2 varchar) +obs_valueratio_denominator_unit varchar (60), -- valueRatio/denominator/unit (30 x 2 varchar) +obs_valueratio_denominator_system varchar (140), -- valueRatio/denominator/system (70 x 2 varchar) +obs_valueratio_denominator_code varchar (60), -- valueRatio/denominator/code (30 x 2 varchar) +obs_valuequantity_value varchar (20), -- valueQuantity/value (10 x 2 varchar) +obs_valuequantity_comparator varchar (20), -- valueQuantity/comparator (10 x 2 varchar) +obs_valuequantity_unit varchar (60), -- valueQuantity/unit (30 x 2 varchar) +obs_valuequantity_system varchar (140), -- valueQuantity/system (70 x 2 varchar) +obs_valuequantity_code varchar (60), -- valueQuantity/code (30 x 2 varchar) +obs_valuecodableconcept_system varchar (420), -- valueCodableConcept/coding/system (70 x 6 varchar) +obs_valuecodableconcept_version varchar (300), -- valueCodableConcept/coding/version (50 x 6 varchar) +obs_valuecodableconcept_code varchar (180), -- valueCodableConcept/coding/code (30 x 6 varchar) +obs_valuecodableconcept_display varchar (600), -- valueCodableConcept/coding/display (100 x 6 varchar) +obs_valuecodableconcept_text varchar (1000), -- valueCodableConcept/text (500 x 2 varchar) +obs_dataabsentreason_system varchar (70), -- dataAbsentReason/coding/system (70 x 1 varchar) +obs_dataabsentreason_version varchar (50), -- dataAbsentReason/coding/version (50 x 1 varchar) +obs_dataabsentreason_code varchar (30), -- dataAbsentReason/coding/code (30 x 1 varchar) +obs_dataabsentreason_display varchar (100), -- dataAbsentReason/coding/display (100 x 1 varchar) +obs_dataabsentreason_text varchar (500), -- dataAbsentReason/text (500 x 1 varchar) +obs_note_authorstring varchar (50), -- note/authorString (50 x 1 varchar) +obs_note_authorreference_id varchar (70), -- note/authorReference/reference (70 x 1 varchar) +obs_note_authorreference_type varchar (30), -- note/authorReference/type (30 x 1 varchar) +obs_note_authorreference_identifier_use varchar (30), -- note/authorReference/identifier/use (30 x 1 varchar) +obs_note_authorreference_identifier_type_system varchar (70), -- note/authorReference/identifier/type/coding/system (70 x 1 varchar) +obs_note_authorreference_identifier_type_version varchar (50), -- note/authorReference/identifier/type/coding/version (50 x 1 varchar) +obs_note_authorreference_identifier_type_code varchar (30), -- note/authorReference/identifier/type/coding/code (30 x 1 varchar) +obs_note_authorreference_identifier_type_display varchar (100), -- note/authorReference/identifier/type/coding/display (100 x 1 varchar) +obs_note_authorreference_identifier_type_text varchar (500), -- note/authorReference/identifier/type/text (500 x 1 varchar) +obs_note_authorreference_display varchar (100), -- note/authorReference/display (100 x 1 varchar) +obs_note_time varchar (30), -- note/time (30 x 1 varchar) +obs_note_text varchar (5000), -- note/text (5000 x 1 varchar) +obs_method_codableconcept varchar (100), -- method/CodableConcept (100 x 1 varchar) +obs_performer_id varchar (70), -- performer/reference (70 x 1 varchar) +obs_performer_type varchar (30), -- performer/type (30 x 1 varchar) +obs_performer_identifier_use varchar (30), -- performer/identifier/use (30 x 1 varchar) +obs_performer_identifier_type_system varchar (70), -- performer/identifier/type/coding/system (70 x 1 varchar) +obs_performer_identifier_type_version varchar (50), -- performer/identifier/type/coding/version (50 x 1 varchar) +obs_performer_identifier_type_code varchar (30), -- performer/identifier/type/coding/code (30 x 1 varchar) +obs_performer_identifier_type_display varchar (100), -- performer/identifier/type/coding/display (100 x 1 varchar) +obs_performer_identifier_type_text varchar (500), -- performer/identifier/type/text (500 x 1 varchar) +obs_performer_display varchar (100), -- performer/display (100 x 1 varchar) +obs_referencerange_low_value varchar (30), -- referenceRange/low/value (10 x 3 varchar) +obs_referencerange_low_unit varchar (90), -- referenceRange/low/unit (30 x 3 varchar) +obs_referencerange_low_system varchar (210), -- referenceRange/low/system (70 x 3 varchar) +obs_referencerange_low_code varchar (90), -- referenceRange/low/code (30 x 3 varchar) +obs_referencerange_high_value varchar (30), -- referenceRange/high/value (10 x 3 varchar) +obs_referencerange_high_unit varchar (90), -- referenceRange/high/unit (30 x 3 varchar) +obs_referencerange_high_system varchar (210), -- referenceRange/high/system (70 x 3 varchar) +obs_referencerange_high_code varchar (90), -- referenceRange/high/code (30 x 3 varchar) +obs_referencerange_type_codableconcept varchar (300), -- referenceRange/type/CodableConcept (100 x 3 varchar) +obs_referencerange_appliesto_system varchar (630), -- referenceRange/appliesTo/coding/system (70 x 9 varchar) +obs_referencerange_appliesto_version varchar (450), -- referenceRange/appliesTo/coding/version (50 x 9 varchar) +obs_referencerange_appliesto_code varchar (270), -- referenceRange/appliesTo/coding/code (30 x 9 varchar) +obs_referencerange_appliesto_display varchar (900), -- referenceRange/appliesTo/coding/display (100 x 9 varchar) +obs_referencerange_appliesto_text varchar (1500), -- referenceRange/appliesTo/text (500 x 3 varchar) +obs_referencerange_age_low_value varchar (30), -- referenceRange/age/low/value (10 x 3 varchar) +obs_referencerange_age_low_unit varchar (90), -- referenceRange/age/low/unit (30 x 3 varchar) +obs_referencerange_age_low_system varchar (210), -- referenceRange/age/low/system (70 x 3 varchar) +obs_referencerange_age_low_code varchar (90), -- referenceRange/age/low/code (30 x 3 varchar) +obs_referencerange_age_high_value varchar (30), -- referenceRange/age/high/value (10 x 3 varchar) +obs_referencerange_age_high_unit varchar (90), -- referenceRange/age/high/unit (30 x 3 varchar) +obs_referencerange_age_high_system varchar (210), -- referenceRange/age/high/system (70 x 3 varchar) +obs_referencerange_age_high_code varchar (90), -- referenceRange/age/high/code (30 x 3 varchar) +obs_referencerange_text varchar (500), -- referenceRange/text (500 x 1 varchar) +obs_hasmember_id varchar (70), -- hasMember/reference (70 x 1 varchar) +obs_hasmember_type varchar (30), -- hasMember/type (30 x 1 varchar) +obs_hasmember_identifier_use varchar (30), -- hasMember/identifier/use (30 x 1 varchar) +obs_hasmember_identifier_type_system varchar (70), -- hasMember/identifier/type/coding/system (70 x 1 varchar) +obs_hasmember_identifier_type_version varchar (50), -- hasMember/identifier/type/coding/version (50 x 1 varchar) +obs_hasmember_identifier_type_code varchar (30), -- hasMember/identifier/type/coding/code (30 x 1 varchar) +obs_hasmember_identifier_type_display varchar (100), -- hasMember/identifier/type/coding/display (100 x 1 varchar) +obs_hasmember_identifier_type_text varchar (500), -- hasMember/identifier/type/text (500 x 1 varchar) +obs_hasmember_display varchar (100), -- hasMember/display (100 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.diagnosticreport ( +diagnosticreport_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +diagrep_id varchar (70), -- id (70 x 1 varchar) +diagrep_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +diagrep_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +diagrep_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +diagrep_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +diagrep_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +diagrep_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +diagrep_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +diagrep_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +diagrep_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +diagrep_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +diagrep_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +diagrep_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +diagrep_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +diagrep_result_id varchar (70), -- result/reference (70 x 1 varchar) +diagrep_basedon_id varchar (100), -- basedOn/reference (100 x 1 varchar) +diagrep_status varchar (30), -- status (30 x 1 varchar) +diagrep_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +diagrep_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +diagrep_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +diagrep_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +diagrep_category_text varchar (500), -- category/text (500 x 1 varchar) +diagrep_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +diagrep_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +diagrep_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +diagrep_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +diagrep_code_text varchar (500), -- code/text (500 x 1 varchar) +diagrep_effectivedatetime varchar (30), -- effectiveDateTime (30 x 1 varchar) +diagrep_issued varchar (30), -- issued (30 x 1 varchar) +diagrep_performer_id varchar (70), -- performer/reference (70 x 1 varchar) +diagrep_performer_type varchar (30), -- performer/type (30 x 1 varchar) +diagrep_performer_identifier_use varchar (30), -- performer/identifier/use (30 x 1 varchar) +diagrep_performer_identifier_type_system varchar (70), -- performer/identifier/type/coding/system (70 x 1 varchar) +diagrep_performer_identifier_type_version varchar (50), -- performer/identifier/type/coding/version (50 x 1 varchar) +diagrep_performer_identifier_type_code varchar (30), -- performer/identifier/type/coding/code (30 x 1 varchar) +diagrep_performer_identifier_type_display varchar (100), -- performer/identifier/type/coding/display (100 x 1 varchar) +diagrep_performer_identifier_type_text varchar (500), -- performer/identifier/type/text (500 x 1 varchar) +diagrep_performer_display varchar (100), -- performer/display (100 x 1 varchar) +diagrep_conclusion varchar (500), -- conclusion (500 x 1 varchar) +diagrep_conclusioncode_system varchar (70), -- conclusionCode/coding/system (70 x 1 varchar) +diagrep_conclusioncode_version varchar (50), -- conclusionCode/coding/version (50 x 1 varchar) +diagrep_conclusioncode_code varchar (30), -- conclusionCode/coding/code (30 x 1 varchar) +diagrep_conclusioncode_display varchar (100), -- conclusionCode/coding/display (100 x 1 varchar) +diagrep_conclusioncode_text varchar (500), -- conclusionCode/text (500 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.servicerequest ( +servicerequest_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +servreq_id varchar (70), -- id (70 x 1 varchar) +servreq_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +servreq_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +servreq_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +servreq_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +servreq_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +servreq_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +servreq_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +servreq_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +servreq_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +servreq_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +servreq_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +servreq_basedon_id varchar (70), -- basedOn/reference (70 x 1 varchar) +servreq_basedon_type varchar (30), -- basedOn/type (30 x 1 varchar) +servreq_basedon_identifier_use varchar (30), -- basedOn/identifier/use (30 x 1 varchar) +servreq_basedon_identifier_type_system varchar (70), -- basedOn/identifier/type/coding/system (70 x 1 varchar) +servreq_basedon_identifier_type_version varchar (50), -- basedOn/identifier/type/coding/version (50 x 1 varchar) +servreq_basedon_identifier_type_code varchar (30), -- basedOn/identifier/type/coding/code (30 x 1 varchar) +servreq_basedon_identifier_type_display varchar (100), -- basedOn/identifier/type/coding/display (100 x 1 varchar) +servreq_basedon_identifier_type_text varchar (500), -- basedOn/identifier/type/text (500 x 1 varchar) +servreq_basedon_display varchar (100), -- basedOn/display (100 x 1 varchar) +servreq_status varchar (30), -- status (30 x 1 varchar) +servreq_intent varchar (30), -- intent (30 x 1 varchar) +servreq_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +servreq_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +servreq_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +servreq_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +servreq_category_text varchar (500), -- category/text (500 x 1 varchar) +servreq_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +servreq_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +servreq_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +servreq_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +servreq_code_text varchar (500), -- code/text (500 x 1 varchar) +servreq_authoredon varchar (30), -- authoredOn (30 x 1 varchar) +servreq_requester_id varchar (70), -- requester/reference (70 x 1 varchar) +servreq_requester_type varchar (30), -- requester/type (30 x 1 varchar) +servreq_requester_identifier_use varchar (30), -- requester/identifier/use (30 x 1 varchar) +servreq_requester_identifier_type_system varchar (70), -- requester/identifier/type/coding/system (70 x 1 varchar) +servreq_requester_identifier_type_version varchar (50), -- requester/identifier/type/coding/version (50 x 1 varchar) +servreq_requester_identifier_type_code varchar (30), -- requester/identifier/type/coding/code (30 x 1 varchar) +servreq_requester_identifier_type_display varchar (100), -- requester/identifier/type/coding/display (100 x 1 varchar) +servreq_requester_identifier_type_text varchar (500), -- requester/identifier/type/text (500 x 1 varchar) +servreq_requester_display varchar (100), -- requester/display (100 x 1 varchar) +servreq_performer_id varchar (70), -- performer/reference (70 x 1 varchar) +servreq_performer_type varchar (30), -- performer/type (30 x 1 varchar) +servreq_performer_identifier_use varchar (30), -- performer/identifier/use (30 x 1 varchar) +servreq_performer_identifier_type_system varchar (70), -- performer/identifier/type/coding/system (70 x 1 varchar) +servreq_performer_identifier_type_version varchar (50), -- performer/identifier/type/coding/version (50 x 1 varchar) +servreq_performer_identifier_type_code varchar (30), -- performer/identifier/type/coding/code (30 x 1 varchar) +servreq_performer_identifier_type_display varchar (100), -- performer/identifier/type/coding/display (100 x 1 varchar) +servreq_performer_identifier_type_text varchar (500), -- performer/identifier/type/text (500 x 1 varchar) +servreq_performer_display varchar (100), -- performer/display (100 x 1 varchar) +servreq_locationcode_system varchar (70), -- locationCode/coding/system (70 x 1 varchar) +servreq_locationcode_version varchar (50), -- locationCode/coding/version (50 x 1 varchar) +servreq_locationcode_code varchar (30), -- locationCode/coding/code (30 x 1 varchar) +servreq_locationcode_display varchar (100), -- locationCode/coding/display (100 x 1 varchar) +servreq_locationcode_text varchar (500), -- locationCode/text (500 x 1 varchar) input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes ); ---SQL Role / Trigger in Schema kds2db_in +CREATE TABLE IF NOT EXISTS kds2db_in.procedure ( +procedure_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +proc_id varchar (70), -- id (70 x 1 varchar) +proc_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +proc_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +proc_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +proc_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +proc_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +proc_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +proc_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +proc_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +proc_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +proc_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +proc_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +proc_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +proc_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +proc_basedon_id varchar (70), -- basedOn/reference (70 x 1 varchar) +proc_basedon_type varchar (30), -- basedOn/type (30 x 1 varchar) +proc_basedon_identifier_use varchar (30), -- basedOn/identifier/use (30 x 1 varchar) +proc_basedon_identifier_type_system varchar (70), -- basedOn/identifier/type/coding/system (70 x 1 varchar) +proc_basedon_identifier_type_version varchar (50), -- basedOn/identifier/type/coding/version (50 x 1 varchar) +proc_basedon_identifier_type_code varchar (30), -- basedOn/identifier/type/coding/code (30 x 1 varchar) +proc_basedon_identifier_type_display varchar (100), -- basedOn/identifier/type/coding/display (100 x 1 varchar) +proc_basedon_identifier_type_text varchar (500), -- basedOn/identifier/type/text (500 x 1 varchar) +proc_basedon_display varchar (100), -- basedOn/display (100 x 1 varchar) +proc_status varchar (30), -- status (30 x 1 varchar) +proc_statusreason_system varchar (70), -- statusReason/coding/system (70 x 1 varchar) +proc_statusreason_version varchar (50), -- statusReason/coding/version (50 x 1 varchar) +proc_statusreason_code varchar (30), -- statusReason/coding/code (30 x 1 varchar) +proc_statusreason_display varchar (100), -- statusReason/coding/display (100 x 1 varchar) +proc_statusreason_text varchar (500), -- statusReason/text (500 x 1 varchar) +proc_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +proc_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +proc_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +proc_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +proc_category_text varchar (500), -- category/text (500 x 1 varchar) +proc_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +proc_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +proc_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +proc_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +proc_code_text varchar (500), -- code/text (500 x 1 varchar) +proc_performeddatetime varchar (30), -- performedDateTime (30 x 1 varchar) +proc_performedperiod_start varchar (30), -- performedPeriod/start (30 x 1 varchar) +proc_performedperiod_end varchar (30), -- performedPeriod/end (30 x 1 varchar) +proc_reasoncode_system varchar (70), -- reasonCode/coding/system (70 x 1 varchar) +proc_reasoncode_version varchar (50), -- reasonCode/coding/version (50 x 1 varchar) +proc_reasoncode_code varchar (30), -- reasonCode/coding/code (30 x 1 varchar) +proc_reasoncode_display varchar (100), -- reasonCode/coding/display (100 x 1 varchar) +proc_reasoncode_text varchar (500), -- reasonCode/text (500 x 1 varchar) +proc_reasonreference_id varchar (70), -- reasonReference/reference (70 x 1 varchar) +proc_reasonreference_type varchar (30), -- reasonReference/type (30 x 1 varchar) +proc_reasonreference_identifier_use varchar (30), -- reasonReference/identifier/use (30 x 1 varchar) +proc_reasonreference_identifier_type_system varchar (70), -- reasonReference/identifier/type/coding/system (70 x 1 varchar) +proc_reasonreference_identifier_type_version varchar (50), -- reasonReference/identifier/type/coding/version (50 x 1 varchar) +proc_reasonreference_identifier_type_code varchar (30), -- reasonReference/identifier/type/coding/code (30 x 1 varchar) +proc_reasonreference_identifier_type_display varchar (100), -- reasonReference/identifier/type/coding/display (100 x 1 varchar) +proc_reasonreference_identifier_type_text varchar (500), -- reasonReference/identifier/type/text (500 x 1 varchar) +proc_reasonreference_display varchar (100), -- reasonReference/display (100 x 1 varchar) +proc_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +proc_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +proc_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +proc_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +proc_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +proc_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +proc_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +proc_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +proc_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +proc_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +proc_note_time varchar (60), -- note/time (30 x 2 varchar) +proc_note_text varchar (10000), -- note/text (5000 x 2 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.consent ( +consent_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +cons_id varchar (70), -- id (70 x 1 varchar) +cons_patient_id varchar (70), -- patient/reference (70 x 1 varchar) +cons_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +cons_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +cons_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +cons_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +cons_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +cons_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +cons_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +cons_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +cons_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +cons_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +cons_status varchar (30), -- status (30 x 1 varchar) +cons_scope_system varchar (70), -- scope/coding/system (70 x 1 varchar) +cons_scope_version varchar (50), -- scope/coding/version (50 x 1 varchar) +cons_scope_code varchar (30), -- scope/coding/code (30 x 1 varchar) +cons_scope_display varchar (100), -- scope/coding/display (100 x 1 varchar) +cons_scope_text varchar (500), -- scope/text (500 x 1 varchar) +cons_datetime varchar (30), -- dateTime (30 x 1 varchar) +cons_provision_type varchar (10), -- provision/type (10 x 1 varchar) +cons_provision_period_start varchar (30), -- provision/period/start (30 x 1 varchar) +cons_provision_period_end varchar (30), -- provision/period/end (30 x 1 varchar) +cons_provision_actor_role_system varchar (70), -- provision/actor/role/coding/system (70 x 1 varchar) +cons_provision_actor_role_version varchar (50), -- provision/actor/role/coding/version (50 x 1 varchar) +cons_provision_actor_role_code varchar (30), -- provision/actor/role/coding/code (30 x 1 varchar) +cons_provision_actor_role_display varchar (100), -- provision/actor/role/coding/display (100 x 1 varchar) +cons_provision_actor_role_text varchar (500), -- provision/actor/role/text (500 x 1 varchar) +cons_provision_code_system varchar (70), -- provision/code/coding/system (70 x 1 varchar) +cons_provision_code_version varchar (50), -- provision/code/coding/version (50 x 1 varchar) +cons_provision_code_code varchar (30), -- provision/code/coding/code (30 x 1 varchar) +cons_provision_code_display varchar (100), -- provision/code/coding/display (100 x 1 varchar) +cons_provision_code_text varchar (500), -- provision/code/text (500 x 1 varchar) +cons_provision_dataperiod_start varchar (30), -- provision/dataPeriod/start (30 x 1 varchar) +cons_provision_dataperiod_end varchar (30), -- provision/dataPeriod/end (30 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS kds2db_in.location ( +location_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +loc_id varchar (70), -- id (70 x 1 varchar) +loc_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +loc_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +loc_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +loc_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +loc_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +loc_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +loc_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +loc_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +loc_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +loc_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +loc_status varchar (30), -- status (30 x 1 varchar) +loc_name varchar (50), -- name (50 x 1 varchar) +loc_description varchar (50), -- description (50 x 1 varchar) +loc_alias varchar (90), -- alias (30 x 3 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + + --GRANT INSERT, SELECT ON TABLE kds2db_in.encounter TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.encounter TO kds2db_user; -- zum Testen weitere Berechtigungen GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.encounter TO db_user; -- Entwicklungsphase GRANT TRIGGER ON kds2db_in.encounter TO kds2db_user; ALTER TABLE kds2db_in.encounter ALTER COLUMN encounter_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; CREATE OR REPLACE FUNCTION kds2db_in.encounter_tr_ins_fkt() RETURNS TRIGGER AS $$ @@ -188,11 +1307,13 @@ CREATE OR REPLACE TRIGGER encounter_tr_ins_tr FOR EACH ROW EXECUTE PROCEDURE kds2db_in.encounter_tr_ins_fkt(); - ---GRANT INSERT, SELECT ON TABLE kds2db_in.patient TO 100; -- nach Entwicklungsphase -GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.patient TO kds2db_user; -- Entwicklungsphase +--GRANT INSERT, SELECT ON TABLE kds2db_in.patient TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.patient TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.patient TO db_user; -- Entwicklungsphase GRANT TRIGGER ON kds2db_in.patient TO kds2db_user; ALTER TABLE kds2db_in.patient ALTER COLUMN patient_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; CREATE OR REPLACE FUNCTION kds2db_in.patient_tr_ins_fkt() RETURNS TRIGGER AS $$ @@ -209,203 +1330,1497 @@ CREATE OR REPLACE TRIGGER patient_tr_ins_tr FOR EACH ROW EXECUTE PROCEDURE kds2db_in.patient_tr_ins_fkt(); +--GRANT INSERT, SELECT ON TABLE kds2db_in.condition TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.condition TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.condition TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.condition TO kds2db_user; +ALTER TABLE kds2db_in.condition ALTER COLUMN condition_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.condition_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER condition_tr_ins_tr + BEFORE INSERT + ON kds2db_in.condition + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.condition_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.medication TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.medication TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.medication TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.medication TO kds2db_user; +ALTER TABLE kds2db_in.medication ALTER COLUMN medication_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.medication_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER medication_tr_ins_tr + BEFORE INSERT + ON kds2db_in.medication + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.medication_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.medicationrequest TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.medicationrequest TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.medicationrequest TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.medicationrequest TO kds2db_user; +ALTER TABLE kds2db_in.medicationrequest ALTER COLUMN medicationrequest_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.medicationrequest_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER medicationrequest_tr_ins_tr + BEFORE INSERT + ON kds2db_in.medicationrequest + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.medicationrequest_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.medicationadministration TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.medicationadministration TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.medicationadministration TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.medicationadministration TO kds2db_user; +ALTER TABLE kds2db_in.medicationadministration ALTER COLUMN medicationadministration_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.medicationadministration_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER medicationadministration_tr_ins_tr + BEFORE INSERT + ON kds2db_in.medicationadministration + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.medicationadministration_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.medicationstatement TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.medicationstatement TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.medicationstatement TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.medicationstatement TO kds2db_user; +ALTER TABLE kds2db_in.medicationstatement ALTER COLUMN medicationstatement_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.medicationstatement_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER medicationstatement_tr_ins_tr + BEFORE INSERT + ON kds2db_in.medicationstatement + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.medicationstatement_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.observation TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.observation TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.observation TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.observation TO kds2db_user; +ALTER TABLE kds2db_in.observation ALTER COLUMN observation_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.observation_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER observation_tr_ins_tr + BEFORE INSERT + ON kds2db_in.observation + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.observation_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.diagnosticreport TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.diagnosticreport TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.diagnosticreport TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.diagnosticreport TO kds2db_user; +ALTER TABLE kds2db_in.diagnosticreport ALTER COLUMN diagnosticreport_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.diagnosticreport_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER diagnosticreport_tr_ins_tr + BEFORE INSERT + ON kds2db_in.diagnosticreport + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.diagnosticreport_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.servicerequest TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.servicerequest TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.servicerequest TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.servicerequest TO kds2db_user; +ALTER TABLE kds2db_in.servicerequest ALTER COLUMN servicerequest_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.servicerequest_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER servicerequest_tr_ins_tr + BEFORE INSERT + ON kds2db_in.servicerequest + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.servicerequest_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.procedure TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.procedure TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.procedure TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.procedure TO kds2db_user; +ALTER TABLE kds2db_in.procedure ALTER COLUMN procedure_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.procedure_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER procedure_tr_ins_tr + BEFORE INSERT + ON kds2db_in.procedure + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.procedure_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.consent TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.consent TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.consent TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.consent TO kds2db_user; +ALTER TABLE kds2db_in.consent ALTER COLUMN consent_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.consent_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER consent_tr_ins_tr + BEFORE INSERT + ON kds2db_in.consent + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.consent_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE kds2db_in.location TO kds2db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE kds2db_in.location TO kds2db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE kds2db_in.location TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON kds2db_in.location TO kds2db_user; +ALTER TABLE kds2db_in.location ALTER COLUMN location_id SET DEFAULT (nextval('kds2db_in.kds2db_in_seq')); +GRANT USAGE ON SCHEMA kds2db_in TO kds2db_user; +GRANT USAGE ON kds2db_in.kds2db_in_seq TO kds2db_user; + +CREATE OR REPLACE FUNCTION kds2db_in.location_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER location_tr_ins_tr + BEFORE INSERT + ON kds2db_in.location + FOR EACH ROW + EXECUTE PROCEDURE kds2db_in.location_tr_ins_fkt(); + -- Comment on Table in Schema kds2db_in comment on column kds2db_in.encounter.enc_id is 'id (70 x 1 70)'; -comment on column kds2db_in.encounter.enc_pat_id is 'subject/reference (70 x 1 70)'; +comment on column kds2db_in.encounter.enc_patient_id is 'subject/reference (70 x 1 70)'; comment on column kds2db_in.encounter.enc_partof_id is 'partOf/reference (70 x 1 70)'; -comment on column kds2db_in.encounter.enc_identifier_use is 'identifier/use (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_identifier_type_system is 'identifier/type/coding/system (70 x 3 210)'; -comment on column kds2db_in.encounter.enc_identifier_type_version is 'identifier/type/coding/version (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_identifier_type_code is 'identifier/type/coding/code (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_identifier_type_display is 'identifier/type/coding/display (100 x 3 300)'; -comment on column kds2db_in.encounter.enc_identifier_type_text is 'identifier/type/text (500 x 3 1500)'; -comment on column kds2db_in.encounter.enc_identifier_system is 'identifier/system (70 x 3 210)'; -comment on column kds2db_in.encounter.enc_identifier_value is 'identifier/value (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_identifier_period_start is 'identifier/period/start (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_identifier_period_end is 'identifier/period/end (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_id is 'identifier/assigner/reference (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_type is 'identifier/assigner/type (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_type_use is 'identifier/assigner/identifier/use (20 x 3 60)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_type_system is 'identifier/assigner/identifier/type/coding/system (70 x 3 210)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_type_version is 'identifier/assigner/identifier/type/coding/version (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_type_code is 'identifier/assigner/identifier/type/coding/code (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_type_display is 'identifier/assigner/identifier/type/coding/display (100 x 3 300)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_type_text is 'identifier/assigner/identifier/type/text (500 x 3 1500)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_system is 'identifier/assigner/identifier/system (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_value is 'identifier/assigner/identifier/value (100 x 3 300)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_period_start is 'identifier/assigner/identifier/period/start (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_identifier_assigner_identifier_period_end is 'identifier/assigner/identifier/period/end (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_status is 'status (20 x 1 20)'; -comment on column kds2db_in.encounter.enc_class_system is 'class/system (70 x 1 70)'; -comment on column kds2db_in.encounter.enc_class_version is 'class/version (30 x 1 30)'; -comment on column kds2db_in.encounter.enc_class_code is 'class/code (30 x 1 30)'; -comment on column kds2db_in.encounter.enc_class_display is 'class/display (100 x 1 100)'; -comment on column kds2db_in.encounter.enc_type_system is 'type/coding/system (70 x 10 700)'; -comment on column kds2db_in.encounter.enc_type_version is 'type/coding/version (30 x 10 300)'; -comment on column kds2db_in.encounter.enc_type_code is 'type/coding/code (30 x 10 300)'; -comment on column kds2db_in.encounter.enc_type_display is 'type/coding/display (50 x 10 500)'; -comment on column kds2db_in.encounter.enc_type_text is 'type/text (300 x 10 3000)'; -comment on column kds2db_in.encounter.enc_servicetype_system is 'serviceType/coding/system (70 x 3 210)'; -comment on column kds2db_in.encounter.enc_servicetype_version is 'serviceType/coding/version (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_servicetype_code is 'serviceType/coding/code (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_servicetype_display is 'serviceType/coding/display (100 x 3 300)'; +comment on column kds2db_in.encounter.enc_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.encounter.enc_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.encounter.enc_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.encounter.enc_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.encounter.enc_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.encounter.enc_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.encounter.enc_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.encounter.enc_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.encounter.enc_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.encounter.enc_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.encounter.enc_status is 'status (30 x 1 30)'; +comment on column kds2db_in.encounter.enc_class_system is 'class/coding/system (70 x 1 70)'; +comment on column kds2db_in.encounter.enc_class_version is 'class/coding/version (50 x 1 50)'; +comment on column kds2db_in.encounter.enc_class_code is 'class/coding/code (30 x 1 30)'; +comment on column kds2db_in.encounter.enc_class_display is 'class/coding/display (100 x 1 100)'; +comment on column kds2db_in.encounter.enc_type_system is 'type/coding/system (70 x 9 630)'; +comment on column kds2db_in.encounter.enc_type_version is 'type/coding/version (50 x 9 450)'; +comment on column kds2db_in.encounter.enc_type_code is 'type/coding/code (30 x 9 270)'; +comment on column kds2db_in.encounter.enc_type_display is 'type/coding/display (100 x 9 900)'; +comment on column kds2db_in.encounter.enc_type_text is 'type/text (500 x 3 1500)'; +comment on column kds2db_in.encounter.enc_servicetype_system is 'serviceType/coding/system (70 x 1 70)'; +comment on column kds2db_in.encounter.enc_servicetype_version is 'serviceType/coding/version (50 x 1 50)'; +comment on column kds2db_in.encounter.enc_servicetype_code is 'serviceType/coding/code (30 x 1 30)'; +comment on column kds2db_in.encounter.enc_servicetype_display is 'serviceType/coding/display (100 x 1 100)'; +comment on column kds2db_in.encounter.enc_servicetype_text is 'serviceType/text (500 x 1 500)'; comment on column kds2db_in.encounter.enc_period_start is 'period/start (30 x 1 30)'; comment on column kds2db_in.encounter.enc_period_end is 'period/end (30 x 1 30)'; -comment on column kds2db_in.encounter.enc_diagnosis_condition_id is 'diagnosis/condition/reference (70 x 15 1050)'; -comment on column kds2db_in.encounter.enc_diagnosis_use_system is 'diagnosis/use/coding/system (70 x 15 1050)'; -comment on column kds2db_in.encounter.enc_diagnosis_use_version is 'diagnosis/use/coding/version (30 x 15 450)'; -comment on column kds2db_in.encounter.enc_diagnosis_use_code is 'diagnosis/use/coding/code (30 x 15 450)'; -comment on column kds2db_in.encounter.enc_diagnosis_use_display is 'diagnosis/use/coding/display (100 x 15 1500)'; -comment on column kds2db_in.encounter.enc_diagnosis_use_text is 'diagnosis/use/text (500 x 15 7500)'; -comment on column kds2db_in.encounter.enc_diagnosis_rank is 'diagnosis/rank (5 x 15 75)'; -comment on column kds2db_in.encounter.enc_hospitalization_admitsource_system is 'hospitalization/admitSource/coding/system (70 x 2 140)'; -comment on column kds2db_in.encounter.enc_hospitalization_admitsource_version is 'hospitalization/admitSource/coding/version (30 x 2 60)'; -comment on column kds2db_in.encounter.enc_hospitalization_admitsource_code is 'hospitalization/admitSource/coding/code (30 x 2 60)'; -comment on column kds2db_in.encounter.enc_hospitalization_admitsource_display is 'hospitalization/admitSource/coding/display (100 x 2 200)'; -comment on column kds2db_in.encounter.enc_hospitalization_admitsource_text is 'hospitalization/admitSource/text (500 x 2 1000)'; -comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_system is 'hospitalization/dischargeDisposition/coding/system (70 x 2 140)'; -comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_version is 'hospitalization/dischargeDisposition/coding/version (30 x 2 60)'; -comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_code is 'hospitalization/dischargeDisposition/coding/code (30 x 2 60)'; -comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_display is 'hospitalization/dischargeDisposition/coding/display (100 x 2 200)'; -comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_text is 'hospitalization/dischargeDisposition/text (500 x 2 1000)'; -comment on column kds2db_in.encounter.enc_location_id is 'location/location/reference (70 x 3 210)'; -comment on column kds2db_in.encounter.enc_location_type is 'location/location/type (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_location_identifier_type_use is 'location/location/identifier/use (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_location_identifier_type_system is 'location/location/identifier/type/coding/system (70 x 3 210)'; -comment on column kds2db_in.encounter.enc_location_identifier_type_version is 'location/location/identifier/type/coding/version (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_location_identifier_type_code is 'location/location/identifier/type/coding/code (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_location_identifier_type_display is 'location/location/identifier/type/coding/display (100 x 3 300)'; -comment on column kds2db_in.encounter.enc_location_identifier_type_text is 'location/location/identifier/type/text (500 x 3 1500)'; -comment on column kds2db_in.encounter.enc_location_identifier_system is 'location/location/identifier/system (70 x 3 210)'; -comment on column kds2db_in.encounter.enc_location_identifier_value is 'location/location/identifier/value (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_location_identifier_period_start is 'location/location/identifier/period/start (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_location_identifier_period_end is 'location/location/identifier/period/end (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_location_display is 'location/location/display (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_location_physicaltype_system is 'location/location/physicalType/coding/system (70 x 3 210)'; -comment on column kds2db_in.encounter.enc_location_physicaltype_version is 'location/location/physicalType/coding/version (30 x 3 90)'; -comment on column kds2db_in.encounter.enc_location_physicaltype_code is 'location/location/physicalType/coding/code (50 x 3 150)'; -comment on column kds2db_in.encounter.enc_location_physicaltype_display is 'location/location/physicalType/coding/display (100 x 3 300)'; -comment on column kds2db_in.encounter.enc_location_physicaltype_text is 'location/location/physicalType/text (500 x 3 1500)'; +comment on column kds2db_in.encounter.enc_diagnosis_condition_id is 'diagnosis/condition/reference (70 x 7 490)'; +comment on column kds2db_in.encounter.enc_diagnosis_use_system is 'diagnosis/use/coding/system (70 x 21 1470)'; +comment on column kds2db_in.encounter.enc_diagnosis_use_version is 'diagnosis/use/coding/version (50 x 21 1050)'; +comment on column kds2db_in.encounter.enc_diagnosis_use_code is 'diagnosis/use/coding/code (30 x 21 630)'; +comment on column kds2db_in.encounter.enc_diagnosis_use_display is 'diagnosis/use/coding/display (100 x 21 2100)'; +comment on column kds2db_in.encounter.enc_diagnosis_use_text is 'diagnosis/use/text (500 x 7 3500)'; +comment on column kds2db_in.encounter.enc_diagnosis_rank is 'diagnosis/rank (2 x 7 14)'; +comment on column kds2db_in.encounter.enc_hospitalization_admitsource_system is 'hospitalization/admitSource/coding/system (70 x 1 70)'; +comment on column kds2db_in.encounter.enc_hospitalization_admitsource_version is 'hospitalization/admitSource/coding/version (50 x 1 50)'; +comment on column kds2db_in.encounter.enc_hospitalization_admitsource_code is 'hospitalization/admitSource/coding/code (30 x 1 30)'; +comment on column kds2db_in.encounter.enc_hospitalization_admitsource_display is 'hospitalization/admitSource/coding/display (100 x 1 100)'; +comment on column kds2db_in.encounter.enc_hospitalization_admitsource_text is 'hospitalization/admitSource/text (500 x 1 500)'; +comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_system is 'hospitalization/dischargeDisposition/coding/system (70 x 1 70)'; +comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_version is 'hospitalization/dischargeDisposition/coding/version (50 x 1 50)'; +comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_code is 'hospitalization/dischargeDisposition/coding/code (30 x 1 30)'; +comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_display is 'hospitalization/dischargeDisposition/coding/display (100 x 1 100)'; +comment on column kds2db_in.encounter.enc_hospitalization_dischargedisposition_text is 'hospitalization/dischargeDisposition/text (500 x 1 500)'; +comment on column kds2db_in.encounter.enc_location_id is 'location/location/reference (70 x 2 140)'; +comment on column kds2db_in.encounter.enc_location_type is 'location/location/type (30 x 2 60)'; +comment on column kds2db_in.encounter.enc_location_identifier_use is 'location/location/identifier/use (30 x 2 60)'; +comment on column kds2db_in.encounter.enc_location_identifier_type_system is 'location/location/identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.encounter.enc_location_identifier_type_version is 'location/location/identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.encounter.enc_location_identifier_type_code is 'location/location/identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.encounter.enc_location_identifier_type_display is 'location/location/identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.encounter.enc_location_identifier_type_text is 'location/location/identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.encounter.enc_location_display is 'location/location/display (100 x 2 200)'; +comment on column kds2db_in.encounter.enc_location_status is 'location/location/status (10 x 2 20)'; +comment on column kds2db_in.encounter.enc_location_physicaltype_system is 'location/location/physicalType/coding/system (70 x 6 420)'; +comment on column kds2db_in.encounter.enc_location_physicaltype_version is 'location/location/physicalType/coding/version (50 x 6 300)'; +comment on column kds2db_in.encounter.enc_location_physicaltype_code is 'location/location/physicalType/coding/code (30 x 6 180)'; +comment on column kds2db_in.encounter.enc_location_physicaltype_display is 'location/location/physicalType/coding/display (100 x 6 600)'; +comment on column kds2db_in.encounter.enc_location_physicaltype_text is 'location/location/physicalType/text (500 x 2 1000)'; comment on column kds2db_in.encounter.enc_serviceprovider_id is 'serviceProvider/reference (70 x 1 70)'; -comment on column kds2db_in.encounter.enc_serviceprovider_type is 'serviceProvider/type (500 x 1 500)'; -comment on column kds2db_in.encounter.enc_serviceprovider_identifier_type_use is 'serviceProvider/identifier/use (50 x 1 50)'; +comment on column kds2db_in.encounter.enc_serviceprovider_type is 'serviceProvider/type (30 x 1 30)'; +comment on column kds2db_in.encounter.enc_serviceprovider_identifier_use is 'serviceProvider/identifier/use (30 x 1 30)'; comment on column kds2db_in.encounter.enc_serviceprovider_identifier_type_system is 'serviceProvider/identifier/type/coding/system (70 x 1 70)'; -comment on column kds2db_in.encounter.enc_serviceprovider_identifier_type_version is 'serviceProvider/identifier/type/coding/version (30 x 1 30)'; +comment on column kds2db_in.encounter.enc_serviceprovider_identifier_type_version is 'serviceProvider/identifier/type/coding/version (50 x 1 50)'; comment on column kds2db_in.encounter.enc_serviceprovider_identifier_type_code is 'serviceProvider/identifier/type/coding/code (30 x 1 30)'; comment on column kds2db_in.encounter.enc_serviceprovider_identifier_type_display is 'serviceProvider/identifier/type/coding/display (100 x 1 100)'; comment on column kds2db_in.encounter.enc_serviceprovider_identifier_type_text is 'serviceProvider/identifier/type/text (500 x 1 500)'; -comment on column kds2db_in.encounter.enc_serviceprovider_identifier_system is 'serviceProvider/identifier/system (100 x 1 100)'; -comment on column kds2db_in.encounter.enc_serviceprovider_identifier_value is 'serviceProvider/identifier/value (50 x 1 50)'; -comment on column kds2db_in.encounter.enc_serviceprovider_identifier_period_start is 'serviceProvider/identifier/period/start (30 x 1 30)'; -comment on column kds2db_in.encounter.enc_serviceprovider_identifier_period_end is 'serviceProvider/identifier/period/end (30 x 1 30)'; comment on column kds2db_in.encounter.enc_serviceprovider_display is 'serviceProvider/display (100 x 1 100)'; comment on column kds2db_in.patient.pat_id is 'id (70 x 1 70)'; -comment on column kds2db_in.patient.pat_identifier_value is 'identifier/value (50 x 3 150)'; -comment on column kds2db_in.patient.pat_identifier_system is 'identifier/system (70 x 3 210)'; -comment on column kds2db_in.patient.pat_identifier_type_system is 'identifier/type/coding/system (70 x 3 210)'; -comment on column kds2db_in.patient.pat_identifier_type_version is 'identifier/type/coding/version (50 x 3 150)'; -comment on column kds2db_in.patient.pat_identifier_type_code is 'identifier/type/coding/code (50 x 3 150)'; -comment on column kds2db_in.patient.pat_identifier_type_display is 'identifier/type/coding/display (100 x 3 300)'; -comment on column kds2db_in.patient.pat_identifier_type_text is 'identifier/type/text (500 x 3 1500)'; -comment on column kds2db_in.patient.pat_name_given is 'name/given (100 x 1 100)'; -comment on column kds2db_in.patient.pat_name_family is 'name/family (50 x 1 50)'; +comment on column kds2db_in.patient.pat_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.patient.pat_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.patient.pat_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.patient.pat_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.patient.pat_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.patient.pat_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.patient.pat_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.patient.pat_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.patient.pat_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.patient.pat_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.patient.pat_name_given is 'name/given (50 x 2 100)'; +comment on column kds2db_in.patient.pat_name_family is 'name/family (50 x 2 100)'; comment on column kds2db_in.patient.pat_gender is 'gender (10 x 1 10)'; comment on column kds2db_in.patient.pat_birthdate is 'birthDate (30 x 1 30)'; -comment on column kds2db_in.patient.pat_adress_postalcode is 'address/postalCode (10 x 1 10)'; +comment on column kds2db_in.patient.pat_address_postalcode is 'address/postalCode (10 x 3 30)'; + +comment on column kds2db_in.condition.con_id is 'id (70 x 1 70)'; +comment on column kds2db_in.condition.con_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column kds2db_in.condition.con_patient_id is 'subject/reference (70 x 1 70)'; +comment on column kds2db_in.condition.con_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.condition.con_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.condition.con_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.condition.con_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.condition.con_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.condition.con_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.condition.con_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.condition.con_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.condition.con_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.condition.con_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.condition.con_clinicalstatus_system is 'clinicalStatus/coding/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_clinicalstatus_version is 'clinicalStatus/coding/version (50 x 1 50)'; +comment on column kds2db_in.condition.con_clinicalstatus_code is 'clinicalStatus/coding/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_clinicalstatus_display is 'clinicalStatus/coding/display (100 x 1 100)'; +comment on column kds2db_in.condition.con_clinicalstatus_text is 'clinicalStatus/text (500 x 1 500)'; +comment on column kds2db_in.condition.con_verificationstatus_system is 'verificationStatus/coding/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_verificationstatus_version is 'verificationStatus/coding/version (50 x 1 50)'; +comment on column kds2db_in.condition.con_verificationstatus_code is 'verificationStatus/coding/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_verificationstatus_display is 'verificationStatus/coding/display (100 x 1 100)'; +comment on column kds2db_in.condition.con_verificationstatus_text is 'verificationStatus/text (500 x 1 500)'; +comment on column kds2db_in.condition.con_category_system is 'category/coding/system (70 x 6 420)'; +comment on column kds2db_in.condition.con_category_version is 'category/coding/version (50 x 6 300)'; +comment on column kds2db_in.condition.con_category_code is 'category/coding/code (30 x 6 180)'; +comment on column kds2db_in.condition.con_category_display is 'category/coding/display (100 x 6 600)'; +comment on column kds2db_in.condition.con_category_text is 'category/text (500 x 2 1000)'; +comment on column kds2db_in.condition.con_severity_system is 'severity/coding/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_severity_version is 'severity/coding/version (50 x 1 50)'; +comment on column kds2db_in.condition.con_severity_code is 'severity/coding/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_severity_display is 'severity/coding/display (100 x 1 100)'; +comment on column kds2db_in.condition.con_severity_text is 'severity/text (500 x 1 500)'; +comment on column kds2db_in.condition.con_code_system is 'code/coding/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_code_version is 'code/coding/version (50 x 1 50)'; +comment on column kds2db_in.condition.con_code_code is 'code/coding/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_code_display is 'code/coding/display (100 x 1 100)'; +comment on column kds2db_in.condition.con_code_text is 'code/text (500 x 1 500)'; +comment on column kds2db_in.condition.con_bodysite_system is 'bodySite/coding/system (70 x 9 630)'; +comment on column kds2db_in.condition.con_bodysite_version is 'bodySite/coding/version (50 x 9 450)'; +comment on column kds2db_in.condition.con_bodysite_code is 'bodySite/coding/code (30 x 9 270)'; +comment on column kds2db_in.condition.con_bodysite_display is 'bodySite/coding/display (100 x 9 900)'; +comment on column kds2db_in.condition.con_bodysite_text is 'bodySite/text (500 x 3 1500)'; +comment on column kds2db_in.condition.con_onsetperiod_start is 'onsetPeriod/start (30 x 1 30)'; +comment on column kds2db_in.condition.con_onsetperiod_end is 'onsetPeriod/end (30 x 1 30)'; +comment on column kds2db_in.condition.con_onsetdatetime is 'onsetDateTime (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementdatetime is 'abatementDateTime (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementage_value is 'abatementAge/value (10 x 1 10)'; +comment on column kds2db_in.condition.con_abatementage_comparator is 'abatementAge/comparator (3 x 1 3)'; +comment on column kds2db_in.condition.con_abatementage_unit is 'abatementAge/unit (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementage_system is 'abatementAge/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_abatementage_code is 'abatementAge/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementperiod_start is 'abatementPeriod/start (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementperiod_end is 'abatementPeriod/end (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementrange_low_value is 'abatementRange/low/value (10 x 1 10)'; +comment on column kds2db_in.condition.con_abatementrange_low_unit is 'abatementRange/low/unit (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementrange_low_system is 'abatementRange/low/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_abatementrange_low_code is 'abatementRange/low/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementrange_high_value is 'abatementRange/high/value (10 x 1 10)'; +comment on column kds2db_in.condition.con_abatementrange_high_unit is 'abatementRange/high/unit (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementrange_high_system is 'abatementRange/high/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_abatementrange_high_code is 'abatementRange/high/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_abatementstring is 'abatementString (300 x 1 300)'; +comment on column kds2db_in.condition.con_recordeddate is 'recordedDate (30 x 1 30)'; +comment on column kds2db_in.condition.con_recorder_id is 'recorder/reference (70 x 1 70)'; +comment on column kds2db_in.condition.con_recorder_type is 'recorder/type (30 x 1 30)'; +comment on column kds2db_in.condition.con_recorder_identifier_use is 'recorder/identifier/use (30 x 1 30)'; +comment on column kds2db_in.condition.con_recorder_identifier_type_system is 'recorder/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_recorder_identifier_type_version is 'recorder/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.condition.con_recorder_identifier_type_code is 'recorder/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_recorder_identifier_type_display is 'recorder/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.condition.con_recorder_identifier_type_text is 'recorder/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.condition.con_recorder_display is 'recorder/display (100 x 1 100)'; +comment on column kds2db_in.condition.con_asserter_id is 'asserter/reference (70 x 1 70)'; +comment on column kds2db_in.condition.con_asserter_type is 'asserter/type (30 x 1 30)'; +comment on column kds2db_in.condition.con_asserter_identifier_use is 'asserter/identifier/use (30 x 1 30)'; +comment on column kds2db_in.condition.con_asserter_identifier_type_system is 'asserter/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.condition.con_asserter_identifier_type_version is 'asserter/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.condition.con_asserter_identifier_type_code is 'asserter/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.condition.con_asserter_identifier_type_display is 'asserter/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.condition.con_asserter_identifier_type_text is 'asserter/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.condition.con_asserter_display is 'asserter/display (100 x 1 100)'; +comment on column kds2db_in.condition.con_stage_summary_system is 'stage/summary/coding/system (70 x 6 420)'; +comment on column kds2db_in.condition.con_stage_summary_version is 'stage/summary/coding/version (50 x 6 300)'; +comment on column kds2db_in.condition.con_stage_summary_code is 'stage/summary/coding/code (30 x 6 180)'; +comment on column kds2db_in.condition.con_stage_summary_display is 'stage/summary/coding/display (100 x 6 600)'; +comment on column kds2db_in.condition.con_stage_summary_text is 'stage/summary/text (500 x 2 1000)'; +comment on column kds2db_in.condition.con_stage_assessment_id is 'stage/assessment/reference (70 x 4 280)'; +comment on column kds2db_in.condition.con_stage_assessment_type is 'stage/assessment/type (30 x 4 120)'; +comment on column kds2db_in.condition.con_stage_assessment_identifier_use is 'stage/assessment/identifier/use (30 x 4 120)'; +comment on column kds2db_in.condition.con_stage_assessment_identifier_type_system is 'stage/assessment/identifier/type/coding/system (70 x 12 840)'; +comment on column kds2db_in.condition.con_stage_assessment_identifier_type_version is 'stage/assessment/identifier/type/coding/version (50 x 12 600)'; +comment on column kds2db_in.condition.con_stage_assessment_identifier_type_code is 'stage/assessment/identifier/type/coding/code (30 x 12 360)'; +comment on column kds2db_in.condition.con_stage_assessment_identifier_type_display is 'stage/assessment/identifier/type/coding/display (100 x 12 1200)'; +comment on column kds2db_in.condition.con_stage_assessment_identifier_type_text is 'stage/assessment/identifier/type/text (500 x 4 2000)'; +comment on column kds2db_in.condition.con_stage_assessment_display is 'stage/assessment/display (100 x 4 400)'; +comment on column kds2db_in.condition.con_stage_type_system is 'stage/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.condition.con_stage_type_version is 'stage/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.condition.con_stage_type_code is 'stage/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.condition.con_stage_type_display is 'stage/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.condition.con_stage_type_text is 'stage/type/text (500 x 2 1000)'; +comment on column kds2db_in.condition.con_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column kds2db_in.condition.con_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column kds2db_in.condition.con_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column kds2db_in.condition.con_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column kds2db_in.condition.con_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column kds2db_in.condition.con_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column kds2db_in.condition.con_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column kds2db_in.condition.con_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column kds2db_in.condition.con_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column kds2db_in.condition.con_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column kds2db_in.condition.con_note_time is 'note/time (30 x 2 60)'; +comment on column kds2db_in.condition.con_note_text is 'note/text (5000 x 2 10000)'; + +comment on column kds2db_in.medication.med_id is 'id (70 x 1 70)'; +comment on column kds2db_in.medication.med_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.medication.med_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medication.med_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medication.med_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medication.med_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medication.med_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medication.med_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.medication.med_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.medication.med_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.medication.med_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.medication.med_code_system is 'code/coding/system (70 x 1 70)'; +comment on column kds2db_in.medication.med_code_version is 'code/coding/version (50 x 1 50)'; +comment on column kds2db_in.medication.med_code_code is 'code/coding/code (30 x 1 30)'; +comment on column kds2db_in.medication.med_code_display is 'code/coding/display (100 x 1 100)'; +comment on column kds2db_in.medication.med_code_text is 'code/text (500 x 1 500)'; +comment on column kds2db_in.medication.med_status is 'status (20 x 1 20)'; +comment on column kds2db_in.medication.med_form_system is 'form/coding/system (70 x 1 70)'; +comment on column kds2db_in.medication.med_form_version is 'form/coding/version (50 x 1 50)'; +comment on column kds2db_in.medication.med_form_code is 'form/coding/code (30 x 1 30)'; +comment on column kds2db_in.medication.med_form_display is 'form/coding/display (100 x 1 100)'; +comment on column kds2db_in.medication.med_form_text is 'form/text (500 x 1 500)'; +comment on column kds2db_in.medication.med_amount_numerator_value is 'amount/numerator/value (10 x 1 10)'; +comment on column kds2db_in.medication.med_amount_numerator_comparator is 'amount/numerator/comparator (10 x 1 10)'; +comment on column kds2db_in.medication.med_amount_numerator_unit is 'amount/numerator/unit (30 x 1 30)'; +comment on column kds2db_in.medication.med_amount_numerator_system is 'amount/numerator/system (70 x 1 70)'; +comment on column kds2db_in.medication.med_amount_numerator_code is 'amount/numerator/code (30 x 1 30)'; +comment on column kds2db_in.medication.med_amount_denominator_value is 'amount/denominator/value (10 x 1 10)'; +comment on column kds2db_in.medication.med_amount_denominator_comparator is 'amount/denominator/comparator (10 x 1 10)'; +comment on column kds2db_in.medication.med_amount_denominator_unit is 'amount/denominator/unit (30 x 1 30)'; +comment on column kds2db_in.medication.med_amount_denominator_system is 'amount/denominator/system (70 x 1 70)'; +comment on column kds2db_in.medication.med_amount_denominator_code is 'amount/denominator/code (30 x 1 30)'; +comment on column kds2db_in.medication.med_ingredient_strength_numerator_value is 'ingredient/strength/numerator/value (10 x 15 150)'; +comment on column kds2db_in.medication.med_ingredient_strength_numerator_comparator is 'ingredient/strength/numerator/comparator (10 x 15 150)'; +comment on column kds2db_in.medication.med_ingredient_strength_numerator_unit is 'ingredient/strength/numerator/unit (30 x 15 450)'; +comment on column kds2db_in.medication.med_ingredient_strength_numerator_system is 'ingredient/strength/numerator/system (70 x 15 1050)'; +comment on column kds2db_in.medication.med_ingredient_strength_numerator_code is 'ingredient/strength/numerator/code (30 x 15 450)'; +comment on column kds2db_in.medication.med_ingredient_strength_denominator_value is 'ingredient/strength/denominator/value (10 x 15 150)'; +comment on column kds2db_in.medication.med_ingredient_strength_denominator_comparator is 'ingredient/strength/denominator/comparator (10 x 15 150)'; +comment on column kds2db_in.medication.med_ingredient_strength_denominator_unit is 'ingredient/strength/denominator/unit (30 x 15 450)'; +comment on column kds2db_in.medication.med_ingredient_strength_denominator_system is 'ingredient/strength/denominator/system (70 x 15 1050)'; +comment on column kds2db_in.medication.med_ingredient_strength_denominator_code is 'ingredient/strength/denominator/code (30 x 15 450)'; +comment on column kds2db_in.medication.med_ingredient_itemcodeableconcept_system is 'ingredient/itemCodeableConcept/coding/system (70 x 45 3150)'; +comment on column kds2db_in.medication.med_ingredient_itemcodeableconcept_version is 'ingredient/itemCodeableConcept/coding/version (50 x 45 2250)'; +comment on column kds2db_in.medication.med_ingredient_itemcodeableconcept_code is 'ingredient/itemCodeableConcept/coding/code (30 x 45 1350)'; +comment on column kds2db_in.medication.med_ingredient_itemcodeableconcept_display is 'ingredient/itemCodeableConcept/coding/display (100 x 45 4500)'; +comment on column kds2db_in.medication.med_ingredient_itemcodeableconcept_text is 'ingredient/itemCodeableConcept/text (500 x 15 7500)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_id is 'ingredient/itemReference/reference (70 x 15 1050)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_type is 'ingredient/itemReference/type (30 x 15 450)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_identifier_use is 'ingredient/itemReference/identifier/use (30 x 15 450)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_identifier_type_system is 'ingredient/itemReference/identifier/type/coding/system (70 x 45 3150)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_identifier_type_version is 'ingredient/itemReference/identifier/type/coding/version (50 x 45 2250)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_identifier_type_code is 'ingredient/itemReference/identifier/type/coding/code (30 x 45 1350)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_identifier_type_display is 'ingredient/itemReference/identifier/type/coding/display (100 x 45 4500)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_identifier_type_text is 'ingredient/itemReference/identifier/type/text (500 x 15 7500)'; +comment on column kds2db_in.medication.med_ingredient_itemreference_display is 'ingredient/itemReference/display (100 x 15 1500)'; +comment on column kds2db_in.medication.med_ingredient_isactive is 'ingredient/isActive (10 x 15 150)'; + +comment on column kds2db_in.medicationrequest.medreq_id is 'id (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_patient_id is 'subject/reference (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_medicationreference_id is 'medicationReference/reference (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_status is 'status (20 x 1 20)'; +comment on column kds2db_in.medicationrequest.medreq_statusreason_system is 'statusReason/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_statusreason_version is 'statusReason/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationrequest.medreq_statusreason_code is 'statusReason/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_statusreason_display is 'statusReason/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationrequest.medreq_statusreason_text is 'statusReason/text (500 x 1 500)'; +comment on column kds2db_in.medicationrequest.medreq_intend is 'intend (20 x 1 20)'; +comment on column kds2db_in.medicationrequest.medreq_category_system is 'category/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_category_version is 'category/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_category_code is 'category/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_category_display is 'category/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_category_text is 'category/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_priority is 'priority (10 x 1 10)'; +comment on column kds2db_in.medicationrequest.medreq_reportedboolean is 'reportedBoolean (10 x 1 10)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_id is 'reportedReference/reference (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_type is 'reportedReference/type (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_identifier_use is 'reportedReference/identifier/use (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_identifier_type_system is 'reportedReference/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_identifier_type_version is 'reportedReference/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_identifier_type_code is 'reportedReference/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_identifier_type_display is 'reportedReference/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_identifier_type_text is 'reportedReference/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.medicationrequest.medreq_reportedreference_display is 'reportedReference/display (100 x 1 100)'; +comment on column kds2db_in.medicationrequest.medreq_medicationcodeableconcept_system is 'medicationCodeableConcept/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_medicationcodeableconcept_version is 'medicationCodeableConcept/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationrequest.medreq_medicationcodeableconcept_code is 'medicationCodeableConcept/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_medicationcodeableconcept_display is 'medicationCodeableConcept/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationrequest.medreq_medicationcodeableconcept_text is 'medicationCodeableConcept/text (500 x 1 500)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_id is 'supportingInformation/reference (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_type is 'supportingInformation/type (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_identifier_use is 'supportingInformation/identifier/use (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_identifier_type_system is 'supportingInformation/identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_identifier_type_version is 'supportingInformation/identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_identifier_type_code is 'supportingInformation/identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_identifier_type_display is 'supportingInformation/identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_identifier_type_text is 'supportingInformation/identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_supportinginformation_display is 'supportingInformation/display (100 x 2 200)'; +comment on column kds2db_in.medicationrequest.medreq_authoredon is 'authoredOn (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_requester_id is 'requester/reference (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_requester_type is 'requester/type (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_requester_identifier_use is 'requester/identifier/use (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_requester_identifier_type_system is 'requester/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_requester_identifier_type_version is 'requester/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationrequest.medreq_requester_identifier_type_code is 'requester/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_requester_identifier_type_display is 'requester/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationrequest.medreq_requester_identifier_type_text is 'requester/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.medicationrequest.medreq_requester_display is 'requester/display (100 x 1 100)'; +comment on column kds2db_in.medicationrequest.medreq_reasoncode_system is 'reasonCode/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_reasoncode_version is 'reasonCode/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_reasoncode_code is 'reasonCode/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_reasoncode_display is 'reasonCode/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_reasoncode_text is 'reasonCode/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_id is 'reasonReference/reference (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_type is 'reasonReference/type (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_identifier_use is 'reasonReference/identifier/use (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_identifier_type_system is 'reasonReference/identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_identifier_type_version is 'reasonReference/identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_identifier_type_code is 'reasonReference/identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_identifier_type_display is 'reasonReference/identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_identifier_type_text is 'reasonReference/identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_reasonreference_display is 'reasonReference/display (100 x 2 200)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_id is 'basedOn/reference (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_type is 'basedOn/type (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_identifier_use is 'basedOn/identifier/use (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_basedon_display is 'basedOn/display (100 x 2 200)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column kds2db_in.medicationrequest.medreq_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_note_time is 'note/time (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_note_text is 'note/text (5000 x 2 10000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_sequence is 'dosageInstruction/sequence (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_text is 'dosageInstruction/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_additionalinstruction_system is 'dosageInstruction/additionalInstruction/coding/system (70 x 12 840)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_additionalinstruction_version is 'dosageInstruction/additionalInstruction/coding/version (50 x 12 600)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_additionalinstruction_code is 'dosageInstruction/additionalInstruction/coding/code (30 x 12 360)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_additionalinstruction_display is 'dosageInstruction/additionalInstruction/coding/display (100 x 12 1200)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_additionalinstruction_text is 'dosageInstruction/additionalInstruction/text (500 x 4 2000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_patientinstruction is 'dosageInstruction/patientInstruction (100 x 2 200)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_event is 'dosageInstruction/timing/event (30 x 8 240)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_value is 'dosageInstruction/timing/repeat/boundsDuration/value (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_comparator is 'dosageInstruction/timing/repeat/boundsDuration/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_unit is 'dosageInstruction/timing/repeat/boundsDuration/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_system is 'dosageInstruction/timing/repeat/boundsDuration/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_code is 'dosageInstruction/timing/repeat/boundsDuration/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_low_value is 'dosageInstruction/timing/repeat/boundsRange/low/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_low_unit is 'dosageInstruction/timing/repeat/boundsRange/low/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_low_system is 'dosageInstruction/timing/repeat/boundsRange/low/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_low_code is 'dosageInstruction/timing/repeat/boundsRange/low/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_high_value is 'dosageInstruction/timing/repeat/boundsRange/high/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_high_unit is 'dosageInstruction/timing/repeat/boundsRange/high/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_high_system is 'dosageInstruction/timing/repeat/boundsRange/high/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_high_code is 'dosageInstruction/timing/repeat/boundsRange/high/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsperiod_start is 'dosageInstruction/timing/repeat/boundsPeriod/start (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_boundsperiod_end is 'dosageInstruction/timing/repeat/boundsPeriod/end (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_count is 'dosageInstruction/timing/repeat/count (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_countmax is 'dosageInstruction/timing/repeat/countMax (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_duration is 'dosageInstruction/timing/repeat/duration (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_durationmax is 'dosageInstruction/timing/repeat/durationMax (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_durationunit is 'dosageInstruction/timing/repeat/durationUnit (20 x 2 40)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_frequency is 'dosageInstruction/timing/repeat/frequency (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_frequencymax is 'dosageInstruction/timing/repeat/frequencyMax (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_period is 'dosageInstruction/timing/repeat/period (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_periodmax is 'dosageInstruction/timing/repeat/periodMax (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_periodunit is 'dosageInstruction/timing/repeat/periodUnit (20 x 2 40)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_dayofweek is 'dosageInstruction/timing/repeat/dayOfWeek (10 x 14 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_timeofday is 'dosageInstruction/timing/repeat/timeOfDay (20 x 8 160)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_when is 'dosageInstruction/timing/repeat/when (20 x 8 160)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_repeat_offset is 'dosageInstruction/timing/repeat/offset (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_code_system is 'dosageInstruction/timing/code/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_code_version is 'dosageInstruction/timing/code/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_code_code is 'dosageInstruction/timing/code/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_code_display is 'dosageInstruction/timing/code/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_timing_code_text is 'dosageInstruction/timing/code/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_asneededboolean is 'dosageInstruction/asNeededBoolean (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_system is 'dosageInstruction/asNeededCodeableConcept/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_version is 'dosageInstruction/asNeededCodeableConcept/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_code is 'dosageInstruction/asNeededCodeableConcept/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_display is 'dosageInstruction/asNeededCodeableConcept/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_text is 'dosageInstruction/asNeededCodeableConcept/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_site_system is 'dosageInstruction/site/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_site_version is 'dosageInstruction/site/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_site_code is 'dosageInstruction/site/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_site_display is 'dosageInstruction/site/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_site_text is 'dosageInstruction/site/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_route_system is 'dosageInstruction/route/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_route_version is 'dosageInstruction/route/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_route_code is 'dosageInstruction/route/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_route_display is 'dosageInstruction/route/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_route_text is 'dosageInstruction/route/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_method_system is 'dosageInstruction/method/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_method_version is 'dosageInstruction/method/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_method_code is 'dosageInstruction/method/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_method_display is 'dosageInstruction/method/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_method_text is 'dosageInstruction/method/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_type_system is 'dosageInstruction/doseAndRate/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_type_version is 'dosageInstruction/doseAndRate/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_type_code is 'dosageInstruction/doseAndRate/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_type_display is 'dosageInstruction/doseAndRate/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_type_text is 'dosageInstruction/doseAndRate/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_doserange_low_value is 'dosageInstruction/doseAndRate/doseRange/low/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_doserange_low_unit is 'dosageInstruction/doseAndRate/doseRange/low/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_doserange_low_system is 'dosageInstruction/doseAndRate/doseRange/low/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_doserange_low_code is 'dosageInstruction/doseAndRate/doseRange/low/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_doserange_high_value is 'dosageInstruction/doseAndRate/doseRange/high/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_doserange_high_unit is 'dosageInstruction/doseAndRate/doseRange/high/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_doserange_high_system is 'dosageInstruction/doseAndRate/doseRange/high/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_doserange_high_code is 'dosageInstruction/doseAndRate/doseRange/high/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_value is 'dosageInstruction/doseAndRate/doseQuantity/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_comparator is 'dosageInstruction/doseAndRate/doseQuantity/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_unit is 'dosageInstruction/doseAndRate/doseQuantity/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_system is 'dosageInstruction/doseAndRate/doseQuantity/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_code is 'dosageInstruction/doseAndRate/doseQuantity/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_value is 'dosageInstruction/doseAndRate/rateRatio/numerator/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_comparator is 'dosageInstruction/doseAndRate/rateRatio/numerator/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_unit is 'dosageInstruction/doseAndRate/rateRatio/numerator/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_system is 'dosageInstruction/doseAndRate/rateRatio/numerator/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_code is 'dosageInstruction/doseAndRate/rateRatio/numerator/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_value is 'dosageInstruction/doseAndRate/rateRatio/denominator/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_comparator is 'dosageInstruction/doseAndRate/rateRatio/denominator/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_unit is 'dosageInstruction/doseAndRate/rateRatio/denominator/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_system is 'dosageInstruction/doseAndRate/rateRatio/denominator/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_code is 'dosageInstruction/doseAndRate/rateRatio/denominator/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_raterange_low_value is 'dosageInstruction/doseAndRate/rateRange/low/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_raterange_low_unit is 'dosageInstruction/doseAndRate/rateRange/low/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_raterange_low_system is 'dosageInstruction/doseAndRate/rateRange/low/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_raterange_low_code is 'dosageInstruction/doseAndRate/rateRange/low/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_raterange_high_value is 'dosageInstruction/doseAndRate/rateRange/high/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_raterange_high_unit is 'dosageInstruction/doseAndRate/rateRange/high/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_raterange_high_system is 'dosageInstruction/doseAndRate/rateRange/high/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_raterange_high_code is 'dosageInstruction/doseAndRate/rateRange/high/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_ratequantity_value is 'dosageInstruction/doseAndRate/rateQuantity/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_ratequantity_unit is 'dosageInstruction/doseAndRate/rateQuantity/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_ratequantity_system is 'dosageInstruction/doseAndRate/rateQuantity/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_doseandrate_ratequantity_code is 'dosageInstruction/doseAndRate/rateQuantity/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_value is 'dosageInstruction/maxDosePerPeriod/numerator/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_comparator is 'dosageInstruction/maxDosePerPeriod/numerator/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_unit is 'dosageInstruction/maxDosePerPeriod/numerator/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_system is 'dosageInstruction/maxDosePerPeriod/numerator/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_code is 'dosageInstruction/maxDosePerPeriod/numerator/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_value is 'dosageInstruction/maxDosePerPeriod/denominator/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_comparator is 'dosageInstruction/maxDosePerPeriod/denominator/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_unit is 'dosageInstruction/maxDosePerPeriod/denominator/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_system is 'dosageInstruction/maxDosePerPeriod/denominator/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_code is 'dosageInstruction/maxDosePerPeriod/denominator/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperadministration_value is 'dosageInstruction/maxDosePerAdministration/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperadministration_unit is 'dosageInstruction/maxDosePerAdministration/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperadministration_system is 'dosageInstruction/maxDosePerAdministration/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperadministration_code is 'dosageInstruction/maxDosePerAdministration/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperlifetime_value is 'dosageInstruction/maxDosePerLifetime/value (10 x 2 20)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperlifetime_unit is 'dosageInstruction/maxDosePerLifetime/unit (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperlifetime_system is 'dosageInstruction/maxDosePerLifetime/system (70 x 2 140)'; +comment on column kds2db_in.medicationrequest.medreq_doseinstruc_maxdoseperlifetime_code is 'dosageInstruction/maxDosePerLifetime/code (30 x 2 60)'; +comment on column kds2db_in.medicationrequest.medreq_substitution_reason_system is 'substitution/reason/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationrequest.medreq_substitution_reason_version is 'substitution/reason/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationrequest.medreq_substitution_reason_code is 'substitution/reason/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationrequest.medreq_substitution_reason_display is 'substitution/reason/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationrequest.medreq_substitution_reason_text is 'substitution/reason/text (500 x 1 500)'; + +comment on column kds2db_in.medicationadministration.medadm_id is 'id (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_encounter_id is 'context/reference (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_patient_id is 'subject/reference (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.medicationadministration.medadm_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.medicationadministration.medadm_status is 'status (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_statusreason_system is 'statusReason/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_statusreason_version is 'statusReason/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationadministration.medadm_statusreason_code is 'statusReason/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_statusreason_display is 'statusReason/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationadministration.medadm_statusreason_text is 'statusReason/text (500 x 1 500)'; +comment on column kds2db_in.medicationadministration.medadm_category_system is 'category/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_category_version is 'category/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationadministration.medadm_category_code is 'category/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_category_display is 'category/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationadministration.medadm_category_text is 'category/text (500 x 1 500)'; +comment on column kds2db_in.medicationadministration.medadm_medicationreference_id is 'medicationReference/reference (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_medicationcodeableconcept_system is 'medicationCodeableConcept/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_medicationcodeableconcept_version is 'medicationCodeableConcept/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationadministration.medadm_medicationcodeableconcept_code is 'medicationCodeableConcept/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_medicationcodeableconcept_display is 'medicationCodeableConcept/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationadministration.medadm_medicationcodeableconcept_text is 'medicationCodeableConcept/text (500 x 1 500)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_id is 'supportingInformation/reference (70 x 2 140)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_type is 'supportingInformation/type (30 x 2 60)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_identifier_use is 'supportingInformation/identifier/use (30 x 2 60)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_identifier_type_system is 'supportingInformation/identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_identifier_type_version is 'supportingInformation/identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_identifier_type_code is 'supportingInformation/identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_identifier_type_display is 'supportingInformation/identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_identifier_type_text is 'supportingInformation/identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationadministration.medadm_supportinginformation_display is 'supportingInformation/display (100 x 2 200)'; +comment on column kds2db_in.medicationadministration.medadm_effectivedatetime is 'effectiveDateTime (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_effectiveperiod_start is 'effectivePeriod/start (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_effectiveperiod_end is 'effectivePeriod/end (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_performer_function_system is 'performer/function/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_performer_function_version is 'performer/function/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationadministration.medadm_performer_function_code is 'performer/function/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_performer_function_display is 'performer/function/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationadministration.medadm_performer_function_text is 'performer/function/text (500 x 1 500)'; +comment on column kds2db_in.medicationadministration.medadm_reasoncode_system is 'reasonCode/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationadministration.medadm_reasoncode_version is 'reasonCode/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationadministration.medadm_reasoncode_code is 'reasonCode/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationadministration.medadm_reasoncode_display is 'reasonCode/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationadministration.medadm_reasoncode_text is 'reasonCode/text (500 x 2 1000)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_id is 'reasonReference/reference (70 x 2 140)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_type is 'reasonReference/type (30 x 2 60)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_identifier_use is 'reasonReference/identifier/use (30 x 2 60)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_identifier_type_system is 'reasonReference/identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_identifier_type_version is 'reasonReference/identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_identifier_type_code is 'reasonReference/identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_identifier_type_display is 'reasonReference/identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_identifier_type_text is 'reasonReference/identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationadministration.medadm_reasonreference_display is 'reasonReference/display (100 x 2 200)'; +comment on column kds2db_in.medicationadministration.medadm_request_id is 'request/reference (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column kds2db_in.medicationadministration.medadm_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column kds2db_in.medicationadministration.medadm_note_time is 'note/time (30 x 2 60)'; +comment on column kds2db_in.medicationadministration.medadm_note_text is 'note/text (5000 x 2 10000)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_text is 'dosage/text (100 x 1 100)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_site_system is 'dosage/site/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_site_version is 'dosage/site/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_site_code is 'dosage/site/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_site_display is 'dosage/site/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_site_text is 'dosage/site/text (500 x 1 500)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_route_system is 'dosage/route/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_route_version is 'dosage/route/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_route_code is 'dosage/route/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_route_display is 'dosage/route/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_route_text is 'dosage/route/text (500 x 1 500)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_method_system is 'dosage/method/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_method_version is 'dosage/method/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_method_code is 'dosage/method/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_method_display is 'dosage/method/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_method_text is 'dosage/method/text (500 x 1 500)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_dose_value is 'dosage/dose/value (10 x 1 10)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_dose_unit is 'dosage/dose/unit (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_dose_system is 'dosage/dose/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_dose_code is 'dosage/dose/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_numerator_value is 'dosage/rateRatio/numerator/value (10 x 1 10)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_numerator_comparator is 'dosage/rateRatio/numerator/comparator (10 x 1 10)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_numerator_unit is 'dosage/rateRatio/numerator/unit (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_numerator_system is 'dosage/rateRatio/numerator/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_numerator_code is 'dosage/rateRatio/numerator/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_denominator_value is 'dosage/rateRatio/denominator/value (10 x 1 10)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_denominator_comparator is 'dosage/rateRatio/denominator/comparator (10 x 1 10)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_denominator_unit is 'dosage/rateRatio/denominator/unit (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_denominator_system is 'dosage/rateRatio/denominator/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_rateratio_denominator_code is 'dosage/rateRatio/denominator/code (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_ratequantity_value is 'dosage/rateQuantity/value (10 x 1 10)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_ratequantity_unit is 'dosage/rateQuantity/unit (30 x 1 30)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_ratequantity_system is 'dosage/rateQuantity/system (70 x 1 70)'; +comment on column kds2db_in.medicationadministration.medadm_dosage_ratequantity_code is 'dosage/rateQuantity/code (30 x 1 30)'; + +comment on column kds2db_in.medicationstatement.medstat_id is 'id (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_encounter_id is 'context/reference (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_patient_id is 'subject/reference (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_id is 'basedOn/reference (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_type is 'basedOn/type (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_identifier_use is 'basedOn/identifier/use (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_basedon_display is 'basedOn/display (100 x 2 200)'; +comment on column kds2db_in.medicationstatement.medstat_status is 'status (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_statusreason_system is 'statusReason/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_statusreason_version is 'statusReason/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationstatement.medstat_statusreason_code is 'statusReason/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_statusreason_display is 'statusReason/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_statusreason_text is 'statusReason/text (500 x 1 500)'; +comment on column kds2db_in.medicationstatement.medstat_category_system is 'category/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_category_version is 'category/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationstatement.medstat_category_code is 'category/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_category_display is 'category/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_category_text is 'category/text (500 x 1 500)'; +comment on column kds2db_in.medicationstatement.medstat_medicationreference_id is 'medicationReference/reference (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_medicationcodeableconcept_system is 'medicationCodeableConcept/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_medicationcodeableconcept_version is 'medicationCodeableConcept/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationstatement.medstat_medicationcodeableconcept_code is 'medicationCodeableConcept/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_medicationcodeableconcept_display is 'medicationCodeableConcept/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_medicationcodeableconcept_text is 'medicationCodeableConcept/text (500 x 1 500)'; +comment on column kds2db_in.medicationstatement.medstat_effectivedatetime is 'effectiveDateTime (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_effectiveperiod_start is 'effectivePeriod/start (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_effectiveperiod_end is 'effectivePeriod/end (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_dateasserted is 'dateAsserted (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_id is 'informationSource/reference (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_type is 'informationSource/type (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_identifier_use is 'informationSource/identifier/use (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_identifier_type_system is 'informationSource/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_identifier_type_version is 'informationSource/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_identifier_type_code is 'informationSource/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_identifier_type_display is 'informationSource/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_identifier_type_text is 'informationSource/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.medicationstatement.medstat_informationsource_display is 'informationSource/display (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_id is 'derivedFrom/reference (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_type is 'derivedFrom/type (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_identifier_use is 'derivedFrom/identifier/use (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_identifier_type_system is 'derivedFrom/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_identifier_type_version is 'derivedFrom/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_identifier_type_code is 'derivedFrom/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_identifier_type_display is 'derivedFrom/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_identifier_type_text is 'derivedFrom/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.medicationstatement.medstat_derivedfrom_display is 'derivedFrom/display (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_reasoncode_system is 'reasonCode/coding/system (70 x 1 70)'; +comment on column kds2db_in.medicationstatement.medstat_reasoncode_version is 'reasonCode/coding/version (50 x 1 50)'; +comment on column kds2db_in.medicationstatement.medstat_reasoncode_code is 'reasonCode/coding/code (30 x 1 30)'; +comment on column kds2db_in.medicationstatement.medstat_reasoncode_display is 'reasonCode/coding/display (100 x 1 100)'; +comment on column kds2db_in.medicationstatement.medstat_reasoncode_text is 'reasonCode/text (500 x 1 500)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_id is 'reasonReference/reference (70 x 3 210)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_type is 'reasonReference/type (30 x 3 90)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_identifier_use is 'reasonReference/identifier/use (30 x 3 90)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_identifier_type_system is 'reasonReference/identifier/type/coding/system (70 x 9 630)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_identifier_type_version is 'reasonReference/identifier/type/coding/version (50 x 9 450)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_identifier_type_code is 'reasonReference/identifier/type/coding/code (30 x 9 270)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_identifier_type_display is 'reasonReference/identifier/type/coding/display (100 x 9 900)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_identifier_type_text is 'reasonReference/identifier/type/text (500 x 3 1500)'; +comment on column kds2db_in.medicationstatement.medstat_reasonreference_display is 'reasonReference/display (100 x 3 300)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column kds2db_in.medicationstatement.medstat_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_note_time is 'note/time (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_note_text is 'note/text (5000 x 2 10000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_sequence is 'dosage/sequence (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_text is 'dosage/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_additionalinstruction_system is 'dosage/additionalInstruction/coding/system (70 x 12 840)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_additionalinstruction_version is 'dosage/additionalInstruction/coding/version (50 x 12 600)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_additionalinstruction_code is 'dosage/additionalInstruction/coding/code (30 x 12 360)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_additionalinstruction_display is 'dosage/additionalInstruction/coding/display (100 x 12 1200)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_additionalinstruction_text is 'dosage/additionalInstruction/text (500 x 4 2000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_patientinstruction is 'dosage/patientInstruction (100 x 2 200)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_event is 'dosage/timing/event (30 x 8 240)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsduration_value is 'dosage/timing/repeat/boundsDuration/value (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsduration_comparator is 'dosage/timing/repeat/boundsDuration/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsduration_unit is 'dosage/timing/repeat/boundsDuration/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsduration_system is 'dosage/timing/repeat/boundsDuration/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsduration_code is 'dosage/timing/repeat/boundsDuration/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsrange_low_value is 'dosage/timing/repeat/boundsRange/low/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsrange_low_unit is 'dosage/timing/repeat/boundsRange/low/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsrange_low_system is 'dosage/timing/repeat/boundsRange/low/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsrange_low_code is 'dosage/timing/repeat/boundsRange/low/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsrange_high_value is 'dosage/timing/repeat/boundsRange/high/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsrange_high_unit is 'dosage/timing/repeat/boundsRange/high/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsrange_high_system is 'dosage/timing/repeat/boundsRange/high/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsrange_high_code is 'dosage/timing/repeat/boundsRange/high/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsperiod_start is 'dosage/timing/repeat/boundsPeriod/start (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_boundsperiod_end is 'dosage/timing/repeat/boundsPeriod/end (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_count is 'dosage/timing/repeat/count (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_countmax is 'dosage/timing/repeat/countMax (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_duration is 'dosage/timing/repeat/duration (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_durationmax is 'dosage/timing/repeat/durationMax (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_durationunit is 'dosage/timing/repeat/durationUnit (20 x 2 40)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_frequency is 'dosage/timing/repeat/frequency (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_frequencymax is 'dosage/timing/repeat/frequencyMax (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_period is 'dosage/timing/repeat/period (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_periodmax is 'dosage/timing/repeat/periodMax (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_periodunit is 'dosage/timing/repeat/periodUnit (20 x 2 40)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_dayofweek is 'dosage/timing/repeat/dayOfWeek (10 x 14 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_timeofday is 'dosage/timing/repeat/timeOfDay (20 x 8 160)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_when is 'dosage/timing/repeat/when (20 x 8 160)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_repeat_offset is 'dosage/timing/repeat/offset (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_code_system is 'dosage/timing/code/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_code_version is 'dosage/timing/code/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_code_code is 'dosage/timing/code/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_code_display is 'dosage/timing/code/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_timing_code_text is 'dosage/timing/code/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_asneededboolean is 'dosage/asNeededBoolean (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_asneededcodeableconcept_system is 'dosage/asNeededCodeableConcept/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_asneededcodeableconcept_version is 'dosage/asNeededCodeableConcept/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_asneededcodeableconcept_code is 'dosage/asNeededCodeableConcept/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_asneededcodeableconcept_display is 'dosage/asNeededCodeableConcept/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_asneededcodeableconcept_text is 'dosage/asNeededCodeableConcept/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_site_system is 'dosage/site/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_site_version is 'dosage/site/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_site_code is 'dosage/site/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_site_display is 'dosage/site/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_site_text is 'dosage/site/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_route_system is 'dosage/route/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_route_version is 'dosage/route/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_route_code is 'dosage/route/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_route_display is 'dosage/route/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_route_text is 'dosage/route/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_method_system is 'dosage/method/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_method_version is 'dosage/method/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_method_code is 'dosage/method/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_method_display is 'dosage/method/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_method_text is 'dosage/method/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_type_system is 'dosage/doseAndRate/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_type_version is 'dosage/doseAndRate/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_type_code is 'dosage/doseAndRate/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_type_display is 'dosage/doseAndRate/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_type_text is 'dosage/doseAndRate/type/text (500 x 2 1000)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_doserange_low_value is 'dosage/doseAndRate/doseRange/low/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_doserange_low_unit is 'dosage/doseAndRate/doseRange/low/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_doserange_low_system is 'dosage/doseAndRate/doseRange/low/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_doserange_low_code is 'dosage/doseAndRate/doseRange/low/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_doserange_high_value is 'dosage/doseAndRate/doseRange/high/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_doserange_high_unit is 'dosage/doseAndRate/doseRange/high/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_doserange_high_system is 'dosage/doseAndRate/doseRange/high/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_doserange_high_code is 'dosage/doseAndRate/doseRange/high/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_dosequantity_value is 'dosage/doseAndRate/doseQuantity/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_dosequantity_comparator is 'dosage/doseAndRate/doseQuantity/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_dosequantity_unit is 'dosage/doseAndRate/doseQuantity/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_dosequantity_system is 'dosage/doseAndRate/doseQuantity/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_dosequantity_code is 'dosage/doseAndRate/doseQuantity/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_value is 'dosage/doseAndRate/rateRatio/numerator/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_comparator is 'dosage/doseAndRate/rateRatio/numerator/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_unit is 'dosage/doseAndRate/rateRatio/numerator/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_system is 'dosage/doseAndRate/rateRatio/numerator/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_code is 'dosage/doseAndRate/rateRatio/numerator/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_value is 'dosage/doseAndRate/rateRatio/denominator/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_comparator is 'dosage/doseAndRate/rateRatio/denominator/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_unit is 'dosage/doseAndRate/rateRatio/denominator/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_system is 'dosage/doseAndRate/rateRatio/denominator/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_code is 'dosage/doseAndRate/rateRatio/denominator/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_raterange_low_value is 'dosage/doseAndRate/rateRange/low/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_raterange_low_unit is 'dosage/doseAndRate/rateRange/low/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_raterange_low_system is 'dosage/doseAndRate/rateRange/low/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_raterange_low_code is 'dosage/doseAndRate/rateRange/low/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_raterange_high_value is 'dosage/doseAndRate/rateRange/high/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_raterange_high_unit is 'dosage/doseAndRate/rateRange/high/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_raterange_high_system is 'dosage/doseAndRate/rateRange/high/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_raterange_high_code is 'dosage/doseAndRate/rateRange/high/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_ratequantity_value is 'dosage/doseAndRate/rateQuantity/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_ratequantity_unit is 'dosage/doseAndRate/rateQuantity/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_ratequantity_system is 'dosage/doseAndRate/rateQuantity/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_doseandrate_ratequantity_code is 'dosage/doseAndRate/rateQuantity/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_value is 'dosage/maxDosePerPeriod/numerator/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_comparator is 'dosage/maxDosePerPeriod/numerator/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_unit is 'dosage/maxDosePerPeriod/numerator/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_system is 'dosage/maxDosePerPeriod/numerator/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_code is 'dosage/maxDosePerPeriod/numerator/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_value is 'dosage/maxDosePerPeriod/denominator/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_comparator is 'dosage/maxDosePerPeriod/denominator/comparator (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_unit is 'dosage/maxDosePerPeriod/denominator/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_system is 'dosage/maxDosePerPeriod/denominator/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_code is 'dosage/maxDosePerPeriod/denominator/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperadministration_value is 'dosage/maxDosePerAdministration/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperadministration_unit is 'dosage/maxDosePerAdministration/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperadministration_system is 'dosage/maxDosePerAdministration/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperadministration_code is 'dosage/maxDosePerAdministration/code (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperlifetime_value is 'dosage/maxDosePerLifetime/value (10 x 2 20)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperlifetime_unit is 'dosage/maxDosePerLifetime/unit (30 x 2 60)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperlifetime_system is 'dosage/maxDosePerLifetime/system (70 x 2 140)'; +comment on column kds2db_in.medicationstatement.medstat_dosage_maxdoseperlifetime_code is 'dosage/maxDosePerLifetime/code (30 x 2 60)'; + +comment on column kds2db_in.observation.obs_id is 'id (70 x 1 70)'; +comment on column kds2db_in.observation.obs_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column kds2db_in.observation.obs_patient_id is 'subject/reference (70 x 1 70)'; +comment on column kds2db_in.observation.obs_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column kds2db_in.observation.obs_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.observation.obs_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.observation.obs_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.observation.obs_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.observation.obs_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.observation.obs_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.observation.obs_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.observation.obs_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.observation.obs_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.observation.obs_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.observation.obs_basedon_id is 'basedOn/reference (70 x 1 70)'; +comment on column kds2db_in.observation.obs_basedon_type is 'basedOn/type (30 x 1 30)'; +comment on column kds2db_in.observation.obs_basedon_identifier_use is 'basedOn/identifier/use (30 x 1 30)'; +comment on column kds2db_in.observation.obs_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.observation.obs_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.observation.obs_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.observation.obs_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.observation.obs_basedon_display is 'basedOn/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_status is 'status (30 x 1 30)'; +comment on column kds2db_in.observation.obs_category_system is 'category/coding/system (70 x 1 70)'; +comment on column kds2db_in.observation.obs_category_version is 'category/coding/version (50 x 1 50)'; +comment on column kds2db_in.observation.obs_category_code is 'category/coding/code (30 x 1 30)'; +comment on column kds2db_in.observation.obs_category_display is 'category/coding/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_category_text is 'category/text (500 x 1 500)'; +comment on column kds2db_in.observation.obs_code_system is 'code/coding/system (70 x 1 70)'; +comment on column kds2db_in.observation.obs_code_version is 'code/coding/version (50 x 1 50)'; +comment on column kds2db_in.observation.obs_code_code is 'code/coding/code (30 x 1 30)'; +comment on column kds2db_in.observation.obs_code_display is 'code/coding/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_code_text is 'code/text (500 x 1 500)'; +comment on column kds2db_in.observation.obs_effectivedatetime is 'effectiveDateTime (30 x 1 30)'; +comment on column kds2db_in.observation.obs_issued is 'issued (30 x 1 30)'; +comment on column kds2db_in.observation.obs_valuerange_low_value is 'valueRange/low/value (10 x 2 20)'; +comment on column kds2db_in.observation.obs_valuerange_low_unit is 'valueRange/low/unit (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valuerange_low_system is 'valueRange/low/system (70 x 2 140)'; +comment on column kds2db_in.observation.obs_valuerange_low_code is 'valueRange/low/code (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valuerange_high_value is 'valueRange/high/value (10 x 2 20)'; +comment on column kds2db_in.observation.obs_valuerange_high_unit is 'valueRange/high/unit (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valuerange_high_system is 'valueRange/high/system (70 x 2 140)'; +comment on column kds2db_in.observation.obs_valuerange_high_code is 'valueRange/high/code (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valueratio_numerator_value is 'valueRatio/numerator/value (10 x 2 20)'; +comment on column kds2db_in.observation.obs_valueratio_numerator_comparator is 'valueRatio/numerator/comparator (10 x 2 20)'; +comment on column kds2db_in.observation.obs_valueratio_numerator_unit is 'valueRatio/numerator/unit (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valueratio_numerator_system is 'valueRatio/numerator/system (70 x 2 140)'; +comment on column kds2db_in.observation.obs_valueratio_numerator_code is 'valueRatio/numerator/code (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valueratio_denominator_value is 'valueRatio/denominator/value (10 x 2 20)'; +comment on column kds2db_in.observation.obs_valueratio_denominator_comparator is 'valueRatio/denominator/comparator (10 x 2 20)'; +comment on column kds2db_in.observation.obs_valueratio_denominator_unit is 'valueRatio/denominator/unit (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valueratio_denominator_system is 'valueRatio/denominator/system (70 x 2 140)'; +comment on column kds2db_in.observation.obs_valueratio_denominator_code is 'valueRatio/denominator/code (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valuequantity_value is 'valueQuantity/value (10 x 2 20)'; +comment on column kds2db_in.observation.obs_valuequantity_comparator is 'valueQuantity/comparator (10 x 2 20)'; +comment on column kds2db_in.observation.obs_valuequantity_unit is 'valueQuantity/unit (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valuequantity_system is 'valueQuantity/system (70 x 2 140)'; +comment on column kds2db_in.observation.obs_valuequantity_code is 'valueQuantity/code (30 x 2 60)'; +comment on column kds2db_in.observation.obs_valuecodableconcept_system is 'valueCodableConcept/coding/system (70 x 6 420)'; +comment on column kds2db_in.observation.obs_valuecodableconcept_version is 'valueCodableConcept/coding/version (50 x 6 300)'; +comment on column kds2db_in.observation.obs_valuecodableconcept_code is 'valueCodableConcept/coding/code (30 x 6 180)'; +comment on column kds2db_in.observation.obs_valuecodableconcept_display is 'valueCodableConcept/coding/display (100 x 6 600)'; +comment on column kds2db_in.observation.obs_valuecodableconcept_text is 'valueCodableConcept/text (500 x 2 1000)'; +comment on column kds2db_in.observation.obs_dataabsentreason_system is 'dataAbsentReason/coding/system (70 x 1 70)'; +comment on column kds2db_in.observation.obs_dataabsentreason_version is 'dataAbsentReason/coding/version (50 x 1 50)'; +comment on column kds2db_in.observation.obs_dataabsentreason_code is 'dataAbsentReason/coding/code (30 x 1 30)'; +comment on column kds2db_in.observation.obs_dataabsentreason_display is 'dataAbsentReason/coding/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_dataabsentreason_text is 'dataAbsentReason/text (500 x 1 500)'; +comment on column kds2db_in.observation.obs_note_authorstring is 'note/authorString (50 x 1 50)'; +comment on column kds2db_in.observation.obs_note_authorreference_id is 'note/authorReference/reference (70 x 1 70)'; +comment on column kds2db_in.observation.obs_note_authorreference_type is 'note/authorReference/type (30 x 1 30)'; +comment on column kds2db_in.observation.obs_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 1 30)'; +comment on column kds2db_in.observation.obs_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.observation.obs_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.observation.obs_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.observation.obs_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.observation.obs_note_authorreference_display is 'note/authorReference/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_note_time is 'note/time (30 x 1 30)'; +comment on column kds2db_in.observation.obs_note_text is 'note/text (5000 x 1 5000)'; +comment on column kds2db_in.observation.obs_method_codableconcept is 'method/CodableConcept (100 x 1 100)'; +comment on column kds2db_in.observation.obs_performer_id is 'performer/reference (70 x 1 70)'; +comment on column kds2db_in.observation.obs_performer_type is 'performer/type (30 x 1 30)'; +comment on column kds2db_in.observation.obs_performer_identifier_use is 'performer/identifier/use (30 x 1 30)'; +comment on column kds2db_in.observation.obs_performer_identifier_type_system is 'performer/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.observation.obs_performer_identifier_type_version is 'performer/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.observation.obs_performer_identifier_type_code is 'performer/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.observation.obs_performer_identifier_type_display is 'performer/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_performer_identifier_type_text is 'performer/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.observation.obs_performer_display is 'performer/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_referencerange_low_value is 'referenceRange/low/value (10 x 3 30)'; +comment on column kds2db_in.observation.obs_referencerange_low_unit is 'referenceRange/low/unit (30 x 3 90)'; +comment on column kds2db_in.observation.obs_referencerange_low_system is 'referenceRange/low/system (70 x 3 210)'; +comment on column kds2db_in.observation.obs_referencerange_low_code is 'referenceRange/low/code (30 x 3 90)'; +comment on column kds2db_in.observation.obs_referencerange_high_value is 'referenceRange/high/value (10 x 3 30)'; +comment on column kds2db_in.observation.obs_referencerange_high_unit is 'referenceRange/high/unit (30 x 3 90)'; +comment on column kds2db_in.observation.obs_referencerange_high_system is 'referenceRange/high/system (70 x 3 210)'; +comment on column kds2db_in.observation.obs_referencerange_high_code is 'referenceRange/high/code (30 x 3 90)'; +comment on column kds2db_in.observation.obs_referencerange_type_codableconcept is 'referenceRange/type/CodableConcept (100 x 3 300)'; +comment on column kds2db_in.observation.obs_referencerange_appliesto_system is 'referenceRange/appliesTo/coding/system (70 x 9 630)'; +comment on column kds2db_in.observation.obs_referencerange_appliesto_version is 'referenceRange/appliesTo/coding/version (50 x 9 450)'; +comment on column kds2db_in.observation.obs_referencerange_appliesto_code is 'referenceRange/appliesTo/coding/code (30 x 9 270)'; +comment on column kds2db_in.observation.obs_referencerange_appliesto_display is 'referenceRange/appliesTo/coding/display (100 x 9 900)'; +comment on column kds2db_in.observation.obs_referencerange_appliesto_text is 'referenceRange/appliesTo/text (500 x 3 1500)'; +comment on column kds2db_in.observation.obs_referencerange_age_low_value is 'referenceRange/age/low/value (10 x 3 30)'; +comment on column kds2db_in.observation.obs_referencerange_age_low_unit is 'referenceRange/age/low/unit (30 x 3 90)'; +comment on column kds2db_in.observation.obs_referencerange_age_low_system is 'referenceRange/age/low/system (70 x 3 210)'; +comment on column kds2db_in.observation.obs_referencerange_age_low_code is 'referenceRange/age/low/code (30 x 3 90)'; +comment on column kds2db_in.observation.obs_referencerange_age_high_value is 'referenceRange/age/high/value (10 x 3 30)'; +comment on column kds2db_in.observation.obs_referencerange_age_high_unit is 'referenceRange/age/high/unit (30 x 3 90)'; +comment on column kds2db_in.observation.obs_referencerange_age_high_system is 'referenceRange/age/high/system (70 x 3 210)'; +comment on column kds2db_in.observation.obs_referencerange_age_high_code is 'referenceRange/age/high/code (30 x 3 90)'; +comment on column kds2db_in.observation.obs_referencerange_text is 'referenceRange/text (500 x 1 500)'; +comment on column kds2db_in.observation.obs_hasmember_id is 'hasMember/reference (70 x 1 70)'; +comment on column kds2db_in.observation.obs_hasmember_type is 'hasMember/type (30 x 1 30)'; +comment on column kds2db_in.observation.obs_hasmember_identifier_use is 'hasMember/identifier/use (30 x 1 30)'; +comment on column kds2db_in.observation.obs_hasmember_identifier_type_system is 'hasMember/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.observation.obs_hasmember_identifier_type_version is 'hasMember/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.observation.obs_hasmember_identifier_type_code is 'hasMember/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.observation.obs_hasmember_identifier_type_display is 'hasMember/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.observation.obs_hasmember_identifier_type_text is 'hasMember/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.observation.obs_hasmember_display is 'hasMember/display (100 x 1 100)'; + +comment on column kds2db_in.diagnosticreport.diagrep_id is 'id (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_patient_id is 'subject/reference (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.diagnosticreport.diagrep_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.diagnosticreport.diagrep_result_id is 'result/reference (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_basedon_id is 'basedOn/reference (100 x 1 100)'; +comment on column kds2db_in.diagnosticreport.diagrep_status is 'status (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_category_system is 'category/coding/system (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_category_version is 'category/coding/version (50 x 1 50)'; +comment on column kds2db_in.diagnosticreport.diagrep_category_code is 'category/coding/code (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_category_display is 'category/coding/display (100 x 1 100)'; +comment on column kds2db_in.diagnosticreport.diagrep_category_text is 'category/text (500 x 1 500)'; +comment on column kds2db_in.diagnosticreport.diagrep_code_system is 'code/coding/system (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_code_version is 'code/coding/version (50 x 1 50)'; +comment on column kds2db_in.diagnosticreport.diagrep_code_code is 'code/coding/code (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_code_display is 'code/coding/display (100 x 1 100)'; +comment on column kds2db_in.diagnosticreport.diagrep_code_text is 'code/text (500 x 1 500)'; +comment on column kds2db_in.diagnosticreport.diagrep_effectivedatetime is 'effectiveDateTime (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_issued is 'issued (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_id is 'performer/reference (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_type is 'performer/type (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_identifier_use is 'performer/identifier/use (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_identifier_type_system is 'performer/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_identifier_type_version is 'performer/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_identifier_type_code is 'performer/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_identifier_type_display is 'performer/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_identifier_type_text is 'performer/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.diagnosticreport.diagrep_performer_display is 'performer/display (100 x 1 100)'; +comment on column kds2db_in.diagnosticreport.diagrep_conclusion is 'conclusion (500 x 1 500)'; +comment on column kds2db_in.diagnosticreport.diagrep_conclusioncode_system is 'conclusionCode/coding/system (70 x 1 70)'; +comment on column kds2db_in.diagnosticreport.diagrep_conclusioncode_version is 'conclusionCode/coding/version (50 x 1 50)'; +comment on column kds2db_in.diagnosticreport.diagrep_conclusioncode_code is 'conclusionCode/coding/code (30 x 1 30)'; +comment on column kds2db_in.diagnosticreport.diagrep_conclusioncode_display is 'conclusionCode/coding/display (100 x 1 100)'; +comment on column kds2db_in.diagnosticreport.diagrep_conclusioncode_text is 'conclusionCode/text (500 x 1 500)'; + +comment on column kds2db_in.servicerequest.servreq_id is 'id (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.servicerequest.servreq_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.servicerequest.servreq_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.servicerequest.servreq_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.servicerequest.servreq_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.servicerequest.servreq_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.servicerequest.servreq_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.servicerequest.servreq_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.servicerequest.servreq_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.servicerequest.servreq_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.servicerequest.servreq_basedon_id is 'basedOn/reference (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_basedon_type is 'basedOn/type (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_basedon_identifier_use is 'basedOn/identifier/use (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.servicerequest.servreq_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.servicerequest.servreq_basedon_display is 'basedOn/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_status is 'status (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_intent is 'intent (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_category_system is 'category/coding/system (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_category_version is 'category/coding/version (50 x 1 50)'; +comment on column kds2db_in.servicerequest.servreq_category_code is 'category/coding/code (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_category_display is 'category/coding/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_category_text is 'category/text (500 x 1 500)'; +comment on column kds2db_in.servicerequest.servreq_code_system is 'code/coding/system (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_code_version is 'code/coding/version (50 x 1 50)'; +comment on column kds2db_in.servicerequest.servreq_code_code is 'code/coding/code (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_code_display is 'code/coding/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_code_text is 'code/text (500 x 1 500)'; +comment on column kds2db_in.servicerequest.servreq_authoredon is 'authoredOn (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_requester_id is 'requester/reference (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_requester_type is 'requester/type (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_requester_identifier_use is 'requester/identifier/use (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_requester_identifier_type_system is 'requester/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_requester_identifier_type_version is 'requester/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.servicerequest.servreq_requester_identifier_type_code is 'requester/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_requester_identifier_type_display is 'requester/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_requester_identifier_type_text is 'requester/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.servicerequest.servreq_requester_display is 'requester/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_performer_id is 'performer/reference (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_performer_type is 'performer/type (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_performer_identifier_use is 'performer/identifier/use (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_performer_identifier_type_system is 'performer/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_performer_identifier_type_version is 'performer/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.servicerequest.servreq_performer_identifier_type_code is 'performer/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_performer_identifier_type_display is 'performer/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_performer_identifier_type_text is 'performer/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.servicerequest.servreq_performer_display is 'performer/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_locationcode_system is 'locationCode/coding/system (70 x 1 70)'; +comment on column kds2db_in.servicerequest.servreq_locationcode_version is 'locationCode/coding/version (50 x 1 50)'; +comment on column kds2db_in.servicerequest.servreq_locationcode_code is 'locationCode/coding/code (30 x 1 30)'; +comment on column kds2db_in.servicerequest.servreq_locationcode_display is 'locationCode/coding/display (100 x 1 100)'; +comment on column kds2db_in.servicerequest.servreq_locationcode_text is 'locationCode/text (500 x 1 500)'; + +comment on column kds2db_in.procedure.proc_id is 'id (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_patient_id is 'subject/reference (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.procedure.proc_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.procedure.proc_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.procedure.proc_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.procedure.proc_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.procedure.proc_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.procedure.proc_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.procedure.proc_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.procedure.proc_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.procedure.proc_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.procedure.proc_basedon_id is 'basedOn/reference (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_basedon_type is 'basedOn/type (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_basedon_identifier_use is 'basedOn/identifier/use (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.procedure.proc_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.procedure.proc_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.procedure.proc_basedon_display is 'basedOn/display (100 x 1 100)'; +comment on column kds2db_in.procedure.proc_status is 'status (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_statusreason_system is 'statusReason/coding/system (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_statusreason_version is 'statusReason/coding/version (50 x 1 50)'; +comment on column kds2db_in.procedure.proc_statusreason_code is 'statusReason/coding/code (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_statusreason_display is 'statusReason/coding/display (100 x 1 100)'; +comment on column kds2db_in.procedure.proc_statusreason_text is 'statusReason/text (500 x 1 500)'; +comment on column kds2db_in.procedure.proc_category_system is 'category/coding/system (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_category_version is 'category/coding/version (50 x 1 50)'; +comment on column kds2db_in.procedure.proc_category_code is 'category/coding/code (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_category_display is 'category/coding/display (100 x 1 100)'; +comment on column kds2db_in.procedure.proc_category_text is 'category/text (500 x 1 500)'; +comment on column kds2db_in.procedure.proc_code_system is 'code/coding/system (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_code_version is 'code/coding/version (50 x 1 50)'; +comment on column kds2db_in.procedure.proc_code_code is 'code/coding/code (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_code_display is 'code/coding/display (100 x 1 100)'; +comment on column kds2db_in.procedure.proc_code_text is 'code/text (500 x 1 500)'; +comment on column kds2db_in.procedure.proc_performeddatetime is 'performedDateTime (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_performedperiod_start is 'performedPeriod/start (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_performedperiod_end is 'performedPeriod/end (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_reasoncode_system is 'reasonCode/coding/system (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_reasoncode_version is 'reasonCode/coding/version (50 x 1 50)'; +comment on column kds2db_in.procedure.proc_reasoncode_code is 'reasonCode/coding/code (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_reasoncode_display is 'reasonCode/coding/display (100 x 1 100)'; +comment on column kds2db_in.procedure.proc_reasoncode_text is 'reasonCode/text (500 x 1 500)'; +comment on column kds2db_in.procedure.proc_reasonreference_id is 'reasonReference/reference (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_reasonreference_type is 'reasonReference/type (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_reasonreference_identifier_use is 'reasonReference/identifier/use (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_reasonreference_identifier_type_system is 'reasonReference/identifier/type/coding/system (70 x 1 70)'; +comment on column kds2db_in.procedure.proc_reasonreference_identifier_type_version is 'reasonReference/identifier/type/coding/version (50 x 1 50)'; +comment on column kds2db_in.procedure.proc_reasonreference_identifier_type_code is 'reasonReference/identifier/type/coding/code (30 x 1 30)'; +comment on column kds2db_in.procedure.proc_reasonreference_identifier_type_display is 'reasonReference/identifier/type/coding/display (100 x 1 100)'; +comment on column kds2db_in.procedure.proc_reasonreference_identifier_type_text is 'reasonReference/identifier/type/text (500 x 1 500)'; +comment on column kds2db_in.procedure.proc_reasonreference_display is 'reasonReference/display (100 x 1 100)'; +comment on column kds2db_in.procedure.proc_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column kds2db_in.procedure.proc_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column kds2db_in.procedure.proc_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column kds2db_in.procedure.proc_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column kds2db_in.procedure.proc_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column kds2db_in.procedure.proc_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column kds2db_in.procedure.proc_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column kds2db_in.procedure.proc_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column kds2db_in.procedure.proc_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column kds2db_in.procedure.proc_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column kds2db_in.procedure.proc_note_time is 'note/time (30 x 2 60)'; +comment on column kds2db_in.procedure.proc_note_text is 'note/text (5000 x 2 10000)'; + +comment on column kds2db_in.consent.cons_id is 'id (70 x 1 70)'; +comment on column kds2db_in.consent.cons_patient_id is 'patient/reference (70 x 1 70)'; +comment on column kds2db_in.consent.cons_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.consent.cons_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.consent.cons_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.consent.cons_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.consent.cons_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.consent.cons_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.consent.cons_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.consent.cons_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.consent.cons_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.consent.cons_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.consent.cons_status is 'status (30 x 1 30)'; +comment on column kds2db_in.consent.cons_scope_system is 'scope/coding/system (70 x 1 70)'; +comment on column kds2db_in.consent.cons_scope_version is 'scope/coding/version (50 x 1 50)'; +comment on column kds2db_in.consent.cons_scope_code is 'scope/coding/code (30 x 1 30)'; +comment on column kds2db_in.consent.cons_scope_display is 'scope/coding/display (100 x 1 100)'; +comment on column kds2db_in.consent.cons_scope_text is 'scope/text (500 x 1 500)'; +comment on column kds2db_in.consent.cons_datetime is 'dateTime (30 x 1 30)'; +comment on column kds2db_in.consent.cons_provision_type is 'provision/type (10 x 1 10)'; +comment on column kds2db_in.consent.cons_provision_period_start is 'provision/period/start (30 x 1 30)'; +comment on column kds2db_in.consent.cons_provision_period_end is 'provision/period/end (30 x 1 30)'; +comment on column kds2db_in.consent.cons_provision_actor_role_system is 'provision/actor/role/coding/system (70 x 1 70)'; +comment on column kds2db_in.consent.cons_provision_actor_role_version is 'provision/actor/role/coding/version (50 x 1 50)'; +comment on column kds2db_in.consent.cons_provision_actor_role_code is 'provision/actor/role/coding/code (30 x 1 30)'; +comment on column kds2db_in.consent.cons_provision_actor_role_display is 'provision/actor/role/coding/display (100 x 1 100)'; +comment on column kds2db_in.consent.cons_provision_actor_role_text is 'provision/actor/role/text (500 x 1 500)'; +comment on column kds2db_in.consent.cons_provision_code_system is 'provision/code/coding/system (70 x 1 70)'; +comment on column kds2db_in.consent.cons_provision_code_version is 'provision/code/coding/version (50 x 1 50)'; +comment on column kds2db_in.consent.cons_provision_code_code is 'provision/code/coding/code (30 x 1 30)'; +comment on column kds2db_in.consent.cons_provision_code_display is 'provision/code/coding/display (100 x 1 100)'; +comment on column kds2db_in.consent.cons_provision_code_text is 'provision/code/text (500 x 1 500)'; +comment on column kds2db_in.consent.cons_provision_dataperiod_start is 'provision/dataPeriod/start (30 x 1 30)'; +comment on column kds2db_in.consent.cons_provision_dataperiod_end is 'provision/dataPeriod/end (30 x 1 30)'; + +comment on column kds2db_in.location.loc_id is 'id (70 x 1 70)'; +comment on column kds2db_in.location.loc_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column kds2db_in.location.loc_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column kds2db_in.location.loc_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column kds2db_in.location.loc_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column kds2db_in.location.loc_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column kds2db_in.location.loc_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column kds2db_in.location.loc_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column kds2db_in.location.loc_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column kds2db_in.location.loc_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column kds2db_in.location.loc_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column kds2db_in.location.loc_status is 'status (30 x 1 30)'; +comment on column kds2db_in.location.loc_name is 'name (50 x 1 50)'; +comment on column kds2db_in.location.loc_description is 'description (50 x 1 50)'; +comment on column kds2db_in.location.loc_alias is 'alias (30 x 3 90)'; --Create SQL Table in Schema db CREATE TABLE IF NOT EXISTS db.encounter ( encounter_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität -enc_id varchar (70), -- id (70 x 1 varchar)" -enc_pat_id varchar (70), -- subject/reference (70 x 1 varchar) +enc_id varchar (70), -- id (70 x 1 varchar) +enc_patient_id varchar (70), -- subject/reference (70 x 1 varchar) enc_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) -enc_identifier_use varchar (90), -- identifier/use (30 x 3 varchar) -enc_identifier_type_system varchar (210), -- identifier/type/coding/system (70 x 3 varchar) -enc_identifier_type_version varchar (150), -- identifier/type/coding/version (50 x 3 varchar) -enc_identifier_type_code varchar (90), -- identifier/type/coding/code (30 x 3 varchar) -enc_identifier_type_display varchar (300), -- identifier/type/coding/display (100 x 3 varchar) -enc_identifier_type_text varchar (1500), -- identifier/type/text (500 x 3 varchar) -enc_identifier_system varchar (210), -- identifier/system (70 x 3 varchar) -enc_identifier_value varchar (150), -- identifier/value (50 x 3 varchar) -enc_identifier_period_start varchar (90), -- identifier/period/start (30 x 3 varchar) -enc_identifier_period_end varchar (90), -- identifier/period/end (30 x 3 varchar) -enc_identifier_assigner_id varchar (150), -- identifier/assigner/reference (50 x 3 varchar) -enc_identifier_assigner_type varchar (90), -- identifier/assigner/type (30 x 3 varchar) -enc_identifier_assigner_identifier_type_use varchar (60), -- identifier/assigner/identifier/use (20 x 3 varchar) -enc_identifier_assigner_identifier_type_system varchar (210), -- identifier/assigner/identifier/type/coding/system (70 x 3 varchar) -enc_identifier_assigner_identifier_type_version varchar (90), -- identifier/assigner/identifier/type/coding/version (30 x 3 varchar) -enc_identifier_assigner_identifier_type_code varchar (90), -- identifier/assigner/identifier/type/coding/code (30 x 3 varchar) -enc_identifier_assigner_identifier_type_display varchar (300), -- identifier/assigner/identifier/type/coding/display (100 x 3 varchar) -enc_identifier_assigner_identifier_type_text varchar (1500), -- identifier/assigner/identifier/type/text (500 x 3 varchar) -enc_identifier_assigner_identifier_system varchar (150), -- identifier/assigner/identifier/system (50 x 3 varchar) -enc_identifier_assigner_identifier_value varchar (300), -- identifier/assigner/identifier/value (100 x 3 varchar) -enc_identifier_assigner_identifier_period_start varchar (90), -- identifier/assigner/identifier/period/start (30 x 3 varchar) -enc_identifier_assigner_identifier_period_end varchar (90), -- identifier/assigner/identifier/period/end (30 x 3 varchar) -enc_status varchar (20), -- status (20 x 1 varchar) -enc_class_system varchar (70), -- class/system (70 x 1 varchar) -enc_class_version varchar (30), -- class/version (30 x 1 varchar) -enc_class_code varchar (30), -- class/code (30 x 1 varchar) -enc_class_display varchar (100), -- class/display (100 x 1 varchar) -enc_type_system varchar (700), -- type/coding/system (70 x 10 varchar) -enc_type_version varchar (300), -- type/coding/version (30 x 10 varchar) -enc_type_code varchar (300), -- type/coding/code (30 x 10 varchar) -enc_type_display varchar (500), -- type/coding/display (50 x 10 varchar) -enc_type_text varchar (3000), -- type/text (300 x 10 varchar) -enc_servicetype_system varchar (210), -- serviceType/coding/system (70 x 3 varchar) -enc_servicetype_version varchar (90), -- serviceType/coding/version (30 x 3 varchar) -enc_servicetype_code varchar (90), -- serviceType/coding/code (30 x 3 varchar) -enc_servicetype_display varchar (300), -- serviceType/coding/display (100 x 3 varchar) +enc_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +enc_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +enc_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +enc_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +enc_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +enc_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +enc_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +enc_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +enc_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +enc_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +enc_status varchar (30), -- status (30 x 1 varchar) +enc_class_system varchar (70), -- class/coding/system (70 x 1 varchar) +enc_class_version varchar (50), -- class/coding/version (50 x 1 varchar) +enc_class_code varchar (30), -- class/coding/code (30 x 1 varchar) +enc_class_display varchar (100), -- class/coding/display (100 x 1 varchar) +enc_type_system varchar (630), -- type/coding/system (70 x 9 varchar) +enc_type_version varchar (450), -- type/coding/version (50 x 9 varchar) +enc_type_code varchar (270), -- type/coding/code (30 x 9 varchar) +enc_type_display varchar (900), -- type/coding/display (100 x 9 varchar) +enc_type_text varchar (1500), -- type/text (500 x 3 varchar) +enc_servicetype_system varchar (70), -- serviceType/coding/system (70 x 1 varchar) +enc_servicetype_version varchar (50), -- serviceType/coding/version (50 x 1 varchar) +enc_servicetype_code varchar (30), -- serviceType/coding/code (30 x 1 varchar) +enc_servicetype_display varchar (100), -- serviceType/coding/display (100 x 1 varchar) +enc_servicetype_text varchar (500), -- serviceType/text (500 x 1 varchar) enc_period_start varchar (30), -- period/start (30 x 1 varchar) enc_period_end varchar (30), -- period/end (30 x 1 varchar) -enc_diagnosis_condition_id varchar (1050), -- diagnosis/condition/reference (70 x 15 varchar) -enc_diagnosis_use_system varchar (1050), -- diagnosis/use/coding/system (70 x 15 varchar) -enc_diagnosis_use_version varchar (450), -- diagnosis/use/coding/version (30 x 15 varchar) -enc_diagnosis_use_code varchar (450), -- diagnosis/use/coding/code (30 x 15 varchar) -enc_diagnosis_use_display varchar (1500), -- diagnosis/use/coding/display (100 x 15 varchar) -enc_diagnosis_use_text varchar (7500), -- diagnosis/use/text (500 x 15 varchar) -enc_diagnosis_rank varchar (75), -- diagnosis/rank (5 x 15 varchar) -enc_hospitalization_admitsource_system varchar (140), -- hospitalization/admitSource/coding/system (70 x 2 varchar) -enc_hospitalization_admitsource_version varchar (60), -- hospitalization/admitSource/coding/version (30 x 2 varchar) -enc_hospitalization_admitsource_code varchar (60), -- hospitalization/admitSource/coding/code (30 x 2 varchar) -enc_hospitalization_admitsource_display varchar (200), -- hospitalization/admitSource/coding/display (100 x 2 varchar) -enc_hospitalization_admitsource_text varchar (1000), -- hospitalization/admitSource/text (500 x 2 varchar) -enc_hospitalization_dischargedisposition_system varchar (140), -- hospitalization/dischargeDisposition/coding/system (70 x 2 varchar) -enc_hospitalization_dischargedisposition_version varchar (60), -- hospitalization/dischargeDisposition/coding/version (30 x 2 varchar) -enc_hospitalization_dischargedisposition_code varchar (60), -- hospitalization/dischargeDisposition/coding/code (30 x 2 varchar) -enc_hospitalization_dischargedisposition_display varchar (200), -- hospitalization/dischargeDisposition/coding/display (100 x 2 varchar) -enc_hospitalization_dischargedisposition_text varchar (1000), -- hospitalization/dischargeDisposition/text (500 x 2 varchar) -enc_location_id varchar (210), -- location/location/reference (70 x 3 varchar) -enc_location_type varchar (150), -- location/location/type (50 x 3 varchar) -enc_location_identifier_type_use varchar (90), -- location/location/identifier/use (30 x 3 varchar) -enc_location_identifier_type_system varchar (210), -- location/location/identifier/type/coding/system (70 x 3 varchar) -enc_location_identifier_type_version varchar (150), -- location/location/identifier/type/coding/version (50 x 3 varchar) -enc_location_identifier_type_code varchar (90), -- location/location/identifier/type/coding/code (30 x 3 varchar) -enc_location_identifier_type_display varchar (300), -- location/location/identifier/type/coding/display (100 x 3 varchar) -enc_location_identifier_type_text varchar (1500), -- location/location/identifier/type/text (500 x 3 varchar) -enc_location_identifier_system varchar (210), -- location/location/identifier/system (70 x 3 varchar) -enc_location_identifier_value varchar (150), -- location/location/identifier/value (50 x 3 varchar) -enc_location_identifier_period_start varchar (90), -- location/location/identifier/period/start (30 x 3 varchar) -enc_location_identifier_period_end varchar (90), -- location/location/identifier/period/end (30 x 3 varchar) -enc_location_display varchar (150), -- location/location/display (50 x 3 varchar) -enc_location_physicaltype_system varchar (210), -- location/location/physicalType/coding/system (70 x 3 varchar) -enc_location_physicaltype_version varchar (90), -- location/location/physicalType/coding/version (30 x 3 varchar) -enc_location_physicaltype_code varchar (150), -- location/location/physicalType/coding/code (50 x 3 varchar) -enc_location_physicaltype_display varchar (300), -- location/location/physicalType/coding/display (100 x 3 varchar) -enc_location_physicaltype_text varchar (1500), -- location/location/physicalType/text (500 x 3 varchar) +enc_diagnosis_condition_id varchar (490), -- diagnosis/condition/reference (70 x 7 varchar) +enc_diagnosis_use_system varchar (1470), -- diagnosis/use/coding/system (70 x 21 varchar) +enc_diagnosis_use_version varchar (1050), -- diagnosis/use/coding/version (50 x 21 varchar) +enc_diagnosis_use_code varchar (630), -- diagnosis/use/coding/code (30 x 21 varchar) +enc_diagnosis_use_display varchar (2100), -- diagnosis/use/coding/display (100 x 21 varchar) +enc_diagnosis_use_text varchar (3500), -- diagnosis/use/text (500 x 7 varchar) +enc_diagnosis_rank varchar (14), -- diagnosis/rank (2 x 7 varchar) +enc_hospitalization_admitsource_system varchar (70), -- hospitalization/admitSource/coding/system (70 x 1 varchar) +enc_hospitalization_admitsource_version varchar (50), -- hospitalization/admitSource/coding/version (50 x 1 varchar) +enc_hospitalization_admitsource_code varchar (30), -- hospitalization/admitSource/coding/code (30 x 1 varchar) +enc_hospitalization_admitsource_display varchar (100), -- hospitalization/admitSource/coding/display (100 x 1 varchar) +enc_hospitalization_admitsource_text varchar (500), -- hospitalization/admitSource/text (500 x 1 varchar) +enc_hospitalization_dischargedisposition_system varchar (70), -- hospitalization/dischargeDisposition/coding/system (70 x 1 varchar) +enc_hospitalization_dischargedisposition_version varchar (50), -- hospitalization/dischargeDisposition/coding/version (50 x 1 varchar) +enc_hospitalization_dischargedisposition_code varchar (30), -- hospitalization/dischargeDisposition/coding/code (30 x 1 varchar) +enc_hospitalization_dischargedisposition_display varchar (100), -- hospitalization/dischargeDisposition/coding/display (100 x 1 varchar) +enc_hospitalization_dischargedisposition_text varchar (500), -- hospitalization/dischargeDisposition/text (500 x 1 varchar) +enc_location_id varchar (140), -- location/location/reference (70 x 2 varchar) +enc_location_type varchar (60), -- location/location/type (30 x 2 varchar) +enc_location_identifier_use varchar (60), -- location/location/identifier/use (30 x 2 varchar) +enc_location_identifier_type_system varchar (420), -- location/location/identifier/type/coding/system (70 x 6 varchar) +enc_location_identifier_type_version varchar (300), -- location/location/identifier/type/coding/version (50 x 6 varchar) +enc_location_identifier_type_code varchar (180), -- location/location/identifier/type/coding/code (30 x 6 varchar) +enc_location_identifier_type_display varchar (600), -- location/location/identifier/type/coding/display (100 x 6 varchar) +enc_location_identifier_type_text varchar (1000), -- location/location/identifier/type/text (500 x 2 varchar) +enc_location_display varchar (200), -- location/location/display (100 x 2 varchar) +enc_location_status varchar (20), -- location/location/status (10 x 2 varchar) +enc_location_physicaltype_system varchar (420), -- location/location/physicalType/coding/system (70 x 6 varchar) +enc_location_physicaltype_version varchar (300), -- location/location/physicalType/coding/version (50 x 6 varchar) +enc_location_physicaltype_code varchar (180), -- location/location/physicalType/coding/code (30 x 6 varchar) +enc_location_physicaltype_display varchar (600), -- location/location/physicalType/coding/display (100 x 6 varchar) +enc_location_physicaltype_text varchar (1000), -- location/location/physicalType/text (500 x 2 varchar) enc_serviceprovider_id varchar (70), -- serviceProvider/reference (70 x 1 varchar) -enc_serviceprovider_type varchar (500), -- serviceProvider/type (500 x 1 varchar) -enc_serviceprovider_identifier_type_use varchar (50), -- serviceProvider/identifier/use (50 x 1 varchar) +enc_serviceprovider_type varchar (30), -- serviceProvider/type (30 x 1 varchar) +enc_serviceprovider_identifier_use varchar (30), -- serviceProvider/identifier/use (30 x 1 varchar) enc_serviceprovider_identifier_type_system varchar (70), -- serviceProvider/identifier/type/coding/system (70 x 1 varchar) -enc_serviceprovider_identifier_type_version varchar (30), -- serviceProvider/identifier/type/coding/version (30 x 1 varchar) +enc_serviceprovider_identifier_type_version varchar (50), -- serviceProvider/identifier/type/coding/version (50 x 1 varchar) enc_serviceprovider_identifier_type_code varchar (30), -- serviceProvider/identifier/type/coding/code (30 x 1 varchar) enc_serviceprovider_identifier_type_display varchar (100), -- serviceProvider/identifier/type/coding/display (100 x 1 varchar) enc_serviceprovider_identifier_type_text varchar (500), -- serviceProvider/identifier/type/text (500 x 1 varchar) -enc_serviceprovider_identifier_system varchar (100), -- serviceProvider/identifier/system (100 x 1 varchar) -enc_serviceprovider_identifier_value varchar (50), -- serviceProvider/identifier/value (50 x 1 varchar) -enc_serviceprovider_identifier_period_start varchar (30), -- serviceProvider/identifier/period/start (30 x 1 varchar) -enc_serviceprovider_identifier_period_end varchar (30), -- serviceProvider/identifier/period/end (30 x 1 varchar) enc_serviceprovider_display varchar (100), -- serviceProvider/display (100 x 1 varchar) input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde @@ -415,18 +2830,1151 @@ current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Da CREATE TABLE IF NOT EXISTS db.patient ( patient_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität pat_id varchar (70), -- id (70 x 1 varchar) -pat_identifier_value varchar (150), -- identifier/value (50 x 3 varchar) -pat_identifier_system varchar (210), -- identifier/system (70 x 3 varchar) -pat_identifier_type_system varchar (210), -- identifier/type/coding/system (70 x 3 varchar) -pat_identifier_type_version varchar (150), -- identifier/type/coding/version (50 x 3 varchar) -pat_identifier_type_code varchar (150), -- identifier/type/coding/code (50 x 3 varchar) -pat_identifier_type_display varchar (300), -- identifier/type/coding/display (100 x 3 varchar) -pat_identifier_type_text varchar (1500), -- identifier/type/text (500 x 3 varchar) -pat_name_given varchar (100), -- name/given (100 x 1 varchar) -pat_name_family varchar (50), -- name/family (50 x 1 varchar) +pat_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +pat_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +pat_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +pat_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +pat_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +pat_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +pat_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +pat_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +pat_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +pat_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +pat_name_given varchar (100), -- name/given (50 x 2 varchar) +pat_name_family varchar (100), -- name/family (50 x 2 varchar) pat_gender varchar (10), -- gender (10 x 1 varchar) pat_birthdate varchar (30), -- birthDate (30 x 1 varchar) -pat_adress_postalcode varchar (10), -- address/postalCode (10 x 1 varchar) +pat_address_postalcode varchar (30), -- address/postalCode (10 x 3 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.condition ( +condition_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +con_id varchar (70), -- id (70 x 1 varchar) +con_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +con_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +con_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +con_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +con_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +con_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +con_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +con_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +con_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +con_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +con_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +con_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +con_clinicalstatus_system varchar (70), -- clinicalStatus/coding/system (70 x 1 varchar) +con_clinicalstatus_version varchar (50), -- clinicalStatus/coding/version (50 x 1 varchar) +con_clinicalstatus_code varchar (30), -- clinicalStatus/coding/code (30 x 1 varchar) +con_clinicalstatus_display varchar (100), -- clinicalStatus/coding/display (100 x 1 varchar) +con_clinicalstatus_text varchar (500), -- clinicalStatus/text (500 x 1 varchar) +con_verificationstatus_system varchar (70), -- verificationStatus/coding/system (70 x 1 varchar) +con_verificationstatus_version varchar (50), -- verificationStatus/coding/version (50 x 1 varchar) +con_verificationstatus_code varchar (30), -- verificationStatus/coding/code (30 x 1 varchar) +con_verificationstatus_display varchar (100), -- verificationStatus/coding/display (100 x 1 varchar) +con_verificationstatus_text varchar (500), -- verificationStatus/text (500 x 1 varchar) +con_category_system varchar (420), -- category/coding/system (70 x 6 varchar) +con_category_version varchar (300), -- category/coding/version (50 x 6 varchar) +con_category_code varchar (180), -- category/coding/code (30 x 6 varchar) +con_category_display varchar (600), -- category/coding/display (100 x 6 varchar) +con_category_text varchar (1000), -- category/text (500 x 2 varchar) +con_severity_system varchar (70), -- severity/coding/system (70 x 1 varchar) +con_severity_version varchar (50), -- severity/coding/version (50 x 1 varchar) +con_severity_code varchar (30), -- severity/coding/code (30 x 1 varchar) +con_severity_display varchar (100), -- severity/coding/display (100 x 1 varchar) +con_severity_text varchar (500), -- severity/text (500 x 1 varchar) +con_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +con_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +con_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +con_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +con_code_text varchar (500), -- code/text (500 x 1 varchar) +con_bodysite_system varchar (630), -- bodySite/coding/system (70 x 9 varchar) +con_bodysite_version varchar (450), -- bodySite/coding/version (50 x 9 varchar) +con_bodysite_code varchar (270), -- bodySite/coding/code (30 x 9 varchar) +con_bodysite_display varchar (900), -- bodySite/coding/display (100 x 9 varchar) +con_bodysite_text varchar (1500), -- bodySite/text (500 x 3 varchar) +con_onsetperiod_start varchar (30), -- onsetPeriod/start (30 x 1 varchar) +con_onsetperiod_end varchar (30), -- onsetPeriod/end (30 x 1 varchar) +con_onsetdatetime varchar (30), -- onsetDateTime (30 x 1 varchar) +con_abatementdatetime varchar (30), -- abatementDateTime (30 x 1 varchar) +con_abatementage_value varchar (10), -- abatementAge/value (10 x 1 varchar) +con_abatementage_comparator varchar (3), -- abatementAge/comparator (3 x 1 varchar) +con_abatementage_unit varchar (30), -- abatementAge/unit (30 x 1 varchar) +con_abatementage_system varchar (70), -- abatementAge/system (70 x 1 varchar) +con_abatementage_code varchar (30), -- abatementAge/code (30 x 1 varchar) +con_abatementperiod_start varchar (30), -- abatementPeriod/start (30 x 1 varchar) +con_abatementperiod_end varchar (30), -- abatementPeriod/end (30 x 1 varchar) +con_abatementrange_low_value varchar (10), -- abatementRange/low/value (10 x 1 varchar) +con_abatementrange_low_unit varchar (30), -- abatementRange/low/unit (30 x 1 varchar) +con_abatementrange_low_system varchar (70), -- abatementRange/low/system (70 x 1 varchar) +con_abatementrange_low_code varchar (30), -- abatementRange/low/code (30 x 1 varchar) +con_abatementrange_high_value varchar (10), -- abatementRange/high/value (10 x 1 varchar) +con_abatementrange_high_unit varchar (30), -- abatementRange/high/unit (30 x 1 varchar) +con_abatementrange_high_system varchar (70), -- abatementRange/high/system (70 x 1 varchar) +con_abatementrange_high_code varchar (30), -- abatementRange/high/code (30 x 1 varchar) +con_abatementstring varchar (300), -- abatementString (300 x 1 varchar) +con_recordeddate varchar (30), -- recordedDate (30 x 1 varchar) +con_recorder_id varchar (70), -- recorder/reference (70 x 1 varchar) +con_recorder_type varchar (30), -- recorder/type (30 x 1 varchar) +con_recorder_identifier_use varchar (30), -- recorder/identifier/use (30 x 1 varchar) +con_recorder_identifier_type_system varchar (70), -- recorder/identifier/type/coding/system (70 x 1 varchar) +con_recorder_identifier_type_version varchar (50), -- recorder/identifier/type/coding/version (50 x 1 varchar) +con_recorder_identifier_type_code varchar (30), -- recorder/identifier/type/coding/code (30 x 1 varchar) +con_recorder_identifier_type_display varchar (100), -- recorder/identifier/type/coding/display (100 x 1 varchar) +con_recorder_identifier_type_text varchar (500), -- recorder/identifier/type/text (500 x 1 varchar) +con_recorder_display varchar (100), -- recorder/display (100 x 1 varchar) +con_asserter_id varchar (70), -- asserter/reference (70 x 1 varchar) +con_asserter_type varchar (30), -- asserter/type (30 x 1 varchar) +con_asserter_identifier_use varchar (30), -- asserter/identifier/use (30 x 1 varchar) +con_asserter_identifier_type_system varchar (70), -- asserter/identifier/type/coding/system (70 x 1 varchar) +con_asserter_identifier_type_version varchar (50), -- asserter/identifier/type/coding/version (50 x 1 varchar) +con_asserter_identifier_type_code varchar (30), -- asserter/identifier/type/coding/code (30 x 1 varchar) +con_asserter_identifier_type_display varchar (100), -- asserter/identifier/type/coding/display (100 x 1 varchar) +con_asserter_identifier_type_text varchar (500), -- asserter/identifier/type/text (500 x 1 varchar) +con_asserter_display varchar (100), -- asserter/display (100 x 1 varchar) +con_stage_summary_system varchar (420), -- stage/summary/coding/system (70 x 6 varchar) +con_stage_summary_version varchar (300), -- stage/summary/coding/version (50 x 6 varchar) +con_stage_summary_code varchar (180), -- stage/summary/coding/code (30 x 6 varchar) +con_stage_summary_display varchar (600), -- stage/summary/coding/display (100 x 6 varchar) +con_stage_summary_text varchar (1000), -- stage/summary/text (500 x 2 varchar) +con_stage_assessment_id varchar (280), -- stage/assessment/reference (70 x 4 varchar) +con_stage_assessment_type varchar (120), -- stage/assessment/type (30 x 4 varchar) +con_stage_assessment_identifier_use varchar (120), -- stage/assessment/identifier/use (30 x 4 varchar) +con_stage_assessment_identifier_type_system varchar (840), -- stage/assessment/identifier/type/coding/system (70 x 12 varchar) +con_stage_assessment_identifier_type_version varchar (600), -- stage/assessment/identifier/type/coding/version (50 x 12 varchar) +con_stage_assessment_identifier_type_code varchar (360), -- stage/assessment/identifier/type/coding/code (30 x 12 varchar) +con_stage_assessment_identifier_type_display varchar (1200), -- stage/assessment/identifier/type/coding/display (100 x 12 varchar) +con_stage_assessment_identifier_type_text varchar (2000), -- stage/assessment/identifier/type/text (500 x 4 varchar) +con_stage_assessment_display varchar (400), -- stage/assessment/display (100 x 4 varchar) +con_stage_type_system varchar (420), -- stage/type/coding/system (70 x 6 varchar) +con_stage_type_version varchar (300), -- stage/type/coding/version (50 x 6 varchar) +con_stage_type_code varchar (180), -- stage/type/coding/code (30 x 6 varchar) +con_stage_type_display varchar (600), -- stage/type/coding/display (100 x 6 varchar) +con_stage_type_text varchar (1000), -- stage/type/text (500 x 2 varchar) +con_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +con_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +con_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +con_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +con_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +con_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +con_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +con_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +con_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +con_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +con_note_time varchar (60), -- note/time (30 x 2 varchar) +con_note_text varchar (10000), -- note/text (5000 x 2 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.medication ( +medication_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +med_id varchar (70), -- id (70 x 1 varchar) +med_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +med_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +med_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +med_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +med_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +med_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +med_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +med_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +med_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +med_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +med_code_system varchar (1000), -- code/coding/system (70 x 1 varchar) +med_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +med_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +med_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +med_code_text varchar (500), -- code/text (500 x 1 varchar) +med_status varchar (20), -- status (20 x 1 varchar) +med_form_system varchar (70), -- form/coding/system (70 x 1 varchar) +med_form_version varchar (50), -- form/coding/version (50 x 1 varchar) +med_form_code varchar (30), -- form/coding/code (30 x 1 varchar) +med_form_display varchar (100), -- form/coding/display (100 x 1 varchar) +med_form_text varchar (500), -- form/text (500 x 1 varchar) +med_amount_numerator_value varchar (10), -- amount/numerator/value (10 x 1 varchar) +med_amount_numerator_comparator varchar (10), -- amount/numerator/comparator (10 x 1 varchar) +med_amount_numerator_unit varchar (30), -- amount/numerator/unit (30 x 1 varchar) +med_amount_numerator_system varchar (70), -- amount/numerator/system (70 x 1 varchar) +med_amount_numerator_code varchar (30), -- amount/numerator/code (30 x 1 varchar) +med_amount_denominator_value varchar (10), -- amount/denominator/value (10 x 1 varchar) +med_amount_denominator_comparator varchar (10), -- amount/denominator/comparator (10 x 1 varchar) +med_amount_denominator_unit varchar (30), -- amount/denominator/unit (30 x 1 varchar) +med_amount_denominator_system varchar (70), -- amount/denominator/system (70 x 1 varchar) +med_amount_denominator_code varchar (30), -- amount/denominator/code (30 x 1 varchar) +med_ingredient_strength_numerator_value varchar (150), -- ingredient/strength/numerator/value (10 x 15 varchar) +med_ingredient_strength_numerator_comparator varchar (150), -- ingredient/strength/numerator/comparator (10 x 15 varchar) +med_ingredient_strength_numerator_unit varchar (450), -- ingredient/strength/numerator/unit (30 x 15 varchar) +med_ingredient_strength_numerator_system varchar (1050), -- ingredient/strength/numerator/system (70 x 15 varchar) +med_ingredient_strength_numerator_code varchar (450), -- ingredient/strength/numerator/code (30 x 15 varchar) +med_ingredient_strength_denominator_value varchar (150), -- ingredient/strength/denominator/value (10 x 15 varchar) +med_ingredient_strength_denominator_comparator varchar (150), -- ingredient/strength/denominator/comparator (10 x 15 varchar) +med_ingredient_strength_denominator_unit varchar (450), -- ingredient/strength/denominator/unit (30 x 15 varchar) +med_ingredient_strength_denominator_system varchar (1050), -- ingredient/strength/denominator/system (70 x 15 varchar) +med_ingredient_strength_denominator_code varchar (450), -- ingredient/strength/denominator/code (30 x 15 varchar) +med_ingredient_itemcodeableconcept_system varchar (3150), -- ingredient/itemCodeableConcept/coding/system (70 x 45 varchar) +med_ingredient_itemcodeableconcept_version varchar (2250), -- ingredient/itemCodeableConcept/coding/version (50 x 45 varchar) +med_ingredient_itemcodeableconcept_code varchar (1350), -- ingredient/itemCodeableConcept/coding/code (30 x 45 varchar) +med_ingredient_itemcodeableconcept_display varchar (4500), -- ingredient/itemCodeableConcept/coding/display (100 x 45 varchar) +med_ingredient_itemcodeableconcept_text varchar (7500), -- ingredient/itemCodeableConcept/text (500 x 15 varchar) +med_ingredient_itemreference_id varchar (1050), -- ingredient/itemReference/reference (70 x 15 varchar) +med_ingredient_itemreference_type varchar (450), -- ingredient/itemReference/type (30 x 15 varchar) +med_ingredient_itemreference_identifier_use varchar (450), -- ingredient/itemReference/identifier/use (30 x 15 varchar) +med_ingredient_itemreference_identifier_type_system varchar (3150), -- ingredient/itemReference/identifier/type/coding/system (70 x 45 varchar) +med_ingredient_itemreference_identifier_type_version varchar (2250), -- ingredient/itemReference/identifier/type/coding/version (50 x 45 varchar) +med_ingredient_itemreference_identifier_type_code varchar (1350), -- ingredient/itemReference/identifier/type/coding/code (30 x 45 varchar) +med_ingredient_itemreference_identifier_type_display varchar (4500), -- ingredient/itemReference/identifier/type/coding/display (100 x 45 varchar) +med_ingredient_itemreference_identifier_type_text varchar (7500), -- ingredient/itemReference/identifier/type/text (500 x 15 varchar) +med_ingredient_itemreference_display varchar (1500), -- ingredient/itemReference/display (100 x 15 varchar) +med_ingredient_isactive varchar (150), -- ingredient/isActive (10 x 15 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.medicationrequest ( +medicationrequest_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +medreq_id varchar (70), -- id (70 x 1 varchar) +medreq_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +medreq_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +medreq_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +medreq_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +medreq_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +medreq_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +medreq_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +medreq_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +medreq_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +medreq_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +medreq_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +medreq_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +medreq_medicationreference_id varchar (70), -- medicationReference/reference (70 x 1 varchar) +medreq_status varchar (20), -- status (20 x 1 varchar) +medreq_statusreason_system varchar (70), -- statusReason/coding/system (70 x 1 varchar) +medreq_statusreason_version varchar (50), -- statusReason/coding/version (50 x 1 varchar) +medreq_statusreason_code varchar (30), -- statusReason/coding/code (30 x 1 varchar) +medreq_statusreason_display varchar (100), -- statusReason/coding/display (100 x 1 varchar) +medreq_statusreason_text varchar (500), -- statusReason/text (500 x 1 varchar) +medreq_intend varchar (20), -- intend (20 x 1 varchar) +medreq_category_system varchar (420), -- category/coding/system (70 x 6 varchar) +medreq_category_version varchar (300), -- category/coding/version (50 x 6 varchar) +medreq_category_code varchar (180), -- category/coding/code (30 x 6 varchar) +medreq_category_display varchar (600), -- category/coding/display (100 x 6 varchar) +medreq_category_text varchar (1000), -- category/text (500 x 2 varchar) +medreq_priority varchar (10), -- priority (10 x 1 varchar) +medreq_reportedboolean varchar (10), -- reportedBoolean (10 x 1 varchar) +medreq_reportedreference_id varchar (70), -- reportedReference/reference (70 x 1 varchar) +medreq_reportedreference_type varchar (30), -- reportedReference/type (30 x 1 varchar) +medreq_reportedreference_identifier_use varchar (30), -- reportedReference/identifier/use (30 x 1 varchar) +medreq_reportedreference_identifier_type_system varchar (70), -- reportedReference/identifier/type/coding/system (70 x 1 varchar) +medreq_reportedreference_identifier_type_version varchar (50), -- reportedReference/identifier/type/coding/version (50 x 1 varchar) +medreq_reportedreference_identifier_type_code varchar (30), -- reportedReference/identifier/type/coding/code (30 x 1 varchar) +medreq_reportedreference_identifier_type_display varchar (100), -- reportedReference/identifier/type/coding/display (100 x 1 varchar) +medreq_reportedreference_identifier_type_text varchar (500), -- reportedReference/identifier/type/text (500 x 1 varchar) +medreq_reportedreference_display varchar (100), -- reportedReference/display (100 x 1 varchar) +medreq_medicationcodeableconcept_system varchar (70), -- medicationCodeableConcept/coding/system (70 x 1 varchar) +medreq_medicationcodeableconcept_version varchar (50), -- medicationCodeableConcept/coding/version (50 x 1 varchar) +medreq_medicationcodeableconcept_code varchar (30), -- medicationCodeableConcept/coding/code (30 x 1 varchar) +medreq_medicationcodeableconcept_display varchar (100), -- medicationCodeableConcept/coding/display (100 x 1 varchar) +medreq_medicationcodeableconcept_text varchar (500), -- medicationCodeableConcept/text (500 x 1 varchar) +medreq_supportinginformation_id varchar (140), -- supportingInformation/reference (70 x 2 varchar) +medreq_supportinginformation_type varchar (60), -- supportingInformation/type (30 x 2 varchar) +medreq_supportinginformation_identifier_use varchar (60), -- supportingInformation/identifier/use (30 x 2 varchar) +medreq_supportinginformation_identifier_type_system varchar (420), -- supportingInformation/identifier/type/coding/system (70 x 6 varchar) +medreq_supportinginformation_identifier_type_version varchar (300), -- supportingInformation/identifier/type/coding/version (50 x 6 varchar) +medreq_supportinginformation_identifier_type_code varchar (180), -- supportingInformation/identifier/type/coding/code (30 x 6 varchar) +medreq_supportinginformation_identifier_type_display varchar (600), -- supportingInformation/identifier/type/coding/display (100 x 6 varchar) +medreq_supportinginformation_identifier_type_text varchar (1000), -- supportingInformation/identifier/type/text (500 x 2 varchar) +medreq_supportinginformation_display varchar (200), -- supportingInformation/display (100 x 2 varchar) +medreq_authoredon varchar (30), -- authoredOn (30 x 1 varchar) +medreq_requester_id varchar (70), -- requester/reference (70 x 1 varchar) +medreq_requester_type varchar (30), -- requester/type (30 x 1 varchar) +medreq_requester_identifier_use varchar (30), -- requester/identifier/use (30 x 1 varchar) +medreq_requester_identifier_type_system varchar (70), -- requester/identifier/type/coding/system (70 x 1 varchar) +medreq_requester_identifier_type_version varchar (50), -- requester/identifier/type/coding/version (50 x 1 varchar) +medreq_requester_identifier_type_code varchar (30), -- requester/identifier/type/coding/code (30 x 1 varchar) +medreq_requester_identifier_type_display varchar (100), -- requester/identifier/type/coding/display (100 x 1 varchar) +medreq_requester_identifier_type_text varchar (500), -- requester/identifier/type/text (500 x 1 varchar) +medreq_requester_display varchar (100), -- requester/display (100 x 1 varchar) +medreq_reasoncode_system varchar (420), -- reasonCode/coding/system (70 x 6 varchar) +medreq_reasoncode_version varchar (300), -- reasonCode/coding/version (50 x 6 varchar) +medreq_reasoncode_code varchar (180), -- reasonCode/coding/code (30 x 6 varchar) +medreq_reasoncode_display varchar (600), -- reasonCode/coding/display (100 x 6 varchar) +medreq_reasoncode_text varchar (1000), -- reasonCode/text (500 x 2 varchar) +medreq_reasonreference_id varchar (140), -- reasonReference/reference (70 x 2 varchar) +medreq_reasonreference_type varchar (60), -- reasonReference/type (30 x 2 varchar) +medreq_reasonreference_identifier_use varchar (60), -- reasonReference/identifier/use (30 x 2 varchar) +medreq_reasonreference_identifier_type_system varchar (420), -- reasonReference/identifier/type/coding/system (70 x 6 varchar) +medreq_reasonreference_identifier_type_version varchar (300), -- reasonReference/identifier/type/coding/version (50 x 6 varchar) +medreq_reasonreference_identifier_type_code varchar (180), -- reasonReference/identifier/type/coding/code (30 x 6 varchar) +medreq_reasonreference_identifier_type_display varchar (600), -- reasonReference/identifier/type/coding/display (100 x 6 varchar) +medreq_reasonreference_identifier_type_text varchar (1000), -- reasonReference/identifier/type/text (500 x 2 varchar) +medreq_reasonreference_display varchar (200), -- reasonReference/display (100 x 2 varchar) +medreq_basedon_id varchar (140), -- basedOn/reference (70 x 2 varchar) +medreq_basedon_type varchar (60), -- basedOn/type (30 x 2 varchar) +medreq_basedon_identifier_use varchar (60), -- basedOn/identifier/use (30 x 2 varchar) +medreq_basedon_identifier_type_system varchar (420), -- basedOn/identifier/type/coding/system (70 x 6 varchar) +medreq_basedon_identifier_type_version varchar (300), -- basedOn/identifier/type/coding/version (50 x 6 varchar) +medreq_basedon_identifier_type_code varchar (180), -- basedOn/identifier/type/coding/code (30 x 6 varchar) +medreq_basedon_identifier_type_display varchar (600), -- basedOn/identifier/type/coding/display (100 x 6 varchar) +medreq_basedon_identifier_type_text varchar (1000), -- basedOn/identifier/type/text (500 x 2 varchar) +medreq_basedon_display varchar (200), -- basedOn/display (100 x 2 varchar) +medreq_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +medreq_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +medreq_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +medreq_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +medreq_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +medreq_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +medreq_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +medreq_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +medreq_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +medreq_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +medreq_note_time varchar (60), -- note/time (30 x 2 varchar) +medreq_note_text varchar (10000), -- note/text (5000 x 2 varchar) +medreq_doseinstruc_sequence varchar (20), -- dosageInstruction/sequence (10 x 2 varchar) +medreq_doseinstruc_text varchar (1000), -- dosageInstruction/text (500 x 2 varchar) +medreq_doseinstruc_additionalinstruction_system varchar (840), -- dosageInstruction/additionalInstruction/coding/system (70 x 12 varchar) +medreq_doseinstruc_additionalinstruction_version varchar (600), -- dosageInstruction/additionalInstruction/coding/version (50 x 12 varchar) +medreq_doseinstruc_additionalinstruction_code varchar (360), -- dosageInstruction/additionalInstruction/coding/code (30 x 12 varchar) +medreq_doseinstruc_additionalinstruction_display varchar (1200), -- dosageInstruction/additionalInstruction/coding/display (100 x 12 varchar) +medreq_doseinstruc_additionalinstruction_text varchar (2000), -- dosageInstruction/additionalInstruction/text (500 x 4 varchar) +medreq_doseinstruc_patientinstruction varchar (200), -- dosageInstruction/patientInstruction (100 x 2 varchar) +medreq_doseinstruc_timing_event varchar (240), -- dosageInstruction/timing/event (30 x 8 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_value varchar (60), -- dosageInstruction/timing/repeat/boundsDuration/value (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_comparator varchar (20), -- dosageInstruction/timing/repeat/boundsDuration/comparator (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_unit varchar (60), -- dosageInstruction/timing/repeat/boundsDuration/unit (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_system varchar (140), -- dosageInstruction/timing/repeat/boundsDuration/system (70 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsduration_code varchar (60), -- dosageInstruction/timing/repeat/boundsDuration/code (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_low_value varchar (20), -- dosageInstruction/timing/repeat/boundsRange/low/value (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_low_unit varchar (60), -- dosageInstruction/timing/repeat/boundsRange/low/unit (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_low_system varchar (140), -- dosageInstruction/timing/repeat/boundsRange/low/system (70 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_low_code varchar (60), -- dosageInstruction/timing/repeat/boundsRange/low/code (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_high_value varchar (20), -- dosageInstruction/timing/repeat/boundsRange/high/value (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_high_unit varchar (60), -- dosageInstruction/timing/repeat/boundsRange/high/unit (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_high_system varchar (140), -- dosageInstruction/timing/repeat/boundsRange/high/system (70 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsrange_high_code varchar (60), -- dosageInstruction/timing/repeat/boundsRange/high/code (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsperiod_start varchar (60), -- dosageInstruction/timing/repeat/boundsPeriod/start (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_boundsperiod_end varchar (60), -- dosageInstruction/timing/repeat/boundsPeriod/end (30 x 2 varchar) +medreq_doseinstruc_timing_repeat_count varchar (20), -- dosageInstruction/timing/repeat/count (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_countmax varchar (20), -- dosageInstruction/timing/repeat/countMax (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_duration varchar (20), -- dosageInstruction/timing/repeat/duration (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_durationmax varchar (20), -- dosageInstruction/timing/repeat/durationMax (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_durationunit varchar (40), -- dosageInstruction/timing/repeat/durationUnit (20 x 2 varchar) +medreq_doseinstruc_timing_repeat_frequency varchar (20), -- dosageInstruction/timing/repeat/frequency (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_frequencymax varchar (20), -- dosageInstruction/timing/repeat/frequencyMax (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_period varchar (20), -- dosageInstruction/timing/repeat/period (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_periodmax varchar (20), -- dosageInstruction/timing/repeat/periodMax (10 x 2 varchar) +medreq_doseinstruc_timing_repeat_periodunit varchar (40), -- dosageInstruction/timing/repeat/periodUnit (20 x 2 varchar) +medreq_doseinstruc_timing_repeat_dayofweek varchar (140), -- dosageInstruction/timing/repeat/dayOfWeek (10 x 14 varchar) +medreq_doseinstruc_timing_repeat_timeofday varchar (160), -- dosageInstruction/timing/repeat/timeOfDay (20 x 8 varchar) +medreq_doseinstruc_timing_repeat_when varchar (160), -- dosageInstruction/timing/repeat/when (20 x 8 varchar) +medreq_doseinstruc_timing_repeat_offset varchar (20), -- dosageInstruction/timing/repeat/offset (10 x 2 varchar) +medreq_doseinstruc_timing_code_system varchar (420), -- dosageInstruction/timing/code/coding/system (70 x 6 varchar) +medreq_doseinstruc_timing_code_version varchar (300), -- dosageInstruction/timing/code/coding/version (50 x 6 varchar) +medreq_doseinstruc_timing_code_code varchar (180), -- dosageInstruction/timing/code/coding/code (30 x 6 varchar) +medreq_doseinstruc_timing_code_display varchar (600), -- dosageInstruction/timing/code/coding/display (100 x 6 varchar) +medreq_doseinstruc_timing_code_text varchar (1000), -- dosageInstruction/timing/code/text (500 x 2 varchar) +medreq_doseinstruc_asneededboolean varchar (20), -- dosageInstruction/asNeededBoolean (10 x 2 varchar) +medreq_doseinstruc_asneededcodeableconcept_system varchar (420), -- dosageInstruction/asNeededCodeableConcept/coding/system (70 x 6 varchar) +medreq_doseinstruc_asneededcodeableconcept_version varchar (300), -- dosageInstruction/asNeededCodeableConcept/coding/version (50 x 6 varchar) +medreq_doseinstruc_asneededcodeableconcept_code varchar (180), -- dosageInstruction/asNeededCodeableConcept/coding/code (30 x 6 varchar) +medreq_doseinstruc_asneededcodeableconcept_display varchar (600), -- dosageInstruction/asNeededCodeableConcept/coding/display (100 x 6 varchar) +medreq_doseinstruc_asneededcodeableconcept_text varchar (1000), -- dosageInstruction/asNeededCodeableConcept/text (500 x 2 varchar) +medreq_doseinstruc_site_system varchar (420), -- dosageInstruction/site/coding/system (70 x 6 varchar) +medreq_doseinstruc_site_version varchar (300), -- dosageInstruction/site/coding/version (50 x 6 varchar) +medreq_doseinstruc_site_code varchar (180), -- dosageInstruction/site/coding/code (30 x 6 varchar) +medreq_doseinstruc_site_display varchar (600), -- dosageInstruction/site/coding/display (100 x 6 varchar) +medreq_doseinstruc_site_text varchar (1000), -- dosageInstruction/site/text (500 x 2 varchar) +medreq_doseinstruc_route_system varchar (420), -- dosageInstruction/route/coding/system (70 x 6 varchar) +medreq_doseinstruc_route_version varchar (300), -- dosageInstruction/route/coding/version (50 x 6 varchar) +medreq_doseinstruc_route_code varchar (180), -- dosageInstruction/route/coding/code (30 x 6 varchar) +medreq_doseinstruc_route_display varchar (600), -- dosageInstruction/route/coding/display (100 x 6 varchar) +medreq_doseinstruc_route_text varchar (1000), -- dosageInstruction/route/text (500 x 2 varchar) +medreq_doseinstruc_method_system varchar (420), -- dosageInstruction/method/coding/system (70 x 6 varchar) +medreq_doseinstruc_method_version varchar (300), -- dosageInstruction/method/coding/version (50 x 6 varchar) +medreq_doseinstruc_method_code varchar (180), -- dosageInstruction/method/coding/code (30 x 6 varchar) +medreq_doseinstruc_method_display varchar (600), -- dosageInstruction/method/coding/display (100 x 6 varchar) +medreq_doseinstruc_method_text varchar (1000), -- dosageInstruction/method/text (500 x 2 varchar) +medreq_doseinstruc_doseandrate_type_system varchar (420), -- dosageInstruction/doseAndRate/type/coding/system (70 x 6 varchar) +medreq_doseinstruc_doseandrate_type_version varchar (300), -- dosageInstruction/doseAndRate/type/coding/version (50 x 6 varchar) +medreq_doseinstruc_doseandrate_type_code varchar (180), -- dosageInstruction/doseAndRate/type/coding/code (30 x 6 varchar) +medreq_doseinstruc_doseandrate_type_display varchar (600), -- dosageInstruction/doseAndRate/type/coding/display (100 x 6 varchar) +medreq_doseinstruc_doseandrate_type_text varchar (1000), -- dosageInstruction/doseAndRate/type/text (500 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_low_value varchar (20), -- dosageInstruction/doseAndRate/doseRange/low/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_low_unit varchar (60), -- dosageInstruction/doseAndRate/doseRange/low/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_low_system varchar (140), -- dosageInstruction/doseAndRate/doseRange/low/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_low_code varchar (60), -- dosageInstruction/doseAndRate/doseRange/low/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_high_value varchar (20), -- dosageInstruction/doseAndRate/doseRange/high/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_high_unit varchar (60), -- dosageInstruction/doseAndRate/doseRange/high/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_high_system varchar (140), -- dosageInstruction/doseAndRate/doseRange/high/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_doserange_high_code varchar (60), -- dosageInstruction/doseAndRate/doseRange/high/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_value varchar (20), -- dosageInstruction/doseAndRate/doseQuantity/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_comparator varchar (20), -- dosageInstruction/doseAndRate/doseQuantity/comparator (10 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_unit varchar (60), -- dosageInstruction/doseAndRate/doseQuantity/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_system varchar (140), -- dosageInstruction/doseAndRate/doseQuantity/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_dosequantity_code varchar (60), -- dosageInstruction/doseAndRate/doseQuantity/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_value varchar (20), -- dosageInstruction/doseAndRate/rateRatio/numerator/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_comparator varchar (20), -- dosageInstruction/doseAndRate/rateRatio/numerator/comparator (10 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_unit varchar (60), -- dosageInstruction/doseAndRate/rateRatio/numerator/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_system varchar (140), -- dosageInstruction/doseAndRate/rateRatio/numerator/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_numerator_code varchar (60), -- dosageInstruction/doseAndRate/rateRatio/numerator/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_value varchar (20), -- dosageInstruction/doseAndRate/rateRatio/denominator/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_comparator varchar (20), -- dosageInstruction/doseAndRate/rateRatio/denominator/comparator (10 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_unit varchar (60), -- dosageInstruction/doseAndRate/rateRatio/denominator/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_system varchar (140), -- dosageInstruction/doseAndRate/rateRatio/denominator/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_rateratio_denominator_code varchar (60), -- dosageInstruction/doseAndRate/rateRatio/denominator/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_low_value varchar (20), -- dosageInstruction/doseAndRate/rateRange/low/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_low_unit varchar (60), -- dosageInstruction/doseAndRate/rateRange/low/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_low_system varchar (140), -- dosageInstruction/doseAndRate/rateRange/low/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_low_code varchar (60), -- dosageInstruction/doseAndRate/rateRange/low/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_high_value varchar (20), -- dosageInstruction/doseAndRate/rateRange/high/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_high_unit varchar (60), -- dosageInstruction/doseAndRate/rateRange/high/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_high_system varchar (140), -- dosageInstruction/doseAndRate/rateRange/high/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_raterange_high_code varchar (60), -- dosageInstruction/doseAndRate/rateRange/high/code (30 x 2 varchar) +medreq_doseinstruc_doseandrate_ratequantity_value varchar (20), -- dosageInstruction/doseAndRate/rateQuantity/value (10 x 2 varchar) +medreq_doseinstruc_doseandrate_ratequantity_unit varchar (60), -- dosageInstruction/doseAndRate/rateQuantity/unit (30 x 2 varchar) +medreq_doseinstruc_doseandrate_ratequantity_system varchar (140), -- dosageInstruction/doseAndRate/rateQuantity/system (70 x 2 varchar) +medreq_doseinstruc_doseandrate_ratequantity_code varchar (60), -- dosageInstruction/doseAndRate/rateQuantity/code (30 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_value varchar (20), -- dosageInstruction/maxDosePerPeriod/numerator/value (10 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_comparator varchar (20), -- dosageInstruction/maxDosePerPeriod/numerator/comparator (10 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_unit varchar (60), -- dosageInstruction/maxDosePerPeriod/numerator/unit (30 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_system varchar (140), -- dosageInstruction/maxDosePerPeriod/numerator/system (70 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_numerator_code varchar (60), -- dosageInstruction/maxDosePerPeriod/numerator/code (30 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_value varchar (20), -- dosageInstruction/maxDosePerPeriod/denominator/value (10 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_comparator varchar (20), -- dosageInstruction/maxDosePerPeriod/denominator/comparator (10 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_unit varchar (60), -- dosageInstruction/maxDosePerPeriod/denominator/unit (30 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_system varchar (140), -- dosageInstruction/maxDosePerPeriod/denominator/system (70 x 2 varchar) +medreq_doseinstruc_maxdoseperperiod_denominator_code varchar (60), -- dosageInstruction/maxDosePerPeriod/denominator/code (30 x 2 varchar) +medreq_doseinstruc_maxdoseperadministration_value varchar (20), -- dosageInstruction/maxDosePerAdministration/value (10 x 2 varchar) +medreq_doseinstruc_maxdoseperadministration_unit varchar (60), -- dosageInstruction/maxDosePerAdministration/unit (30 x 2 varchar) +medreq_doseinstruc_maxdoseperadministration_system varchar (140), -- dosageInstruction/maxDosePerAdministration/system (70 x 2 varchar) +medreq_doseinstruc_maxdoseperadministration_code varchar (60), -- dosageInstruction/maxDosePerAdministration/code (30 x 2 varchar) +medreq_doseinstruc_maxdoseperlifetime_value varchar (20), -- dosageInstruction/maxDosePerLifetime/value (10 x 2 varchar) +medreq_doseinstruc_maxdoseperlifetime_unit varchar (60), -- dosageInstruction/maxDosePerLifetime/unit (30 x 2 varchar) +medreq_doseinstruc_maxdoseperlifetime_system varchar (140), -- dosageInstruction/maxDosePerLifetime/system (70 x 2 varchar) +medreq_doseinstruc_maxdoseperlifetime_code varchar (60), -- dosageInstruction/maxDosePerLifetime/code (30 x 2 varchar) +medreq_substitution_reason_system varchar (70), -- substitution/reason/coding/system (70 x 1 varchar) +medreq_substitution_reason_version varchar (50), -- substitution/reason/coding/version (50 x 1 varchar) +medreq_substitution_reason_code varchar (30), -- substitution/reason/coding/code (30 x 1 varchar) +medreq_substitution_reason_display varchar (100), -- substitution/reason/coding/display (100 x 1 varchar) +medreq_substitution_reason_text varchar (500), -- substitution/reason/text (500 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.medicationadministration ( +medicationadministration_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +medadm_id varchar (70), -- id (70 x 1 varchar) +medadm_encounter_id varchar (70), -- context/reference (70 x 1 varchar) +medadm_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +medadm_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +medadm_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +medadm_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +medadm_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +medadm_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +medadm_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +medadm_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +medadm_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +medadm_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +medadm_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +medadm_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +medadm_status varchar (30), -- status (30 x 1 varchar) +medadm_statusreason_system varchar (70), -- statusReason/coding/system (70 x 1 varchar) +medadm_statusreason_version varchar (50), -- statusReason/coding/version (50 x 1 varchar) +medadm_statusreason_code varchar (30), -- statusReason/coding/code (30 x 1 varchar) +medadm_statusreason_display varchar (100), -- statusReason/coding/display (100 x 1 varchar) +medadm_statusreason_text varchar (500), -- statusReason/text (500 x 1 varchar) +medadm_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +medadm_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +medadm_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +medadm_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +medadm_category_text varchar (500), -- category/text (500 x 1 varchar) +medadm_medicationreference_id varchar (70), -- medicationReference/reference (70 x 1 varchar) +medadm_medicationcodeableconcept_system varchar (70), -- medicationCodeableConcept/coding/system (70 x 1 varchar) +medadm_medicationcodeableconcept_version varchar (50), -- medicationCodeableConcept/coding/version (50 x 1 varchar) +medadm_medicationcodeableconcept_code varchar (30), -- medicationCodeableConcept/coding/code (30 x 1 varchar) +medadm_medicationcodeableconcept_display varchar (100), -- medicationCodeableConcept/coding/display (100 x 1 varchar) +medadm_medicationcodeableconcept_text varchar (500), -- medicationCodeableConcept/text (500 x 1 varchar) +medadm_supportinginformation_id varchar (140), -- supportingInformation/reference (70 x 2 varchar) +medadm_supportinginformation_type varchar (60), -- supportingInformation/type (30 x 2 varchar) +medadm_supportinginformation_identifier_use varchar (60), -- supportingInformation/identifier/use (30 x 2 varchar) +medadm_supportinginformation_identifier_type_system varchar (420), -- supportingInformation/identifier/type/coding/system (70 x 6 varchar) +medadm_supportinginformation_identifier_type_version varchar (300), -- supportingInformation/identifier/type/coding/version (50 x 6 varchar) +medadm_supportinginformation_identifier_type_code varchar (180), -- supportingInformation/identifier/type/coding/code (30 x 6 varchar) +medadm_supportinginformation_identifier_type_display varchar (600), -- supportingInformation/identifier/type/coding/display (100 x 6 varchar) +medadm_supportinginformation_identifier_type_text varchar (1000), -- supportingInformation/identifier/type/text (500 x 2 varchar) +medadm_supportinginformation_display varchar (200), -- supportingInformation/display (100 x 2 varchar) +medadm_effectivedatetime varchar (30), -- effectiveDateTime (30 x 1 varchar) +medadm_effectiveperiod_start varchar (30), -- effectivePeriod/start (30 x 1 varchar) +medadm_effectiveperiod_end varchar (30), -- effectivePeriod/end (30 x 1 varchar) +medadm_performer_function_system varchar (70), -- performer/function/coding/system (70 x 1 varchar) +medadm_performer_function_version varchar (50), -- performer/function/coding/version (50 x 1 varchar) +medadm_performer_function_code varchar (30), -- performer/function/coding/code (30 x 1 varchar) +medadm_performer_function_display varchar (100), -- performer/function/coding/display (100 x 1 varchar) +medadm_performer_function_text varchar (500), -- performer/function/text (500 x 1 varchar) +medadm_reasoncode_system varchar (420), -- reasonCode/coding/system (70 x 6 varchar) +medadm_reasoncode_version varchar (300), -- reasonCode/coding/version (50 x 6 varchar) +medadm_reasoncode_code varchar (180), -- reasonCode/coding/code (30 x 6 varchar) +medadm_reasoncode_display varchar (600), -- reasonCode/coding/display (100 x 6 varchar) +medadm_reasoncode_text varchar (1000), -- reasonCode/text (500 x 2 varchar) +medadm_reasonreference_id varchar (140), -- reasonReference/reference (70 x 2 varchar) +medadm_reasonreference_type varchar (60), -- reasonReference/type (30 x 2 varchar) +medadm_reasonreference_identifier_use varchar (60), -- reasonReference/identifier/use (30 x 2 varchar) +medadm_reasonreference_identifier_type_system varchar (420), -- reasonReference/identifier/type/coding/system (70 x 6 varchar) +medadm_reasonreference_identifier_type_version varchar (300), -- reasonReference/identifier/type/coding/version (50 x 6 varchar) +medadm_reasonreference_identifier_type_code varchar (180), -- reasonReference/identifier/type/coding/code (30 x 6 varchar) +medadm_reasonreference_identifier_type_display varchar (600), -- reasonReference/identifier/type/coding/display (100 x 6 varchar) +medadm_reasonreference_identifier_type_text varchar (1000), -- reasonReference/identifier/type/text (500 x 2 varchar) +medadm_reasonreference_display varchar (200), -- reasonReference/display (100 x 2 varchar) +medadm_request_id varchar (70), -- request/reference (70 x 1 varchar) +medadm_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +medadm_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +medadm_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +medadm_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +medadm_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +medadm_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +medadm_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +medadm_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +medadm_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +medadm_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +medadm_note_time varchar (60), -- note/time (30 x 2 varchar) +medadm_note_text varchar (10000), -- note/text (5000 x 2 varchar) +medadm_dosage_text varchar (100), -- dosage/text (100 x 1 varchar) +medadm_dosage_site_system varchar (70), -- dosage/site/coding/system (70 x 1 varchar) +medadm_dosage_site_version varchar (50), -- dosage/site/coding/version (50 x 1 varchar) +medadm_dosage_site_code varchar (30), -- dosage/site/coding/code (30 x 1 varchar) +medadm_dosage_site_display varchar (100), -- dosage/site/coding/display (100 x 1 varchar) +medadm_dosage_site_text varchar (500), -- dosage/site/text (500 x 1 varchar) +medadm_dosage_route_system varchar (70), -- dosage/route/coding/system (70 x 1 varchar) +medadm_dosage_route_version varchar (50), -- dosage/route/coding/version (50 x 1 varchar) +medadm_dosage_route_code varchar (30), -- dosage/route/coding/code (30 x 1 varchar) +medadm_dosage_route_display varchar (100), -- dosage/route/coding/display (100 x 1 varchar) +medadm_dosage_route_text varchar (500), -- dosage/route/text (500 x 1 varchar) +medadm_dosage_method_system varchar (70), -- dosage/method/coding/system (70 x 1 varchar) +medadm_dosage_method_version varchar (50), -- dosage/method/coding/version (50 x 1 varchar) +medadm_dosage_method_code varchar (30), -- dosage/method/coding/code (30 x 1 varchar) +medadm_dosage_method_display varchar (100), -- dosage/method/coding/display (100 x 1 varchar) +medadm_dosage_method_text varchar (500), -- dosage/method/text (500 x 1 varchar) +medadm_dosage_dose_value varchar (10), -- dosage/dose/value (10 x 1 varchar) +medadm_dosage_dose_unit varchar (30), -- dosage/dose/unit (30 x 1 varchar) +medadm_dosage_dose_system varchar (70), -- dosage/dose/system (70 x 1 varchar) +medadm_dosage_dose_code varchar (30), -- dosage/dose/code (30 x 1 varchar) +medadm_dosage_rateratio_numerator_value varchar (10), -- dosage/rateRatio/numerator/value (10 x 1 varchar) +medadm_dosage_rateratio_numerator_comparator varchar (10), -- dosage/rateRatio/numerator/comparator (10 x 1 varchar) +medadm_dosage_rateratio_numerator_unit varchar (30), -- dosage/rateRatio/numerator/unit (30 x 1 varchar) +medadm_dosage_rateratio_numerator_system varchar (70), -- dosage/rateRatio/numerator/system (70 x 1 varchar) +medadm_dosage_rateratio_numerator_code varchar (30), -- dosage/rateRatio/numerator/code (30 x 1 varchar) +medadm_dosage_rateratio_denominator_value varchar (10), -- dosage/rateRatio/denominator/value (10 x 1 varchar) +medadm_dosage_rateratio_denominator_comparator varchar (10), -- dosage/rateRatio/denominator/comparator (10 x 1 varchar) +medadm_dosage_rateratio_denominator_unit varchar (30), -- dosage/rateRatio/denominator/unit (30 x 1 varchar) +medadm_dosage_rateratio_denominator_system varchar (70), -- dosage/rateRatio/denominator/system (70 x 1 varchar) +medadm_dosage_rateratio_denominator_code varchar (30), -- dosage/rateRatio/denominator/code (30 x 1 varchar) +medadm_dosage_ratequantity_value varchar (10), -- dosage/rateQuantity/value (10 x 1 varchar) +medadm_dosage_ratequantity_unit varchar (30), -- dosage/rateQuantity/unit (30 x 1 varchar) +medadm_dosage_ratequantity_system varchar (70), -- dosage/rateQuantity/system (70 x 1 varchar) +medadm_dosage_ratequantity_code varchar (30), -- dosage/rateQuantity/code (30 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.medicationstatement ( +medicationstatement_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +medstat_id varchar (70), -- id (70 x 1 varchar) +medstat_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +medstat_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +medstat_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +medstat_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +medstat_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +medstat_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +medstat_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +medstat_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +medstat_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +medstat_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +medstat_encounter_id varchar (70), -- context/reference (70 x 1 varchar) +medstat_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +medstat_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +medstat_basedon_id varchar (140), -- basedOn/reference (70 x 2 varchar) +medstat_basedon_type varchar (60), -- basedOn/type (30 x 2 varchar) +medstat_basedon_identifier_use varchar (60), -- basedOn/identifier/use (30 x 2 varchar) +medstat_basedon_identifier_type_system varchar (420), -- basedOn/identifier/type/coding/system (70 x 6 varchar) +medstat_basedon_identifier_type_version varchar (300), -- basedOn/identifier/type/coding/version (50 x 6 varchar) +medstat_basedon_identifier_type_code varchar (180), -- basedOn/identifier/type/coding/code (30 x 6 varchar) +medstat_basedon_identifier_type_display varchar (600), -- basedOn/identifier/type/coding/display (100 x 6 varchar) +medstat_basedon_identifier_type_text varchar (1000), -- basedOn/identifier/type/text (500 x 2 varchar) +medstat_basedon_display varchar (200), -- basedOn/display (100 x 2 varchar) +medstat_status varchar (30), -- status (30 x 1 varchar) +medstat_statusreason_system varchar (70), -- statusReason/coding/system (70 x 1 varchar) +medstat_statusreason_version varchar (50), -- statusReason/coding/version (50 x 1 varchar) +medstat_statusreason_code varchar (30), -- statusReason/coding/code (30 x 1 varchar) +medstat_statusreason_display varchar (100), -- statusReason/coding/display (100 x 1 varchar) +medstat_statusreason_text varchar (500), -- statusReason/text (500 x 1 varchar) +medstat_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +medstat_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +medstat_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +medstat_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +medstat_category_text varchar (500), -- category/text (500 x 1 varchar) +medstat_medicationreference_id varchar (100), -- medicationReference/reference (100 x 1 varchar) +medstat_medicationcodeableconcept_system varchar (70), -- medicationCodeableConcept/coding/system (70 x 1 varchar) +medstat_medicationcodeableconcept_version varchar (50), -- medicationCodeableConcept/coding/version (50 x 1 varchar) +medstat_medicationcodeableconcept_code varchar (30), -- medicationCodeableConcept/coding/code (30 x 1 varchar) +medstat_medicationcodeableconcept_display varchar (100), -- medicationCodeableConcept/coding/display (100 x 1 varchar) +medstat_medicationcodeableconcept_text varchar (500), -- medicationCodeableConcept/text (500 x 1 varchar) +medstat_effectivedatetime varchar (30), -- effectiveDateTime (30 x 1 varchar) +medstat_effectiveperiod_start varchar (30), -- effectivePeriod/start (30 x 1 varchar) +medstat_effectiveperiod_end varchar (30), -- effectivePeriod/end (30 x 1 varchar) +medstat_dateasserted varchar (30), -- dateAsserted (30 x 1 varchar) +medstat_informationsource_id varchar (70), -- informationSource/reference (70 x 1 varchar) +medstat_informationsource_type varchar (30), -- informationSource/type (30 x 1 varchar) +medstat_informationsource_identifier_use varchar (30), -- informationSource/identifier/use (30 x 1 varchar) +medstat_informationsource_identifier_type_system varchar (70), -- informationSource/identifier/type/coding/system (70 x 1 varchar) +medstat_informationsource_identifier_type_version varchar (50), -- informationSource/identifier/type/coding/version (50 x 1 varchar) +medstat_informationsource_identifier_type_code varchar (30), -- informationSource/identifier/type/coding/code (30 x 1 varchar) +medstat_informationsource_identifier_type_display varchar (100), -- informationSource/identifier/type/coding/display (100 x 1 varchar) +medstat_informationsource_identifier_type_text varchar (500), -- informationSource/identifier/type/text (500 x 1 varchar) +medstat_informationsource_display varchar (100), -- informationSource/display (100 x 1 varchar) +medstat_derivedfrom_id varchar (70), -- derivedFrom/reference (70 x 1 varchar) +medstat_derivedfrom_type varchar (30), -- derivedFrom/type (30 x 1 varchar) +medstat_derivedfrom_identifier_use varchar (30), -- derivedFrom/identifier/use (30 x 1 varchar) +medstat_derivedfrom_identifier_type_system varchar (70), -- derivedFrom/identifier/type/coding/system (70 x 1 varchar) +medstat_derivedfrom_identifier_type_version varchar (50), -- derivedFrom/identifier/type/coding/version (50 x 1 varchar) +medstat_derivedfrom_identifier_type_code varchar (30), -- derivedFrom/identifier/type/coding/code (30 x 1 varchar) +medstat_derivedfrom_identifier_type_display varchar (100), -- derivedFrom/identifier/type/coding/display (100 x 1 varchar) +medstat_derivedfrom_identifier_type_text varchar (500), -- derivedFrom/identifier/type/text (500 x 1 varchar) +medstat_derivedfrom_display varchar (100), -- derivedFrom/display (100 x 1 varchar) +medstat_reasoncode_system varchar (70), -- reasonCode/coding/system (70 x 1 varchar) +medstat_reasoncode_version varchar (50), -- reasonCode/coding/version (50 x 1 varchar) +medstat_reasoncode_code varchar (30), -- reasonCode/coding/code (30 x 1 varchar) +medstat_reasoncode_display varchar (100), -- reasonCode/coding/display (100 x 1 varchar) +medstat_reasoncode_text varchar (500), -- reasonCode/text (500 x 1 varchar) +medstat_reasonreference_id varchar (210), -- reasonReference/reference (70 x 3 varchar) +medstat_reasonreference_type varchar (90), -- reasonReference/type (30 x 3 varchar) +medstat_reasonreference_identifier_use varchar (90), -- reasonReference/identifier/use (30 x 3 varchar) +medstat_reasonreference_identifier_type_system varchar (630), -- reasonReference/identifier/type/coding/system (70 x 9 varchar) +medstat_reasonreference_identifier_type_version varchar (450), -- reasonReference/identifier/type/coding/version (50 x 9 varchar) +medstat_reasonreference_identifier_type_code varchar (270), -- reasonReference/identifier/type/coding/code (30 x 9 varchar) +medstat_reasonreference_identifier_type_display varchar (900), -- reasonReference/identifier/type/coding/display (100 x 9 varchar) +medstat_reasonreference_identifier_type_text varchar (1500), -- reasonReference/identifier/type/text (500 x 3 varchar) +medstat_reasonreference_display varchar (300), -- reasonReference/display (100 x 3 varchar) +medstat_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +medstat_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +medstat_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +medstat_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +medstat_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +medstat_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +medstat_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +medstat_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +medstat_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +medstat_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +medstat_note_time varchar (60), -- note/time (30 x 2 varchar) +medstat_note_text varchar (10000), -- note/text (5000 x 2 varchar) +medstat_dosage_sequence varchar (20), -- dosage/sequence (10 x 2 varchar) +medstat_dosage_text varchar (1000), -- dosage/text (500 x 2 varchar) +medstat_dosage_additionalinstruction_system varchar (840), -- dosage/additionalInstruction/coding/system (70 x 12 varchar) +medstat_dosage_additionalinstruction_version varchar (600), -- dosage/additionalInstruction/coding/version (50 x 12 varchar) +medstat_dosage_additionalinstruction_code varchar (360), -- dosage/additionalInstruction/coding/code (30 x 12 varchar) +medstat_dosage_additionalinstruction_display varchar (1200), -- dosage/additionalInstruction/coding/display (100 x 12 varchar) +medstat_dosage_additionalinstruction_text varchar (2000), -- dosage/additionalInstruction/text (500 x 4 varchar) +medstat_dosage_patientinstruction varchar (200), -- dosage/patientInstruction (100 x 2 varchar) +medstat_dosage_timing_event varchar (240), -- dosage/timing/event (30 x 8 varchar) +medstat_dosage_timing_repeat_boundsduration_value varchar (60), -- dosage/timing/repeat/boundsDuration/value (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsduration_comparator varchar (20), -- dosage/timing/repeat/boundsDuration/comparator (10 x 2 varchar) +medstat_dosage_timing_repeat_boundsduration_unit varchar (60), -- dosage/timing/repeat/boundsDuration/unit (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsduration_system varchar (140), -- dosage/timing/repeat/boundsDuration/system (70 x 2 varchar) +medstat_dosage_timing_repeat_boundsduration_code varchar (60), -- dosage/timing/repeat/boundsDuration/code (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_low_value varchar (20), -- dosage/timing/repeat/boundsRange/low/value (10 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_low_unit varchar (60), -- dosage/timing/repeat/boundsRange/low/unit (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_low_system varchar (140), -- dosage/timing/repeat/boundsRange/low/system (70 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_low_code varchar (60), -- dosage/timing/repeat/boundsRange/low/code (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_high_value varchar (20), -- dosage/timing/repeat/boundsRange/high/value (10 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_high_unit varchar (60), -- dosage/timing/repeat/boundsRange/high/unit (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_high_system varchar (140), -- dosage/timing/repeat/boundsRange/high/system (70 x 2 varchar) +medstat_dosage_timing_repeat_boundsrange_high_code varchar (60), -- dosage/timing/repeat/boundsRange/high/code (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsperiod_start varchar (60), -- dosage/timing/repeat/boundsPeriod/start (30 x 2 varchar) +medstat_dosage_timing_repeat_boundsperiod_end varchar (60), -- dosage/timing/repeat/boundsPeriod/end (30 x 2 varchar) +medstat_dosage_timing_repeat_count varchar (20), -- dosage/timing/repeat/count (10 x 2 varchar) +medstat_dosage_timing_repeat_countmax varchar (20), -- dosage/timing/repeat/countMax (10 x 2 varchar) +medstat_dosage_timing_repeat_duration varchar (20), -- dosage/timing/repeat/duration (10 x 2 varchar) +medstat_dosage_timing_repeat_durationmax varchar (20), -- dosage/timing/repeat/durationMax (10 x 2 varchar) +medstat_dosage_timing_repeat_durationunit varchar (40), -- dosage/timing/repeat/durationUnit (20 x 2 varchar) +medstat_dosage_timing_repeat_frequency varchar (20), -- dosage/timing/repeat/frequency (10 x 2 varchar) +medstat_dosage_timing_repeat_frequencymax varchar (20), -- dosage/timing/repeat/frequencyMax (10 x 2 varchar) +medstat_dosage_timing_repeat_period varchar (20), -- dosage/timing/repeat/period (10 x 2 varchar) +medstat_dosage_timing_repeat_periodmax varchar (20), -- dosage/timing/repeat/periodMax (10 x 2 varchar) +medstat_dosage_timing_repeat_periodunit varchar (40), -- dosage/timing/repeat/periodUnit (20 x 2 varchar) +medstat_dosage_timing_repeat_dayofweek varchar (140), -- dosage/timing/repeat/dayOfWeek (10 x 14 varchar) +medstat_dosage_timing_repeat_timeofday varchar (160), -- dosage/timing/repeat/timeOfDay (20 x 8 varchar) +medstat_dosage_timing_repeat_when varchar (160), -- dosage/timing/repeat/when (20 x 8 varchar) +medstat_dosage_timing_repeat_offset varchar (20), -- dosage/timing/repeat/offset (10 x 2 varchar) +medstat_dosage_timing_code_system varchar (420), -- dosage/timing/code/coding/system (70 x 6 varchar) +medstat_dosage_timing_code_version varchar (300), -- dosage/timing/code/coding/version (50 x 6 varchar) +medstat_dosage_timing_code_code varchar (180), -- dosage/timing/code/coding/code (30 x 6 varchar) +medstat_dosage_timing_code_display varchar (600), -- dosage/timing/code/coding/display (100 x 6 varchar) +medstat_dosage_timing_code_text varchar (1000), -- dosage/timing/code/text (500 x 2 varchar) +medstat_dosage_asneededboolean varchar (20), -- dosage/asNeededBoolean (10 x 2 varchar) +medstat_dosage_asneededcodeableconcept_system varchar (420), -- dosage/asNeededCodeableConcept/coding/system (70 x 6 varchar) +medstat_dosage_asneededcodeableconcept_version varchar (300), -- dosage/asNeededCodeableConcept/coding/version (50 x 6 varchar) +medstat_dosage_asneededcodeableconcept_code varchar (180), -- dosage/asNeededCodeableConcept/coding/code (30 x 6 varchar) +medstat_dosage_asneededcodeableconcept_display varchar (600), -- dosage/asNeededCodeableConcept/coding/display (100 x 6 varchar) +medstat_dosage_asneededcodeableconcept_text varchar (1000), -- dosage/asNeededCodeableConcept/text (500 x 2 varchar) +medstat_dosage_site_system varchar (420), -- dosage/site/coding/system (70 x 6 varchar) +medstat_dosage_site_version varchar (300), -- dosage/site/coding/version (50 x 6 varchar) +medstat_dosage_site_code varchar (180), -- dosage/site/coding/code (30 x 6 varchar) +medstat_dosage_site_display varchar (600), -- dosage/site/coding/display (100 x 6 varchar) +medstat_dosage_site_text varchar (1000), -- dosage/site/text (500 x 2 varchar) +medstat_dosage_route_system varchar (420), -- dosage/route/coding/system (70 x 6 varchar) +medstat_dosage_route_version varchar (300), -- dosage/route/coding/version (50 x 6 varchar) +medstat_dosage_route_code varchar (180), -- dosage/route/coding/code (30 x 6 varchar) +medstat_dosage_route_display varchar (600), -- dosage/route/coding/display (100 x 6 varchar) +medstat_dosage_route_text varchar (1000), -- dosage/route/text (500 x 2 varchar) +medstat_dosage_method_system varchar (420), -- dosage/method/coding/system (70 x 6 varchar) +medstat_dosage_method_version varchar (300), -- dosage/method/coding/version (50 x 6 varchar) +medstat_dosage_method_code varchar (180), -- dosage/method/coding/code (30 x 6 varchar) +medstat_dosage_method_display varchar (600), -- dosage/method/coding/display (100 x 6 varchar) +medstat_dosage_method_text varchar (1000), -- dosage/method/text (500 x 2 varchar) +medstat_dosage_doseandrate_type_system varchar (420), -- dosage/doseAndRate/type/coding/system (70 x 6 varchar) +medstat_dosage_doseandrate_type_version varchar (300), -- dosage/doseAndRate/type/coding/version (50 x 6 varchar) +medstat_dosage_doseandrate_type_code varchar (180), -- dosage/doseAndRate/type/coding/code (30 x 6 varchar) +medstat_dosage_doseandrate_type_display varchar (600), -- dosage/doseAndRate/type/coding/display (100 x 6 varchar) +medstat_dosage_doseandrate_type_text varchar (1000), -- dosage/doseAndRate/type/text (500 x 2 varchar) +medstat_dosage_doseandrate_doserange_low_value varchar (20), -- dosage/doseAndRate/doseRange/low/value (10 x 2 varchar) +medstat_dosage_doseandrate_doserange_low_unit varchar (60), -- dosage/doseAndRate/doseRange/low/unit (30 x 2 varchar) +medstat_dosage_doseandrate_doserange_low_system varchar (140), -- dosage/doseAndRate/doseRange/low/system (70 x 2 varchar) +medstat_dosage_doseandrate_doserange_low_code varchar (60), -- dosage/doseAndRate/doseRange/low/code (30 x 2 varchar) +medstat_dosage_doseandrate_doserange_high_value varchar (20), -- dosage/doseAndRate/doseRange/high/value (10 x 2 varchar) +medstat_dosage_doseandrate_doserange_high_unit varchar (60), -- dosage/doseAndRate/doseRange/high/unit (30 x 2 varchar) +medstat_dosage_doseandrate_doserange_high_system varchar (140), -- dosage/doseAndRate/doseRange/high/system (70 x 2 varchar) +medstat_dosage_doseandrate_doserange_high_code varchar (60), -- dosage/doseAndRate/doseRange/high/code (30 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_value varchar (20), -- dosage/doseAndRate/doseQuantity/value (10 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_comparator varchar (20), -- dosage/doseAndRate/doseQuantity/comparator (10 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_unit varchar (60), -- dosage/doseAndRate/doseQuantity/unit (30 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_system varchar (140), -- dosage/doseAndRate/doseQuantity/system (70 x 2 varchar) +medstat_dosage_doseandrate_dosequantity_code varchar (60), -- dosage/doseAndRate/doseQuantity/code (30 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_value varchar (20), -- dosage/doseAndRate/rateRatio/numerator/value (10 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_comparator varchar (20), -- dosage/doseAndRate/rateRatio/numerator/comparator (10 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_unit varchar (60), -- dosage/doseAndRate/rateRatio/numerator/unit (30 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_system varchar (140), -- dosage/doseAndRate/rateRatio/numerator/system (70 x 2 varchar) +medstat_dosage_doseandrate_rateratio_numerator_code varchar (60), -- dosage/doseAndRate/rateRatio/numerator/code (30 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_value varchar (20), -- dosage/doseAndRate/rateRatio/denominator/value (10 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_comparator varchar (20), -- dosage/doseAndRate/rateRatio/denominator/comparator (10 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_unit varchar (60), -- dosage/doseAndRate/rateRatio/denominator/unit (30 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_system varchar (140), -- dosage/doseAndRate/rateRatio/denominator/system (70 x 2 varchar) +medstat_dosage_doseandrate_rateratio_denominator_code varchar (60), -- dosage/doseAndRate/rateRatio/denominator/code (30 x 2 varchar) +medstat_dosage_doseandrate_raterange_low_value varchar (20), -- dosage/doseAndRate/rateRange/low/value (10 x 2 varchar) +medstat_dosage_doseandrate_raterange_low_unit varchar (60), -- dosage/doseAndRate/rateRange/low/unit (30 x 2 varchar) +medstat_dosage_doseandrate_raterange_low_system varchar (140), -- dosage/doseAndRate/rateRange/low/system (70 x 2 varchar) +medstat_dosage_doseandrate_raterange_low_code varchar (60), -- dosage/doseAndRate/rateRange/low/code (30 x 2 varchar) +medstat_dosage_doseandrate_raterange_high_value varchar (20), -- dosage/doseAndRate/rateRange/high/value (10 x 2 varchar) +medstat_dosage_doseandrate_raterange_high_unit varchar (60), -- dosage/doseAndRate/rateRange/high/unit (30 x 2 varchar) +medstat_dosage_doseandrate_raterange_high_system varchar (140), -- dosage/doseAndRate/rateRange/high/system (70 x 2 varchar) +medstat_dosage_doseandrate_raterange_high_code varchar (60), -- dosage/doseAndRate/rateRange/high/code (30 x 2 varchar) +medstat_dosage_doseandrate_ratequantity_value varchar (20), -- dosage/doseAndRate/rateQuantity/value (10 x 2 varchar) +medstat_dosage_doseandrate_ratequantity_unit varchar (60), -- dosage/doseAndRate/rateQuantity/unit (30 x 2 varchar) +medstat_dosage_doseandrate_ratequantity_system varchar (140), -- dosage/doseAndRate/rateQuantity/system (70 x 2 varchar) +medstat_dosage_doseandrate_ratequantity_code varchar (60), -- dosage/doseAndRate/rateQuantity/code (30 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_value varchar (20), -- dosage/maxDosePerPeriod/numerator/value (10 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_comparator varchar (20), -- dosage/maxDosePerPeriod/numerator/comparator (10 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_unit varchar (60), -- dosage/maxDosePerPeriod/numerator/unit (30 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_system varchar (140), -- dosage/maxDosePerPeriod/numerator/system (70 x 2 varchar) +medstat_dosage_maxdoseperperiod_numerator_code varchar (60), -- dosage/maxDosePerPeriod/numerator/code (30 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_value varchar (20), -- dosage/maxDosePerPeriod/denominator/value (10 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_comparator varchar (20), -- dosage/maxDosePerPeriod/denominator/comparator (10 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_unit varchar (60), -- dosage/maxDosePerPeriod/denominator/unit (30 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_system varchar (140), -- dosage/maxDosePerPeriod/denominator/system (70 x 2 varchar) +medstat_dosage_maxdoseperperiod_denominator_code varchar (60), -- dosage/maxDosePerPeriod/denominator/code (30 x 2 varchar) +medstat_dosage_maxdoseperadministration_value varchar (20), -- dosage/maxDosePerAdministration/value (10 x 2 varchar) +medstat_dosage_maxdoseperadministration_unit varchar (60), -- dosage/maxDosePerAdministration/unit (30 x 2 varchar) +medstat_dosage_maxdoseperadministration_system varchar (140), -- dosage/maxDosePerAdministration/system (70 x 2 varchar) +medstat_dosage_maxdoseperadministration_code varchar (60), -- dosage/maxDosePerAdministration/code (30 x 2 varchar) +medstat_dosage_maxdoseperlifetime_value varchar (20), -- dosage/maxDosePerLifetime/value (10 x 2 varchar) +medstat_dosage_maxdoseperlifetime_unit varchar (60), -- dosage/maxDosePerLifetime/unit (30 x 2 varchar) +medstat_dosage_maxdoseperlifetime_system varchar (140), -- dosage/maxDosePerLifetime/system (70 x 2 varchar) +medstat_dosage_maxdoseperlifetime_code varchar (60), -- dosage/maxDosePerLifetime/code (30 x 2 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.observation ( +observation_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +obs_id varchar (70), -- id (70 x 1 varchar) +obs_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +obs_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +obs_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +obs_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +obs_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +obs_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +obs_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +obs_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +obs_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +obs_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +obs_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +obs_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +obs_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +obs_basedon_id varchar (70), -- basedOn/reference (70 x 1 varchar) +obs_basedon_type varchar (30), -- basedOn/type (30 x 1 varchar) +obs_basedon_identifier_use varchar (30), -- basedOn/identifier/use (30 x 1 varchar) +obs_basedon_identifier_type_system varchar (70), -- basedOn/identifier/type/coding/system (70 x 1 varchar) +obs_basedon_identifier_type_version varchar (50), -- basedOn/identifier/type/coding/version (50 x 1 varchar) +obs_basedon_identifier_type_code varchar (30), -- basedOn/identifier/type/coding/code (30 x 1 varchar) +obs_basedon_identifier_type_display varchar (100), -- basedOn/identifier/type/coding/display (100 x 1 varchar) +obs_basedon_identifier_type_text varchar (500), -- basedOn/identifier/type/text (500 x 1 varchar) +obs_basedon_display varchar (100), -- basedOn/display (100 x 1 varchar) +obs_status varchar (30), -- status (30 x 1 varchar) +obs_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +obs_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +obs_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +obs_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +obs_category_text varchar (500), -- category/text (500 x 1 varchar) +obs_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +obs_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +obs_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +obs_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +obs_code_text varchar (500), -- code/text (500 x 1 varchar) +obs_effectivedatetime varchar (30), -- effectiveDateTime (30 x 1 varchar) +obs_issued varchar (30), -- issued (30 x 1 varchar) +obs_valuerange_low_value varchar (20), -- valueRange/low/value (10 x 2 varchar) +obs_valuerange_low_unit varchar (60), -- valueRange/low/unit (30 x 2 varchar) +obs_valuerange_low_system varchar (140), -- valueRange/low/system (70 x 2 varchar) +obs_valuerange_low_code varchar (60), -- valueRange/low/code (30 x 2 varchar) +obs_valuerange_high_value varchar (20), -- valueRange/high/value (10 x 2 varchar) +obs_valuerange_high_unit varchar (60), -- valueRange/high/unit (30 x 2 varchar) +obs_valuerange_high_system varchar (140), -- valueRange/high/system (70 x 2 varchar) +obs_valuerange_high_code varchar (60), -- valueRange/high/code (30 x 2 varchar) +obs_valueratio_numerator_value varchar (20), -- valueRatio/numerator/value (10 x 2 varchar) +obs_valueratio_numerator_comparator varchar (20), -- valueRatio/numerator/comparator (10 x 2 varchar) +obs_valueratio_numerator_unit varchar (60), -- valueRatio/numerator/unit (30 x 2 varchar) +obs_valueratio_numerator_system varchar (140), -- valueRatio/numerator/system (70 x 2 varchar) +obs_valueratio_numerator_code varchar (60), -- valueRatio/numerator/code (30 x 2 varchar) +obs_valueratio_denominator_value varchar (20), -- valueRatio/denominator/value (10 x 2 varchar) +obs_valueratio_denominator_comparator varchar (20), -- valueRatio/denominator/comparator (10 x 2 varchar) +obs_valueratio_denominator_unit varchar (60), -- valueRatio/denominator/unit (30 x 2 varchar) +obs_valueratio_denominator_system varchar (140), -- valueRatio/denominator/system (70 x 2 varchar) +obs_valueratio_denominator_code varchar (60), -- valueRatio/denominator/code (30 x 2 varchar) +obs_valuequantity_value varchar (20), -- valueQuantity/value (10 x 2 varchar) +obs_valuequantity_comparator varchar (20), -- valueQuantity/comparator (10 x 2 varchar) +obs_valuequantity_unit varchar (60), -- valueQuantity/unit (30 x 2 varchar) +obs_valuequantity_system varchar (140), -- valueQuantity/system (70 x 2 varchar) +obs_valuequantity_code varchar (60), -- valueQuantity/code (30 x 2 varchar) +obs_valuecodableconcept_system varchar (420), -- valueCodableConcept/coding/system (70 x 6 varchar) +obs_valuecodableconcept_version varchar (300), -- valueCodableConcept/coding/version (50 x 6 varchar) +obs_valuecodableconcept_code varchar (180), -- valueCodableConcept/coding/code (30 x 6 varchar) +obs_valuecodableconcept_display varchar (600), -- valueCodableConcept/coding/display (100 x 6 varchar) +obs_valuecodableconcept_text varchar (1000), -- valueCodableConcept/text (500 x 2 varchar) +obs_dataabsentreason_system varchar (70), -- dataAbsentReason/coding/system (70 x 1 varchar) +obs_dataabsentreason_version varchar (50), -- dataAbsentReason/coding/version (50 x 1 varchar) +obs_dataabsentreason_code varchar (30), -- dataAbsentReason/coding/code (30 x 1 varchar) +obs_dataabsentreason_display varchar (100), -- dataAbsentReason/coding/display (100 x 1 varchar) +obs_dataabsentreason_text varchar (500), -- dataAbsentReason/text (500 x 1 varchar) +obs_note_authorstring varchar (50), -- note/authorString (50 x 1 varchar) +obs_note_authorreference_id varchar (70), -- note/authorReference/reference (70 x 1 varchar) +obs_note_authorreference_type varchar (30), -- note/authorReference/type (30 x 1 varchar) +obs_note_authorreference_identifier_use varchar (30), -- note/authorReference/identifier/use (30 x 1 varchar) +obs_note_authorreference_identifier_type_system varchar (70), -- note/authorReference/identifier/type/coding/system (70 x 1 varchar) +obs_note_authorreference_identifier_type_version varchar (50), -- note/authorReference/identifier/type/coding/version (50 x 1 varchar) +obs_note_authorreference_identifier_type_code varchar (30), -- note/authorReference/identifier/type/coding/code (30 x 1 varchar) +obs_note_authorreference_identifier_type_display varchar (100), -- note/authorReference/identifier/type/coding/display (100 x 1 varchar) +obs_note_authorreference_identifier_type_text varchar (500), -- note/authorReference/identifier/type/text (500 x 1 varchar) +obs_note_authorreference_display varchar (100), -- note/authorReference/display (100 x 1 varchar) +obs_note_time varchar (30), -- note/time (30 x 1 varchar) +obs_note_text varchar (5000), -- note/text (5000 x 1 varchar) +obs_method_codableconcept varchar (100), -- method/CodableConcept (100 x 1 varchar) +obs_performer_id varchar (70), -- performer/reference (70 x 1 varchar) +obs_performer_type varchar (30), -- performer/type (30 x 1 varchar) +obs_performer_identifier_use varchar (30), -- performer/identifier/use (30 x 1 varchar) +obs_performer_identifier_type_system varchar (70), -- performer/identifier/type/coding/system (70 x 1 varchar) +obs_performer_identifier_type_version varchar (50), -- performer/identifier/type/coding/version (50 x 1 varchar) +obs_performer_identifier_type_code varchar (30), -- performer/identifier/type/coding/code (30 x 1 varchar) +obs_performer_identifier_type_display varchar (100), -- performer/identifier/type/coding/display (100 x 1 varchar) +obs_performer_identifier_type_text varchar (500), -- performer/identifier/type/text (500 x 1 varchar) +obs_performer_display varchar (100), -- performer/display (100 x 1 varchar) +obs_referencerange_low_value varchar (30), -- referenceRange/low/value (10 x 3 varchar) +obs_referencerange_low_unit varchar (90), -- referenceRange/low/unit (30 x 3 varchar) +obs_referencerange_low_system varchar (210), -- referenceRange/low/system (70 x 3 varchar) +obs_referencerange_low_code varchar (90), -- referenceRange/low/code (30 x 3 varchar) +obs_referencerange_high_value varchar (30), -- referenceRange/high/value (10 x 3 varchar) +obs_referencerange_high_unit varchar (90), -- referenceRange/high/unit (30 x 3 varchar) +obs_referencerange_high_system varchar (210), -- referenceRange/high/system (70 x 3 varchar) +obs_referencerange_high_code varchar (90), -- referenceRange/high/code (30 x 3 varchar) +obs_referencerange_type_codableconcept varchar (300), -- referenceRange/type/CodableConcept (100 x 3 varchar) +obs_referencerange_appliesto_system varchar (630), -- referenceRange/appliesTo/coding/system (70 x 9 varchar) +obs_referencerange_appliesto_version varchar (450), -- referenceRange/appliesTo/coding/version (50 x 9 varchar) +obs_referencerange_appliesto_code varchar (270), -- referenceRange/appliesTo/coding/code (30 x 9 varchar) +obs_referencerange_appliesto_display varchar (900), -- referenceRange/appliesTo/coding/display (100 x 9 varchar) +obs_referencerange_appliesto_text varchar (1500), -- referenceRange/appliesTo/text (500 x 3 varchar) +obs_referencerange_age_low_value varchar (30), -- referenceRange/age/low/value (10 x 3 varchar) +obs_referencerange_age_low_unit varchar (90), -- referenceRange/age/low/unit (30 x 3 varchar) +obs_referencerange_age_low_system varchar (210), -- referenceRange/age/low/system (70 x 3 varchar) +obs_referencerange_age_low_code varchar (90), -- referenceRange/age/low/code (30 x 3 varchar) +obs_referencerange_age_high_value varchar (30), -- referenceRange/age/high/value (10 x 3 varchar) +obs_referencerange_age_high_unit varchar (90), -- referenceRange/age/high/unit (30 x 3 varchar) +obs_referencerange_age_high_system varchar (210), -- referenceRange/age/high/system (70 x 3 varchar) +obs_referencerange_age_high_code varchar (90), -- referenceRange/age/high/code (30 x 3 varchar) +obs_referencerange_text varchar (500), -- referenceRange/text (500 x 1 varchar) +obs_hasmember_id varchar (70), -- hasMember/reference (70 x 1 varchar) +obs_hasmember_type varchar (30), -- hasMember/type (30 x 1 varchar) +obs_hasmember_identifier_use varchar (30), -- hasMember/identifier/use (30 x 1 varchar) +obs_hasmember_identifier_type_system varchar (70), -- hasMember/identifier/type/coding/system (70 x 1 varchar) +obs_hasmember_identifier_type_version varchar (50), -- hasMember/identifier/type/coding/version (50 x 1 varchar) +obs_hasmember_identifier_type_code varchar (30), -- hasMember/identifier/type/coding/code (30 x 1 varchar) +obs_hasmember_identifier_type_display varchar (100), -- hasMember/identifier/type/coding/display (100 x 1 varchar) +obs_hasmember_identifier_type_text varchar (500), -- hasMember/identifier/type/text (500 x 1 varchar) +obs_hasmember_display varchar (100), -- hasMember/display (100 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.diagnosticreport ( +diagnosticreport_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +diagrep_id varchar (70), -- id (70 x 1 varchar) +diagrep_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +diagrep_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +diagrep_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +diagrep_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +diagrep_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +diagrep_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +diagrep_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +diagrep_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +diagrep_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +diagrep_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +diagrep_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +diagrep_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +diagrep_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +diagrep_result_id varchar (70), -- result/reference (70 x 1 varchar) +diagrep_basedon_id varchar (100), -- basedOn/reference (100 x 1 varchar) +diagrep_status varchar (30), -- status (30 x 1 varchar) +diagrep_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +diagrep_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +diagrep_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +diagrep_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +diagrep_category_text varchar (500), -- category/text (500 x 1 varchar) +diagrep_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +diagrep_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +diagrep_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +diagrep_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +diagrep_code_text varchar (500), -- code/text (500 x 1 varchar) +diagrep_effectivedatetime varchar (30), -- effectiveDateTime (30 x 1 varchar) +diagrep_issued varchar (30), -- issued (30 x 1 varchar) +diagrep_performer_id varchar (70), -- performer/reference (70 x 1 varchar) +diagrep_performer_type varchar (30), -- performer/type (30 x 1 varchar) +diagrep_performer_identifier_use varchar (30), -- performer/identifier/use (30 x 1 varchar) +diagrep_performer_identifier_type_system varchar (70), -- performer/identifier/type/coding/system (70 x 1 varchar) +diagrep_performer_identifier_type_version varchar (50), -- performer/identifier/type/coding/version (50 x 1 varchar) +diagrep_performer_identifier_type_code varchar (30), -- performer/identifier/type/coding/code (30 x 1 varchar) +diagrep_performer_identifier_type_display varchar (100), -- performer/identifier/type/coding/display (100 x 1 varchar) +diagrep_performer_identifier_type_text varchar (500), -- performer/identifier/type/text (500 x 1 varchar) +diagrep_performer_display varchar (100), -- performer/display (100 x 1 varchar) +diagrep_conclusion varchar (500), -- conclusion (500 x 1 varchar) +diagrep_conclusioncode_system varchar (70), -- conclusionCode/coding/system (70 x 1 varchar) +diagrep_conclusioncode_version varchar (50), -- conclusionCode/coding/version (50 x 1 varchar) +diagrep_conclusioncode_code varchar (30), -- conclusionCode/coding/code (30 x 1 varchar) +diagrep_conclusioncode_display varchar (100), -- conclusionCode/coding/display (100 x 1 varchar) +diagrep_conclusioncode_text varchar (500), -- conclusionCode/text (500 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.servicerequest ( +servicerequest_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +servreq_id varchar (70), -- id (70 x 1 varchar) +servreq_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +servreq_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +servreq_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +servreq_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +servreq_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +servreq_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +servreq_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +servreq_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +servreq_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +servreq_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +servreq_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +servreq_basedon_id varchar (70), -- basedOn/reference (70 x 1 varchar) +servreq_basedon_type varchar (30), -- basedOn/type (30 x 1 varchar) +servreq_basedon_identifier_use varchar (30), -- basedOn/identifier/use (30 x 1 varchar) +servreq_basedon_identifier_type_system varchar (70), -- basedOn/identifier/type/coding/system (70 x 1 varchar) +servreq_basedon_identifier_type_version varchar (50), -- basedOn/identifier/type/coding/version (50 x 1 varchar) +servreq_basedon_identifier_type_code varchar (30), -- basedOn/identifier/type/coding/code (30 x 1 varchar) +servreq_basedon_identifier_type_display varchar (100), -- basedOn/identifier/type/coding/display (100 x 1 varchar) +servreq_basedon_identifier_type_text varchar (500), -- basedOn/identifier/type/text (500 x 1 varchar) +servreq_basedon_display varchar (100), -- basedOn/display (100 x 1 varchar) +servreq_status varchar (30), -- status (30 x 1 varchar) +servreq_intent varchar (30), -- intent (30 x 1 varchar) +servreq_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +servreq_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +servreq_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +servreq_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +servreq_category_text varchar (500), -- category/text (500 x 1 varchar) +servreq_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +servreq_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +servreq_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +servreq_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +servreq_code_text varchar (500), -- code/text (500 x 1 varchar) +servreq_authoredon varchar (30), -- authoredOn (30 x 1 varchar) +servreq_requester_id varchar (70), -- requester/reference (70 x 1 varchar) +servreq_requester_type varchar (30), -- requester/type (30 x 1 varchar) +servreq_requester_identifier_use varchar (30), -- requester/identifier/use (30 x 1 varchar) +servreq_requester_identifier_type_system varchar (70), -- requester/identifier/type/coding/system (70 x 1 varchar) +servreq_requester_identifier_type_version varchar (50), -- requester/identifier/type/coding/version (50 x 1 varchar) +servreq_requester_identifier_type_code varchar (30), -- requester/identifier/type/coding/code (30 x 1 varchar) +servreq_requester_identifier_type_display varchar (100), -- requester/identifier/type/coding/display (100 x 1 varchar) +servreq_requester_identifier_type_text varchar (500), -- requester/identifier/type/text (500 x 1 varchar) +servreq_requester_display varchar (100), -- requester/display (100 x 1 varchar) +servreq_performer_id varchar (70), -- performer/reference (70 x 1 varchar) +servreq_performer_type varchar (30), -- performer/type (30 x 1 varchar) +servreq_performer_identifier_use varchar (30), -- performer/identifier/use (30 x 1 varchar) +servreq_performer_identifier_type_system varchar (70), -- performer/identifier/type/coding/system (70 x 1 varchar) +servreq_performer_identifier_type_version varchar (50), -- performer/identifier/type/coding/version (50 x 1 varchar) +servreq_performer_identifier_type_code varchar (30), -- performer/identifier/type/coding/code (30 x 1 varchar) +servreq_performer_identifier_type_display varchar (100), -- performer/identifier/type/coding/display (100 x 1 varchar) +servreq_performer_identifier_type_text varchar (500), -- performer/identifier/type/text (500 x 1 varchar) +servreq_performer_display varchar (100), -- performer/display (100 x 1 varchar) +servreq_locationcode_system varchar (70), -- locationCode/coding/system (70 x 1 varchar) +servreq_locationcode_version varchar (50), -- locationCode/coding/version (50 x 1 varchar) +servreq_locationcode_code varchar (30), -- locationCode/coding/code (30 x 1 varchar) +servreq_locationcode_display varchar (100), -- locationCode/coding/display (100 x 1 varchar) +servreq_locationcode_text varchar (500), -- locationCode/text (500 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.procedure ( +procedure_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +proc_id varchar (70), -- id (70 x 1 varchar) +proc_encounter_id varchar (70), -- encounter/reference (70 x 1 varchar) +proc_patient_id varchar (70), -- subject/reference (70 x 1 varchar) +proc_partof_id varchar (70), -- partOf/reference (70 x 1 varchar) +proc_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +proc_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +proc_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +proc_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +proc_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +proc_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +proc_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +proc_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +proc_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +proc_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +proc_basedon_id varchar (70), -- basedOn/reference (70 x 1 varchar) +proc_basedon_type varchar (30), -- basedOn/type (30 x 1 varchar) +proc_basedon_identifier_use varchar (30), -- basedOn/identifier/use (30 x 1 varchar) +proc_basedon_identifier_type_system varchar (70), -- basedOn/identifier/type/coding/system (70 x 1 varchar) +proc_basedon_identifier_type_version varchar (50), -- basedOn/identifier/type/coding/version (50 x 1 varchar) +proc_basedon_identifier_type_code varchar (30), -- basedOn/identifier/type/coding/code (30 x 1 varchar) +proc_basedon_identifier_type_display varchar (100), -- basedOn/identifier/type/coding/display (100 x 1 varchar) +proc_basedon_identifier_type_text varchar (500), -- basedOn/identifier/type/text (500 x 1 varchar) +proc_basedon_display varchar (100), -- basedOn/display (100 x 1 varchar) +proc_status varchar (30), -- status (30 x 1 varchar) +proc_statusreason_system varchar (70), -- statusReason/coding/system (70 x 1 varchar) +proc_statusreason_version varchar (50), -- statusReason/coding/version (50 x 1 varchar) +proc_statusreason_code varchar (30), -- statusReason/coding/code (30 x 1 varchar) +proc_statusreason_display varchar (100), -- statusReason/coding/display (100 x 1 varchar) +proc_statusreason_text varchar (500), -- statusReason/text (500 x 1 varchar) +proc_category_system varchar (70), -- category/coding/system (70 x 1 varchar) +proc_category_version varchar (50), -- category/coding/version (50 x 1 varchar) +proc_category_code varchar (30), -- category/coding/code (30 x 1 varchar) +proc_category_display varchar (100), -- category/coding/display (100 x 1 varchar) +proc_category_text varchar (500), -- category/text (500 x 1 varchar) +proc_code_system varchar (70), -- code/coding/system (70 x 1 varchar) +proc_code_version varchar (50), -- code/coding/version (50 x 1 varchar) +proc_code_code varchar (30), -- code/coding/code (30 x 1 varchar) +proc_code_display varchar (100), -- code/coding/display (100 x 1 varchar) +proc_code_text varchar (500), -- code/text (500 x 1 varchar) +proc_performeddatetime varchar (30), -- performedDateTime (30 x 1 varchar) +proc_performedperiod_start varchar (30), -- performedPeriod/start (30 x 1 varchar) +proc_performedperiod_end varchar (30), -- performedPeriod/end (30 x 1 varchar) +proc_reasoncode_system varchar (70), -- reasonCode/coding/system (70 x 1 varchar) +proc_reasoncode_version varchar (50), -- reasonCode/coding/version (50 x 1 varchar) +proc_reasoncode_code varchar (30), -- reasonCode/coding/code (30 x 1 varchar) +proc_reasoncode_display varchar (100), -- reasonCode/coding/display (100 x 1 varchar) +proc_reasoncode_text varchar (500), -- reasonCode/text (500 x 1 varchar) +proc_reasonreference_id varchar (70), -- reasonReference/reference (70 x 1 varchar) +proc_reasonreference_type varchar (30), -- reasonReference/type (30 x 1 varchar) +proc_reasonreference_identifier_use varchar (30), -- reasonReference/identifier/use (30 x 1 varchar) +proc_reasonreference_identifier_type_system varchar (70), -- reasonReference/identifier/type/coding/system (70 x 1 varchar) +proc_reasonreference_identifier_type_version varchar (50), -- reasonReference/identifier/type/coding/version (50 x 1 varchar) +proc_reasonreference_identifier_type_code varchar (30), -- reasonReference/identifier/type/coding/code (30 x 1 varchar) +proc_reasonreference_identifier_type_display varchar (100), -- reasonReference/identifier/type/coding/display (100 x 1 varchar) +proc_reasonreference_identifier_type_text varchar (500), -- reasonReference/identifier/type/text (500 x 1 varchar) +proc_reasonreference_display varchar (100), -- reasonReference/display (100 x 1 varchar) +proc_note_authorstring varchar (300), -- note/authorString (50 x 6 varchar) +proc_note_authorreference_id varchar (420), -- note/authorReference/reference (70 x 6 varchar) +proc_note_authorreference_type varchar (180), -- note/authorReference/type (30 x 6 varchar) +proc_note_authorreference_identifier_use varchar (180), -- note/authorReference/identifier/use (30 x 6 varchar) +proc_note_authorreference_identifier_type_system varchar (1260), -- note/authorReference/identifier/type/coding/system (70 x 18 varchar) +proc_note_authorreference_identifier_type_version varchar (900), -- note/authorReference/identifier/type/coding/version (50 x 18 varchar) +proc_note_authorreference_identifier_type_code varchar (540), -- note/authorReference/identifier/type/coding/code (30 x 18 varchar) +proc_note_authorreference_identifier_type_display varchar (1800), -- note/authorReference/identifier/type/coding/display (100 x 18 varchar) +proc_note_authorreference_identifier_type_text varchar (3000), -- note/authorReference/identifier/type/text (500 x 6 varchar) +proc_note_authorreference_display varchar (600), -- note/authorReference/display (100 x 6 varchar) +proc_note_time varchar (60), -- note/time (30 x 2 varchar) +proc_note_text varchar (10000), -- note/text (5000 x 2 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.consent ( +consent_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +cons_id varchar (70), -- id (70 x 1 varchar) +cons_patient_id varchar (70), -- patient/reference (70 x 1 varchar) +cons_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +cons_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +cons_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +cons_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +cons_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +cons_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +cons_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +cons_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +cons_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +cons_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +cons_status varchar (30), -- status (30 x 1 varchar) +cons_scope_system varchar (70), -- scope/coding/system (70 x 1 varchar) +cons_scope_version varchar (50), -- scope/coding/version (50 x 1 varchar) +cons_scope_code varchar (30), -- scope/coding/code (30 x 1 varchar) +cons_scope_display varchar (100), -- scope/coding/display (100 x 1 varchar) +cons_scope_text varchar (500), -- scope/text (500 x 1 varchar) +cons_datetime varchar (30), -- dateTime (30 x 1 varchar) +cons_provision_type varchar (10), -- provision/type (10 x 1 varchar) +cons_provision_period_start varchar (30), -- provision/period/start (30 x 1 varchar) +cons_provision_period_end varchar (30), -- provision/period/end (30 x 1 varchar) +cons_provision_actor_role_system varchar (70), -- provision/actor/role/coding/system (70 x 1 varchar) +cons_provision_actor_role_version varchar (50), -- provision/actor/role/coding/version (50 x 1 varchar) +cons_provision_actor_role_code varchar (30), -- provision/actor/role/coding/code (30 x 1 varchar) +cons_provision_actor_role_display varchar (100), -- provision/actor/role/coding/display (100 x 1 varchar) +cons_provision_actor_role_text varchar (500), -- provision/actor/role/text (500 x 1 varchar) +cons_provision_code_system varchar (70), -- provision/code/coding/system (70 x 1 varchar) +cons_provision_code_version varchar (50), -- provision/code/coding/version (50 x 1 varchar) +cons_provision_code_code varchar (30), -- provision/code/coding/code (30 x 1 varchar) +cons_provision_code_display varchar (100), -- provision/code/coding/display (100 x 1 varchar) +cons_provision_code_text varchar (500), -- provision/code/text (500 x 1 varchar) +cons_provision_dataperiod_start varchar (30), -- provision/dataPeriod/start (30 x 1 varchar) +cons_provision_dataperiod_end varchar (30), -- provision/dataPeriod/end (30 x 1 varchar) +input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird +last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde +current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes +); + +CREATE TABLE IF NOT EXISTS db.location ( +location_id serial PRIMARY KEY not null, -- Primärschlüssel der Entität +loc_id varchar (70), -- id (70 x 1 varchar) +loc_identifier_use varchar (100), -- identifier/use (50 x 2 varchar) +loc_identifier_type_system varchar (420), -- identifier/type/coding/system (70 x 6 varchar) +loc_identifier_type_version varchar (300), -- identifier/type/coding/version (50 x 6 varchar) +loc_identifier_type_code varchar (180), -- identifier/type/coding/code (30 x 6 varchar) +loc_identifier_type_display varchar (600), -- identifier/type/coding/display (100 x 6 varchar) +loc_identifier_type_text varchar (1000), -- identifier/type/text (500 x 2 varchar) +loc_identifier_system varchar (140), -- identifier/system (70 x 2 varchar) +loc_identifier_value varchar (140), -- identifier/value (70 x 2 varchar) +loc_identifier_start varchar (60), -- identifier/start (30 x 2 varchar) +loc_identifier_end varchar (60), -- identifier/end (30 x 2 varchar) +loc_status varchar (30), -- status (30 x 1 varchar) +loc_name varchar (50), -- name (50 x 1 varchar) +loc_description varchar (50), -- description (50 x 1 varchar) +loc_alias varchar (90), -- alias (30 x 3 varchar) input_datetime timestamp not null default CURRENT_TIMESTAMP, -- Zeitpunkt an dem der Datensatz eingefügt wird last_check_datetime timestamp DEFAULT NULL, -- Zeitpunkt an dem Datensatz zuletzt Überprüft wurde current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Datensatzes @@ -434,9 +3982,13 @@ current_dataset_status varchar(50) DEFAULT 'input' -- Bearbeitungstatus des Da --SQL Role / Trigger in Schema db --GRANT INSERT, SELECT ON TABLE db.encounter TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.encounter TO db_user; -- zum Testen weitere Berechtigungen GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.encounter TO db_user; -- Entwicklungsphase GRANT TRIGGER ON db.encounter TO db_user; ALTER TABLE db.encounter ALTER COLUMN encounter_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + CREATE OR REPLACE FUNCTION db.encounter_tr_ins_fkt() RETURNS TRIGGER AS $$ @@ -453,10 +4005,15 @@ CREATE OR REPLACE TRIGGER encounter_tr_ins_tr FOR EACH ROW EXECUTE PROCEDURE db.encounter_tr_ins_fkt(); ---GRANT INSERT, SELECT ON TABLE db.patient TO 100; -- nach Entwicklungsphase + +--GRANT INSERT, SELECT ON TABLE db.patient TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.patient TO db_user; -- zum Testen weitere Berechtigungen GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.patient TO db_user; -- Entwicklungsphase GRANT TRIGGER ON db.patient TO db_user; ALTER TABLE db.patient ALTER COLUMN patient_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + CREATE OR REPLACE FUNCTION db.patient_tr_ins_fkt() RETURNS TRIGGER AS $$ @@ -474,110 +4031,1514 @@ CREATE OR REPLACE TRIGGER patient_tr_ins_tr EXECUTE PROCEDURE db.patient_tr_ins_fkt(); +--GRANT INSERT, SELECT ON TABLE db.condition TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.condition TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.condition TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.condition TO db_user; +ALTER TABLE db.condition ALTER COLUMN condition_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.condition_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER condition_tr_ins_tr + BEFORE INSERT + ON db.condition + FOR EACH ROW + EXECUTE PROCEDURE db.condition_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE db.medication TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.medication TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.medication TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.medication TO db_user; +ALTER TABLE db.medication ALTER COLUMN medication_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.medication_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER medication_tr_ins_tr + BEFORE INSERT + ON db.medication + FOR EACH ROW + EXECUTE PROCEDURE db.medication_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE db.medicationrequest TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.medicationrequest TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.medicationrequest TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.medicationrequest TO db_user; +ALTER TABLE db.medicationrequest ALTER COLUMN medicationrequest_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.medicationrequest_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER medicationrequest_tr_ins_tr + BEFORE INSERT + ON db.medicationrequest + FOR EACH ROW + EXECUTE PROCEDURE db.medicationrequest_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE db.medicationadministration TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.medicationadministration TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.medicationadministration TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.medicationadministration TO db_user; +ALTER TABLE db.medicationadministration ALTER COLUMN medicationadministration_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.medicationadministration_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER medicationadministration_tr_ins_tr + BEFORE INSERT + ON db.medicationadministration + FOR EACH ROW + EXECUTE PROCEDURE db.medicationadministration_tr_ins_fkt(); + +--GRANT INSERT, SELECT ON TABLE db.medicationstatement TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.medicationstatement TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.medicationstatement TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.medicationstatement TO db_user; +ALTER TABLE db.medicationstatement ALTER COLUMN medicationstatement_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.medicationstatement_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER medicationstatement_tr_ins_tr + BEFORE INSERT + ON db.medicationstatement + FOR EACH ROW + EXECUTE PROCEDURE db.medicationstatement_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE db.observation TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.observation TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.observation TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.observation TO db_user; +ALTER TABLE db.observation ALTER COLUMN observation_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.observation_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER observation_tr_ins_tr + BEFORE INSERT + ON db.observation + FOR EACH ROW + EXECUTE PROCEDURE db.observation_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE db.diagnosticreport TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.diagnosticreport TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.diagnosticreport TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.diagnosticreport TO db_user; +ALTER TABLE db.diagnosticreport ALTER COLUMN diagnosticreport_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.diagnosticreport_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER diagnosticreport_tr_ins_tr + BEFORE INSERT + ON db.diagnosticreport + FOR EACH ROW + EXECUTE PROCEDURE db.diagnosticreport_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE db.servicerequest TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.servicerequest TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.servicerequest TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.servicerequest TO db_user; +ALTER TABLE db.servicerequest ALTER COLUMN servicerequest_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.servicerequest_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER servicerequest_tr_ins_tr + BEFORE INSERT + ON db.servicerequest + FOR EACH ROW + EXECUTE PROCEDURE db.servicerequest_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE db.procedure TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.procedure TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.procedure TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.procedure TO db_user; +ALTER TABLE db.procedure ALTER COLUMN procedure_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.procedure_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER procedure_tr_ins_tr + BEFORE INSERT + ON db.procedure + FOR EACH ROW + EXECUTE PROCEDURE db.procedure_tr_ins_fkt(); + + +--GRANT INSERT, SELECT ON TABLE db.consent TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.consent TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.consent TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.consent TO db_user; +ALTER TABLE db.consent ALTER COLUMN consent_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.consent_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER consent_tr_ins_tr + BEFORE INSERT + ON db.consent + FOR EACH ROW + EXECUTE PROCEDURE db.consent_tr_ins_fkt(); + +--GRANT INSERT, SELECT ON TABLE db.location TO db_user; -- nach Entwicklungsphase +GRANT INSERT, DELETE, UPDATE, SELECT ON TABLE db.location TO db_user; -- zum Testen weitere Berechtigungen +GRANT INSERT,SELECT, UPDATE, DELETE ON TABLE db.location TO db_user; -- Entwicklungsphase +GRANT TRIGGER ON db.location TO db_user; +ALTER TABLE db.location ALTER COLUMN location_id SET DEFAULT (nextval('db.db_seq')); +GRANT USAGE ON SCHEMA db TO db_user; +GRANT USAGE ON db.db_seq TO db_user; + + +CREATE OR REPLACE FUNCTION db.location_tr_ins_fkt() +RETURNS TRIGGER AS $$ +BEGIN + -- Eintragen des aktuellen Zeitpunkts + NEW.input_datetime := CURRENT_TIMESTAMP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE TRIGGER location_tr_ins_tr + BEFORE INSERT + ON db.location + FOR EACH ROW + EXECUTE PROCEDURE db.location_tr_ins_fkt(); + + -- Comment on Table in Schema db comment on column db.encounter.enc_id is 'id (70 x 1 70)'; -comment on column db.encounter.enc_pat_id is 'subject/reference (70 x 1 70)'; +comment on column db.encounter.enc_patient_id is 'subject/reference (70 x 1 70)'; comment on column db.encounter.enc_partof_id is 'partOf/reference (70 x 1 70)'; -comment on column db.encounter.enc_identifier_use is 'identifier/use (30 x 3 90)'; -comment on column db.encounter.enc_identifier_type_system is 'identifier/type/coding/system (70 x 3 210)'; -comment on column db.encounter.enc_identifier_type_version is 'identifier/type/coding/version (50 x 3 150)'; -comment on column db.encounter.enc_identifier_type_code is 'identifier/type/coding/code (30 x 3 90)'; -comment on column db.encounter.enc_identifier_type_display is 'identifier/type/coding/display (100 x 3 300)'; -comment on column db.encounter.enc_identifier_type_text is 'identifier/type/text (500 x 3 1500)'; -comment on column db.encounter.enc_identifier_system is 'identifier/system (70 x 3 210)'; -comment on column db.encounter.enc_identifier_value is 'identifier/value (50 x 3 150)'; -comment on column db.encounter.enc_identifier_period_start is 'identifier/period/start (30 x 3 90)'; -comment on column db.encounter.enc_identifier_period_end is 'identifier/period/end (30 x 3 90)'; -comment on column db.encounter.enc_identifier_assigner_id is 'identifier/assigner/reference (50 x 3 150)'; -comment on column db.encounter.enc_identifier_assigner_type is 'identifier/assigner/type (30 x 3 90)'; -comment on column db.encounter.enc_identifier_assigner_identifier_type_use is 'identifier/assigner/identifier/use (20 x 3 60)'; -comment on column db.encounter.enc_identifier_assigner_identifier_type_system is 'identifier/assigner/identifier/type/coding/system (70 x 3 210)'; -comment on column db.encounter.enc_identifier_assigner_identifier_type_version is 'identifier/assigner/identifier/type/coding/version (30 x 3 90)'; -comment on column db.encounter.enc_identifier_assigner_identifier_type_code is 'identifier/assigner/identifier/type/coding/code (30 x 3 90)'; -comment on column db.encounter.enc_identifier_assigner_identifier_type_display is 'identifier/assigner/identifier/type/coding/display (100 x 3 300)'; -comment on column db.encounter.enc_identifier_assigner_identifier_type_text is 'identifier/assigner/identifier/type/text (500 x 3 1500)'; -comment on column db.encounter.enc_identifier_assigner_identifier_system is 'identifier/assigner/identifier/system (50 x 3 150)'; -comment on column db.encounter.enc_identifier_assigner_identifier_value is 'identifier/assigner/identifier/value (100 x 3 300)'; -comment on column db.encounter.enc_identifier_assigner_identifier_period_start is 'identifier/assigner/identifier/period/start (30 x 3 90)'; -comment on column db.encounter.enc_identifier_assigner_identifier_period_end is 'identifier/assigner/identifier/period/end (30 x 3 90)'; -comment on column db.encounter.enc_status is 'status (20 x 1 20)'; -comment on column db.encounter.enc_class_system is 'class/system (70 x 1 70)'; -comment on column db.encounter.enc_class_version is 'class/version (30 x 1 30)'; -comment on column db.encounter.enc_class_code is 'class/code (30 x 1 30)'; -comment on column db.encounter.enc_class_display is 'class/display (100 x 1 100)'; -comment on column db.encounter.enc_type_system is 'type/coding/system (70 x 10 700)'; -comment on column db.encounter.enc_type_version is 'type/coding/version (30 x 10 300)'; -comment on column db.encounter.enc_type_code is 'type/coding/code (30 x 10 300)'; -comment on column db.encounter.enc_type_display is 'type/coding/display (50 x 10 500)'; -comment on column db.encounter.enc_type_text is 'type/text (300 x 10 3000)'; -comment on column db.encounter.enc_servicetype_system is 'serviceType/coding/system (70 x 3 210)'; -comment on column db.encounter.enc_servicetype_version is 'serviceType/coding/version (30 x 3 90)'; -comment on column db.encounter.enc_servicetype_code is 'serviceType/coding/code (30 x 3 90)'; -comment on column db.encounter.enc_servicetype_display is 'serviceType/coding/display (100 x 3 300)'; +comment on column db.encounter.enc_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.encounter.enc_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.encounter.enc_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.encounter.enc_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.encounter.enc_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.encounter.enc_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.encounter.enc_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.encounter.enc_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.encounter.enc_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.encounter.enc_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.encounter.enc_status is 'status (30 x 1 30)'; +comment on column db.encounter.enc_class_system is 'class/coding/system (70 x 1 70)'; +comment on column db.encounter.enc_class_version is 'class/coding/version (50 x 1 50)'; +comment on column db.encounter.enc_class_code is 'class/coding/code (30 x 1 30)'; +comment on column db.encounter.enc_class_display is 'class/coding/display (100 x 1 100)'; +comment on column db.encounter.enc_type_system is 'type/coding/system (70 x 9 630)'; +comment on column db.encounter.enc_type_version is 'type/coding/version (50 x 9 450)'; +comment on column db.encounter.enc_type_code is 'type/coding/code (30 x 9 270)'; +comment on column db.encounter.enc_type_display is 'type/coding/display (100 x 9 900)'; +comment on column db.encounter.enc_type_text is 'type/text (500 x 3 1500)'; +comment on column db.encounter.enc_servicetype_system is 'serviceType/coding/system (70 x 1 70)'; +comment on column db.encounter.enc_servicetype_version is 'serviceType/coding/version (50 x 1 50)'; +comment on column db.encounter.enc_servicetype_code is 'serviceType/coding/code (30 x 1 30)'; +comment on column db.encounter.enc_servicetype_display is 'serviceType/coding/display (100 x 1 100)'; +comment on column db.encounter.enc_servicetype_text is 'serviceType/text (500 x 1 500)'; comment on column db.encounter.enc_period_start is 'period/start (30 x 1 30)'; comment on column db.encounter.enc_period_end is 'period/end (30 x 1 30)'; -comment on column db.encounter.enc_diagnosis_condition_id is 'diagnosis/condition/reference (70 x 15 1050)'; -comment on column db.encounter.enc_diagnosis_use_system is 'diagnosis/use/coding/system (70 x 15 1050)'; -comment on column db.encounter.enc_diagnosis_use_version is 'diagnosis/use/coding/version (30 x 15 450)'; -comment on column db.encounter.enc_diagnosis_use_code is 'diagnosis/use/coding/code (30 x 15 450)'; -comment on column db.encounter.enc_diagnosis_use_display is 'diagnosis/use/coding/display (100 x 15 1500)'; -comment on column db.encounter.enc_diagnosis_use_text is 'diagnosis/use/text (500 x 15 7500)'; -comment on column db.encounter.enc_diagnosis_rank is 'diagnosis/rank (5 x 15 75)'; -comment on column db.encounter.enc_hospitalization_admitsource_system is 'hospitalization/admitSource/coding/system (70 x 2 140)'; -comment on column db.encounter.enc_hospitalization_admitsource_version is 'hospitalization/admitSource/coding/version (30 x 2 60)'; -comment on column db.encounter.enc_hospitalization_admitsource_code is 'hospitalization/admitSource/coding/code (30 x 2 60)'; -comment on column db.encounter.enc_hospitalization_admitsource_display is 'hospitalization/admitSource/coding/display (100 x 2 200)'; -comment on column db.encounter.enc_hospitalization_admitsource_text is 'hospitalization/admitSource/text (500 x 2 1000)'; -comment on column db.encounter.enc_hospitalization_dischargedisposition_system is 'hospitalization/dischargeDisposition/coding/system (70 x 2 140)'; -comment on column db.encounter.enc_hospitalization_dischargedisposition_version is 'hospitalization/dischargeDisposition/coding/version (30 x 2 60)'; -comment on column db.encounter.enc_hospitalization_dischargedisposition_code is 'hospitalization/dischargeDisposition/coding/code (30 x 2 60)'; -comment on column db.encounter.enc_hospitalization_dischargedisposition_display is 'hospitalization/dischargeDisposition/coding/display (100 x 2 200)'; -comment on column db.encounter.enc_hospitalization_dischargedisposition_text is 'hospitalization/dischargeDisposition/text (500 x 2 1000)'; -comment on column db.encounter.enc_location_id is 'location/location/reference (70 x 3 210)'; -comment on column db.encounter.enc_location_type is 'location/location/type (50 x 3 150)'; -comment on column db.encounter.enc_location_identifier_type_use is 'location/location/identifier/use (30 x 3 90)'; -comment on column db.encounter.enc_location_identifier_type_system is 'location/location/identifier/type/coding/system (70 x 3 210)'; -comment on column db.encounter.enc_location_identifier_type_version is 'location/location/identifier/type/coding/version (50 x 3 150)'; -comment on column db.encounter.enc_location_identifier_type_code is 'location/location/identifier/type/coding/code (30 x 3 90)'; -comment on column db.encounter.enc_location_identifier_type_display is 'location/location/identifier/type/coding/display (100 x 3 300)'; -comment on column db.encounter.enc_location_identifier_type_text is 'location/location/identifier/type/text (500 x 3 1500)'; -comment on column db.encounter.enc_location_identifier_system is 'location/location/identifier/system (70 x 3 210)'; -comment on column db.encounter.enc_location_identifier_value is 'location/location/identifier/value (50 x 3 150)'; -comment on column db.encounter.enc_location_identifier_period_start is 'location/location/identifier/period/start (30 x 3 90)'; -comment on column db.encounter.enc_location_identifier_period_end is 'location/location/identifier/period/end (30 x 3 90)'; -comment on column db.encounter.enc_location_display is 'location/location/display (50 x 3 150)'; -comment on column db.encounter.enc_location_physicaltype_system is 'location/location/physicalType/coding/system (70 x 3 210)'; -comment on column db.encounter.enc_location_physicaltype_version is 'location/location/physicalType/coding/version (30 x 3 90)'; -comment on column db.encounter.enc_location_physicaltype_code is 'location/location/physicalType/coding/code (50 x 3 150)'; -comment on column db.encounter.enc_location_physicaltype_display is 'location/location/physicalType/coding/display (100 x 3 300)'; -comment on column db.encounter.enc_location_physicaltype_text is 'location/location/physicalType/text (500 x 3 1500)'; +comment on column db.encounter.enc_diagnosis_condition_id is 'diagnosis/condition/reference (70 x 7 490)'; +comment on column db.encounter.enc_diagnosis_use_system is 'diagnosis/use/coding/system (70 x 21 1470)'; +comment on column db.encounter.enc_diagnosis_use_version is 'diagnosis/use/coding/version (50 x 21 1050)'; +comment on column db.encounter.enc_diagnosis_use_code is 'diagnosis/use/coding/code (30 x 21 630)'; +comment on column db.encounter.enc_diagnosis_use_display is 'diagnosis/use/coding/display (100 x 21 2100)'; +comment on column db.encounter.enc_diagnosis_use_text is 'diagnosis/use/text (500 x 7 3500)'; +comment on column db.encounter.enc_diagnosis_rank is 'diagnosis/rank (2 x 7 14)'; +comment on column db.encounter.enc_hospitalization_admitsource_system is 'hospitalization/admitSource/coding/system (70 x 1 70)'; +comment on column db.encounter.enc_hospitalization_admitsource_version is 'hospitalization/admitSource/coding/version (50 x 1 50)'; +comment on column db.encounter.enc_hospitalization_admitsource_code is 'hospitalization/admitSource/coding/code (30 x 1 30)'; +comment on column db.encounter.enc_hospitalization_admitsource_display is 'hospitalization/admitSource/coding/display (100 x 1 100)'; +comment on column db.encounter.enc_hospitalization_admitsource_text is 'hospitalization/admitSource/text (500 x 1 500)'; +comment on column db.encounter.enc_hospitalization_dischargedisposition_system is 'hospitalization/dischargeDisposition/coding/system (70 x 1 70)'; +comment on column db.encounter.enc_hospitalization_dischargedisposition_version is 'hospitalization/dischargeDisposition/coding/version (50 x 1 50)'; +comment on column db.encounter.enc_hospitalization_dischargedisposition_code is 'hospitalization/dischargeDisposition/coding/code (30 x 1 30)'; +comment on column db.encounter.enc_hospitalization_dischargedisposition_display is 'hospitalization/dischargeDisposition/coding/display (100 x 1 100)'; +comment on column db.encounter.enc_hospitalization_dischargedisposition_text is 'hospitalization/dischargeDisposition/text (500 x 1 500)'; +comment on column db.encounter.enc_location_id is 'location/location/reference (70 x 2 140)'; +comment on column db.encounter.enc_location_type is 'location/location/type (30 x 2 60)'; +comment on column db.encounter.enc_location_identifier_use is 'location/location/identifier/use (30 x 2 60)'; +comment on column db.encounter.enc_location_identifier_type_system is 'location/location/identifier/type/coding/system (70 x 6 420)'; +comment on column db.encounter.enc_location_identifier_type_version is 'location/location/identifier/type/coding/version (50 x 6 300)'; +comment on column db.encounter.enc_location_identifier_type_code is 'location/location/identifier/type/coding/code (30 x 6 180)'; +comment on column db.encounter.enc_location_identifier_type_display is 'location/location/identifier/type/coding/display (100 x 6 600)'; +comment on column db.encounter.enc_location_identifier_type_text is 'location/location/identifier/type/text (500 x 2 1000)'; +comment on column db.encounter.enc_location_display is 'location/location/display (100 x 2 200)'; +comment on column db.encounter.enc_location_status is 'location/location/status (10 x 2 20)'; +comment on column db.encounter.enc_location_physicaltype_system is 'location/location/physicalType/coding/system (70 x 6 420)'; +comment on column db.encounter.enc_location_physicaltype_version is 'location/location/physicalType/coding/version (50 x 6 300)'; +comment on column db.encounter.enc_location_physicaltype_code is 'location/location/physicalType/coding/code (30 x 6 180)'; +comment on column db.encounter.enc_location_physicaltype_display is 'location/location/physicalType/coding/display (100 x 6 600)'; +comment on column db.encounter.enc_location_physicaltype_text is 'location/location/physicalType/text (500 x 2 1000)'; comment on column db.encounter.enc_serviceprovider_id is 'serviceProvider/reference (70 x 1 70)'; -comment on column db.encounter.enc_serviceprovider_type is 'serviceProvider/type (500 x 1 500)'; -comment on column db.encounter.enc_serviceprovider_identifier_type_use is 'serviceProvider/identifier/use (50 x 1 50)'; +comment on column db.encounter.enc_serviceprovider_type is 'serviceProvider/type (30 x 1 30)'; +comment on column db.encounter.enc_serviceprovider_identifier_use is 'serviceProvider/identifier/use (30 x 1 30)'; comment on column db.encounter.enc_serviceprovider_identifier_type_system is 'serviceProvider/identifier/type/coding/system (70 x 1 70)'; -comment on column db.encounter.enc_serviceprovider_identifier_type_version is 'serviceProvider/identifier/type/coding/version (30 x 1 30)'; +comment on column db.encounter.enc_serviceprovider_identifier_type_version is 'serviceProvider/identifier/type/coding/version (50 x 1 50)'; comment on column db.encounter.enc_serviceprovider_identifier_type_code is 'serviceProvider/identifier/type/coding/code (30 x 1 30)'; comment on column db.encounter.enc_serviceprovider_identifier_type_display is 'serviceProvider/identifier/type/coding/display (100 x 1 100)'; comment on column db.encounter.enc_serviceprovider_identifier_type_text is 'serviceProvider/identifier/type/text (500 x 1 500)'; -comment on column db.encounter.enc_serviceprovider_identifier_system is 'serviceProvider/identifier/system (100 x 1 100)'; -comment on column db.encounter.enc_serviceprovider_identifier_value is 'serviceProvider/identifier/value (50 x 1 50)'; -comment on column db.encounter.enc_serviceprovider_identifier_period_start is 'serviceProvider/identifier/period/start (30 x 1 30)'; -comment on column db.encounter.enc_serviceprovider_identifier_period_end is 'serviceProvider/identifier/period/end (30 x 1 30)'; comment on column db.encounter.enc_serviceprovider_display is 'serviceProvider/display (100 x 1 100)'; comment on column db.patient.pat_id is 'id (70 x 1 70)'; -comment on column db.patient.pat_identifier_value is 'identifier/value (50 x 3 150)'; -comment on column db.patient.pat_identifier_system is 'identifier/system (70 x 3 210)'; -comment on column db.patient.pat_identifier_type_system is 'identifier/type/coding/system (70 x 3 210)'; -comment on column db.patient.pat_identifier_type_version is 'identifier/type/coding/version (50 x 3 150)'; -comment on column db.patient.pat_identifier_type_code is 'identifier/type/coding/code (50 x 3 150)'; -comment on column db.patient.pat_identifier_type_display is 'identifier/type/coding/display (100 x 3 300)'; -comment on column db.patient.pat_identifier_type_text is 'identifier/type/text (500 x 3 1500)'; -comment on column db.patient.pat_name_given is 'name/given (100 x 1 100)'; -comment on column db.patient.pat_name_family is 'name/family (50 x 1 50)'; +comment on column db.patient.pat_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.patient.pat_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.patient.pat_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.patient.pat_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.patient.pat_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.patient.pat_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.patient.pat_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.patient.pat_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.patient.pat_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.patient.pat_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.patient.pat_name_given is 'name/given (50 x 2 100)'; +comment on column db.patient.pat_name_family is 'name/family (50 x 2 100)'; comment on column db.patient.pat_gender is 'gender (10 x 1 10)'; comment on column db.patient.pat_birthdate is 'birthDate (30 x 1 30)'; -comment on column db.patient.pat_adress_postalcode is 'address/postalCode (10 x 1 10)'; +comment on column db.patient.pat_address_postalcode is 'address/postalCode (10 x 3 30)'; + +comment on column db.condition.con_id is 'id (70 x 1 70)'; +comment on column db.condition.con_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column db.condition.con_patient_id is 'subject/reference (70 x 1 70)'; +comment on column db.condition.con_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.condition.con_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.condition.con_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.condition.con_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.condition.con_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.condition.con_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.condition.con_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.condition.con_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.condition.con_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.condition.con_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.condition.con_clinicalstatus_system is 'clinicalStatus/coding/system (70 x 1 70)'; +comment on column db.condition.con_clinicalstatus_version is 'clinicalStatus/coding/version (50 x 1 50)'; +comment on column db.condition.con_clinicalstatus_code is 'clinicalStatus/coding/code (30 x 1 30)'; +comment on column db.condition.con_clinicalstatus_display is 'clinicalStatus/coding/display (100 x 1 100)'; +comment on column db.condition.con_clinicalstatus_text is 'clinicalStatus/text (500 x 1 500)'; +comment on column db.condition.con_verificationstatus_system is 'verificationStatus/coding/system (70 x 1 70)'; +comment on column db.condition.con_verificationstatus_version is 'verificationStatus/coding/version (50 x 1 50)'; +comment on column db.condition.con_verificationstatus_code is 'verificationStatus/coding/code (30 x 1 30)'; +comment on column db.condition.con_verificationstatus_display is 'verificationStatus/coding/display (100 x 1 100)'; +comment on column db.condition.con_verificationstatus_text is 'verificationStatus/text (500 x 1 500)'; +comment on column db.condition.con_category_system is 'category/coding/system (70 x 6 420)'; +comment on column db.condition.con_category_version is 'category/coding/version (50 x 6 300)'; +comment on column db.condition.con_category_code is 'category/coding/code (30 x 6 180)'; +comment on column db.condition.con_category_display is 'category/coding/display (100 x 6 600)'; +comment on column db.condition.con_category_text is 'category/text (500 x 2 1000)'; +comment on column db.condition.con_severity_system is 'severity/coding/system (70 x 1 70)'; +comment on column db.condition.con_severity_version is 'severity/coding/version (50 x 1 50)'; +comment on column db.condition.con_severity_code is 'severity/coding/code (30 x 1 30)'; +comment on column db.condition.con_severity_display is 'severity/coding/display (100 x 1 100)'; +comment on column db.condition.con_severity_text is 'severity/text (500 x 1 500)'; +comment on column db.condition.con_code_system is 'code/coding/system (70 x 1 70)'; +comment on column db.condition.con_code_version is 'code/coding/version (50 x 1 50)'; +comment on column db.condition.con_code_code is 'code/coding/code (30 x 1 30)'; +comment on column db.condition.con_code_display is 'code/coding/display (100 x 1 100)'; +comment on column db.condition.con_code_text is 'code/text (500 x 1 500)'; +comment on column db.condition.con_bodysite_system is 'bodySite/coding/system (70 x 9 630)'; +comment on column db.condition.con_bodysite_version is 'bodySite/coding/version (50 x 9 450)'; +comment on column db.condition.con_bodysite_code is 'bodySite/coding/code (30 x 9 270)'; +comment on column db.condition.con_bodysite_display is 'bodySite/coding/display (100 x 9 900)'; +comment on column db.condition.con_bodysite_text is 'bodySite/text (500 x 3 1500)'; +comment on column db.condition.con_onsetperiod_start is 'onsetPeriod/start (30 x 1 30)'; +comment on column db.condition.con_onsetperiod_end is 'onsetPeriod/end (30 x 1 30)'; +comment on column db.condition.con_onsetdatetime is 'onsetDateTime (30 x 1 30)'; +comment on column db.condition.con_abatementdatetime is 'abatementDateTime (30 x 1 30)'; +comment on column db.condition.con_abatementage_value is 'abatementAge/value (10 x 1 10)'; +comment on column db.condition.con_abatementage_comparator is 'abatementAge/comparator (3 x 1 3)'; +comment on column db.condition.con_abatementage_unit is 'abatementAge/unit (30 x 1 30)'; +comment on column db.condition.con_abatementage_system is 'abatementAge/system (70 x 1 70)'; +comment on column db.condition.con_abatementage_code is 'abatementAge/code (30 x 1 30)'; +comment on column db.condition.con_abatementperiod_start is 'abatementPeriod/start (30 x 1 30)'; +comment on column db.condition.con_abatementperiod_end is 'abatementPeriod/end (30 x 1 30)'; +comment on column db.condition.con_abatementrange_low_value is 'abatementRange/low/value (10 x 1 10)'; +comment on column db.condition.con_abatementrange_low_unit is 'abatementRange/low/unit (30 x 1 30)'; +comment on column db.condition.con_abatementrange_low_system is 'abatementRange/low/system (70 x 1 70)'; +comment on column db.condition.con_abatementrange_low_code is 'abatementRange/low/code (30 x 1 30)'; +comment on column db.condition.con_abatementrange_high_value is 'abatementRange/high/value (10 x 1 10)'; +comment on column db.condition.con_abatementrange_high_unit is 'abatementRange/high/unit (30 x 1 30)'; +comment on column db.condition.con_abatementrange_high_system is 'abatementRange/high/system (70 x 1 70)'; +comment on column db.condition.con_abatementrange_high_code is 'abatementRange/high/code (30 x 1 30)'; +comment on column db.condition.con_abatementstring is 'abatementString (300 x 1 300)'; +comment on column db.condition.con_recordeddate is 'recordedDate (30 x 1 30)'; +comment on column db.condition.con_recorder_id is 'recorder/reference (70 x 1 70)'; +comment on column db.condition.con_recorder_type is 'recorder/type (30 x 1 30)'; +comment on column db.condition.con_recorder_identifier_use is 'recorder/identifier/use (30 x 1 30)'; +comment on column db.condition.con_recorder_identifier_type_system is 'recorder/identifier/type/coding/system (70 x 1 70)'; +comment on column db.condition.con_recorder_identifier_type_version is 'recorder/identifier/type/coding/version (50 x 1 50)'; +comment on column db.condition.con_recorder_identifier_type_code is 'recorder/identifier/type/coding/code (30 x 1 30)'; +comment on column db.condition.con_recorder_identifier_type_display is 'recorder/identifier/type/coding/display (100 x 1 100)'; +comment on column db.condition.con_recorder_identifier_type_text is 'recorder/identifier/type/text (500 x 1 500)'; +comment on column db.condition.con_recorder_display is 'recorder/display (100 x 1 100)'; +comment on column db.condition.con_asserter_id is 'asserter/reference (70 x 1 70)'; +comment on column db.condition.con_asserter_type is 'asserter/type (30 x 1 30)'; +comment on column db.condition.con_asserter_identifier_use is 'asserter/identifier/use (30 x 1 30)'; +comment on column db.condition.con_asserter_identifier_type_system is 'asserter/identifier/type/coding/system (70 x 1 70)'; +comment on column db.condition.con_asserter_identifier_type_version is 'asserter/identifier/type/coding/version (50 x 1 50)'; +comment on column db.condition.con_asserter_identifier_type_code is 'asserter/identifier/type/coding/code (30 x 1 30)'; +comment on column db.condition.con_asserter_identifier_type_display is 'asserter/identifier/type/coding/display (100 x 1 100)'; +comment on column db.condition.con_asserter_identifier_type_text is 'asserter/identifier/type/text (500 x 1 500)'; +comment on column db.condition.con_asserter_display is 'asserter/display (100 x 1 100)'; +comment on column db.condition.con_stage_summary_system is 'stage/summary/coding/system (70 x 6 420)'; +comment on column db.condition.con_stage_summary_version is 'stage/summary/coding/version (50 x 6 300)'; +comment on column db.condition.con_stage_summary_code is 'stage/summary/coding/code (30 x 6 180)'; +comment on column db.condition.con_stage_summary_display is 'stage/summary/coding/display (100 x 6 600)'; +comment on column db.condition.con_stage_summary_text is 'stage/summary/text (500 x 2 1000)'; +comment on column db.condition.con_stage_assessment_id is 'stage/assessment/reference (70 x 4 280)'; +comment on column db.condition.con_stage_assessment_type is 'stage/assessment/type (30 x 4 120)'; +comment on column db.condition.con_stage_assessment_identifier_use is 'stage/assessment/identifier/use (30 x 4 120)'; +comment on column db.condition.con_stage_assessment_identifier_type_system is 'stage/assessment/identifier/type/coding/system (70 x 12 840)'; +comment on column db.condition.con_stage_assessment_identifier_type_version is 'stage/assessment/identifier/type/coding/version (50 x 12 600)'; +comment on column db.condition.con_stage_assessment_identifier_type_code is 'stage/assessment/identifier/type/coding/code (30 x 12 360)'; +comment on column db.condition.con_stage_assessment_identifier_type_display is 'stage/assessment/identifier/type/coding/display (100 x 12 1200)'; +comment on column db.condition.con_stage_assessment_identifier_type_text is 'stage/assessment/identifier/type/text (500 x 4 2000)'; +comment on column db.condition.con_stage_assessment_display is 'stage/assessment/display (100 x 4 400)'; +comment on column db.condition.con_stage_type_system is 'stage/type/coding/system (70 x 6 420)'; +comment on column db.condition.con_stage_type_version is 'stage/type/coding/version (50 x 6 300)'; +comment on column db.condition.con_stage_type_code is 'stage/type/coding/code (30 x 6 180)'; +comment on column db.condition.con_stage_type_display is 'stage/type/coding/display (100 x 6 600)'; +comment on column db.condition.con_stage_type_text is 'stage/type/text (500 x 2 1000)'; +comment on column db.condition.con_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column db.condition.con_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column db.condition.con_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column db.condition.con_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column db.condition.con_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column db.condition.con_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column db.condition.con_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column db.condition.con_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column db.condition.con_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column db.condition.con_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column db.condition.con_note_time is 'note/time (30 x 2 60)'; +comment on column db.condition.con_note_text is 'note/text (5000 x 2 10000)'; + +comment on column db.medication.med_id is 'id (70 x 1 70)'; +comment on column db.medication.med_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.medication.med_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.medication.med_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.medication.med_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.medication.med_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.medication.med_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.medication.med_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.medication.med_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.medication.med_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.medication.med_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.medication.med_code_system is 'code/coding/system (70 x 1 70)'; +comment on column db.medication.med_code_version is 'code/coding/version (50 x 1 50)'; +comment on column db.medication.med_code_code is 'code/coding/code (30 x 1 30)'; +comment on column db.medication.med_code_display is 'code/coding/display (100 x 1 100)'; +comment on column db.medication.med_code_text is 'code/text (500 x 1 500)'; +comment on column db.medication.med_status is 'status (20 x 1 20)'; +comment on column db.medication.med_form_system is 'form/coding/system (70 x 1 70)'; +comment on column db.medication.med_form_version is 'form/coding/version (50 x 1 50)'; +comment on column db.medication.med_form_code is 'form/coding/code (30 x 1 30)'; +comment on column db.medication.med_form_display is 'form/coding/display (100 x 1 100)'; +comment on column db.medication.med_form_text is 'form/text (500 x 1 500)'; +comment on column db.medication.med_amount_numerator_value is 'amount/numerator/value (10 x 1 10)'; +comment on column db.medication.med_amount_numerator_comparator is 'amount/numerator/comparator (10 x 1 10)'; +comment on column db.medication.med_amount_numerator_unit is 'amount/numerator/unit (30 x 1 30)'; +comment on column db.medication.med_amount_numerator_system is 'amount/numerator/system (70 x 1 70)'; +comment on column db.medication.med_amount_numerator_code is 'amount/numerator/code (30 x 1 30)'; +comment on column db.medication.med_amount_denominator_value is 'amount/denominator/value (10 x 1 10)'; +comment on column db.medication.med_amount_denominator_comparator is 'amount/denominator/comparator (10 x 1 10)'; +comment on column db.medication.med_amount_denominator_unit is 'amount/denominator/unit (30 x 1 30)'; +comment on column db.medication.med_amount_denominator_system is 'amount/denominator/system (70 x 1 70)'; +comment on column db.medication.med_amount_denominator_code is 'amount/denominator/code (30 x 1 30)'; +comment on column db.medication.med_ingredient_strength_numerator_value is 'ingredient/strength/numerator/value (10 x 15 150)'; +comment on column db.medication.med_ingredient_strength_numerator_comparator is 'ingredient/strength/numerator/comparator (10 x 15 150)'; +comment on column db.medication.med_ingredient_strength_numerator_unit is 'ingredient/strength/numerator/unit (30 x 15 450)'; +comment on column db.medication.med_ingredient_strength_numerator_system is 'ingredient/strength/numerator/system (70 x 15 1050)'; +comment on column db.medication.med_ingredient_strength_numerator_code is 'ingredient/strength/numerator/code (30 x 15 450)'; +comment on column db.medication.med_ingredient_strength_denominator_value is 'ingredient/strength/denominator/value (10 x 15 150)'; +comment on column db.medication.med_ingredient_strength_denominator_comparator is 'ingredient/strength/denominator/comparator (10 x 15 150)'; +comment on column db.medication.med_ingredient_strength_denominator_unit is 'ingredient/strength/denominator/unit (30 x 15 450)'; +comment on column db.medication.med_ingredient_strength_denominator_system is 'ingredient/strength/denominator/system (70 x 15 1050)'; +comment on column db.medication.med_ingredient_strength_denominator_code is 'ingredient/strength/denominator/code (30 x 15 450)'; +comment on column db.medication.med_ingredient_itemcodeableconcept_system is 'ingredient/itemCodeableConcept/coding/system (70 x 45 3150)'; +comment on column db.medication.med_ingredient_itemcodeableconcept_version is 'ingredient/itemCodeableConcept/coding/version (50 x 45 2250)'; +comment on column db.medication.med_ingredient_itemcodeableconcept_code is 'ingredient/itemCodeableConcept/coding/code (30 x 45 1350)'; +comment on column db.medication.med_ingredient_itemcodeableconcept_display is 'ingredient/itemCodeableConcept/coding/display (100 x 45 4500)'; +comment on column db.medication.med_ingredient_itemcodeableconcept_text is 'ingredient/itemCodeableConcept/text (500 x 15 7500)'; +comment on column db.medication.med_ingredient_itemreference_id is 'ingredient/itemReference/reference (70 x 15 1050)'; +comment on column db.medication.med_ingredient_itemreference_type is 'ingredient/itemReference/type (30 x 15 450)'; +comment on column db.medication.med_ingredient_itemreference_identifier_use is 'ingredient/itemReference/identifier/use (30 x 15 450)'; +comment on column db.medication.med_ingredient_itemreference_identifier_type_system is 'ingredient/itemReference/identifier/type/coding/system (70 x 45 3150)'; +comment on column db.medication.med_ingredient_itemreference_identifier_type_version is 'ingredient/itemReference/identifier/type/coding/version (50 x 45 2250)'; +comment on column db.medication.med_ingredient_itemreference_identifier_type_code is 'ingredient/itemReference/identifier/type/coding/code (30 x 45 1350)'; +comment on column db.medication.med_ingredient_itemreference_identifier_type_display is 'ingredient/itemReference/identifier/type/coding/display (100 x 45 4500)'; +comment on column db.medication.med_ingredient_itemreference_identifier_type_text is 'ingredient/itemReference/identifier/type/text (500 x 15 7500)'; +comment on column db.medication.med_ingredient_itemreference_display is 'ingredient/itemReference/display (100 x 15 1500)'; +comment on column db.medication.med_ingredient_isactive is 'ingredient/isActive (10 x 15 150)'; + +comment on column db.medicationrequest.medreq_id is 'id (70 x 1 70)'; +comment on column db.medicationrequest.medreq_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column db.medicationrequest.medreq_patient_id is 'subject/reference (70 x 1 70)'; +comment on column db.medicationrequest.medreq_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.medicationrequest.medreq_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.medicationrequest.medreq_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.medicationrequest.medreq_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.medicationrequest.medreq_medicationreference_id is 'medicationReference/reference (70 x 1 70)'; +comment on column db.medicationrequest.medreq_status is 'status (20 x 1 20)'; +comment on column db.medicationrequest.medreq_statusreason_system is 'statusReason/coding/system (70 x 1 70)'; +comment on column db.medicationrequest.medreq_statusreason_version is 'statusReason/coding/version (50 x 1 50)'; +comment on column db.medicationrequest.medreq_statusreason_code is 'statusReason/coding/code (30 x 1 30)'; +comment on column db.medicationrequest.medreq_statusreason_display is 'statusReason/coding/display (100 x 1 100)'; +comment on column db.medicationrequest.medreq_statusreason_text is 'statusReason/text (500 x 1 500)'; +comment on column db.medicationrequest.medreq_intend is 'intend (20 x 1 20)'; +comment on column db.medicationrequest.medreq_category_system is 'category/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_category_version is 'category/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_category_code is 'category/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_category_display is 'category/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_category_text is 'category/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_priority is 'priority (10 x 1 10)'; +comment on column db.medicationrequest.medreq_reportedboolean is 'reportedBoolean (10 x 1 10)'; +comment on column db.medicationrequest.medreq_reportedreference_id is 'reportedReference/reference (70 x 1 70)'; +comment on column db.medicationrequest.medreq_reportedreference_type is 'reportedReference/type (30 x 1 30)'; +comment on column db.medicationrequest.medreq_reportedreference_identifier_use is 'reportedReference/identifier/use (30 x 1 30)'; +comment on column db.medicationrequest.medreq_reportedreference_identifier_type_system is 'reportedReference/identifier/type/coding/system (70 x 1 70)'; +comment on column db.medicationrequest.medreq_reportedreference_identifier_type_version is 'reportedReference/identifier/type/coding/version (50 x 1 50)'; +comment on column db.medicationrequest.medreq_reportedreference_identifier_type_code is 'reportedReference/identifier/type/coding/code (30 x 1 30)'; +comment on column db.medicationrequest.medreq_reportedreference_identifier_type_display is 'reportedReference/identifier/type/coding/display (100 x 1 100)'; +comment on column db.medicationrequest.medreq_reportedreference_identifier_type_text is 'reportedReference/identifier/type/text (500 x 1 500)'; +comment on column db.medicationrequest.medreq_reportedreference_display is 'reportedReference/display (100 x 1 100)'; +comment on column db.medicationrequest.medreq_medicationcodeableconcept_system is 'medicationCodeableConcept/coding/system (70 x 1 70)'; +comment on column db.medicationrequest.medreq_medicationcodeableconcept_version is 'medicationCodeableConcept/coding/version (50 x 1 50)'; +comment on column db.medicationrequest.medreq_medicationcodeableconcept_code is 'medicationCodeableConcept/coding/code (30 x 1 30)'; +comment on column db.medicationrequest.medreq_medicationcodeableconcept_display is 'medicationCodeableConcept/coding/display (100 x 1 100)'; +comment on column db.medicationrequest.medreq_medicationcodeableconcept_text is 'medicationCodeableConcept/text (500 x 1 500)'; +comment on column db.medicationrequest.medreq_supportinginformation_id is 'supportingInformation/reference (70 x 2 140)'; +comment on column db.medicationrequest.medreq_supportinginformation_type is 'supportingInformation/type (30 x 2 60)'; +comment on column db.medicationrequest.medreq_supportinginformation_identifier_use is 'supportingInformation/identifier/use (30 x 2 60)'; +comment on column db.medicationrequest.medreq_supportinginformation_identifier_type_system is 'supportingInformation/identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_supportinginformation_identifier_type_version is 'supportingInformation/identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_supportinginformation_identifier_type_code is 'supportingInformation/identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_supportinginformation_identifier_type_display is 'supportingInformation/identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_supportinginformation_identifier_type_text is 'supportingInformation/identifier/type/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_supportinginformation_display is 'supportingInformation/display (100 x 2 200)'; +comment on column db.medicationrequest.medreq_authoredon is 'authoredOn (30 x 1 30)'; +comment on column db.medicationrequest.medreq_requester_id is 'requester/reference (70 x 1 70)'; +comment on column db.medicationrequest.medreq_requester_type is 'requester/type (30 x 1 30)'; +comment on column db.medicationrequest.medreq_requester_identifier_use is 'requester/identifier/use (30 x 1 30)'; +comment on column db.medicationrequest.medreq_requester_identifier_type_system is 'requester/identifier/type/coding/system (70 x 1 70)'; +comment on column db.medicationrequest.medreq_requester_identifier_type_version is 'requester/identifier/type/coding/version (50 x 1 50)'; +comment on column db.medicationrequest.medreq_requester_identifier_type_code is 'requester/identifier/type/coding/code (30 x 1 30)'; +comment on column db.medicationrequest.medreq_requester_identifier_type_display is 'requester/identifier/type/coding/display (100 x 1 100)'; +comment on column db.medicationrequest.medreq_requester_identifier_type_text is 'requester/identifier/type/text (500 x 1 500)'; +comment on column db.medicationrequest.medreq_requester_display is 'requester/display (100 x 1 100)'; +comment on column db.medicationrequest.medreq_reasoncode_system is 'reasonCode/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_reasoncode_version is 'reasonCode/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_reasoncode_code is 'reasonCode/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_reasoncode_display is 'reasonCode/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_reasoncode_text is 'reasonCode/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_reasonreference_id is 'reasonReference/reference (70 x 2 140)'; +comment on column db.medicationrequest.medreq_reasonreference_type is 'reasonReference/type (30 x 2 60)'; +comment on column db.medicationrequest.medreq_reasonreference_identifier_use is 'reasonReference/identifier/use (30 x 2 60)'; +comment on column db.medicationrequest.medreq_reasonreference_identifier_type_system is 'reasonReference/identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_reasonreference_identifier_type_version is 'reasonReference/identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_reasonreference_identifier_type_code is 'reasonReference/identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_reasonreference_identifier_type_display is 'reasonReference/identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_reasonreference_identifier_type_text is 'reasonReference/identifier/type/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_reasonreference_display is 'reasonReference/display (100 x 2 200)'; +comment on column db.medicationrequest.medreq_basedon_id is 'basedOn/reference (70 x 2 140)'; +comment on column db.medicationrequest.medreq_basedon_type is 'basedOn/type (30 x 2 60)'; +comment on column db.medicationrequest.medreq_basedon_identifier_use is 'basedOn/identifier/use (30 x 2 60)'; +comment on column db.medicationrequest.medreq_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_basedon_display is 'basedOn/display (100 x 2 200)'; +comment on column db.medicationrequest.medreq_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column db.medicationrequest.medreq_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column db.medicationrequest.medreq_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column db.medicationrequest.medreq_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column db.medicationrequest.medreq_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column db.medicationrequest.medreq_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column db.medicationrequest.medreq_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column db.medicationrequest.medreq_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column db.medicationrequest.medreq_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column db.medicationrequest.medreq_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_note_time is 'note/time (30 x 2 60)'; +comment on column db.medicationrequest.medreq_note_text is 'note/text (5000 x 2 10000)'; +comment on column db.medicationrequest.medreq_doseinstruc_sequence is 'dosageInstruction/sequence (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_text is 'dosageInstruction/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_doseinstruc_additionalinstruction_system is 'dosageInstruction/additionalInstruction/coding/system (70 x 12 840)'; +comment on column db.medicationrequest.medreq_doseinstruc_additionalinstruction_version is 'dosageInstruction/additionalInstruction/coding/version (50 x 12 600)'; +comment on column db.medicationrequest.medreq_doseinstruc_additionalinstruction_code is 'dosageInstruction/additionalInstruction/coding/code (30 x 12 360)'; +comment on column db.medicationrequest.medreq_doseinstruc_additionalinstruction_display is 'dosageInstruction/additionalInstruction/coding/display (100 x 12 1200)'; +comment on column db.medicationrequest.medreq_doseinstruc_additionalinstruction_text is 'dosageInstruction/additionalInstruction/text (500 x 4 2000)'; +comment on column db.medicationrequest.medreq_doseinstruc_patientinstruction is 'dosageInstruction/patientInstruction (100 x 2 200)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_event is 'dosageInstruction/timing/event (30 x 8 240)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_value is 'dosageInstruction/timing/repeat/boundsDuration/value (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_comparator is 'dosageInstruction/timing/repeat/boundsDuration/comparator (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_unit is 'dosageInstruction/timing/repeat/boundsDuration/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_system is 'dosageInstruction/timing/repeat/boundsDuration/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsduration_code is 'dosageInstruction/timing/repeat/boundsDuration/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_low_value is 'dosageInstruction/timing/repeat/boundsRange/low/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_low_unit is 'dosageInstruction/timing/repeat/boundsRange/low/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_low_system is 'dosageInstruction/timing/repeat/boundsRange/low/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_low_code is 'dosageInstruction/timing/repeat/boundsRange/low/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_high_value is 'dosageInstruction/timing/repeat/boundsRange/high/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_high_unit is 'dosageInstruction/timing/repeat/boundsRange/high/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_high_system is 'dosageInstruction/timing/repeat/boundsRange/high/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsrange_high_code is 'dosageInstruction/timing/repeat/boundsRange/high/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsperiod_start is 'dosageInstruction/timing/repeat/boundsPeriod/start (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_boundsperiod_end is 'dosageInstruction/timing/repeat/boundsPeriod/end (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_count is 'dosageInstruction/timing/repeat/count (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_countmax is 'dosageInstruction/timing/repeat/countMax (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_duration is 'dosageInstruction/timing/repeat/duration (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_durationmax is 'dosageInstruction/timing/repeat/durationMax (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_durationunit is 'dosageInstruction/timing/repeat/durationUnit (20 x 2 40)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_frequency is 'dosageInstruction/timing/repeat/frequency (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_frequencymax is 'dosageInstruction/timing/repeat/frequencyMax (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_period is 'dosageInstruction/timing/repeat/period (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_periodmax is 'dosageInstruction/timing/repeat/periodMax (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_periodunit is 'dosageInstruction/timing/repeat/periodUnit (20 x 2 40)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_dayofweek is 'dosageInstruction/timing/repeat/dayOfWeek (10 x 14 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_timeofday is 'dosageInstruction/timing/repeat/timeOfDay (20 x 8 160)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_when is 'dosageInstruction/timing/repeat/when (20 x 8 160)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_repeat_offset is 'dosageInstruction/timing/repeat/offset (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_code_system is 'dosageInstruction/timing/code/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_code_version is 'dosageInstruction/timing/code/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_code_code is 'dosageInstruction/timing/code/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_code_display is 'dosageInstruction/timing/code/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_doseinstruc_timing_code_text is 'dosageInstruction/timing/code/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_doseinstruc_asneededboolean is 'dosageInstruction/asNeededBoolean (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_system is 'dosageInstruction/asNeededCodeableConcept/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_version is 'dosageInstruction/asNeededCodeableConcept/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_code is 'dosageInstruction/asNeededCodeableConcept/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_display is 'dosageInstruction/asNeededCodeableConcept/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_doseinstruc_asneededcodeableconcept_text is 'dosageInstruction/asNeededCodeableConcept/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_doseinstruc_site_system is 'dosageInstruction/site/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_doseinstruc_site_version is 'dosageInstruction/site/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_doseinstruc_site_code is 'dosageInstruction/site/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_doseinstruc_site_display is 'dosageInstruction/site/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_doseinstruc_site_text is 'dosageInstruction/site/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_doseinstruc_route_system is 'dosageInstruction/route/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_doseinstruc_route_version is 'dosageInstruction/route/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_doseinstruc_route_code is 'dosageInstruction/route/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_doseinstruc_route_display is 'dosageInstruction/route/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_doseinstruc_route_text is 'dosageInstruction/route/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_doseinstruc_method_system is 'dosageInstruction/method/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_doseinstruc_method_version is 'dosageInstruction/method/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_doseinstruc_method_code is 'dosageInstruction/method/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_doseinstruc_method_display is 'dosageInstruction/method/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_doseinstruc_method_text is 'dosageInstruction/method/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_type_system is 'dosageInstruction/doseAndRate/type/coding/system (70 x 6 420)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_type_version is 'dosageInstruction/doseAndRate/type/coding/version (50 x 6 300)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_type_code is 'dosageInstruction/doseAndRate/type/coding/code (30 x 6 180)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_type_display is 'dosageInstruction/doseAndRate/type/coding/display (100 x 6 600)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_type_text is 'dosageInstruction/doseAndRate/type/text (500 x 2 1000)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_doserange_low_value is 'dosageInstruction/doseAndRate/doseRange/low/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_doserange_low_unit is 'dosageInstruction/doseAndRate/doseRange/low/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_doserange_low_system is 'dosageInstruction/doseAndRate/doseRange/low/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_doserange_low_code is 'dosageInstruction/doseAndRate/doseRange/low/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_doserange_high_value is 'dosageInstruction/doseAndRate/doseRange/high/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_doserange_high_unit is 'dosageInstruction/doseAndRate/doseRange/high/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_doserange_high_system is 'dosageInstruction/doseAndRate/doseRange/high/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_doserange_high_code is 'dosageInstruction/doseAndRate/doseRange/high/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_value is 'dosageInstruction/doseAndRate/doseQuantity/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_comparator is 'dosageInstruction/doseAndRate/doseQuantity/comparator (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_unit is 'dosageInstruction/doseAndRate/doseQuantity/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_system is 'dosageInstruction/doseAndRate/doseQuantity/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_dosequantity_code is 'dosageInstruction/doseAndRate/doseQuantity/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_value is 'dosageInstruction/doseAndRate/rateRatio/numerator/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_comparator is 'dosageInstruction/doseAndRate/rateRatio/numerator/comparator (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_unit is 'dosageInstruction/doseAndRate/rateRatio/numerator/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_system is 'dosageInstruction/doseAndRate/rateRatio/numerator/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_numerator_code is 'dosageInstruction/doseAndRate/rateRatio/numerator/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_value is 'dosageInstruction/doseAndRate/rateRatio/denominator/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_comparator is 'dosageInstruction/doseAndRate/rateRatio/denominator/comparator (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_unit is 'dosageInstruction/doseAndRate/rateRatio/denominator/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_system is 'dosageInstruction/doseAndRate/rateRatio/denominator/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_rateratio_denominator_code is 'dosageInstruction/doseAndRate/rateRatio/denominator/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_raterange_low_value is 'dosageInstruction/doseAndRate/rateRange/low/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_raterange_low_unit is 'dosageInstruction/doseAndRate/rateRange/low/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_raterange_low_system is 'dosageInstruction/doseAndRate/rateRange/low/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_raterange_low_code is 'dosageInstruction/doseAndRate/rateRange/low/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_raterange_high_value is 'dosageInstruction/doseAndRate/rateRange/high/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_raterange_high_unit is 'dosageInstruction/doseAndRate/rateRange/high/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_raterange_high_system is 'dosageInstruction/doseAndRate/rateRange/high/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_raterange_high_code is 'dosageInstruction/doseAndRate/rateRange/high/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_ratequantity_value is 'dosageInstruction/doseAndRate/rateQuantity/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_ratequantity_unit is 'dosageInstruction/doseAndRate/rateQuantity/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_ratequantity_system is 'dosageInstruction/doseAndRate/rateQuantity/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_doseandrate_ratequantity_code is 'dosageInstruction/doseAndRate/rateQuantity/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_value is 'dosageInstruction/maxDosePerPeriod/numerator/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_comparator is 'dosageInstruction/maxDosePerPeriod/numerator/comparator (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_unit is 'dosageInstruction/maxDosePerPeriod/numerator/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_system is 'dosageInstruction/maxDosePerPeriod/numerator/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_numerator_code is 'dosageInstruction/maxDosePerPeriod/numerator/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_value is 'dosageInstruction/maxDosePerPeriod/denominator/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_comparator is 'dosageInstruction/maxDosePerPeriod/denominator/comparator (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_unit is 'dosageInstruction/maxDosePerPeriod/denominator/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_system is 'dosageInstruction/maxDosePerPeriod/denominator/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperperiod_denominator_code is 'dosageInstruction/maxDosePerPeriod/denominator/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperadministration_value is 'dosageInstruction/maxDosePerAdministration/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperadministration_unit is 'dosageInstruction/maxDosePerAdministration/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperadministration_system is 'dosageInstruction/maxDosePerAdministration/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperadministration_code is 'dosageInstruction/maxDosePerAdministration/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperlifetime_value is 'dosageInstruction/maxDosePerLifetime/value (10 x 2 20)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperlifetime_unit is 'dosageInstruction/maxDosePerLifetime/unit (30 x 2 60)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperlifetime_system is 'dosageInstruction/maxDosePerLifetime/system (70 x 2 140)'; +comment on column db.medicationrequest.medreq_doseinstruc_maxdoseperlifetime_code is 'dosageInstruction/maxDosePerLifetime/code (30 x 2 60)'; +comment on column db.medicationrequest.medreq_substitution_reason_system is 'substitution/reason/coding/system (70 x 1 70)'; +comment on column db.medicationrequest.medreq_substitution_reason_version is 'substitution/reason/coding/version (50 x 1 50)'; +comment on column db.medicationrequest.medreq_substitution_reason_code is 'substitution/reason/coding/code (30 x 1 30)'; +comment on column db.medicationrequest.medreq_substitution_reason_display is 'substitution/reason/coding/display (100 x 1 100)'; +comment on column db.medicationrequest.medreq_substitution_reason_text is 'substitution/reason/text (500 x 1 500)'; + +comment on column db.medicationadministration.medadm_id is 'id (70 x 1 70)'; +comment on column db.medicationadministration.medadm_encounter_id is 'context/reference (70 x 1 70)'; +comment on column db.medicationadministration.medadm_patient_id is 'subject/reference (70 x 1 70)'; +comment on column db.medicationadministration.medadm_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column db.medicationadministration.medadm_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.medicationadministration.medadm_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationadministration.medadm_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationadministration.medadm_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationadministration.medadm_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationadministration.medadm_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.medicationadministration.medadm_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.medicationadministration.medadm_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.medicationadministration.medadm_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.medicationadministration.medadm_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.medicationadministration.medadm_status is 'status (30 x 1 30)'; +comment on column db.medicationadministration.medadm_statusreason_system is 'statusReason/coding/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_statusreason_version is 'statusReason/coding/version (50 x 1 50)'; +comment on column db.medicationadministration.medadm_statusreason_code is 'statusReason/coding/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_statusreason_display is 'statusReason/coding/display (100 x 1 100)'; +comment on column db.medicationadministration.medadm_statusreason_text is 'statusReason/text (500 x 1 500)'; +comment on column db.medicationadministration.medadm_category_system is 'category/coding/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_category_version is 'category/coding/version (50 x 1 50)'; +comment on column db.medicationadministration.medadm_category_code is 'category/coding/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_category_display is 'category/coding/display (100 x 1 100)'; +comment on column db.medicationadministration.medadm_category_text is 'category/text (500 x 1 500)'; +comment on column db.medicationadministration.medadm_medicationreference_id is 'medicationReference/reference (70 x 1 70)'; +comment on column db.medicationadministration.medadm_medicationcodeableconcept_system is 'medicationCodeableConcept/coding/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_medicationcodeableconcept_version is 'medicationCodeableConcept/coding/version (50 x 1 50)'; +comment on column db.medicationadministration.medadm_medicationcodeableconcept_code is 'medicationCodeableConcept/coding/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_medicationcodeableconcept_display is 'medicationCodeableConcept/coding/display (100 x 1 100)'; +comment on column db.medicationadministration.medadm_medicationcodeableconcept_text is 'medicationCodeableConcept/text (500 x 1 500)'; +comment on column db.medicationadministration.medadm_supportinginformation_id is 'supportingInformation/reference (70 x 2 140)'; +comment on column db.medicationadministration.medadm_supportinginformation_type is 'supportingInformation/type (30 x 2 60)'; +comment on column db.medicationadministration.medadm_supportinginformation_identifier_use is 'supportingInformation/identifier/use (30 x 2 60)'; +comment on column db.medicationadministration.medadm_supportinginformation_identifier_type_system is 'supportingInformation/identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationadministration.medadm_supportinginformation_identifier_type_version is 'supportingInformation/identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationadministration.medadm_supportinginformation_identifier_type_code is 'supportingInformation/identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationadministration.medadm_supportinginformation_identifier_type_display is 'supportingInformation/identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationadministration.medadm_supportinginformation_identifier_type_text is 'supportingInformation/identifier/type/text (500 x 2 1000)'; +comment on column db.medicationadministration.medadm_supportinginformation_display is 'supportingInformation/display (100 x 2 200)'; +comment on column db.medicationadministration.medadm_effectivedatetime is 'effectiveDateTime (30 x 1 30)'; +comment on column db.medicationadministration.medadm_effectiveperiod_start is 'effectivePeriod/start (30 x 1 30)'; +comment on column db.medicationadministration.medadm_effectiveperiod_end is 'effectivePeriod/end (30 x 1 30)'; +comment on column db.medicationadministration.medadm_performer_function_system is 'performer/function/coding/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_performer_function_version is 'performer/function/coding/version (50 x 1 50)'; +comment on column db.medicationadministration.medadm_performer_function_code is 'performer/function/coding/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_performer_function_display is 'performer/function/coding/display (100 x 1 100)'; +comment on column db.medicationadministration.medadm_performer_function_text is 'performer/function/text (500 x 1 500)'; +comment on column db.medicationadministration.medadm_reasoncode_system is 'reasonCode/coding/system (70 x 6 420)'; +comment on column db.medicationadministration.medadm_reasoncode_version is 'reasonCode/coding/version (50 x 6 300)'; +comment on column db.medicationadministration.medadm_reasoncode_code is 'reasonCode/coding/code (30 x 6 180)'; +comment on column db.medicationadministration.medadm_reasoncode_display is 'reasonCode/coding/display (100 x 6 600)'; +comment on column db.medicationadministration.medadm_reasoncode_text is 'reasonCode/text (500 x 2 1000)'; +comment on column db.medicationadministration.medadm_reasonreference_id is 'reasonReference/reference (70 x 2 140)'; +comment on column db.medicationadministration.medadm_reasonreference_type is 'reasonReference/type (30 x 2 60)'; +comment on column db.medicationadministration.medadm_reasonreference_identifier_use is 'reasonReference/identifier/use (30 x 2 60)'; +comment on column db.medicationadministration.medadm_reasonreference_identifier_type_system is 'reasonReference/identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationadministration.medadm_reasonreference_identifier_type_version is 'reasonReference/identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationadministration.medadm_reasonreference_identifier_type_code is 'reasonReference/identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationadministration.medadm_reasonreference_identifier_type_display is 'reasonReference/identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationadministration.medadm_reasonreference_identifier_type_text is 'reasonReference/identifier/type/text (500 x 2 1000)'; +comment on column db.medicationadministration.medadm_reasonreference_display is 'reasonReference/display (100 x 2 200)'; +comment on column db.medicationadministration.medadm_request_id is 'request/reference (70 x 1 70)'; +comment on column db.medicationadministration.medadm_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column db.medicationadministration.medadm_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column db.medicationadministration.medadm_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column db.medicationadministration.medadm_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column db.medicationadministration.medadm_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column db.medicationadministration.medadm_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column db.medicationadministration.medadm_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column db.medicationadministration.medadm_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column db.medicationadministration.medadm_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column db.medicationadministration.medadm_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column db.medicationadministration.medadm_note_time is 'note/time (30 x 2 60)'; +comment on column db.medicationadministration.medadm_note_text is 'note/text (5000 x 2 10000)'; +comment on column db.medicationadministration.medadm_dosage_text is 'dosage/text (100 x 1 100)'; +comment on column db.medicationadministration.medadm_dosage_site_system is 'dosage/site/coding/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_dosage_site_version is 'dosage/site/coding/version (50 x 1 50)'; +comment on column db.medicationadministration.medadm_dosage_site_code is 'dosage/site/coding/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_site_display is 'dosage/site/coding/display (100 x 1 100)'; +comment on column db.medicationadministration.medadm_dosage_site_text is 'dosage/site/text (500 x 1 500)'; +comment on column db.medicationadministration.medadm_dosage_route_system is 'dosage/route/coding/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_dosage_route_version is 'dosage/route/coding/version (50 x 1 50)'; +comment on column db.medicationadministration.medadm_dosage_route_code is 'dosage/route/coding/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_route_display is 'dosage/route/coding/display (100 x 1 100)'; +comment on column db.medicationadministration.medadm_dosage_route_text is 'dosage/route/text (500 x 1 500)'; +comment on column db.medicationadministration.medadm_dosage_method_system is 'dosage/method/coding/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_dosage_method_version is 'dosage/method/coding/version (50 x 1 50)'; +comment on column db.medicationadministration.medadm_dosage_method_code is 'dosage/method/coding/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_method_display is 'dosage/method/coding/display (100 x 1 100)'; +comment on column db.medicationadministration.medadm_dosage_method_text is 'dosage/method/text (500 x 1 500)'; +comment on column db.medicationadministration.medadm_dosage_dose_value is 'dosage/dose/value (10 x 1 10)'; +comment on column db.medicationadministration.medadm_dosage_dose_unit is 'dosage/dose/unit (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_dose_system is 'dosage/dose/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_dosage_dose_code is 'dosage/dose/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_numerator_value is 'dosage/rateRatio/numerator/value (10 x 1 10)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_numerator_comparator is 'dosage/rateRatio/numerator/comparator (10 x 1 10)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_numerator_unit is 'dosage/rateRatio/numerator/unit (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_numerator_system is 'dosage/rateRatio/numerator/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_numerator_code is 'dosage/rateRatio/numerator/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_denominator_value is 'dosage/rateRatio/denominator/value (10 x 1 10)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_denominator_comparator is 'dosage/rateRatio/denominator/comparator (10 x 1 10)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_denominator_unit is 'dosage/rateRatio/denominator/unit (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_denominator_system is 'dosage/rateRatio/denominator/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_dosage_rateratio_denominator_code is 'dosage/rateRatio/denominator/code (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_ratequantity_value is 'dosage/rateQuantity/value (10 x 1 10)'; +comment on column db.medicationadministration.medadm_dosage_ratequantity_unit is 'dosage/rateQuantity/unit (30 x 1 30)'; +comment on column db.medicationadministration.medadm_dosage_ratequantity_system is 'dosage/rateQuantity/system (70 x 1 70)'; +comment on column db.medicationadministration.medadm_dosage_ratequantity_code is 'dosage/rateQuantity/code (30 x 1 30)'; + +comment on column db.medicationstatement.medstat_id is 'id (70 x 1 70)'; +comment on column db.medicationstatement.medstat_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.medicationstatement.medstat_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationstatement.medstat_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationstatement.medstat_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationstatement.medstat_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.medicationstatement.medstat_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.medicationstatement.medstat_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.medicationstatement.medstat_encounter_id is 'context/reference (70 x 1 70)'; +comment on column db.medicationstatement.medstat_patient_id is 'subject/reference (70 x 1 70)'; +comment on column db.medicationstatement.medstat_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column db.medicationstatement.medstat_basedon_id is 'basedOn/reference (70 x 2 140)'; +comment on column db.medicationstatement.medstat_basedon_type is 'basedOn/type (30 x 2 60)'; +comment on column db.medicationstatement.medstat_basedon_identifier_use is 'basedOn/identifier/use (30 x 2 60)'; +comment on column db.medicationstatement.medstat_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 6 420)'; +comment on column db.medicationstatement.medstat_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 6 300)'; +comment on column db.medicationstatement.medstat_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 6 180)'; +comment on column db.medicationstatement.medstat_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_basedon_display is 'basedOn/display (100 x 2 200)'; +comment on column db.medicationstatement.medstat_status is 'status (30 x 1 30)'; +comment on column db.medicationstatement.medstat_statusreason_system is 'statusReason/coding/system (70 x 1 70)'; +comment on column db.medicationstatement.medstat_statusreason_version is 'statusReason/coding/version (50 x 1 50)'; +comment on column db.medicationstatement.medstat_statusreason_code is 'statusReason/coding/code (30 x 1 30)'; +comment on column db.medicationstatement.medstat_statusreason_display is 'statusReason/coding/display (100 x 1 100)'; +comment on column db.medicationstatement.medstat_statusreason_text is 'statusReason/text (500 x 1 500)'; +comment on column db.medicationstatement.medstat_category_system is 'category/coding/system (70 x 1 70)'; +comment on column db.medicationstatement.medstat_category_version is 'category/coding/version (50 x 1 50)'; +comment on column db.medicationstatement.medstat_category_code is 'category/coding/code (30 x 1 30)'; +comment on column db.medicationstatement.medstat_category_display is 'category/coding/display (100 x 1 100)'; +comment on column db.medicationstatement.medstat_category_text is 'category/text (500 x 1 500)'; +comment on column db.medicationstatement.medstat_medicationreference_id is 'medicationReference/reference (100 x 1 100)'; +comment on column db.medicationstatement.medstat_medicationcodeableconcept_system is 'medicationCodeableConcept/coding/system (70 x 1 70)'; +comment on column db.medicationstatement.medstat_medicationcodeableconcept_version is 'medicationCodeableConcept/coding/version (50 x 1 50)'; +comment on column db.medicationstatement.medstat_medicationcodeableconcept_code is 'medicationCodeableConcept/coding/code (30 x 1 30)'; +comment on column db.medicationstatement.medstat_medicationcodeableconcept_display is 'medicationCodeableConcept/coding/display (100 x 1 100)'; +comment on column db.medicationstatement.medstat_medicationcodeableconcept_text is 'medicationCodeableConcept/text (500 x 1 500)'; +comment on column db.medicationstatement.medstat_effectivedatetime is 'effectiveDateTime (30 x 1 30)'; +comment on column db.medicationstatement.medstat_effectiveperiod_start is 'effectivePeriod/start (30 x 1 30)'; +comment on column db.medicationstatement.medstat_effectiveperiod_end is 'effectivePeriod/end (30 x 1 30)'; +comment on column db.medicationstatement.medstat_dateasserted is 'dateAsserted (30 x 1 30)'; +comment on column db.medicationstatement.medstat_informationsource_id is 'informationSource/reference (70 x 1 70)'; +comment on column db.medicationstatement.medstat_informationsource_type is 'informationSource/type (30 x 1 30)'; +comment on column db.medicationstatement.medstat_informationsource_identifier_use is 'informationSource/identifier/use (30 x 1 30)'; +comment on column db.medicationstatement.medstat_informationsource_identifier_type_system is 'informationSource/identifier/type/coding/system (70 x 1 70)'; +comment on column db.medicationstatement.medstat_informationsource_identifier_type_version is 'informationSource/identifier/type/coding/version (50 x 1 50)'; +comment on column db.medicationstatement.medstat_informationsource_identifier_type_code is 'informationSource/identifier/type/coding/code (30 x 1 30)'; +comment on column db.medicationstatement.medstat_informationsource_identifier_type_display is 'informationSource/identifier/type/coding/display (100 x 1 100)'; +comment on column db.medicationstatement.medstat_informationsource_identifier_type_text is 'informationSource/identifier/type/text (500 x 1 500)'; +comment on column db.medicationstatement.medstat_informationsource_display is 'informationSource/display (100 x 1 100)'; +comment on column db.medicationstatement.medstat_derivedfrom_id is 'derivedFrom/reference (70 x 1 70)'; +comment on column db.medicationstatement.medstat_derivedfrom_type is 'derivedFrom/type (30 x 1 30)'; +comment on column db.medicationstatement.medstat_derivedfrom_identifier_use is 'derivedFrom/identifier/use (30 x 1 30)'; +comment on column db.medicationstatement.medstat_derivedfrom_identifier_type_system is 'derivedFrom/identifier/type/coding/system (70 x 1 70)'; +comment on column db.medicationstatement.medstat_derivedfrom_identifier_type_version is 'derivedFrom/identifier/type/coding/version (50 x 1 50)'; +comment on column db.medicationstatement.medstat_derivedfrom_identifier_type_code is 'derivedFrom/identifier/type/coding/code (30 x 1 30)'; +comment on column db.medicationstatement.medstat_derivedfrom_identifier_type_display is 'derivedFrom/identifier/type/coding/display (100 x 1 100)'; +comment on column db.medicationstatement.medstat_derivedfrom_identifier_type_text is 'derivedFrom/identifier/type/text (500 x 1 500)'; +comment on column db.medicationstatement.medstat_derivedfrom_display is 'derivedFrom/display (100 x 1 100)'; +comment on column db.medicationstatement.medstat_reasoncode_system is 'reasonCode/coding/system (70 x 1 70)'; +comment on column db.medicationstatement.medstat_reasoncode_version is 'reasonCode/coding/version (50 x 1 50)'; +comment on column db.medicationstatement.medstat_reasoncode_code is 'reasonCode/coding/code (30 x 1 30)'; +comment on column db.medicationstatement.medstat_reasoncode_display is 'reasonCode/coding/display (100 x 1 100)'; +comment on column db.medicationstatement.medstat_reasoncode_text is 'reasonCode/text (500 x 1 500)'; +comment on column db.medicationstatement.medstat_reasonreference_id is 'reasonReference/reference (70 x 3 210)'; +comment on column db.medicationstatement.medstat_reasonreference_type is 'reasonReference/type (30 x 3 90)'; +comment on column db.medicationstatement.medstat_reasonreference_identifier_use is 'reasonReference/identifier/use (30 x 3 90)'; +comment on column db.medicationstatement.medstat_reasonreference_identifier_type_system is 'reasonReference/identifier/type/coding/system (70 x 9 630)'; +comment on column db.medicationstatement.medstat_reasonreference_identifier_type_version is 'reasonReference/identifier/type/coding/version (50 x 9 450)'; +comment on column db.medicationstatement.medstat_reasonreference_identifier_type_code is 'reasonReference/identifier/type/coding/code (30 x 9 270)'; +comment on column db.medicationstatement.medstat_reasonreference_identifier_type_display is 'reasonReference/identifier/type/coding/display (100 x 9 900)'; +comment on column db.medicationstatement.medstat_reasonreference_identifier_type_text is 'reasonReference/identifier/type/text (500 x 3 1500)'; +comment on column db.medicationstatement.medstat_reasonreference_display is 'reasonReference/display (100 x 3 300)'; +comment on column db.medicationstatement.medstat_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column db.medicationstatement.medstat_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column db.medicationstatement.medstat_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column db.medicationstatement.medstat_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column db.medicationstatement.medstat_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column db.medicationstatement.medstat_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column db.medicationstatement.medstat_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column db.medicationstatement.medstat_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column db.medicationstatement.medstat_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column db.medicationstatement.medstat_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_note_time is 'note/time (30 x 2 60)'; +comment on column db.medicationstatement.medstat_note_text is 'note/text (5000 x 2 10000)'; +comment on column db.medicationstatement.medstat_dosage_sequence is 'dosage/sequence (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_text is 'dosage/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_dosage_additionalinstruction_system is 'dosage/additionalInstruction/coding/system (70 x 12 840)'; +comment on column db.medicationstatement.medstat_dosage_additionalinstruction_version is 'dosage/additionalInstruction/coding/version (50 x 12 600)'; +comment on column db.medicationstatement.medstat_dosage_additionalinstruction_code is 'dosage/additionalInstruction/coding/code (30 x 12 360)'; +comment on column db.medicationstatement.medstat_dosage_additionalinstruction_display is 'dosage/additionalInstruction/coding/display (100 x 12 1200)'; +comment on column db.medicationstatement.medstat_dosage_additionalinstruction_text is 'dosage/additionalInstruction/text (500 x 4 2000)'; +comment on column db.medicationstatement.medstat_dosage_patientinstruction is 'dosage/patientInstruction (100 x 2 200)'; +comment on column db.medicationstatement.medstat_dosage_timing_event is 'dosage/timing/event (30 x 8 240)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsduration_value is 'dosage/timing/repeat/boundsDuration/value (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsduration_comparator is 'dosage/timing/repeat/boundsDuration/comparator (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsduration_unit is 'dosage/timing/repeat/boundsDuration/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsduration_system is 'dosage/timing/repeat/boundsDuration/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsduration_code is 'dosage/timing/repeat/boundsDuration/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsrange_low_value is 'dosage/timing/repeat/boundsRange/low/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsrange_low_unit is 'dosage/timing/repeat/boundsRange/low/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsrange_low_system is 'dosage/timing/repeat/boundsRange/low/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsrange_low_code is 'dosage/timing/repeat/boundsRange/low/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsrange_high_value is 'dosage/timing/repeat/boundsRange/high/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsrange_high_unit is 'dosage/timing/repeat/boundsRange/high/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsrange_high_system is 'dosage/timing/repeat/boundsRange/high/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsrange_high_code is 'dosage/timing/repeat/boundsRange/high/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsperiod_start is 'dosage/timing/repeat/boundsPeriod/start (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_boundsperiod_end is 'dosage/timing/repeat/boundsPeriod/end (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_count is 'dosage/timing/repeat/count (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_countmax is 'dosage/timing/repeat/countMax (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_duration is 'dosage/timing/repeat/duration (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_durationmax is 'dosage/timing/repeat/durationMax (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_durationunit is 'dosage/timing/repeat/durationUnit (20 x 2 40)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_frequency is 'dosage/timing/repeat/frequency (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_frequencymax is 'dosage/timing/repeat/frequencyMax (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_period is 'dosage/timing/repeat/period (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_periodmax is 'dosage/timing/repeat/periodMax (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_periodunit is 'dosage/timing/repeat/periodUnit (20 x 2 40)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_dayofweek is 'dosage/timing/repeat/dayOfWeek (10 x 14 140)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_timeofday is 'dosage/timing/repeat/timeOfDay (20 x 8 160)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_when is 'dosage/timing/repeat/when (20 x 8 160)'; +comment on column db.medicationstatement.medstat_dosage_timing_repeat_offset is 'dosage/timing/repeat/offset (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_timing_code_system is 'dosage/timing/code/coding/system (70 x 6 420)'; +comment on column db.medicationstatement.medstat_dosage_timing_code_version is 'dosage/timing/code/coding/version (50 x 6 300)'; +comment on column db.medicationstatement.medstat_dosage_timing_code_code is 'dosage/timing/code/coding/code (30 x 6 180)'; +comment on column db.medicationstatement.medstat_dosage_timing_code_display is 'dosage/timing/code/coding/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_dosage_timing_code_text is 'dosage/timing/code/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_dosage_asneededboolean is 'dosage/asNeededBoolean (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_asneededcodeableconcept_system is 'dosage/asNeededCodeableConcept/coding/system (70 x 6 420)'; +comment on column db.medicationstatement.medstat_dosage_asneededcodeableconcept_version is 'dosage/asNeededCodeableConcept/coding/version (50 x 6 300)'; +comment on column db.medicationstatement.medstat_dosage_asneededcodeableconcept_code is 'dosage/asNeededCodeableConcept/coding/code (30 x 6 180)'; +comment on column db.medicationstatement.medstat_dosage_asneededcodeableconcept_display is 'dosage/asNeededCodeableConcept/coding/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_dosage_asneededcodeableconcept_text is 'dosage/asNeededCodeableConcept/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_dosage_site_system is 'dosage/site/coding/system (70 x 6 420)'; +comment on column db.medicationstatement.medstat_dosage_site_version is 'dosage/site/coding/version (50 x 6 300)'; +comment on column db.medicationstatement.medstat_dosage_site_code is 'dosage/site/coding/code (30 x 6 180)'; +comment on column db.medicationstatement.medstat_dosage_site_display is 'dosage/site/coding/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_dosage_site_text is 'dosage/site/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_dosage_route_system is 'dosage/route/coding/system (70 x 6 420)'; +comment on column db.medicationstatement.medstat_dosage_route_version is 'dosage/route/coding/version (50 x 6 300)'; +comment on column db.medicationstatement.medstat_dosage_route_code is 'dosage/route/coding/code (30 x 6 180)'; +comment on column db.medicationstatement.medstat_dosage_route_display is 'dosage/route/coding/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_dosage_route_text is 'dosage/route/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_dosage_method_system is 'dosage/method/coding/system (70 x 6 420)'; +comment on column db.medicationstatement.medstat_dosage_method_version is 'dosage/method/coding/version (50 x 6 300)'; +comment on column db.medicationstatement.medstat_dosage_method_code is 'dosage/method/coding/code (30 x 6 180)'; +comment on column db.medicationstatement.medstat_dosage_method_display is 'dosage/method/coding/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_dosage_method_text is 'dosage/method/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_type_system is 'dosage/doseAndRate/type/coding/system (70 x 6 420)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_type_version is 'dosage/doseAndRate/type/coding/version (50 x 6 300)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_type_code is 'dosage/doseAndRate/type/coding/code (30 x 6 180)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_type_display is 'dosage/doseAndRate/type/coding/display (100 x 6 600)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_type_text is 'dosage/doseAndRate/type/text (500 x 2 1000)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_doserange_low_value is 'dosage/doseAndRate/doseRange/low/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_doserange_low_unit is 'dosage/doseAndRate/doseRange/low/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_doserange_low_system is 'dosage/doseAndRate/doseRange/low/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_doserange_low_code is 'dosage/doseAndRate/doseRange/low/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_doserange_high_value is 'dosage/doseAndRate/doseRange/high/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_doserange_high_unit is 'dosage/doseAndRate/doseRange/high/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_doserange_high_system is 'dosage/doseAndRate/doseRange/high/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_doserange_high_code is 'dosage/doseAndRate/doseRange/high/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_dosequantity_value is 'dosage/doseAndRate/doseQuantity/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_dosequantity_comparator is 'dosage/doseAndRate/doseQuantity/comparator (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_dosequantity_unit is 'dosage/doseAndRate/doseQuantity/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_dosequantity_system is 'dosage/doseAndRate/doseQuantity/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_dosequantity_code is 'dosage/doseAndRate/doseQuantity/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_value is 'dosage/doseAndRate/rateRatio/numerator/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_comparator is 'dosage/doseAndRate/rateRatio/numerator/comparator (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_unit is 'dosage/doseAndRate/rateRatio/numerator/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_system is 'dosage/doseAndRate/rateRatio/numerator/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_numerator_code is 'dosage/doseAndRate/rateRatio/numerator/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_value is 'dosage/doseAndRate/rateRatio/denominator/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_comparator is 'dosage/doseAndRate/rateRatio/denominator/comparator (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_unit is 'dosage/doseAndRate/rateRatio/denominator/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_system is 'dosage/doseAndRate/rateRatio/denominator/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_rateratio_denominator_code is 'dosage/doseAndRate/rateRatio/denominator/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_raterange_low_value is 'dosage/doseAndRate/rateRange/low/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_raterange_low_unit is 'dosage/doseAndRate/rateRange/low/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_raterange_low_system is 'dosage/doseAndRate/rateRange/low/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_raterange_low_code is 'dosage/doseAndRate/rateRange/low/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_raterange_high_value is 'dosage/doseAndRate/rateRange/high/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_raterange_high_unit is 'dosage/doseAndRate/rateRange/high/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_raterange_high_system is 'dosage/doseAndRate/rateRange/high/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_raterange_high_code is 'dosage/doseAndRate/rateRange/high/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_ratequantity_value is 'dosage/doseAndRate/rateQuantity/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_ratequantity_unit is 'dosage/doseAndRate/rateQuantity/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_ratequantity_system is 'dosage/doseAndRate/rateQuantity/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_doseandrate_ratequantity_code is 'dosage/doseAndRate/rateQuantity/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_value is 'dosage/maxDosePerPeriod/numerator/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_comparator is 'dosage/maxDosePerPeriod/numerator/comparator (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_unit is 'dosage/maxDosePerPeriod/numerator/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_system is 'dosage/maxDosePerPeriod/numerator/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_numerator_code is 'dosage/maxDosePerPeriod/numerator/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_value is 'dosage/maxDosePerPeriod/denominator/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_comparator is 'dosage/maxDosePerPeriod/denominator/comparator (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_unit is 'dosage/maxDosePerPeriod/denominator/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_system is 'dosage/maxDosePerPeriod/denominator/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperperiod_denominator_code is 'dosage/maxDosePerPeriod/denominator/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperadministration_value is 'dosage/maxDosePerAdministration/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperadministration_unit is 'dosage/maxDosePerAdministration/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperadministration_system is 'dosage/maxDosePerAdministration/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperadministration_code is 'dosage/maxDosePerAdministration/code (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperlifetime_value is 'dosage/maxDosePerLifetime/value (10 x 2 20)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperlifetime_unit is 'dosage/maxDosePerLifetime/unit (30 x 2 60)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperlifetime_system is 'dosage/maxDosePerLifetime/system (70 x 2 140)'; +comment on column db.medicationstatement.medstat_dosage_maxdoseperlifetime_code is 'dosage/maxDosePerLifetime/code (30 x 2 60)'; + +comment on column db.observation.obs_id is 'id (70 x 1 70)'; +comment on column db.observation.obs_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column db.observation.obs_patient_id is 'subject/reference (70 x 1 70)'; +comment on column db.observation.obs_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column db.observation.obs_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.observation.obs_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.observation.obs_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.observation.obs_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.observation.obs_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.observation.obs_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.observation.obs_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.observation.obs_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.observation.obs_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.observation.obs_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.observation.obs_basedon_id is 'basedOn/reference (70 x 1 70)'; +comment on column db.observation.obs_basedon_type is 'basedOn/type (30 x 1 30)'; +comment on column db.observation.obs_basedon_identifier_use is 'basedOn/identifier/use (30 x 1 30)'; +comment on column db.observation.obs_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 1 70)'; +comment on column db.observation.obs_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 1 50)'; +comment on column db.observation.obs_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 1 30)'; +comment on column db.observation.obs_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 1 100)'; +comment on column db.observation.obs_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 1 500)'; +comment on column db.observation.obs_basedon_display is 'basedOn/display (100 x 1 100)'; +comment on column db.observation.obs_status is 'status (30 x 1 30)'; +comment on column db.observation.obs_category_system is 'category/coding/system (70 x 1 70)'; +comment on column db.observation.obs_category_version is 'category/coding/version (50 x 1 50)'; +comment on column db.observation.obs_category_code is 'category/coding/code (30 x 1 30)'; +comment on column db.observation.obs_category_display is 'category/coding/display (100 x 1 100)'; +comment on column db.observation.obs_category_text is 'category/text (500 x 1 500)'; +comment on column db.observation.obs_code_system is 'code/coding/system (70 x 1 70)'; +comment on column db.observation.obs_code_version is 'code/coding/version (50 x 1 50)'; +comment on column db.observation.obs_code_code is 'code/coding/code (30 x 1 30)'; +comment on column db.observation.obs_code_display is 'code/coding/display (100 x 1 100)'; +comment on column db.observation.obs_code_text is 'code/text (500 x 1 500)'; +comment on column db.observation.obs_effectivedatetime is 'effectiveDateTime (30 x 1 30)'; +comment on column db.observation.obs_issued is 'issued (30 x 1 30)'; +comment on column db.observation.obs_valuerange_low_value is 'valueRange/low/value (10 x 2 20)'; +comment on column db.observation.obs_valuerange_low_unit is 'valueRange/low/unit (30 x 2 60)'; +comment on column db.observation.obs_valuerange_low_system is 'valueRange/low/system (70 x 2 140)'; +comment on column db.observation.obs_valuerange_low_code is 'valueRange/low/code (30 x 2 60)'; +comment on column db.observation.obs_valuerange_high_value is 'valueRange/high/value (10 x 2 20)'; +comment on column db.observation.obs_valuerange_high_unit is 'valueRange/high/unit (30 x 2 60)'; +comment on column db.observation.obs_valuerange_high_system is 'valueRange/high/system (70 x 2 140)'; +comment on column db.observation.obs_valuerange_high_code is 'valueRange/high/code (30 x 2 60)'; +comment on column db.observation.obs_valueratio_numerator_value is 'valueRatio/numerator/value (10 x 2 20)'; +comment on column db.observation.obs_valueratio_numerator_comparator is 'valueRatio/numerator/comparator (10 x 2 20)'; +comment on column db.observation.obs_valueratio_numerator_unit is 'valueRatio/numerator/unit (30 x 2 60)'; +comment on column db.observation.obs_valueratio_numerator_system is 'valueRatio/numerator/system (70 x 2 140)'; +comment on column db.observation.obs_valueratio_numerator_code is 'valueRatio/numerator/code (30 x 2 60)'; +comment on column db.observation.obs_valueratio_denominator_value is 'valueRatio/denominator/value (10 x 2 20)'; +comment on column db.observation.obs_valueratio_denominator_comparator is 'valueRatio/denominator/comparator (10 x 2 20)'; +comment on column db.observation.obs_valueratio_denominator_unit is 'valueRatio/denominator/unit (30 x 2 60)'; +comment on column db.observation.obs_valueratio_denominator_system is 'valueRatio/denominator/system (70 x 2 140)'; +comment on column db.observation.obs_valueratio_denominator_code is 'valueRatio/denominator/code (30 x 2 60)'; +comment on column db.observation.obs_valuequantity_value is 'valueQuantity/value (10 x 2 20)'; +comment on column db.observation.obs_valuequantity_comparator is 'valueQuantity/comparator (10 x 2 20)'; +comment on column db.observation.obs_valuequantity_unit is 'valueQuantity/unit (30 x 2 60)'; +comment on column db.observation.obs_valuequantity_system is 'valueQuantity/system (70 x 2 140)'; +comment on column db.observation.obs_valuequantity_code is 'valueQuantity/code (30 x 2 60)'; +comment on column db.observation.obs_valuecodableconcept_system is 'valueCodableConcept/coding/system (70 x 6 420)'; +comment on column db.observation.obs_valuecodableconcept_version is 'valueCodableConcept/coding/version (50 x 6 300)'; +comment on column db.observation.obs_valuecodableconcept_code is 'valueCodableConcept/coding/code (30 x 6 180)'; +comment on column db.observation.obs_valuecodableconcept_display is 'valueCodableConcept/coding/display (100 x 6 600)'; +comment on column db.observation.obs_valuecodableconcept_text is 'valueCodableConcept/text (500 x 2 1000)'; +comment on column db.observation.obs_dataabsentreason_system is 'dataAbsentReason/coding/system (70 x 1 70)'; +comment on column db.observation.obs_dataabsentreason_version is 'dataAbsentReason/coding/version (50 x 1 50)'; +comment on column db.observation.obs_dataabsentreason_code is 'dataAbsentReason/coding/code (30 x 1 30)'; +comment on column db.observation.obs_dataabsentreason_display is 'dataAbsentReason/coding/display (100 x 1 100)'; +comment on column db.observation.obs_dataabsentreason_text is 'dataAbsentReason/text (500 x 1 500)'; +comment on column db.observation.obs_note_authorstring is 'note/authorString (50 x 1 50)'; +comment on column db.observation.obs_note_authorreference_id is 'note/authorReference/reference (70 x 1 70)'; +comment on column db.observation.obs_note_authorreference_type is 'note/authorReference/type (30 x 1 30)'; +comment on column db.observation.obs_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 1 30)'; +comment on column db.observation.obs_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 1 70)'; +comment on column db.observation.obs_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 1 50)'; +comment on column db.observation.obs_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 1 30)'; +comment on column db.observation.obs_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 1 100)'; +comment on column db.observation.obs_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 1 500)'; +comment on column db.observation.obs_note_authorreference_display is 'note/authorReference/display (100 x 1 100)'; +comment on column db.observation.obs_note_time is 'note/time (30 x 1 30)'; +comment on column db.observation.obs_note_text is 'note/text (5000 x 1 5000)'; +comment on column db.observation.obs_method_codableconcept is 'method/CodableConcept (100 x 1 100)'; +comment on column db.observation.obs_performer_id is 'performer/reference (70 x 1 70)'; +comment on column db.observation.obs_performer_type is 'performer/type (30 x 1 30)'; +comment on column db.observation.obs_performer_identifier_use is 'performer/identifier/use (30 x 1 30)'; +comment on column db.observation.obs_performer_identifier_type_system is 'performer/identifier/type/coding/system (70 x 1 70)'; +comment on column db.observation.obs_performer_identifier_type_version is 'performer/identifier/type/coding/version (50 x 1 50)'; +comment on column db.observation.obs_performer_identifier_type_code is 'performer/identifier/type/coding/code (30 x 1 30)'; +comment on column db.observation.obs_performer_identifier_type_display is 'performer/identifier/type/coding/display (100 x 1 100)'; +comment on column db.observation.obs_performer_identifier_type_text is 'performer/identifier/type/text (500 x 1 500)'; +comment on column db.observation.obs_performer_display is 'performer/display (100 x 1 100)'; +comment on column db.observation.obs_referencerange_low_value is 'referenceRange/low/value (10 x 3 30)'; +comment on column db.observation.obs_referencerange_low_unit is 'referenceRange/low/unit (30 x 3 90)'; +comment on column db.observation.obs_referencerange_low_system is 'referenceRange/low/system (70 x 3 210)'; +comment on column db.observation.obs_referencerange_low_code is 'referenceRange/low/code (30 x 3 90)'; +comment on column db.observation.obs_referencerange_high_value is 'referenceRange/high/value (10 x 3 30)'; +comment on column db.observation.obs_referencerange_high_unit is 'referenceRange/high/unit (30 x 3 90)'; +comment on column db.observation.obs_referencerange_high_system is 'referenceRange/high/system (70 x 3 210)'; +comment on column db.observation.obs_referencerange_high_code is 'referenceRange/high/code (30 x 3 90)'; +comment on column db.observation.obs_referencerange_type_codableconcept is 'referenceRange/type/CodableConcept (100 x 3 300)'; +comment on column db.observation.obs_referencerange_appliesto_system is 'referenceRange/appliesTo/coding/system (70 x 9 630)'; +comment on column db.observation.obs_referencerange_appliesto_version is 'referenceRange/appliesTo/coding/version (50 x 9 450)'; +comment on column db.observation.obs_referencerange_appliesto_code is 'referenceRange/appliesTo/coding/code (30 x 9 270)'; +comment on column db.observation.obs_referencerange_appliesto_display is 'referenceRange/appliesTo/coding/display (100 x 9 900)'; +comment on column db.observation.obs_referencerange_appliesto_text is 'referenceRange/appliesTo/text (500 x 3 1500)'; +comment on column db.observation.obs_referencerange_age_low_value is 'referenceRange/age/low/value (10 x 3 30)'; +comment on column db.observation.obs_referencerange_age_low_unit is 'referenceRange/age/low/unit (30 x 3 90)'; +comment on column db.observation.obs_referencerange_age_low_system is 'referenceRange/age/low/system (70 x 3 210)'; +comment on column db.observation.obs_referencerange_age_low_code is 'referenceRange/age/low/code (30 x 3 90)'; +comment on column db.observation.obs_referencerange_age_high_value is 'referenceRange/age/high/value (10 x 3 30)'; +comment on column db.observation.obs_referencerange_age_high_unit is 'referenceRange/age/high/unit (30 x 3 90)'; +comment on column db.observation.obs_referencerange_age_high_system is 'referenceRange/age/high/system (70 x 3 210)'; +comment on column db.observation.obs_referencerange_age_high_code is 'referenceRange/age/high/code (30 x 3 90)'; +comment on column db.observation.obs_referencerange_text is 'referenceRange/text (500 x 1 500)'; +comment on column db.observation.obs_hasmember_id is 'hasMember/reference (70 x 1 70)'; +comment on column db.observation.obs_hasmember_type is 'hasMember/type (30 x 1 30)'; +comment on column db.observation.obs_hasmember_identifier_use is 'hasMember/identifier/use (30 x 1 30)'; +comment on column db.observation.obs_hasmember_identifier_type_system is 'hasMember/identifier/type/coding/system (70 x 1 70)'; +comment on column db.observation.obs_hasmember_identifier_type_version is 'hasMember/identifier/type/coding/version (50 x 1 50)'; +comment on column db.observation.obs_hasmember_identifier_type_code is 'hasMember/identifier/type/coding/code (30 x 1 30)'; +comment on column db.observation.obs_hasmember_identifier_type_display is 'hasMember/identifier/type/coding/display (100 x 1 100)'; +comment on column db.observation.obs_hasmember_identifier_type_text is 'hasMember/identifier/type/text (500 x 1 500)'; +comment on column db.observation.obs_hasmember_display is 'hasMember/display (100 x 1 100)'; + +comment on column db.diagnosticreport.diagrep_id is 'id (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_patient_id is 'subject/reference (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.diagnosticreport.diagrep_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.diagnosticreport.diagrep_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.diagnosticreport.diagrep_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.diagnosticreport.diagrep_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.diagnosticreport.diagrep_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.diagnosticreport.diagrep_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.diagnosticreport.diagrep_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.diagnosticreport.diagrep_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.diagnosticreport.diagrep_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.diagnosticreport.diagrep_result_id is 'result/reference (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_basedon_id is 'basedOn/reference (100 x 1 100)'; +comment on column db.diagnosticreport.diagrep_status is 'status (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_category_system is 'category/coding/system (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_category_version is 'category/coding/version (50 x 1 50)'; +comment on column db.diagnosticreport.diagrep_category_code is 'category/coding/code (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_category_display is 'category/coding/display (100 x 1 100)'; +comment on column db.diagnosticreport.diagrep_category_text is 'category/text (500 x 1 500)'; +comment on column db.diagnosticreport.diagrep_code_system is 'code/coding/system (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_code_version is 'code/coding/version (50 x 1 50)'; +comment on column db.diagnosticreport.diagrep_code_code is 'code/coding/code (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_code_display is 'code/coding/display (100 x 1 100)'; +comment on column db.diagnosticreport.diagrep_code_text is 'code/text (500 x 1 500)'; +comment on column db.diagnosticreport.diagrep_effectivedatetime is 'effectiveDateTime (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_issued is 'issued (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_performer_id is 'performer/reference (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_performer_type is 'performer/type (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_performer_identifier_use is 'performer/identifier/use (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_performer_identifier_type_system is 'performer/identifier/type/coding/system (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_performer_identifier_type_version is 'performer/identifier/type/coding/version (50 x 1 50)'; +comment on column db.diagnosticreport.diagrep_performer_identifier_type_code is 'performer/identifier/type/coding/code (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_performer_identifier_type_display is 'performer/identifier/type/coding/display (100 x 1 100)'; +comment on column db.diagnosticreport.diagrep_performer_identifier_type_text is 'performer/identifier/type/text (500 x 1 500)'; +comment on column db.diagnosticreport.diagrep_performer_display is 'performer/display (100 x 1 100)'; +comment on column db.diagnosticreport.diagrep_conclusion is 'conclusion (500 x 1 500)'; +comment on column db.diagnosticreport.diagrep_conclusioncode_system is 'conclusionCode/coding/system (70 x 1 70)'; +comment on column db.diagnosticreport.diagrep_conclusioncode_version is 'conclusionCode/coding/version (50 x 1 50)'; +comment on column db.diagnosticreport.diagrep_conclusioncode_code is 'conclusionCode/coding/code (30 x 1 30)'; +comment on column db.diagnosticreport.diagrep_conclusioncode_display is 'conclusionCode/coding/display (100 x 1 100)'; +comment on column db.diagnosticreport.diagrep_conclusioncode_text is 'conclusionCode/text (500 x 1 500)'; + +comment on column db.servicerequest.servreq_id is 'id (70 x 1 70)'; +comment on column db.servicerequest.servreq_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column db.servicerequest.servreq_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.servicerequest.servreq_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.servicerequest.servreq_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.servicerequest.servreq_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.servicerequest.servreq_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.servicerequest.servreq_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.servicerequest.servreq_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.servicerequest.servreq_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.servicerequest.servreq_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.servicerequest.servreq_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.servicerequest.servreq_basedon_id is 'basedOn/reference (70 x 1 70)'; +comment on column db.servicerequest.servreq_basedon_type is 'basedOn/type (30 x 1 30)'; +comment on column db.servicerequest.servreq_basedon_identifier_use is 'basedOn/identifier/use (30 x 1 30)'; +comment on column db.servicerequest.servreq_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 1 70)'; +comment on column db.servicerequest.servreq_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 1 50)'; +comment on column db.servicerequest.servreq_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 1 30)'; +comment on column db.servicerequest.servreq_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 1 500)'; +comment on column db.servicerequest.servreq_basedon_display is 'basedOn/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_status is 'status (30 x 1 30)'; +comment on column db.servicerequest.servreq_intent is 'intent (30 x 1 30)'; +comment on column db.servicerequest.servreq_category_system is 'category/coding/system (70 x 1 70)'; +comment on column db.servicerequest.servreq_category_version is 'category/coding/version (50 x 1 50)'; +comment on column db.servicerequest.servreq_category_code is 'category/coding/code (30 x 1 30)'; +comment on column db.servicerequest.servreq_category_display is 'category/coding/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_category_text is 'category/text (500 x 1 500)'; +comment on column db.servicerequest.servreq_code_system is 'code/coding/system (70 x 1 70)'; +comment on column db.servicerequest.servreq_code_version is 'code/coding/version (50 x 1 50)'; +comment on column db.servicerequest.servreq_code_code is 'code/coding/code (30 x 1 30)'; +comment on column db.servicerequest.servreq_code_display is 'code/coding/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_code_text is 'code/text (500 x 1 500)'; +comment on column db.servicerequest.servreq_authoredon is 'authoredOn (30 x 1 30)'; +comment on column db.servicerequest.servreq_requester_id is 'requester/reference (70 x 1 70)'; +comment on column db.servicerequest.servreq_requester_type is 'requester/type (30 x 1 30)'; +comment on column db.servicerequest.servreq_requester_identifier_use is 'requester/identifier/use (30 x 1 30)'; +comment on column db.servicerequest.servreq_requester_identifier_type_system is 'requester/identifier/type/coding/system (70 x 1 70)'; +comment on column db.servicerequest.servreq_requester_identifier_type_version is 'requester/identifier/type/coding/version (50 x 1 50)'; +comment on column db.servicerequest.servreq_requester_identifier_type_code is 'requester/identifier/type/coding/code (30 x 1 30)'; +comment on column db.servicerequest.servreq_requester_identifier_type_display is 'requester/identifier/type/coding/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_requester_identifier_type_text is 'requester/identifier/type/text (500 x 1 500)'; +comment on column db.servicerequest.servreq_requester_display is 'requester/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_performer_id is 'performer/reference (70 x 1 70)'; +comment on column db.servicerequest.servreq_performer_type is 'performer/type (30 x 1 30)'; +comment on column db.servicerequest.servreq_performer_identifier_use is 'performer/identifier/use (30 x 1 30)'; +comment on column db.servicerequest.servreq_performer_identifier_type_system is 'performer/identifier/type/coding/system (70 x 1 70)'; +comment on column db.servicerequest.servreq_performer_identifier_type_version is 'performer/identifier/type/coding/version (50 x 1 50)'; +comment on column db.servicerequest.servreq_performer_identifier_type_code is 'performer/identifier/type/coding/code (30 x 1 30)'; +comment on column db.servicerequest.servreq_performer_identifier_type_display is 'performer/identifier/type/coding/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_performer_identifier_type_text is 'performer/identifier/type/text (500 x 1 500)'; +comment on column db.servicerequest.servreq_performer_display is 'performer/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_locationcode_system is 'locationCode/coding/system (70 x 1 70)'; +comment on column db.servicerequest.servreq_locationcode_version is 'locationCode/coding/version (50 x 1 50)'; +comment on column db.servicerequest.servreq_locationcode_code is 'locationCode/coding/code (30 x 1 30)'; +comment on column db.servicerequest.servreq_locationcode_display is 'locationCode/coding/display (100 x 1 100)'; +comment on column db.servicerequest.servreq_locationcode_text is 'locationCode/text (500 x 1 500)'; + +comment on column db.procedure.proc_id is 'id (70 x 1 70)'; +comment on column db.procedure.proc_encounter_id is 'encounter/reference (70 x 1 70)'; +comment on column db.procedure.proc_patient_id is 'subject/reference (70 x 1 70)'; +comment on column db.procedure.proc_partof_id is 'partOf/reference (70 x 1 70)'; +comment on column db.procedure.proc_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.procedure.proc_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.procedure.proc_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.procedure.proc_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.procedure.proc_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.procedure.proc_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.procedure.proc_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.procedure.proc_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.procedure.proc_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.procedure.proc_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.procedure.proc_basedon_id is 'basedOn/reference (70 x 1 70)'; +comment on column db.procedure.proc_basedon_type is 'basedOn/type (30 x 1 30)'; +comment on column db.procedure.proc_basedon_identifier_use is 'basedOn/identifier/use (30 x 1 30)'; +comment on column db.procedure.proc_basedon_identifier_type_system is 'basedOn/identifier/type/coding/system (70 x 1 70)'; +comment on column db.procedure.proc_basedon_identifier_type_version is 'basedOn/identifier/type/coding/version (50 x 1 50)'; +comment on column db.procedure.proc_basedon_identifier_type_code is 'basedOn/identifier/type/coding/code (30 x 1 30)'; +comment on column db.procedure.proc_basedon_identifier_type_display is 'basedOn/identifier/type/coding/display (100 x 1 100)'; +comment on column db.procedure.proc_basedon_identifier_type_text is 'basedOn/identifier/type/text (500 x 1 500)'; +comment on column db.procedure.proc_basedon_display is 'basedOn/display (100 x 1 100)'; +comment on column db.procedure.proc_status is 'status (30 x 1 30)'; +comment on column db.procedure.proc_statusreason_system is 'statusReason/coding/system (70 x 1 70)'; +comment on column db.procedure.proc_statusreason_version is 'statusReason/coding/version (50 x 1 50)'; +comment on column db.procedure.proc_statusreason_code is 'statusReason/coding/code (30 x 1 30)'; +comment on column db.procedure.proc_statusreason_display is 'statusReason/coding/display (100 x 1 100)'; +comment on column db.procedure.proc_statusreason_text is 'statusReason/text (500 x 1 500)'; +comment on column db.procedure.proc_category_system is 'category/coding/system (70 x 1 70)'; +comment on column db.procedure.proc_category_version is 'category/coding/version (50 x 1 50)'; +comment on column db.procedure.proc_category_code is 'category/coding/code (30 x 1 30)'; +comment on column db.procedure.proc_category_display is 'category/coding/display (100 x 1 100)'; +comment on column db.procedure.proc_category_text is 'category/text (500 x 1 500)'; +comment on column db.procedure.proc_code_system is 'code/coding/system (70 x 1 70)'; +comment on column db.procedure.proc_code_version is 'code/coding/version (50 x 1 50)'; +comment on column db.procedure.proc_code_code is 'code/coding/code (30 x 1 30)'; +comment on column db.procedure.proc_code_display is 'code/coding/display (100 x 1 100)'; +comment on column db.procedure.proc_code_text is 'code/text (500 x 1 500)'; +comment on column db.procedure.proc_performeddatetime is 'performedDateTime (30 x 1 30)'; +comment on column db.procedure.proc_performedperiod_start is 'performedPeriod/start (30 x 1 30)'; +comment on column db.procedure.proc_performedperiod_end is 'performedPeriod/end (30 x 1 30)'; +comment on column db.procedure.proc_reasoncode_system is 'reasonCode/coding/system (70 x 1 70)'; +comment on column db.procedure.proc_reasoncode_version is 'reasonCode/coding/version (50 x 1 50)'; +comment on column db.procedure.proc_reasoncode_code is 'reasonCode/coding/code (30 x 1 30)'; +comment on column db.procedure.proc_reasoncode_display is 'reasonCode/coding/display (100 x 1 100)'; +comment on column db.procedure.proc_reasoncode_text is 'reasonCode/text (500 x 1 500)'; +comment on column db.procedure.proc_reasonreference_id is 'reasonReference/reference (70 x 1 70)'; +comment on column db.procedure.proc_reasonreference_type is 'reasonReference/type (30 x 1 30)'; +comment on column db.procedure.proc_reasonreference_identifier_use is 'reasonReference/identifier/use (30 x 1 30)'; +comment on column db.procedure.proc_reasonreference_identifier_type_system is 'reasonReference/identifier/type/coding/system (70 x 1 70)'; +comment on column db.procedure.proc_reasonreference_identifier_type_version is 'reasonReference/identifier/type/coding/version (50 x 1 50)'; +comment on column db.procedure.proc_reasonreference_identifier_type_code is 'reasonReference/identifier/type/coding/code (30 x 1 30)'; +comment on column db.procedure.proc_reasonreference_identifier_type_display is 'reasonReference/identifier/type/coding/display (100 x 1 100)'; +comment on column db.procedure.proc_reasonreference_identifier_type_text is 'reasonReference/identifier/type/text (500 x 1 500)'; +comment on column db.procedure.proc_reasonreference_display is 'reasonReference/display (100 x 1 100)'; +comment on column db.procedure.proc_note_authorstring is 'note/authorString (50 x 6 300)'; +comment on column db.procedure.proc_note_authorreference_id is 'note/authorReference/reference (70 x 6 420)'; +comment on column db.procedure.proc_note_authorreference_type is 'note/authorReference/type (30 x 6 180)'; +comment on column db.procedure.proc_note_authorreference_identifier_use is 'note/authorReference/identifier/use (30 x 6 180)'; +comment on column db.procedure.proc_note_authorreference_identifier_type_system is 'note/authorReference/identifier/type/coding/system (70 x 18 1260)'; +comment on column db.procedure.proc_note_authorreference_identifier_type_version is 'note/authorReference/identifier/type/coding/version (50 x 18 900)'; +comment on column db.procedure.proc_note_authorreference_identifier_type_code is 'note/authorReference/identifier/type/coding/code (30 x 18 540)'; +comment on column db.procedure.proc_note_authorreference_identifier_type_display is 'note/authorReference/identifier/type/coding/display (100 x 18 1800)'; +comment on column db.procedure.proc_note_authorreference_identifier_type_text is 'note/authorReference/identifier/type/text (500 x 6 3000)'; +comment on column db.procedure.proc_note_authorreference_display is 'note/authorReference/display (100 x 6 600)'; +comment on column db.procedure.proc_note_time is 'note/time (30 x 2 60)'; +comment on column db.procedure.proc_note_text is 'note/text (5000 x 2 10000)'; + +comment on column db.consent.cons_id is 'id (70 x 1 70)'; +comment on column db.consent.cons_patient_id is 'patient/reference (70 x 1 70)'; +comment on column db.consent.cons_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.consent.cons_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.consent.cons_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.consent.cons_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.consent.cons_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.consent.cons_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.consent.cons_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.consent.cons_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.consent.cons_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.consent.cons_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.consent.cons_status is 'status (30 x 1 30)'; +comment on column db.consent.cons_scope_system is 'scope/coding/system (70 x 1 70)'; +comment on column db.consent.cons_scope_version is 'scope/coding/version (50 x 1 50)'; +comment on column db.consent.cons_scope_code is 'scope/coding/code (30 x 1 30)'; +comment on column db.consent.cons_scope_display is 'scope/coding/display (100 x 1 100)'; +comment on column db.consent.cons_scope_text is 'scope/text (500 x 1 500)'; +comment on column db.consent.cons_datetime is 'dateTime (30 x 1 30)'; +comment on column db.consent.cons_provision_type is 'provision/type (10 x 1 10)'; +comment on column db.consent.cons_provision_period_start is 'provision/period/start (30 x 1 30)'; +comment on column db.consent.cons_provision_period_end is 'provision/period/end (30 x 1 30)'; +comment on column db.consent.cons_provision_actor_role_system is 'provision/actor/role/coding/system (70 x 1 70)'; +comment on column db.consent.cons_provision_actor_role_version is 'provision/actor/role/coding/version (50 x 1 50)'; +comment on column db.consent.cons_provision_actor_role_code is 'provision/actor/role/coding/code (30 x 1 30)'; +comment on column db.consent.cons_provision_actor_role_display is 'provision/actor/role/coding/display (100 x 1 100)'; +comment on column db.consent.cons_provision_actor_role_text is 'provision/actor/role/text (500 x 1 500)'; +comment on column db.consent.cons_provision_code_system is 'provision/code/coding/system (70 x 1 70)'; +comment on column db.consent.cons_provision_code_version is 'provision/code/coding/version (50 x 1 50)'; +comment on column db.consent.cons_provision_code_code is 'provision/code/coding/code (30 x 1 30)'; +comment on column db.consent.cons_provision_code_display is 'provision/code/coding/display (100 x 1 100)'; +comment on column db.consent.cons_provision_code_text is 'provision/code/text (500 x 1 500)'; +comment on column db.consent.cons_provision_dataperiod_start is 'provision/dataPeriod/start (30 x 1 30)'; +comment on column db.consent.cons_provision_dataperiod_end is 'provision/dataPeriod/end (30 x 1 30)'; + +comment on column db.location.loc_id is 'id (70 x 1 70)'; +comment on column db.location.loc_identifier_use is 'identifier/use (50 x 2 100)'; +comment on column db.location.loc_identifier_type_system is 'identifier/type/coding/system (70 x 6 420)'; +comment on column db.location.loc_identifier_type_version is 'identifier/type/coding/version (50 x 6 300)'; +comment on column db.location.loc_identifier_type_code is 'identifier/type/coding/code (30 x 6 180)'; +comment on column db.location.loc_identifier_type_display is 'identifier/type/coding/display (100 x 6 600)'; +comment on column db.location.loc_identifier_type_text is 'identifier/type/text (500 x 2 1000)'; +comment on column db.location.loc_identifier_system is 'identifier/system (70 x 2 140)'; +comment on column db.location.loc_identifier_value is 'identifier/value (70 x 2 140)'; +comment on column db.location.loc_identifier_start is 'identifier/start (30 x 2 60)'; +comment on column db.location.loc_identifier_end is 'identifier/end (30 x 2 60)'; +comment on column db.location.loc_status is 'status (30 x 1 30)'; +comment on column db.location.loc_name is 'name (50 x 1 50)'; +comment on column db.location.loc_description is 'description (50 x 1 50)'; +comment on column db.location.loc_alias is 'alias (30 x 3 90)'; + +-- Kleine Copy Funktion +-- Überführungsfunktion +CREATE OR REPLACE FUNCTION db.do_kds_import_to_db() +RETURNS VOID AS $$ +DECLARE + record_count INT; + current_record record; + data_count integer; +BEGIN + -- patient ------------------------------------------------------------------------------------------------- + FOR current_record IN (SELECT * FROM kds2db_in.patient WHERE current_dataset_status NOT LIKE 'DELETE after%') + LOOP + SELECT count(1) INTO data_count + FROM db.patient target_record + WHERE pat_identifier_use = pat_identifier_use AND + pat_identifier_type_system = pat_identifier_type_system AND + pat_identifier_type_version = pat_identifier_type_version AND + pat_identifier_type_code = pat_identifier_type_code AND + pat_identifier_type_display = pat_identifier_type_display AND + pat_identifier_type_text = pat_identifier_type_text AND + pat_identifier_system = pat_identifier_system AND + pat_identifier_value = pat_identifier_value AND + pat_identifier_start = pat_identifier_start AND + pat_identifier_end = pat_identifier_end AND + pat_name_given = pat_name_given AND + pat_name_family = pat_name_family AND + pat_gender = pat_gender AND + pat_birthdate = pat_birthdate AND + pat_address_postalcode = pat_address_postalcode + ; + + IF data_count=0 + THEN + -- Füge in die Backup-Tabelle ein, wenn kein übereinstimmender Datensatz gefunden wurde + INSERT INTO db.patient ( + pat_identifier_use, + pat_identifier_type_system, + pat_identifier_type_version, + pat_identifier_type_code, + pat_identifier_type_display, + pat_identifier_type_text, + pat_identifier_system, + pat_identifier_value, + pat_identifier_start, + pat_identifier_end, + pat_name_given, + pat_name_family, + pat_gender, + pat_birthdate, + pat_address_postalcode, + input_datetime + ) + VALUES ( + current_record.pat_identifier_use, + current_record.pat_identifier_type_system, + current_record.pat_identifier_type_version, + current_record.pat_identifier_type_code, + current_record.pat_identifier_type_display, + current_record.pat_identifier_type_text, + current_record.pat_identifier_system, + current_record.pat_identifier_value, + current_record.pat_identifier_start, + current_record.pat_identifier_end, + current_record.pat_name_given, + current_record.pat_name_family, + current_record.pat_gender, + current_record.pat_birthdate, + current_record.pat_address_postalcode, + current_record.input_datetime + ); + + + -- Aktualisiere den Zeitstempel für die letzte Überprüfung/Insert + UPDATE kds2db_in.patient + SET last_check_datetime = CURRENT_TIMESTAMP + , current_dataset_status = 'DELETE after db_insert '||data_count::integer + WHERE patient_id = current_record.patient_id; + END IF; + END LOOP; +END; +$$ LANGUAGE plpgsql; -- Create View DB2FRONTEND_OUT CREATE OR REPLACE VIEW db2frontend_out.patient AS @@ -594,8 +5555,8 @@ patient_id as record_id , to_char(CURRENT_TIMESTAMP,'YYYY-MM-DD HH24:MI:SS') letzter_abrufzeitpunkt_dieser_daten from db.patient order by pat_id; - +GRANT USAGE ON SCHEMA db2frontend_out to db2frontend_user; GRANT SELECT ON db2frontend_out.patient to db2frontend_user; -- CopyJob KDS2DB -> DB -SELECT cron.schedule('*/10 * * * *', 'CALL db.do_kds_import_to_db();'); \ No newline at end of file +SELECT cron.schedule('*/10 * * * *', 'SELECT db.do_kds_import_to_db();'); diff --git a/Postgres-amts_db/postgresql.conf b/Postgres-amts_db/postgresql.conf index a666c2cd..35d5a8c8 100644 --- a/Postgres-amts_db/postgresql.conf +++ b/Postgres-amts_db/postgresql.conf @@ -816,7 +816,7 @@ default_text_search_config = 'pg_catalog.english' shared_preload_libraries = 'pg_cron' # optionally, specify the database in which the pg_cron background worker should run (defaults to postgres) -cron.database_name = 'interpolar' +cron.database_name = 'amts_db' # optionally, specify the timezone in which the pg_cron background worker should run (defaults to GMT). E.g: # cron.timezone = 'PRC' diff --git a/Postgres-amts_db/template_env_amts_db.password b/Postgres-amts_db/template_env_amts_db_admin.password similarity index 100% rename from Postgres-amts_db/template_env_amts_db.password rename to Postgres-amts_db/template_env_amts_db_admin.password diff --git a/R-dataprocessor/README.md b/R-dataprocessor/README.md new file mode 100644 index 00000000..937f33d8 --- /dev/null +++ b/R-dataprocessor/README.md @@ -0,0 +1,7 @@ +### Data Processor + +Dies ist das Data Processor Modul, in dem sämtliche Umwandlungen von Daten erfolgen: + +* Validierung der FHIR Daten +* Harmonisierung (Einheiten, Zeiten, ...) +* Berechnung von Medication Related Problems (MRP) diff --git a/R-dataprocessor/dataprocessor/.Rbuildignore b/R-dataprocessor/dataprocessor/.Rbuildignore new file mode 100644 index 00000000..6ffbe513 --- /dev/null +++ b/R-dataprocessor/dataprocessor/.Rbuildignore @@ -0,0 +1,3 @@ +^dataprocessor\.Rproj$ +^\.Rproj\.user$ +^LICENSE\.md$ diff --git a/R-dataprocessor/dataprocessor/.gitignore b/R-dataprocessor/dataprocessor/.gitignore new file mode 100644 index 00000000..cd67eac6 --- /dev/null +++ b/R-dataprocessor/dataprocessor/.gitignore @@ -0,0 +1 @@ +.Rproj.user diff --git a/R-dataprocessor/dataprocessor/DESCRIPTION b/R-dataprocessor/dataprocessor/DESCRIPTION new file mode 100644 index 00000000..f92ef4e9 --- /dev/null +++ b/R-dataprocessor/dataprocessor/DESCRIPTION @@ -0,0 +1,16 @@ +Package: dataprocessor +Title: What the Package Does (One Line, Title Case) +Version: 0.0.0.9000 +Authors@R: + person("First", "Last", , "first.last@example.com", role = c("aut", "cre"), + comment = c(ORCID = "YOUR-ORCID-ID")) +Description: What the package does (one paragraph). +License: Apache License (>= 2) +Encoding: UTF-8 +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.1 +Imports: + etlutils +Suggests: + testthat (>= 3.0.0) +Config/testthat/edition: 3 diff --git a/R-dataprocessor/dataprocessor/LICENSE.md b/R-dataprocessor/dataprocessor/LICENSE.md new file mode 100644 index 00000000..b62a9b5f --- /dev/null +++ b/R-dataprocessor/dataprocessor/LICENSE.md @@ -0,0 +1,194 @@ +Apache License +============== + +_Version 2.0, January 2004_ +_<>_ + +### Terms and Conditions for use, reproduction, and distribution + +#### 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +#### 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +#### 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +#### 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +#### 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +#### 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +#### 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +#### 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +#### 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +### APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets `[]` replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same “printed page” as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/R-dataprocessor/dataprocessor/NAMESPACE b/R-dataprocessor/dataprocessor/NAMESPACE new file mode 100644 index 00000000..6ae92683 --- /dev/null +++ b/R-dataprocessor/dataprocessor/NAMESPACE @@ -0,0 +1,2 @@ +# Generated by roxygen2: do not edit by hand + diff --git a/R-dataprocessor/dataprocessor/dataprocessor.Rproj b/R-dataprocessor/dataprocessor/dataprocessor.Rproj new file mode 100644 index 00000000..69fafd4b --- /dev/null +++ b/R-dataprocessor/dataprocessor/dataprocessor.Rproj @@ -0,0 +1,22 @@ +Version: 1.0 + +RestoreWorkspace: No +SaveWorkspace: No +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes +LineEndingConversion: Posix + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace diff --git a/R-dataprocessor/dataprocessor/tests/testthat.R b/R-dataprocessor/dataprocessor/tests/testthat.R new file mode 100644 index 00000000..ca656b44 --- /dev/null +++ b/R-dataprocessor/dataprocessor/tests/testthat.R @@ -0,0 +1,12 @@ +# This file is part of the standard setup for testthat. +# It is recommended that you do not modify it. +# +# Where should you do additional test configuration? +# Learn more about the roles of various files in: +# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview +# * https://testthat.r-lib.org/articles/special-files.html + +library(testthat) +library(dataprocessor) + +test_check("dataprocessor") diff --git a/R-dataprocessor/dataprocessor/tests/testthat/test-DUMMY-TEST.R b/R-dataprocessor/dataprocessor/tests/testthat/test-DUMMY-TEST.R new file mode 100644 index 00000000..e80104f6 --- /dev/null +++ b/R-dataprocessor/dataprocessor/tests/testthat/test-DUMMY-TEST.R @@ -0,0 +1,4 @@ +# dummy test to fulfill all conditions for package install +test_that("This is a dummy test and should be removed", { + expect_true(TRUE) +}) diff --git a/R-db2frontend/StartDB2Frontend.R b/R-db2frontend/StartDB2Frontend.R index cda10c8c..7ce60de7 100644 --- a/R-db2frontend/StartDB2Frontend.R +++ b/R-db2frontend/StartDB2Frontend.R @@ -1,8 +1,11 @@ -########################################################################## +# chance the working directory to the main directory +if (grepl('/db2frontend$', getwd())) setwd("../..") +if (grepl('/R-db2frontend$', getwd())) setwd("../") + # free memory -########################################################################## rm(list = ls()) +library(etlutils) library(db2frontend) copyDB2Redcap() diff --git a/R-db2frontend/db2frontend/R/dbDatatoREDCap.R b/R-db2frontend/db2frontend/R/dbDatatoREDCap.R index 18e83476..b0535bda 100644 --- a/R-db2frontend/db2frontend/R/dbDatatoREDCap.R +++ b/R-db2frontend/db2frontend/R/dbDatatoREDCap.R @@ -13,28 +13,13 @@ #' initConstants <- function() { # Path to the module configuration TOML file - path2config_toml <- ifelse(interactive(), './R-db2frontend', '.') - path2config_toml <- paste0(path2config_toml, '/db2frontend_config.toml') + path2config_toml <- './R-db2frontend/db2frontend_config.toml' # Load module configuration settings etlutils::initConstants(path2config_toml) - # Load database configuration settings etlutils::initConstants(PATH_TO_DB_CONFIG_TOML) } -initConstants <- function() { - ### - # Read the module configuration toml file. - ### - path2config_toml <- ifelse(interactive(), './R-db2frontend', '.') - path2config_toml <- paste0(path2config_toml, '/db2frontend_config.toml') - etlutils::initConstants(path2config_toml) - ### - # Read the DB configuration toml file - ### - etlutils::initConstants(PATH_TO_DB_CONFIG_TOML) -} - #' Copy Database Content to REDCap #' #' This function retrieves data from the view or table in a database @@ -60,6 +45,7 @@ initConstants <- function() { copyDB2Redcap <- function() { #get data from patient view / tabelle, schema _out initConstants() + #establish connection to db dbcon <- etlutils::dbConnect(DB_DB2FRONTEND_USER, DB_DB2FRONTEND_PASSWORD, DB_GENERAL_NAME, DB_GENERAL_HOST, DB_GENERAL_PORT, DB_DB2FRONTEND_SCHEMA_OUT) @@ -70,7 +56,7 @@ copyDB2Redcap <- function() { pat_gschlcht FROM patient") #connect to REDCap project - redcapcon <- redcapAPI::redcapConnection(url = url,token = token) + redcapcon <- redcapAPI::redcapConnection(url = REDCAP_URL, token = REDCAP_TOKEN) #send data to REDCap redcapAPI::importRecords(redcapcon, data = new_data, logfile = "log.txt") diff --git a/R-db2frontend/db2frontend_config.toml b/R-db2frontend/db2frontend_config.toml index bb135c2c..f81c0e5b 100644 --- a/R-db2frontend/db2frontend_config.toml +++ b/R-db2frontend/db2frontend_config.toml @@ -1,3 +1,10 @@ [database] PATH_TO_DB_CONFIG_TOML = "./amts_db_config.toml" + +[redcap] + +# URL for the user's REDCap database API. +REDCAP_URL = "http://redcap/redcap/api/" +# REDCap API token +REDCAP_TOKEN = "Fill with your REDCap API token" diff --git a/R-etlutils/etlutils/DESCRIPTION b/R-etlutils/etlutils/DESCRIPTION index d78a54cb..df833fc8 100644 --- a/R-etlutils/etlutils/DESCRIPTION +++ b/R-etlutils/etlutils/DESCRIPTION @@ -23,7 +23,6 @@ Imports: fhircrackr, httr, lubridate, - memuse, methods, openxlsx, RcppTOML, diff --git a/R-etlutils/etlutils/NAMESPACE b/R-etlutils/etlutils/NAMESPACE index 74ac93bb..2afc3dd3 100644 --- a/R-etlutils/etlutils/NAMESPACE +++ b/R-etlutils/etlutils/NAMESPACE @@ -1,31 +1,33 @@ # Generated by roxygen2: do not edit by hand export(END__) -export(END__START__) export(START__) export(addCharlsonScore) export(addTableRow) export(cat_colourised) export(cat_error) export(cat_green) -export(cat_headline) export(cat_ok) export(cat_red) -export(cat_white) export(catl) export(check_error) export(colourise) export(combineDataTables) +export(complete_table) +export(convertDateInformation) export(convertListColumnsToString) +export(convertTimeToPOSIXct) export(createClock) export(create_dirs) -export(data.table.as.character) +export(dataTableAsCharacter) export(dbAddContent) export(dbConnect) export(dbDeleteContent) export(dbDisconnect) export(dbListTables) export(end_logging) +export(fhir_url_add_common_request_params) +export(fixDateFormat) export(flatten_list) export(frame_string) export(getAfterLastSlash) @@ -38,8 +40,6 @@ export(getVarByNameOrDefaultIfMissing) export(get_encounters) export(get_ncores) export(get_os) -export(get_pattern_YYYY) -export(get_pattern_YYYY_MM) export(get_project_dir_names) export(getcolumnIndex) export(human_readable_duration) @@ -53,24 +53,17 @@ export(isSimpleTrueOrNot0) export(isValidTable) export(limit_ncores) export(loadResourcesByPID) -export(log_run) export(moveColumnBefore) export(namedListByParam) export(namedListByValue) export(paste_parameters) export(plural_s) -export(polar_add_common_request_params) export(polar_add_to_bundles_path) export(polar_add_to_log_path) export(polar_add_to_tables_path) -export(polar_as_date) -export(polar_as_time) -export(polar_complete_table) -export(polar_disclaimer) export(polar_download_and_crack_parallel) export(polar_download_by_ids_and_crack_parallel) export(polar_fhir_search) -export(polar_fix_dates) export(polar_get_resources_by_ids) export(polar_get_resources_count) export(polar_get_resources_ids) @@ -80,7 +73,6 @@ export(polar_path_to_log_directory) export(polar_path_to_tables_directory) export(polar_read_rdata) export(polar_refresh_token) -export(polar_run) export(polar_sample_identified_resources) export(polar_sample_resources) export(polar_save_bundles) @@ -108,6 +100,7 @@ export(replacePatternsInColumn) export(replacePatternsInString) export(retainColumns) export(run) +export(runProcess) export(run_in) export(run_in_in) export(run_in_in_ignore_error) @@ -121,6 +114,7 @@ export(sortListByName) export(sortListByValue) export(splitColumnToRows) export(start_logging) +export(stopOnError) export(styled_string) export(toMatrix) export(trimTableValues) diff --git a/R-etlutils/etlutils/R/global_variables.R b/R-etlutils/etlutils/R/global_variables.R index d1a74870..92377369 100644 --- a/R-etlutils/etlutils/R/global_variables.R +++ b/R-etlutils/etlutils/R/global_variables.R @@ -9,6 +9,6 @@ utils::globalVariables(c("PERIOD_END", "PERIOD_START", "RESOURCES_TO_DOWNLOAD", # global variables for directory utils::globalVariables(c("PROJECT_NAME", "SUB_PROJECTS_DIRS", "PROJECT_TIME_STAMP")) # global variables for logging -utils::globalVariables(c("POLAR_CLOCK", "VERBOSE", "DEBUG", "VERSIONS")) +utils::globalVariables(c("PROCESS_CLOCK", "VERBOSE", "DEBUG", "VERSIONS")) # global variables for other functionalities #utils::globalVariables(c("ENC_RES_MERGE", "MEDICATION_RESOURCE")) diff --git a/R-etlutils/etlutils/R/lib_clock.R b/R-etlutils/etlutils/R/lib_clock.R index e4f2f05c..665d918c 100644 --- a/R-etlutils/etlutils/R/lib_clock.R +++ b/R-etlutils/etlutils/R/lib_clock.R @@ -263,7 +263,7 @@ Clock = setRefClass( last_row <- max(which(.history$state == 'RUNNING')) # add end time, error and state to this row .history[last_row, 'end'] <<- now_ - .history[last_row, 'error'] <<- if (inherits(err, 'try-error')) err else '' + .history[last_row, 'error'] <<- if (inherits(err, 'try-error')) cat_red(err) else '' .history[last_row, 'state'] <<- if (inherits(err, 'try-error')) 'ERROR' else 'OK' # if 0 < verbose print some messages if (0 < verbose) { diff --git a/R-etlutils/etlutils/R/lib_colourise_text.R b/R-etlutils/etlutils/R/lib_colourise_text.R index bdb46086..f23bd060 100644 --- a/R-etlutils/etlutils/R/lib_colourise_text.R +++ b/R-etlutils/etlutils/R/lib_colourise_text.R @@ -139,18 +139,6 @@ cat_red <- function(msg, bg = NULL) { cat_colourised(msg, fg = "light red", bg = bg) } -#' Print Text in White Color -#' -#' This function prints text in white color. -#' -#' @param msg The text message to be printed. -#' @param bg The background color. Defaults to NULL. -#' -#' @export -cat_white <- function(msg, bg = NULL) { - cat_colourised(msg, fg = "white", bg = bg) -} - #' Print "OK" in Light Green Color #' #' This function prints "OK" in light green color. @@ -175,12 +163,3 @@ cat_error <- function(msg = "ERROR\n", bg = NULL) { cat_red(msg, bg = bg) } -#' Print Text in White Color (Headline Style) -#' -#' This function prints text in white color (headline style). -#' -#' @param msg The text message to be printed. -#' @param bg The background color. Defaults to NULL. -#' -#' @export -cat_headline <- cat_white diff --git a/R-etlutils/etlutils/R/lib_db.R b/R-etlutils/etlutils/R/lib_db.R index 6633d1f1..ee094dca 100644 --- a/R-etlutils/etlutils/R/lib_db.R +++ b/R-etlutils/etlutils/R/lib_db.R @@ -68,8 +68,7 @@ dbDisconnect <- function(db_connection) { dbListTables <- function(db_connection) { # Get existing table names from the database connection tables <- DBI::dbListTables(db_connection) - # Display the table names using the str() function for a concise overview - utils::str(tables) + return(tables) } #' Insert Rows into a PostgreSQL Table @@ -94,17 +93,12 @@ dbAddContent <- function(db_connection, table_name, table) { # Get row count for reporting row_count <- nrow(table) if (row_count > 0) { - # Try to append table content and catch any error - db_insert_result <- try(RPostgres::dbAppendTable(db_connection, table_name, table)) - # Check for error in insertion and stop execution if error occurs - if (isError(db_insert_result)) { - print(db_insert_result) - STOP <<- TRUE - } + # Append table content + db_insert_result <- RPostgres::dbAppendTable(db_connection, table_name, table) } # Calculate and print duration of operation duration <- difftime(Sys.time(), time0, units = 'secs') - print(paste0('Inserted in ', table_name, ', ', row_count, ' rows (took ', duration, ' seconds)', ifelse(STOP, ' with error', ''))) + print(paste0('Inserted in ', table_name, ', ', row_count, ' rows (took ', duration, ' seconds)')) } #' Delete All Rows from a Database Table diff --git a/R-etlutils/etlutils/R/lib_dir.R b/R-etlutils/etlutils/R/lib_dir.R index 78926cec..ba265384 100644 --- a/R-etlutils/etlutils/R/lib_dir.R +++ b/R-etlutils/etlutils/R/lib_dir.R @@ -198,7 +198,7 @@ polar_save_request <- function(request, filename_without_extension) { #' #' @return Nothing. #' @export -save_performance <- function(filename_without_extension, clock = if (is.null(POLAR_CLOCK)) NULL else POLAR_CLOCK) { +save_performance <- function(filename_without_extension, clock = if (is.null(PROCESS_CLOCK)) NULL else PROCESS_CLOCK) { clock$write(filename_without_extension = fhircrackr::pastep(SUB_PROJECTS_DIRS$local_dir, "performance", filename_without_extension), hide_errors = FALSE) clock$write(filename_without_extension = fhircrackr::pastep(SUB_PROJECTS_DIRS$global_dir, "performance", filename_without_extension), hide_errors = TRUE) } diff --git a/R-etlutils/etlutils/R/lib_helper_functions.R b/R-etlutils/etlutils/R/lib_helper_functions.R index e7ce270e..f7fc913c 100644 --- a/R-etlutils/etlutils/R/lib_helper_functions.R +++ b/R-etlutils/etlutils/R/lib_helper_functions.R @@ -242,161 +242,6 @@ sortListByName <- function(list) list[order(names(list))] #' isDebug <- function() exists('DEBUG') && DEBUG -#' Execute an outer script with a specified message and process -#' -#' This function runs an outer script with the provided message and process, controlling -#' the verbosity level. -#' -#' @param message A character string describing the purpose of the outer script. -#' @param process A function representing the outer script to be executed. -#' -#' @export -run_out <- function(message, process) { - run( - message = message, - process = process, - verbose = VL_20_OUTER_SCRIPTS - )} - -#' Execute an inner script with a specified message and process -#' -#' This function runs an inner script with the provided message and process, controlling -#' the verbosity level. -#' -#' @param message A character string describing the purpose of the inner script. -#' @param process A function representing the inner script to be executed. -#' -#' @export -run_in <- function(message, process) { - run( - message = message, - process = process, - verbose = VL_30_INNER_SCRIPTS - )} - -#' Execute an inner script info with a specified message and process -#' -#' This function runs an inner script info with the provided message and process, controlling -#' the verbosity level. -#' -#' @param message A character string describing the purpose of the inner script info. -#' @param process A function representing the inner script info to be executed. -#' -#' @export -run_in_in <- function(message, process) { - run( - message = message, - process = process, - verbose = VL_40_INNER_SCRIPTS_INFOS - )} - -#' Execute an inner script info with a specified message and process -#' -#' This function runs an inner script info with the provided message and process, controlling -#' the verbosity level. If an error occurs, it is ignored. -#' -#' @param message A character string describing the purpose of the inner script info. -#' @param process A function representing the inner script info to be executed. -#' -#' @export -run_in_in_ignore_error <- function(message, process) { - run( - message = message, - process = process, - verbose = VL_40_INNER_SCRIPTS_INFOS, - throw_exception = FALSE - )} - -#' Execute a script with specified message, process, and verbosity level -#' -#' This function runs a script with the provided message and process, controlling -#' the verbosity level. -#' -#' @param message A character string describing the purpose of the script. -#' @param process A function representing the script to be executed. -#' @param verbose An integer specifying the verbosity level. -#' @param throw_exception if TRUE the execution of the current expression will be stopped -#' -#' @export -run <- function(message, process, verbose, throw_exception = TRUE) { - polar_run( - message = message, - process = process, - verbose = VERBOSE - verbose + 1, - single_line = VERBOSE <= verbose, - throw_exception = throw_exception - )} - -#' Execute an outer script with specified message and process (single line) -#' -#' This function runs an outer script with the provided message and process, controlling -#' the verbosity level. Unlike `runs`, this function always displays output in a -#' single line, regardless of the global verbosity setting. -#' -#' @param message A character string describing the purpose of the outer script. -#' @param process A function representing the outer script to be executed. -#' -#' @export -runs_out <- function(message, process) { - runs( - message = message, - process = process, - verbose = VL_20_OUTER_SCRIPTS - )} - -#' Execute an inner script with specified message and process (single line) -#' -#' This function runs an inner script with the provided message and process, controlling -#' the verbosity level. Unlike `runs`, this function always displays output in a -#' single line, regardless of the global verbosity setting. -#' -#' @param message A character string describing the purpose of the inner script. -#' @param process A function representing the inner script to be executed. -#' -#' @export -runs_in <- function(message, process) { - runs( - message = message, - process = process, - verbose = VL_30_INNER_SCRIPTS - )} - -#' Execute an inner script info with specified message and process (single line) -#' -#' This function runs an inner script info with the provided message and process, controlling -#' the verbosity level. Unlike `runs`, this function always displays output in a -#' single line, regardless of the global verbosity setting. -#' -#' @param message A character string describing the purpose of the inner script info. -#' @param process A function representing the inner script info to be executed. -#' -#' @export -runs_in_in <- function(message, process) { - runs( - message = message, - process = process, - verbose = VL_40_INNER_SCRIPTS_INFOS - )} - -#' Execute a script with specified message, process, and verbosity level (single line) -#' -#' This function runs a script with the provided message and process, controlling -#' the verbosity level. Unlike `run`, this function always displays output in a -#' single line, regardless of the global verbosity setting. -#' -#' @param message A character string describing the purpose of the script. -#' @param process A function representing the script to be executed. -#' @param verbose An integer specifying the verbosity level. -#' -#' @export -runs <- function(message, process, verbose) { - polar_run( - message = message, - process = process, - verbose = VERBOSE - verbose + 1, - single_line = TRUE - )} - #' Conditional Print to Console (for tables) based on verbosity level #' #' This function prints the provided content to the console only if the global @@ -469,6 +314,8 @@ flatten_list <- function(x, prefix = NULL) { #' #' @export initConstants <- function(path_to_toml) { + # normalize relative path for error message + path_to_toml <- normalizePath(path_to_toml) # load the config toml file in the global environment CONFIG <<- RcppTOML::parseToml(path_to_toml) # Take nested list CONFIG and flattens it into a single-level list @@ -482,6 +329,15 @@ initConstants <- function(path_to_toml) { assign(variable_name, flattenConfig[[variable_name]], envir = .GlobalEnv) } + # Port specification in the fhir server url can cause problems -> warning + URL_PORT_SPEC <<- FALSE + if (exists('FHIR_SERVER_ENDPOINT')) { + if (grepl(":[0-9]+(/.*)?$", FHIR_SERVER_ENDPOINT)) { + URL_PORT_SPEC <<- TRUE + warning("FHIR_ENDPOINT use PORT specification. Some Fhir servers do not provide this port in pagination's next_link") + } + } + # the result dir can be extended by an timestamp. this is not neccessary # in Interploar but was used in Polar. For debug reasons we have not deactivated # this functionality. To enable timestamp suffixes at the result dir set @@ -739,6 +595,293 @@ replacePatternsInString <- function(patternsAndReplacements, string, ignore.case return(string) } +#' Check for Errors +#' +#' @param err Any Type. In case of an error occurred it must contain try-error as class +#' @param expr_ok An expression. This runs in case of no error. +#' @param expr_err An expression. This runs in case of an error. +#' +#' @return err +#' @export +check_error <- function(err, expr_ok = {cat_ok()}, expr_err = {cat_error()}) { + + if (!inherits(err, 'try-error')) { + expr_ok + } else { + expr_err + } +} + +#' Convert Numbers to Verbose Number Representations +#' +#' This function converts numbers to verbose number representations, such as "1st," "2nd," "3rd," or "th." +#' +#' @param n Numeric vector to be converted. +#' +#' @return A character vector representing the verbose number representation. +#' @export +verbose_numbers <- function(n) { + n[n < 1 | 3 < n] <- paste0(n[n < 1 | 3 < n], 'th') + n[n == 1] <- '1st' + n[n == 2] <- '2nd' + n[n == 3] <- '3rd' + n +} + +#' Pluralize Suffix Based on Count +#' +#' This function returns an empty string for count 1 and 's' for any other count. +#' +#' @param counts Numeric vector of counts. +#' +#' @return +#' An empty string for count 1, 's' otherwise. +#' @export +plural_s <- function(counts) { + ifelse(counts == 1, '', 's') +} + +#' Create a Framed String +#' +#' This function creates a framed string with specified formatting parameters. +#' +#' @param text A character string to be framed. +#' @param pos The position of the framed text within the frame. It can be 'left', 'center', or 'right'. +#' @param edge The characters to be used for framing the top, bottom, left, and right edges. +#' @param hori The character to be used for horizontal framing. +#' @param vert The character to be used for vertical framing. +#' @return A character string representing the framed text. +#' +#' @details +#' The function creates a framed string by adding specified framing characters (edges, horizontal, and vertical) around the input text. +#' It allows customization of the frame's position, edge characters, and framing characters. +#' The resulting framed string is useful for creating visually appealing console outputs. +#' +#' @export +frame_string <- function( + text = styled_string('\nHello !!!\n\n\nIs\nthere\n\nA N Y O N E\n\nout\nthere\n???\n '), + pos = c('left', 'center', 'right')[1], + edge = ' ', + hori = '-', + vert = '|') { + # own strpad function + # strpad("Hello", 10, "right", "-") + # "-----Hello" + strpad <- function(string, width, pos = c('left', 'right'), pad) { + # duplicate char count times + n_chars <- function(char, count) paste0(rep_len(char, count), collapse = '') + # remove utf codes from string and count characters + w <- nchar(gsub('\033\\[[0-9;]*m', '', string)) + if (pos == 'left') { + paste0(string, n_chars(pad, width - w)) + } else if (pos == 'right') { + paste0(n_chars(pad, width - w), string) + } else { + paste0(n_chars(pad, (width - w) %/% 2), string, n_chars(pad, width - w - (width - w) %/% 2)) + } + } + # get all 4 edges strings + edge <- rep_len(strsplit(edge, '')[[1]], 4)[1 : 4] + r <- '' + s <- strsplit(text, '\n')[[1]] + # get height of frame + h <- length(s) + # get width of frame + w <- max(sapply(s, function(x) nchar(gsub('\033\\[[0-9;]*m', '', x)))) + # build top and botton lines + hbt <- paste0(edge[1], paste0(rep_len(hori, w + 2), collapse = ''), edge[2], '\n') + hbb <- paste0(edge[3], paste0(rep_len(hori, w + 2), collapse = ''), edge[4], '\n') + # construct frame with text in it + r <- hbt + for (s_ in s) {# s_ <- s + r <- paste0(r, vert, ' ', strpad(string = s_, width = w, pos = pos, pad = ' '), ' ', vert, '\n') + } + r <- paste0(r, hbb) + r +} + +#' Convert a time representation to POSIXct format +#' +#' This function takes a time column in a format, extracts the time part, +#' and converts it to POSIXct format with a default date of "2020-01-01". The input +#' time_column is expected to be in a format containing hours, minutes, and seconds. +#' NA and an empty string will return NA. +#' +#' @param time_column A column containing time information in a format. +#' @return A character vector representing the time in POSIXct format ("%H:%M:%S"). +#' +#' @examples +#' # Test case 1: Valid time representation +#' time_column_valid <- c("12:30:45", "08:15:00", "23:59:59") +#' result_valid <- convertTimeToPOSIXct(time_column_valid) +#' cat("Result for valid time representations:\n", result_valid, "\n\n") +#' +#' # Test case 2: NA input, should return NA +#' time_column_na <- c(NA, NA, NA) +#' result_na <- convertTimeToPOSIXct(time_column_na) +#' cat("Result for NA input:\n", result_na, "\n\n") +#' +#' # Test case 3: Empty string input, should throw an error +#' time_column_empty <- c("", "", "") +#' tryCatch( +#' { +#' result_empty <- convertTimeToPOSIXct(time_column_empty) +#' cat("Result for empty string input:\n", result_empty, "\n\n") +#' }, +#' error = function(e) cat("Error for empty string input:\n", e$message, "\n\n") +#' ) +#' +#' @export +convertTimeToPOSIXct <- function(time_column) { + dc <- time_column + dc <- ifelse(nzchar(dc), dc, NA) # empty string is the same as NA + if (!all(is.na(dc))) { + pat <- '^.*?([0-9]+:[0-9]+:[0-9]+).*?$' + # Remove date or return midnight + dc <- ifelse (grepl(pat, dc), gsub(pat, "\\1", as.character(dc)), "00:00:00") + # Any day will work + dc <- paste("2020-01-01", dc) + } + # as.POSIXct returns NA, if it is not a valid date + format(as.POSIXct(dc, optional = TRUE), "%H:%M:%S") +} + +#' Convert a date representation to Date format +#' +#' This function takes a date column in a format, cleans and standardizes +#' the format, and converts it to Date format. The input date_column is expected +#' to be in a format containing year, month, and day information. The function +#' supports patterns for YYYY and YYYY-MM. +#' +#' @param date_column A column containing date information in a format. +#' @return A Date vector representing the converted date information. +#' +#' @examples +#' library(lubridate) +#' +#' # Test case 1: YYYY format +#' date_column_YYYY <- c("2022", "1990", "1980") +#' result_YYYY <- convertDateInformation(date_column_YYYY) +#' +#' # Test case 2: YYYY-MM format +#' date_column_YYYY_MM <- c("2022-12", "1990-05", "1980-11") +#' result_YYYY_MM <- convertDateInformation(date_column_YYYY_MM) +#' +#' # Test case 3: Date with time, should be cleaned +#' date_column_with_time <- c("2022-12-01T15:30:00", "1990-05-01T08:45:00") +#' result_with_time <- convertDateInformation(date_column_with_time) +#' +#' # Test case 4: Date with '/' separator, should be replaced with '-' +#' date_column_slash_separator <- c("2022/12/01", "1990/05/01") +#' result_slash_separator <- convertDateInformation(date_column_slash_separator) +#' +#' @export +#' +convertDateInformation <- function(date_column) { + + dc <- as.character(date_column) + dc <- gsub('T.+$', '', dc) + dc <- gsub('/', '-', dc) + + # Set a regular expression pattern for matching YYYY format + incomplete_date_pattern <- '^[0-9]{4}$' + years <- grepl(incomplete_date_pattern, dc) + dc[years] <- paste0(dc[years], '-01-01') + + # Set a regular expression pattern for matching YYYY-MM format + incomplete_date_pattern <- '^[0-9]{4}-[0-9]{2}$' + years <- grepl(incomplete_date_pattern, dc) + dc[years] <- paste0(dc[years], '-01') + + lubridate::as_date(dc) +} + +#' +#' Fix uncommon date formats +#' +#' This function takes a data.table (`dt`), a set of date columns (`date_columns`), +#' and an optional parameter (`preserve_time`) to fix uncommon date formats. +#' It performs the following tasks: +#' +#' - If `preserve_time` is TRUE, it extracts the time part from each date column +#' and saves it into respective TimeSpec columns by appending ".TimeSpec" to the +#' original date column names. +#' +#' - It then converts the original date columns to Date format using the +#' `convertDateInformation` function. +#' +#' @param dt A data.table containing the data to be processed. +#' @param date_columns A character vector specifying the names of the date columns to be fixed. +#' @param preserve_time A logical value indicating whether to preserve time information. Default is TRUE. +#' @return The modified data.table with fixed date formats. +#' +#' @examples +#' # Create an example data.table +#' dt <- data.table::data.table( +#' date1 = c("2022", "1990-05", "1980-11"), +#' date2 = c("2022-12", "1990-05", "1980-11"), +#' value = c(1, 2, 3) +#' ) +#' +#' # Fix uncommon date formats with time preservation +#' fixDateFormat(dt, c("date1", "date2"), preserve_time = TRUE) +#' +#' # The resulting data.table will have additional columns date1_timespec and date2_timespec +#' # containing the extracted time information, and the original date columns date1 and date2 +#' # will be converted to Date format. +#' dt +#' +#' # Expected output: +#' # date1 date2 value date1_timespec date2_timespec +#' # 1: 2022-01-01 2022-12-01 1 00:00:00 00:00:00 +#' # 2: 1990-05-01 1990-05-01 2 00:00:00 00:00:00 +#' # 3: 1980-11-01 1980-11-01 3 00:00:00 00:00:00 +#' +#' @seealso +#' \code{\link{convertTimeToPOSIXct}}, \code{\link{convertDateInformation}} +#' +#' @export +#' +fixDateFormat <- function(dt, date_columns, preserve_time = TRUE) { + + #preserve time information + if (preserve_time) { + + time_columns <- paste0(date_columns, "_timespec") #add suffix HourMinutesSeconds + + #col by col + for (dc in date_columns) { + + tc <- paste0(dc, "_timespec") + if (0 < nrow(dt)) { + + #extract time from any datetime column and save it into the respecive TimeSpec column + dt[, (tc) := sapply(dt[[dc]], convertTimeToPOSIXct)] + } else { + #avoid columns of type list, which will be generated from empty resource + dt[, (tc) := character()] + } + } + } + dt[, (date_columns) := lapply(.SD, convertDateInformation), .SDcols = date_columns] +} + +#' Stop on Error +#' +#' This function stops execution and prints the concatenated error message. +#' +#' @param ... Character vectors to be concatenated and printed as an error message. +#' +#' @return This function does not return a value. It stops execution. +#' +#' @examples +#' stopOnError("Error: Something went wrong.") +#' +#' @export +stopOnError <- function(...) { + stop(cat_red(paste(c(...)))) + break +} #' #' #' #' Prints a variable or a list of variables via cat() in the style diff --git a/R-etlutils/etlutils/R/lib_logging.R b/R-etlutils/etlutils/R/lib_logging.R index 84a43fcc..6ba40128 100644 --- a/R-etlutils/etlutils/R/lib_logging.R +++ b/R-etlutils/etlutils/R/lib_logging.R @@ -32,3 +32,251 @@ end_logging <- function() { sink(type = "message") sink() } + +#' START__ +#' @description Print Header of Block +#' +#' @param verbose An integer of length 1, the verbose level. If verb is 0, no output will be produced. +#' @param len An integer of length 1, the length of the underline. +#' +#' @return NULL +#' +#' @export +START__ <- function(verbose = VERBOSE - 4, len = 104) { + + # if verb greater than zero, print a underlined line of len spaces followed by the word START + if (0 < verbose) { + cat(paste0( + # print a bold underlined line of len spaces + styled_string(paste0(rep(' ', len), collapse = ''), fg = 7, bold = TRUE, underline = TRUE), + '\n', + styled_string('START', fg = 7, bold = TRUE), + '\n' + )) + } +} + +#' Print Footer of a Block +#' +#' @param verbose An integer of length 1, the verbose level. If verb is 0, no output will be produced. +#' @param len An integer of length 1, the length of the underline. +#' +#' @return NULL +#' +#' @export +END__ <- function(verbose = VERBOSE - 4, len = 104) { + + # if verb greater than zero, print a underlined line of len spaces followed by the word START + if (0 < verbose) { + cat(paste0( + # print bold underlined word END + styled_string('END', fg = 7, bold = TRUE, underline = TRUE), + # fill up to length len with bold unerlined spaces + styled_string(paste0(rep(' ', len - 3), collapse = ''), fg = 7, bold = TRUE, underline = TRUE), + '\n' + )) + } +} + +#' Run and log a process +#' +#' @param message A character of length one. Has to be unique +#' @param process An expression +#' @param single_line A logical of length one +#' @param throw_exception A logical of length one. Should catched error throw again +#' @param verbose The verbose level +#' +#' @return The value process returns. +#' +#' @export +runProcess <- function( + message, + process, + single_line = TRUE, + throw_exception = TRUE, + verbose = VERBOSE +) { + if (0 < VERBOSE) { + st <- Sys.time() + cat("[TIME]", round(as.numeric(st), 0), format(st), "\n") + + cat(paste0(message, ':', if (single_line) ' ' else paste0(colourise(text = ' RUNNING ...', fg = 'blue'), '\n'))) + } + + err <- PROCESS_CLOCK$measure_process_time( + message = message, + process = process + ) + if (!single_line && 0 < VERBOSE) cat(paste0(message, ': ' )) + if (0 < VERBOSE) { + check_error( + err = err, + expr_ok = { + if (single_line) cat_ok() else cat_colourised('OK\n', fg = 'light blue') + err + }, + expr_err = { + cat_error() + if (throw_exception) { + stop(err) + } + } + ) + } +} + + +#' Execute an outer script with a specified message and process +#' +#' This function runs an outer script with the provided message and process, controlling +#' the verbosity level. +#' +#' @param message A character string describing the purpose of the outer script. +#' @param process A function representing the outer script to be executed. +#' +#' @export +run_out <- function(message, process) { + run( + message = message, + process = process, + verbose = VL_20_OUTER_SCRIPTS + )} + +#' Execute an inner script with a specified message and process +#' +#' This function runs an inner script with the provided message and process, controlling +#' the verbosity level. +#' +#' @param message A character string describing the purpose of the inner script. +#' @param process A function representing the inner script to be executed. +#' +#' @export +run_in <- function(message, process) { + run( + message = message, + process = process, + verbose = VL_30_INNER_SCRIPTS + )} + +#' Execute an inner script info with a specified message and process +#' +#' This function runs an inner script info with the provided message and process, controlling +#' the verbosity level. +#' +#' @param message A character string describing the purpose of the inner script info. +#' @param process A function representing the inner script info to be executed. +#' +#' @export +run_in_in <- function(message, process) { + run( + message = message, + process = process, + verbose = VL_40_INNER_SCRIPTS_INFOS + )} + +#' Execute an inner script info with a specified message and process +#' +#' This function runs an inner script info with the provided message and process, controlling +#' the verbosity level. If an error occurs, it is ignored. +#' +#' @param message A character string describing the purpose of the inner script info. +#' @param process A function representing the inner script info to be executed. +#' +#' @export +run_in_in_ignore_error <- function(message, process) { + run( + message = message, + process = process, + verbose = VL_40_INNER_SCRIPTS_INFOS, + throw_exception = FALSE + )} + +#' Execute a script with specified message, process, and verbosity level +#' +#' This function runs a script with the provided message and process, controlling +#' the verbosity level. +#' +#' @param message A character string describing the purpose of the script. +#' @param process A function representing the script to be executed. +#' @param verbose An integer specifying the verbosity level. +#' @param throw_exception if TRUE the execution of the current expression will be stopped +#' +#' @export +run <- function(message, process, verbose, throw_exception = TRUE) { + runProcess( + message = message, + process = process, + verbose = VERBOSE - verbose + 1, + single_line = VERBOSE <= verbose, + throw_exception = throw_exception + )} + +#' Execute an outer script with specified message and process (single line) +#' +#' This function runs an outer script with the provided message and process, controlling +#' the verbosity level. Unlike `runs`, this function always displays output in a +#' single line, regardless of the global verbosity setting. +#' +#' @param message A character string describing the purpose of the outer script. +#' @param process A function representing the outer script to be executed. +#' +#' @export +runs_out <- function(message, process) { + runs( + message = message, + process = process, + verbose = VL_20_OUTER_SCRIPTS + )} + +#' Execute an inner script with specified message and process (single line) +#' +#' This function runs an inner script with the provided message and process, controlling +#' the verbosity level. Unlike `runs`, this function always displays output in a +#' single line, regardless of the global verbosity setting. +#' +#' @param message A character string describing the purpose of the inner script. +#' @param process A function representing the inner script to be executed. +#' +#' @export +runs_in <- function(message, process) { + runs( + message = message, + process = process, + verbose = VL_30_INNER_SCRIPTS + )} + +#' Execute an inner script info with specified message and process (single line) +#' +#' This function runs an inner script info with the provided message and process, controlling +#' the verbosity level. Unlike `runs`, this function always displays output in a +#' single line, regardless of the global verbosity setting. +#' +#' @param message A character string describing the purpose of the inner script info. +#' @param process A function representing the inner script info to be executed. +#' +#' @export +runs_in_in <- function(message, process) { + runs( + message = message, + process = process, + verbose = VL_40_INNER_SCRIPTS_INFOS + )} + +#' Execute a script with specified message, process, and verbosity level (single line) +#' +#' This function runs a script with the provided message and process, controlling +#' the verbosity level. Unlike `run`, this function always displays output in a +#' single line, regardless of the global verbosity setting. +#' +#' @param message A character string describing the purpose of the script. +#' @param process A function representing the script to be executed. +#' @param verbose An integer specifying the verbosity level. +#' +#' @export +runs <- function(message, process, verbose) { + runProcess( + message = message, + process = process, + verbose = VERBOSE - verbose + 1, + single_line = TRUE + )} diff --git a/R-etlutils/etlutils/R/lib_misc.R b/R-etlutils/etlutils/R/lib_misc.R deleted file mode 100644 index e8bf556b..00000000 --- a/R-etlutils/etlutils/R/lib_misc.R +++ /dev/null @@ -1,766 +0,0 @@ -#' START__ -#' @description Print Header of Block -#' -#' @param verbose An integer of length 1, the verbose level. If verb is 0, no output will be produced. -#' @param len An integer of length 1, the length of the underline. -#' -#' @return NULL -#' -#' @export -START__ <- function(verbose = VERBOSE - 4, len = 104) { - - # if verb greater than zero, print a underlined line of len spaces followed by the word START - if (0 < verbose) { - cat(paste0( - # print a bold underlined line of len spaces - styled_string(paste0(rep(' ', len), collapse = ''), fg = 7, bold = TRUE, underline = TRUE), - '\n', - styled_string('START', fg = 7, bold = TRUE), - '\n' - )) - } -} - -#' Print Footer of a Block -#' -#' @param verbose An integer of length 1, the verbose level. If verb is 0, no output will be produced. -#' @param len An integer of length 1, the length of the underline. -#' -#' @return NULL -#' -#' @export -END__ <- function(verbose = VERBOSE - 4, len = 104) { - - # if verb greater than zero, print a underlined line of len spaces followed by the word START - if (0 < verbose) { - cat(paste0( - # print bold underlined word END - styled_string('END', fg = 7, bold = TRUE, underline = TRUE), - # fill up to length len with bold unerlined spaces - styled_string(paste0(rep(' ', len - 3), collapse = ''), fg = 7, bold = TRUE, underline = TRUE), - '\n' - )) - } -} - -#' Print Footer for a Block followed by a Header for the next Block -#' -#' @param verbose An integer of length 1, the verbose level. If verb is 0, no output will be produced. -#' @param len An integer of length 1, the length of the underline. -#' -#' @return NULL -#' -#' @export -END__START__ <- function(verbose = VERBOSE - 4, len = 104) { - if (0 < verbose) { - END__(len) - cat('\n\n') # two empty lines between END and next START - START__(len) - } -} - -#' -#' Runs the given function surrounded with [START__()] and [END__()]. -#' -#' @param process a function -#' @param verbose An integer of length 1, the verbose level. If verb is 0, no output will be produced. -#' @param len An integer of length 1, the length of the underline. -#' -#' @return NULL -#' -#' @export -log_run <- function(process, verbose = VERBOSE - 4, len = 104) { - START__(verbose, len) - process() - END__(verbose, len) -} - -#' Run and log a process -#' -#' @param message A character of length one. Has to be unique -#' @param process An expression -#' @param single_line A logical of length one -#' @param throw_exception A logical of length one. Should catched error throw again -#' @param verbose The verbose level -#' -#' @return The value process returns. -#' -#' @export -polar_run <- function( - message, - process, - single_line = TRUE, - throw_exception = TRUE, - verbose = VERBOSE -) { - if (0 < VERBOSE) { - st <- Sys.time() - cat("[TIME]", round(as.numeric(st), 0), format(st), "\n") - - cat(paste0(message, ':', if (single_line) ' ' else paste0(colourise(text = ' RUNNING ...', fg = 'blue'), '\n'))) - } - - err <- POLAR_CLOCK$measure_process_time( - message = message, - process = process - ) - if (!single_line && 0 < VERBOSE) cat(paste0(message, ': ' )) - if (0 < VERBOSE) { - check_error( - err = err, - expr_ok = { - if (single_line) cat_ok() else cat_colourised('OK\n', fg = 'light blue') - err - }, - expr_err = { - cat_error() - if (throw_exception) { - stop(err) - } - } - ) - } -} - -#' Add Common Parameters to FHIR Resource Request -#' -#' This function adds common parameters, such as '_count' and '_sort', to a list of FHIR resource query parameters. -#' -#' @param parameters A list of FHIR resource query parameters. -#' -#' @return A modified list of FHIR resource query parameters with common parameters added. -#' -#' @export -polar_add_common_request_params <- function(parameters = NULL) { - parameters <- parameters[!is.na(parameters)] - if (!'_count' %in% names(parameters) && exists('COUNT_PER_BUNDLE') && !is.null(COUNT_PER_BUNDLE) && !is.na(COUNT_PER_BUNDLE) && COUNT_PER_BUNDLE != '') { - parameters <- c(parameters, c('_count' = COUNT_PER_BUNDLE)) - } - if (!'_sort' %in% names(parameters) && exists('SORT') && !is.null(SORT) && !is.na(SORT) && SORT != '') { - parameters <- c(parameters, c('_sort' = SORT)) - } - parameters -} - -#' Check for Errors -#' -#' @param err Any Type. In case of an error occurred it must contain try-error as class -#' @param expr_ok An expression. This runs in case of no error. -#' @param expr_err An expression. This runs in case of an error. -#' -#' @return err -#' @export -check_error <- function(err, expr_ok = {cat_ok()}, expr_err = {cat_error()}) { - - if (!inherits(err, 'try-error')) { - expr_ok - } else { - expr_err - } -} - -#' Convert Numbers to Verbose Number Representations -#' -#' This function converts numbers to verbose number representations, such as "1st," "2nd," "3rd," or "th." -#' -#' @param n Numeric vector to be converted. -#' -#' @return A character vector representing the verbose number representation. -#' @export -verbose_numbers <- function(n) { - n[n < 1 | 3 < n] <- paste0(n[n < 1 | 3 < n], 'th') - n[n == 1] <- '1st' - n[n == 2] <- '2nd' - n[n == 3] <- '3rd' - n -} - -#' Pluralize Suffix Based on Count -#' -#' This function returns an empty string for count 1 and 's' for any other count. -#' -#' @param counts Numeric vector of counts. -#' -#' @return -#' An empty string for count 1, 's' otherwise. -#' @export -plural_s <- function(counts) { - ifelse(counts == 1, '', 's') -} - -#' Complete Table with Missing Columns -#' -#' This function completes a table by adding missing columns based on the specified table description. -#' -#' @param table A data.table representing the table to be completed. -#' @param table_description A description of the expected table structure. -#' -#' @return A completed data.table with missing columns added. -#' @export -polar_complete_table <- function(table, table_description) { - # Binding the variable .SD locally to the function, so the R CMD check has nothing to complain about - .SD <- NULL - col_names <- names(table_description@cols) - empty_table <- data.table::setnames( - data.table::data.table(matrix(ncol = length(col_names), nrow = 0)), - new = col_names - ) - d <- data.table::rbindlist(list(empty_table, table), fill = TRUE, use.names = TRUE) - d[, lapply(.SD, function(x) methods::as(x, 'character'))] -} - -#' Convert Data.Table to Character String -#' -#' This function converts a data.table to a formatted character string with optional header and footer. -#' -#' @param dt A data.table to be converted. -#' @param header Logical, indicating whether to include a header with column names. -#' @param footer Logical, indicating whether to include a footer with column names. -#' @return A formatted character string representation of the data.table. -#' -#' @details -#' The function converts a data.table to a character string, aligning columns and optionally including a header and footer. -#' It pads each column to the maximum width of its elements for better alignment. -#' -#' @export -data.table.as.character <- function(dt, header = FALSE, footer = FALSE) { - # Binding the variable .SD locally to the function, so the R CMD check has nothing to complain about - .SD <- NULL - d <- if (header) rbind(as.list(names(dt)), dt) else dt - if (footer) d <- rbind(d, as.list(names(dt))) - l <- d[,lapply(.SD, function(x) max(nchar(x)))] - d <- data.table::as.data.table(lapply(seq_along(d), function(i) stringr::str_pad(string = d[[i]], width = l[[i]], side = 'left', pad = ' '))) - paste0( - sapply( - seq_len(nrow(d)), - function(i) { - paste0(d[i, ], collapse = ' ') - } - ), - collapse = '\n' - ) -} - -#' Create a Framed String -#' -#' This function creates a framed string with specified formatting parameters. -#' -#' @param text A character string to be framed. -#' @param pos The position of the framed text within the frame. It can be 'left', 'center', or 'right'. -#' @param edge The characters to be used for framing the top, bottom, left, and right edges. -#' @param hori The character to be used for horizontal framing. -#' @param vert The character to be used for vertical framing. -#' @return A character string representing the framed text. -#' -#' @details -#' The function creates a framed string by adding specified framing characters (edges, horizontal, and vertical) around the input text. -#' It allows customization of the frame's position, edge characters, and framing characters. -#' The resulting framed string is useful for creating visually appealing console outputs. -#' -#' @export -frame_string <- function( - text = styled_string('\nHello !!!\n\n\nIs\nthere\n\nA N Y O N E\n\nout\nthere\n???\n '), - pos = c('left', 'center', 'right')[1], - edge = ' ', - hori = '-', - vert = '|') { - # own strpad function - # strpad("Hello", 10, "right", "-") - # "-----Hello" - strpad <- function(string, width, pos = c('left', 'right'), pad) { - # duplicate char count times - n_chars <- function(char, count) paste0(rep_len(char, count), collapse = '') - # remove utf codes from string and count characters - w <- nchar(gsub('\033\\[[0-9;]*m', '', string)) - if (pos == 'left') { - paste0(string, n_chars(pad, width - w)) - } else if (pos == 'right') { - paste0(n_chars(pad, width - w), string) - } else { - paste0(n_chars(pad, (width - w) %/% 2), string, n_chars(pad, width - w - (width - w) %/% 2)) - } - } - # get all 4 edges strings - edge <- rep_len(strsplit(edge, '')[[1]], 4)[1 : 4] - r <- '' - s <- strsplit(text, '\n')[[1]] - # get height of frame - h <- length(s) - # get width of frame - w <- max(sapply(s, function(x) nchar(gsub('\033\\[[0-9;]*m', '', x)))) - # build top and botton lines - hbt <- paste0(edge[1], paste0(rep_len(hori, w + 2), collapse = ''), edge[2], '\n') - hbb <- paste0(edge[3], paste0(rep_len(hori, w + 2), collapse = ''), edge[4], '\n') - # construct frame with text in it - r <- hbt - for (s_ in s) {# s_ <- s - r <- paste0(r, vert, ' ', strpad(string = s_, width = w, pos = pos, pad = ' '), ' ', vert, '\n') - } - r <- paste0(r, hbb) - r -} - -#' Print a Disclaimer Text -#' -#' This function prints a disclaimer text with detailed information about the project settings, -#' system details, hardware information, and request parameters. -#' -#' @return NULL -#' -#' @details -#' The disclaimer text includes information about the project name, time stamp, R version, system details, -#' hardware information, working directories, request parameters, and software versions. -#' It provides a comprehensive overview of the project configuration. -#' -#' @export -polar_disclaimer <- function() { - vrbs <- function(v) { - v <- min(max(0, v), 10) - paste0(' PRINT\n', - paste0(' ', sapply(0:10, function(i) { - styled_string({ - s <- c( - ' 0 nothing ', - ' 1 only main info ', - ' 2 main scripts ', - ' 3 sub scripts ', - ' 4 sub scripts content ', - ' 5 result tables ', - ' 6 all tables ', - ' 7 download calls ', - ' 8 coi processing ', - ' 9 fhir response and cracks ', - ' 10 everything ' - )[[i+1]] - if (i == v) toupper(s) else s - }, - bold = i == v, - italic = i != v, - invert = i == v - ) - }), collapse = '\n') - ) - } - mdctnrsrc <- function(v) { - if (v == 50) v <- 3 - v <- min(max(0, v), 4) - - paste0(' PRINT\n', - paste0(' ', sapply(0:4, function(i) { - styled_string({ - s <- c( - ' 0 medication administration and medication statement ', - ' 1 medication administration only ', - ' 2 medication statement only ', - ' 50 default tp definition ', - ' 99 any medication statement or medication administration ' - )[[i+1]] - if (i == v) toupper(s) else s - }, - bold = i == v, - italic = i != v, - invert = i == v - ) - }), collapse = '\n') - ) - } - obsflt <- function(v) { - v <- min(max(0, v), 1) - - paste0(' PRINT\n', - paste0(' ', sapply(0:1, function(i) { - styled_string({ - s <- c( - ' 0 retrieve observations by patient-id ', - ' 1 retrieve observation by loinc-codes ' - )[[i+1]] - if (i == v) toupper(s) else s - }, - bold = i == v, - italic = i != v, - invert = i == v - ) - }), collapse = '\n') - ) - } - - encrsmrg <- function(v) { - v <- min(max(0, v), 2) - - paste0(' PRINT\n', - paste0(' ', sapply(0:2, function(i) { - styled_string({ - s <- c( - ' 0 merge encounter and resources via references or patient id/date ', - ' 1 merge encounter and resources via references only ', - ' 2 merge encounter and resources via patient id/date only ' - )[[i+1]] - if (i == v) toupper(s) else s - }, - bold = i == v, - italic = i != v, - invert = i == v - ) - }), collapse = '\n') - ) - } - encrspr <- function(v) { - if (v == "full") {v <- 0} - else if (v == "month") {v <- 1} - else if (v == "year") {v <- 2} - else {v <- 0} - - paste0(' PRINT\n', - paste0(' ', sapply(0:2, function(i) { - styled_string({ - s <- c( - ' full retrieve encounters for full period with one request ', - ' month retrieve encounters for full period with multiple requests (range: 1 month per request) ', - ' year retrieve encounters for full period with multiple requests (range: 1 year per request) ' - )[[i+1]] - if (i == v) toupper(s) else s - }, - bold = i == v, - italic = i != v, - invert = i == v - ) - }), collapse = '\n') - ) - } - - frame_string( - text = paste0( - styled_string(PROJECT_NAME, PROJECT_TIME_STAMP, sep = '', fg = 4, underline = TRUE, bold = TRUE), '\n', - frame_string( - text = paste0( - styled_string(' TIME ', fg = 7, bold = TRUE, underline = TRUE, invert = TRUE), '\n', - styled_string('Project Time Stamp: ', italic = TRUE), '\n', - styled_string(gsub('^-', '', PROJECT_TIME_STAMP), bold = TRUE), - '\n\n', - styled_string(' SYSTEM ', fg = 7, bold = TRUE, underline = TRUE, invert = TRUE), '\n', - paste0( - sapply( - names(R.version), - function(x) { - styled_string(paste0(x, ': ', R.version[[x]]), bold = TRUE) - } - ), - collapse = '\n' - ), - '\n\n', - styled_string(' HARDWARE ', fg = 7, bold = TRUE, underline = TRUE, invert = TRUE), '\n', - styled_string('# of CPU Cores: ', italic = TRUE), - styled_string(as.character(get_ncores(get_os())), bold = TRUE), '\n', - styled_string('Total RAM: ', italic = TRUE), - styled_string(as.character(memuse::Sys.meminfo()$totalram), bold = TRUE), - '\n', - styled_string('Free RAM: ', italic = TRUE), - styled_string(as.character(memuse::Sys.meminfo()$freeram), bold = TRUE), - '\n\n', - styled_string(' SETTINGS ', fg = 7, bold = TRUE, underline = TRUE, invert = TRUE), '\n\n ', - styled_string(' WORKING DIRECTORIES ', fg = 7, invert = TRUE), '\n ', - styled_string('private: ', italic = TRUE), - styled_string('outputLocal/', PROJECT_NAME, PROJECT_TIME_STAMP, sep = '', fg = 7, bold = TRUE), '\n ', - styled_string('public: ', italic = TRUE), - styled_string('outputGlobal/', PROJECT_NAME, PROJECT_TIME_STAMP, sep = '', fg = 7, bold = TRUE), - '\n\n ', - styled_string(' REQUEST PARAMETERS ', fg = 7, invert = TRUE), '\n ', - styled_string('MAX_ENCOUNTER_BUNDLES: ', italic = TRUE), styled_string(MAX_ENCOUNTER_BUNDLES, bold = TRUE), '\n ', - styled_string('COUNT_PER_BUNDLE: ', italic = TRUE), - styled_string(if (is.na(COUNT_PER_BUNDLE)) 'Server Default' else COUNT_PER_BUNDLE, bold = TRUE), '\n ', - styled_string('BUNDLES_AT_ONCE: ', italic = TRUE), styled_string(BUNDLES_AT_ONCE, bold = TRUE), '\n ', - styled_string('IDS_AT_ONCE: ', italic = TRUE), styled_string(IDS_AT_ONCE, bold = TRUE), '\n ', - '\n\n ', - styled_string(' VERBOSE LEVEL ', fg = 7, invert = TRUE), '\n', - vrbs(VERBOSE), '\n\n', - # styled_string(' MEDICATION RESOURCE ', fg = 7, invert = TRUE), '\n', - # mdctnrsrc(MEDICATION_RESOURCE), '\n\n', - # styled_string(' OBS_BY_FILTER ', fg = 7, invert = TRUE), '\n', - # obsflt(OBS_BY_FILTER), '\n\n', - # styled_string(' ENC_RES_MERGE ', fg = 7, invert = TRUE), '\n', - # encrsmrg(ENC_RES_MERGE), '\n\n', - # styled_string(' ENC_REQ_PER ', fg = 7, invert = TRUE), '\n', - # encrspr(ENC_REQ_PER), '\n\n', - # styled_string(' ENC_REQ_TYPE ', fg = 7, invert = TRUE), '\n', - # ENC_REQ_TYPE, '\n\n', - styled_string(' ENCOUNTER_IDENTIFIER_PATH ', fg = 7, invert = TRUE), '\n', - ENCOUNTER_IDENTIFIER_PATH, '\n\n', - styled_string(' ENCOUNTER_IDENTIFIER_VALUE_PATTERN ', fg = 7, invert = TRUE), '\n', - ENCOUNTER_IDENTIFIER_VALUE_PATTERN, '\n\n', - # styled_string(' SOFTWARE ', fg = 7, bold = TRUE, underline = TRUE, invert = TRUE), '\n', - # data.table.as.character(VERSIONS, TRUE), '\n' - ), - edge = '++++', hori = ' ', vert = ' ' - ), - styled_string(PROJECT_NAME, PROJECT_TIME_STAMP, sep = '', fg = 4, underline = TRUE, bold = TRUE) - ), - pos = 'center', edge = ' ', hori = ' ', vert = ' ' - ) -} - -#' Print a summary for a table -#' -#' This function prints a summary for the specified table, including information -#' about the class, type, number of available values, and number of missing values -#' for each column. The summary is displayed in a formatted table. -#' -#' @param table The input table to summarize. For example, you can use the mtcars dataset. -#' @param table_name An optional name for the table, used in the summary output. -#' @return This function does not explicitly return a value. It prints the summary to the console. -#' -#' @examples -#' # Load required packages -#' library(datasets) -#' library(data.table) -#' -#' # Load the mtcars dataset and convert it to a data.table -#' data(mtcars) -#' setDT(mtcars) -#' -#' # Print summary for the mtcars table -#' print_table_summary(table = mtcars, table_name = 'mtcars') -#' -#' @export -print_table_summary <- function(table=table_enc, table_name = '') { - dt <- data.table::as.data.table( - cbind( - class = sapply(names(table), function(n) class(table[[n]])[1]), #shows only the first specified class - type = sapply(names(table), function(n) typeof(table[[n]])), - available = sapply(names(table), function(n) sum(!is.na(table[[n]]))), - missing = sapply(names(table), function(n) sum( is.na(table[[n]]))) - ), - keep.rownames = TRUE - ) - if (0 < nrow(dt)) { - cat( - frame_string( - text = paste0( - 'Table: ', table_name, '\n\n # Rows: ', nrow(table), '\n # Columns: ', ncol(table), '\n\n', - data.table.as.character( - data.table::setnames( - x = dt, - new = c('Column', 'Class', 'Type', 'Available', 'Missing') - ), - header = TRUE, - footer = TRUE - ) - ), - edge = c('\u231c\u231d\u231e\u231f'), - hori = ' ', - vert = ' ' - ) - ) - } else { - cat( - frame_string( - text = paste0( - 'Table: ', table_name, '\n\n # Rows: ', nrow(table), '\n # Columns: ', ncol(table), '\n\n' - ), - edge = c('\u231c\u231d\u231e\u231f'), - hori = ' ', - vert = ' ' - ) - ) - } -} - -#' Convert a polar time representation to POSIXct format -#' -#' This function takes a time column in a polar format, extracts the time part, -#' and converts it to POSIXct format with a default date of "2020-01-01". The input -#' time_column is expected to be in a format containing hours, minutes, and seconds. -#' NA and an empty string will return NA. -#' -#' @param time_column A column containing time information in a polar format. -#' @return A character vector representing the time in POSIXct format ("%H:%M:%S"). -#' -#' @examples -#' # Test case 1: Valid time representation -#' time_column_valid <- c("12:30:45", "08:15:00", "23:59:59") -#' result_valid <- polar_as_time(time_column_valid) -#' cat("Result for valid time representations:\n", result_valid, "\n\n") -#' -#' # Test case 2: NA input, should return NA -#' time_column_na <- c(NA, NA, NA) -#' result_na <- polar_as_time(time_column_na) -#' cat("Result for NA input:\n", result_na, "\n\n") -#' -#' # Test case 3: Empty string input, should throw an error -#' time_column_empty <- c("", "", "") -#' tryCatch( -#' { -#' result_empty <- polar_as_time(time_column_empty) -#' cat("Result for empty string input:\n", result_empty, "\n\n") -#' }, -#' error = function(e) cat("Error for empty string input:\n", e$message, "\n\n") -#' ) -#' -#' @export -polar_as_time <- function(time_column) { - dc <- time_column - dc <- ifelse(nzchar(dc), dc, NA) # empty string is the same as NA - if (!all(is.na(dc))) { - pat <- '^.*?([0-9]+:[0-9]+:[0-9]+).*?$' - # Remove date or return midnight - dc <- ifelse (grepl(pat, dc), gsub(pat, "\\1", as.character(dc)), "00:00:00") - # Any day will work - dc <- paste("2020-01-01", dc) - } - # as.POSIXct returns NA, if it is not a valid date - format(as.POSIXct(dc, optional = TRUE), "%H:%M:%S") -} - -#' Get a regular expression pattern for matching YYYY format -#' -#' This function returns a regular expression pattern for matching the YYYY format -#' (four-digit year). It can be used for validating and extracting year information -#' from strings. -#' -#' @return A character vector representing the regular expression pattern for YYYY format. -#' -#' @examples -#' get_pattern_YYYY() -#' -#' @export -#' -get_pattern_YYYY <- function() '^[0-9]{4}$' - -#' Get a regular expression pattern for matching YYYY-MM format -#' -#' This function returns a regular expression pattern for matching the YYYY-MM format -#' (four-digit year followed by a hyphen and two-digit month). It can be used for -#' validating and extracting year and month information from strings. -#' -#' @return A character vector representing the regular expression pattern for YYYY-MM format. -#' -#' @examples -#' get_pattern_YYYY_MM() -#' -#' @export -#' -get_pattern_YYYY_MM <- function() '^[0-9]{4}-[0-9]{2}$' - - -#' Convert a date representation to Date format -#' -#' This function takes a date column in a polar format, cleans and standardizes -#' the format, and converts it to Date format. The input date_column is expected -#' to be in a format containing year, month, and day information. The function -#' supports patterns for YYYY and YYYY-MM. It utilizes the functions -#' \code{\link{get_pattern_YYYY}} and \code{\link{get_pattern_YYYY_MM}} for obtaining -#' regular expression patterns. -#' -#' @param date_column A column containing date information in a polar format. -#' @return A Date vector representing the converted date information. -#' -#' @examples -#' library(lubridate) -#' -#' # Test case 1: YYYY format -#' date_column_YYYY <- c("2022", "1990", "1980") -#' result_YYYY <- polar_as_date(date_column_YYYY) -#' -#' # Test case 2: YYYY-MM format -#' date_column_YYYY_MM <- c("2022-12", "1990-05", "1980-11") -#' result_YYYY_MM <- polar_as_date(date_column_YYYY_MM) -#' -#' # Test case 3: Date with time, should be cleaned -#' date_column_with_time <- c("2022-12-01T15:30:00", "1990-05-01T08:45:00") -#' result_with_time <- polar_as_date(date_column_with_time) -#' -#' # Test case 4: Date with '/' separator, should be replaced with '-' -#' date_column_slash_separator <- c("2022/12/01", "1990/05/01") -#' result_slash_separator <- polar_as_date(date_column_slash_separator) -#' -#' @seealso -#' \code{\link{get_pattern_YYYY}}, \code{\link{get_pattern_YYYY_MM}} -#' -#' @export -#' -polar_as_date <- function(date_column) { - - dc <- as.character(date_column) - dc <- gsub('T.+$', '', dc) - dc <- gsub('/', '-', dc) - - incomplete_date_pattern <- get_pattern_YYYY() - years <- grepl(incomplete_date_pattern, dc) - dc[years] <- paste0(dc[years], '-01-01') - - incomplete_date_pattern <- get_pattern_YYYY_MM() - years <- grepl(incomplete_date_pattern, dc) - dc[years] <- paste0(dc[years], '-01') - - lubridate::as_date(dc) -} - -#' -#' Fix uncommon date formats -#' -#' This function takes a data.table (`dt`), a set of date columns (`date_columns`), -#' and an optional parameter (`preserve_time`) to fix uncommon date formats. -#' It performs the following tasks: -#' -#' - If `preserve_time` is TRUE, it extracts the time part from each date column -#' and saves it into respective TimeSpec columns by appending ".TimeSpec" to the -#' original date column names. -#' -#' - It then converts the original date columns to Date format using the -#' `polar_as_date` function. -#' -#' @param dt A data.table containing the data to be processed. -#' @param date_columns A character vector specifying the names of the date columns to be fixed. -#' @param preserve_time A logical value indicating whether to preserve time information. Default is TRUE. -#' @return The modified data.table with fixed date formats. -#' -#' @examples -#' # Create an example data.table -#' dt <- data.table::data.table( -#' date1 = c("2022", "1990-05", "1980-11"), -#' date2 = c("2022-12", "1990-05", "1980-11"), -#' value = c(1, 2, 3) -#' ) -#' -#' # Fix uncommon date formats with time preservation -#' polar_fix_dates(dt, c("date1", "date2"), preserve_time = TRUE) -#' -#' # The resulting data.table will have additional columns date1_timespec and date2_timespec -#' # containing the extracted time information, and the original date columns date1 and date2 -#' # will be converted to Date format. -#' dt -#' -#' # Expected output: -#' # date1 date2 value date1_timespec date2_timespec -#' # 1: 2022-01-01 2022-12-01 1 00:00:00 00:00:00 -#' # 2: 1990-05-01 1990-05-01 2 00:00:00 00:00:00 -#' # 3: 1980-11-01 1980-11-01 3 00:00:00 00:00:00 -#' -#' @seealso -#' \code{\link{polar_as_time}}, \code{\link{polar_as_date}} -#' -#' @export -#' -polar_fix_dates <- function(dt, date_columns, preserve_time = TRUE) { - - #preserve time information - if (preserve_time) { - - time_columns <- paste0(date_columns, "_timespec") #add suffix HourMinutesSeconds - - #col by col - for (dc in date_columns) { - - tc <- paste0(dc, "_timespec") - if (0 < nrow(dt)) { - - #extract time from any datetime column and save it into the respecive TimeSpec column - dt[, (tc) := sapply(dt[[dc]], polar_as_time)] - } else { - #avoid columns of type list, which will be generated from empty resource - dt[, (tc) := character()] - } - } - } - dt[, (date_columns) := lapply(.SD, polar_as_date), .SDcols = date_columns] -} - diff --git a/R-etlutils/etlutils/R/lib_sample_resources.R b/R-etlutils/etlutils/R/lib_sample_resources.R index 420074cf..99a730b0 100644 --- a/R-etlutils/etlutils/R/lib_sample_resources.R +++ b/R-etlutils/etlutils/R/lib_sample_resources.R @@ -242,7 +242,7 @@ polar_get_resources_by_ids <- function( resource, ids, id_param_str = '_id', - parameters = polar_add_common_request_params(c()), + parameters = fhir_url_add_common_request_params(c()), verbose = 0 ) { polar_get_resources_by_ids_get <- function(endpoint, resource, ids, parameters = NULL, verbose = 1) { @@ -285,7 +285,7 @@ polar_get_resources_by_ids <- function( # build request string of maximal max_ids ids ids_ <- collect_ids_for_request(ids = ids, max_ids = length(ids)) # create request with list of resource ids to get from server - url_ <- fhircrackr::fhir_url(endpoint, resource, paste_parameters(paste0(id_param_str, "=", ids_$str), polar_add_common_request_params(parameters))) + url_ <- fhircrackr::fhir_url(endpoint, resource, paste_parameters(paste0(id_param_str, "=", ids_$str), fhir_url_add_common_request_params(parameters))) # get bundle bnd_ <- polar_fhir_search(request = url_, verbose = verbose) if (VL_90_FHIR_RESPONSE <= VERBOSE) { @@ -609,7 +609,7 @@ polar_download_and_crack_parallel <- function( cat_red('Download Stream broken. Leave Download Routine now. Please note! This may cause further problems.\n') } # complete tables with missing column - polar_complete_table(unique(data.table::rbindlist(tables, fill = TRUE)), table_description) + complete_table(unique(data.table::rbindlist(tables, fill = TRUE)), table_description) } #' Downloads and cracks FHIR resources in parallel for a given resource type and patient IDs. @@ -667,13 +667,13 @@ polar_download_by_ids_and_crack_parallel <- function( } if (total < 1) { if (0 < verbose) cat_red(paste0('No ', resource, 's found. Return empty Table. Please note! This may cause further problems.\n')) - return(polar_complete_table(data.table::data.table(), table_description)) + return(complete_table(data.table::data.table(), table_description)) } curr_len <- min(ids_at_once, length(ids)) if (curr_len < 1) {# if no ids for download. return empty data.table with required columns - return(polar_complete_table(data.table::data.table(), table_description)) + return(complete_table(data.table::data.table(), table_description)) } os <- get_os() @@ -844,7 +844,7 @@ polar_download_by_ids_and_crack_parallel <- function( run <- run + 1 } MAX_ENCOUNTER_BUNDLES <<- mb - polar_complete_table(unique(data.table::rbindlist(tables, fill = TRUE)), table_description) + complete_table(unique(data.table::rbindlist(tables, fill = TRUE)), table_description) } #' Download FHIR resources by patient IDs and perform parallel cracking for each resource type. @@ -886,6 +886,26 @@ loadResourcesByPID <- function(patientIDs, table_description) { table_name_to_tables } +#' Add Common Parameters to FHIR Resource Request +#' +#' This function adds common parameters, such as '_count' and '_sort', to a list of FHIR resource query parameters. +#' +#' @param parameters A list of FHIR resource query parameters. +#' +#' @return A modified list of FHIR resource query parameters with common parameters added. +#' +#' @export +fhir_url_add_common_request_params <- function(parameters = NULL) { + parameters <- parameters[!is.na(parameters)] + if (!'_count' %in% names(parameters) && exists('COUNT_PER_BUNDLE') && !is.null(COUNT_PER_BUNDLE) && !is.na(COUNT_PER_BUNDLE) && COUNT_PER_BUNDLE != '') { + parameters <- c(parameters, c('_count' = COUNT_PER_BUNDLE)) + } + if (!'_sort' %in% names(parameters) && exists('SORT') && !is.null(SORT) && !is.na(SORT) && SORT != '') { + parameters <- c(parameters, c('_sort' = SORT)) + } + parameters +} + #' #' Download and Crack FHIR Resources in Parallel by IDs #' #' #' #' This function downloads FHIR resources by specified IDs and cracks the bundles in parallel. @@ -941,13 +961,13 @@ loadResourcesByPID <- function(patientIDs, table_description) { #' } #' if (total < 1) { #' if (0 < verbose) cat_red(paste0('No ', resource, 's found. Return empty Table. Please note! This may cause further problems.\n')) -#' return(polar_complete_table(data.table::data.table(), table_description)) +#' return(complete_table(data.table::data.table(), table_description)) #' } #' #' curr_len <- min(ids_at_once, length(ids)) #' #' if (curr_len < 1) {# if no ids for download. return empty data.table with required columns -#' return(polar_complete_table(data.table::data.table(), table_description)) +#' return(complete_table(data.table::data.table(), table_description)) #' } #' #' os <- get_os() @@ -1119,7 +1139,7 @@ loadResourcesByPID <- function(patientIDs, table_description) { #' run <- run + 1 #' } #' MAX_ENCOUNTER_BUNDLES <<- mb -#' polar_complete_table(unique(data.table::rbindlist(tables, fill = TRUE)), table_description) +#' complete_table(unique(data.table::rbindlist(tables, fill = TRUE)), table_description) #' } #' #' #' Download and Crack FHIR Resources with Maximum Length Limit @@ -1154,7 +1174,7 @@ loadResourcesByPID <- function(patientIDs, table_description) { #' request <- fhir_url( #' url = FHIR_ENDPOINT, #' resource = res_name, -#' parameters = polar_add_common_request_params(X) +#' parameters = fhir_url_add_common_request_params(X) #' ) #' #' polar_download_and_crack_parallel( @@ -1169,5 +1189,5 @@ loadResourcesByPID <- function(patientIDs, table_description) { #' } #' ) #' -#' polar_complete_table(unique(data.table::rbindlist(tables, fill = TRUE)), table_description) +#' complete_table(unique(data.table::rbindlist(tables, fill = TRUE)), table_description) #' } diff --git a/R-etlutils/etlutils/R/lib_table.R b/R-etlutils/etlutils/R/lib_table.R index 02b60b74..070bb457 100644 --- a/R-etlutils/etlutils/R/lib_table.R +++ b/R-etlutils/etlutils/R/lib_table.R @@ -754,3 +754,122 @@ moveColumnBefore <- function(dt, column_to_move, target_column) { # Apply the new order setcolorder(dt, new_order) } + +#' Print a summary for a table +#' +#' This function prints a summary for the specified table, including information +#' about the class, type, number of available values, and number of missing values +#' for each column. The summary is displayed in a formatted table. +#' +#' @param table The input table to summarize. For example, you can use the mtcars dataset. +#' @param table_name An optional name for the table, used in the summary output. +#' @return This function does not explicitly return a value. It prints the summary to the console. +#' +#' @examples +#' # Load required packages +#' library(datasets) +#' library(data.table) +#' +#' # Load the mtcars dataset and convert it to a data.table +#' data(mtcars) +#' setDT(mtcars) +#' +#' # Print summary for the mtcars table +#' print_table_summary(table = mtcars, table_name = 'mtcars') +#' +#' @export +print_table_summary <- function(table=table_enc, table_name = '') { + dt <- data.table::as.data.table( + cbind( + class = sapply(names(table), function(n) class(table[[n]])[1]), #shows only the first specified class + type = sapply(names(table), function(n) typeof(table[[n]])), + available = sapply(names(table), function(n) sum(!is.na(table[[n]]))), + missing = sapply(names(table), function(n) sum( is.na(table[[n]]))) + ), + keep.rownames = TRUE + ) + if (0 < nrow(dt)) { + cat( + frame_string( + text = paste0( + 'Table: ', table_name, '\n\n # Rows: ', nrow(table), '\n # Columns: ', ncol(table), '\n\n', + dataTableAsCharacter( + data.table::setnames( + x = dt, + new = c('Column', 'Class', 'Type', 'Available', 'Missing') + ), + header = TRUE, + footer = TRUE + ) + ), + edge = c('\u231c\u231d\u231e\u231f'), + hori = ' ', + vert = ' ' + ) + ) + } else { + cat( + frame_string( + text = paste0( + 'Table: ', table_name, '\n\n # Rows: ', nrow(table), '\n # Columns: ', ncol(table), '\n\n' + ), + edge = c('\u231c\u231d\u231e\u231f'), + hori = ' ', + vert = ' ' + ) + ) + } +} + +#' Convert Data.Table to Character String +#' +#' This function converts a data.table to a formatted character string with optional header and footer. +#' +#' @param dt A data.table to be converted. +#' @param header Logical, indicating whether to include a header with column names. +#' @param footer Logical, indicating whether to include a footer with column names. +#' @return A formatted character string representation of the data.table. +#' +#' @details +#' The function converts a data.table to a character string, aligning columns and optionally including a header and footer. +#' It pads each column to the maximum width of its elements for better alignment. +#' +#' @export +dataTableAsCharacter <- function(dt, header = FALSE, footer = FALSE) { + # Binding the variable .SD locally to the function, so the R CMD check has nothing to complain about + .SD <- NULL + d <- if (header) rbind(as.list(names(dt)), dt) else dt + if (footer) d <- rbind(d, as.list(names(dt))) + l <- d[,lapply(.SD, function(x) max(nchar(x)))] + d <- data.table::as.data.table(lapply(seq_along(d), function(i) stringr::str_pad(string = d[[i]], width = l[[i]], side = 'left', pad = ' '))) + paste0( + sapply( + seq_len(nrow(d)), + function(i) { + paste0(d[i, ], collapse = ' ') + } + ), + collapse = '\n' + ) +} + +#' Complete Table with Missing Columns +#' +#' This function completes a table by adding missing columns based on the specified table description. +#' +#' @param table A data.table representing the table to be completed. +#' @param table_description A description of the expected table structure. +#' +#' @return A completed data.table with missing columns added. +#' @export +complete_table <- function(table, table_description) { + # Binding the variable .SD locally to the function, so the R CMD check has nothing to complain about + .SD <- NULL + col_names <- names(table_description@cols) + empty_table <- data.table::setnames( + data.table::data.table(matrix(ncol = length(col_names), nrow = 0)), + new = col_names + ) + d <- data.table::rbindlist(list(empty_table, table), fill = TRUE, use.names = TRUE) + d[, lapply(.SD, function(x) methods::as(x, 'character'))] +} diff --git a/R-etlutils/etlutils/R/retrieve_encounter.R b/R-etlutils/etlutils/R/retrieve_encounter.R index ad719ae4..4a837c51 100644 --- a/R-etlutils/etlutils/R/retrieve_encounter.R +++ b/R-etlutils/etlutils/R/retrieve_encounter.R @@ -89,11 +89,11 @@ get_encounters <- function(table_description) { op.end <- gsub("^([a-z]+).*", "\\1", params[2]) }) - polar_run('Download and Crack Encounters', { + run_in_in('Download and Crack Encounters', { request_encounter <- fhircrackr::fhir_url( url = FHIR_SERVER_ENDPOINT, resource = 'Encounter', - parameters = polar_add_common_request_params(params) + parameters = fhir_url_add_common_request_params(params) ) table_enc <- polar_download_and_crack_parallel( @@ -103,8 +103,7 @@ get_encounters <- function(table_description) { log_errors = 'enc_error.xml', verbose = VERBOSE - VL_70_DOWNLOAD ) - - }, single_line = VERBOSE <= VL_70_DOWNLOAD, verbose = VERBOSE - VL_40_INNER_SCRIPTS_INFOS + 1) + }) runs_in_in('change column classes', { table_enc <- table_enc[, lapply(.SD, as.character), ] @@ -117,7 +116,7 @@ get_encounters <- function(table_description) { # # splits the provided dates into day and time columns, if data is available # # converts fhir dates to R dates # # fix the column class to date() - # polar_fix_dates(table_enc, c('Enc.Period.Start', 'Enc.Period.End')) + # fixDateFormat(table_enc, c('Enc.Period.Start', 'Enc.Period.End')) # # # combine day and time column in a column of type date() # table_enc[, Enc.Period.Start.Datetime := do.call(paste,.SD), .SDcols = c('Enc.Period.Start', 'Enc.Period.Start.TimeSpec')] diff --git a/R-etlutils/etlutils/man/END__.Rd b/R-etlutils/etlutils/man/END__.Rd index 64d85839..d5f70809 100644 --- a/R-etlutils/etlutils/man/END__.Rd +++ b/R-etlutils/etlutils/man/END__.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R +% Please edit documentation in R/lib_logging.R \name{END__} \alias{END__} \title{Print Footer of a Block} diff --git a/R-etlutils/etlutils/man/END__START__.Rd b/R-etlutils/etlutils/man/END__START__.Rd deleted file mode 100644 index 2cd760b7..00000000 --- a/R-etlutils/etlutils/man/END__START__.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{END__START__} -\alias{END__START__} -\title{Print Footer for a Block followed by a Header for the next Block} -\usage{ -END__START__(verbose = VERBOSE - 4, len = 104) -} -\arguments{ -\item{verbose}{An integer of length 1, the verbose level. If verb is 0, no output will be produced.} - -\item{len}{An integer of length 1, the length of the underline.} -} -\description{ -Print Footer for a Block followed by a Header for the next Block -} diff --git a/R-etlutils/etlutils/man/START__.Rd b/R-etlutils/etlutils/man/START__.Rd index ba1199a8..8bd5276f 100644 --- a/R-etlutils/etlutils/man/START__.Rd +++ b/R-etlutils/etlutils/man/START__.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R +% Please edit documentation in R/lib_logging.R \name{START__} \alias{START__} \title{START__} diff --git a/R-etlutils/etlutils/man/cat_headline.Rd b/R-etlutils/etlutils/man/cat_headline.Rd deleted file mode 100644 index fc26f3ac..00000000 --- a/R-etlutils/etlutils/man/cat_headline.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_colourise_text.R -\name{cat_headline} -\alias{cat_headline} -\title{Print Text in White Color (Headline Style)} -\usage{ -cat_headline(msg, bg = NULL) -} -\arguments{ -\item{msg}{The text message to be printed.} - -\item{bg}{The background color. Defaults to NULL.} -} -\description{ -This function prints text in white color (headline style). -} diff --git a/R-etlutils/etlutils/man/cat_white.Rd b/R-etlutils/etlutils/man/cat_white.Rd deleted file mode 100644 index eb0939f0..00000000 --- a/R-etlutils/etlutils/man/cat_white.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_colourise_text.R -\name{cat_white} -\alias{cat_white} -\title{Print Text in White Color} -\usage{ -cat_white(msg, bg = NULL) -} -\arguments{ -\item{msg}{The text message to be printed.} - -\item{bg}{The background color. Defaults to NULL.} -} -\description{ -This function prints text in white color. -} diff --git a/R-etlutils/etlutils/man/check_error.Rd b/R-etlutils/etlutils/man/check_error.Rd index 2c0395cb..05bf37cb 100644 --- a/R-etlutils/etlutils/man/check_error.Rd +++ b/R-etlutils/etlutils/man/check_error.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R +% Please edit documentation in R/lib_helper_functions.R \name{check_error} \alias{check_error} \title{Check for Errors} diff --git a/R-etlutils/etlutils/man/polar_complete_table.Rd b/R-etlutils/etlutils/man/complete_table.Rd similarity index 74% rename from R-etlutils/etlutils/man/polar_complete_table.Rd rename to R-etlutils/etlutils/man/complete_table.Rd index e751cb0f..11c9478e 100644 --- a/R-etlutils/etlutils/man/polar_complete_table.Rd +++ b/R-etlutils/etlutils/man/complete_table.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{polar_complete_table} -\alias{polar_complete_table} +% Please edit documentation in R/lib_table.R +\name{complete_table} +\alias{complete_table} \title{Complete Table with Missing Columns} \usage{ -polar_complete_table(table, table_description) +complete_table(table, table_description) } \arguments{ \item{table}{A data.table representing the table to be completed.} diff --git a/R-etlutils/etlutils/man/polar_as_date.Rd b/R-etlutils/etlutils/man/convertDateInformation.Rd similarity index 51% rename from R-etlutils/etlutils/man/polar_as_date.Rd rename to R-etlutils/etlutils/man/convertDateInformation.Rd index 957e5624..66662ba9 100644 --- a/R-etlutils/etlutils/man/polar_as_date.Rd +++ b/R-etlutils/etlutils/man/convertDateInformation.Rd @@ -1,45 +1,40 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{polar_as_date} -\alias{polar_as_date} +% Please edit documentation in R/lib_helper_functions.R +\name{convertDateInformation} +\alias{convertDateInformation} \title{Convert a date representation to Date format} \usage{ -polar_as_date(date_column) +convertDateInformation(date_column) } \arguments{ -\item{date_column}{A column containing date information in a polar format.} +\item{date_column}{A column containing date information in a format.} } \value{ A Date vector representing the converted date information. } \description{ -This function takes a date column in a polar format, cleans and standardizes +This function takes a date column in a format, cleans and standardizes the format, and converts it to Date format. The input date_column is expected to be in a format containing year, month, and day information. The function -supports patterns for YYYY and YYYY-MM. It utilizes the functions -\code{\link{get_pattern_YYYY}} and \code{\link{get_pattern_YYYY_MM}} for obtaining -regular expression patterns. +supports patterns for YYYY and YYYY-MM. } \examples{ library(lubridate) # Test case 1: YYYY format date_column_YYYY <- c("2022", "1990", "1980") -result_YYYY <- polar_as_date(date_column_YYYY) +result_YYYY <- convertDateInformation(date_column_YYYY) # Test case 2: YYYY-MM format date_column_YYYY_MM <- c("2022-12", "1990-05", "1980-11") -result_YYYY_MM <- polar_as_date(date_column_YYYY_MM) +result_YYYY_MM <- convertDateInformation(date_column_YYYY_MM) # Test case 3: Date with time, should be cleaned date_column_with_time <- c("2022-12-01T15:30:00", "1990-05-01T08:45:00") -result_with_time <- polar_as_date(date_column_with_time) +result_with_time <- convertDateInformation(date_column_with_time) # Test case 4: Date with '/' separator, should be replaced with '-' date_column_slash_separator <- c("2022/12/01", "1990/05/01") -result_slash_separator <- polar_as_date(date_column_slash_separator) +result_slash_separator <- convertDateInformation(date_column_slash_separator) } -\seealso{ -\code{\link{get_pattern_YYYY}}, \code{\link{get_pattern_YYYY_MM}} -} diff --git a/R-etlutils/etlutils/man/polar_as_time.Rd b/R-etlutils/etlutils/man/convertTimeToPOSIXct.Rd similarity index 64% rename from R-etlutils/etlutils/man/polar_as_time.Rd rename to R-etlutils/etlutils/man/convertTimeToPOSIXct.Rd index dc382f92..db475006 100644 --- a/R-etlutils/etlutils/man/polar_as_time.Rd +++ b/R-etlutils/etlutils/man/convertTimeToPOSIXct.Rd @@ -1,19 +1,19 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{polar_as_time} -\alias{polar_as_time} -\title{Convert a polar time representation to POSIXct format} +% Please edit documentation in R/lib_helper_functions.R +\name{convertTimeToPOSIXct} +\alias{convertTimeToPOSIXct} +\title{Convert a time representation to POSIXct format} \usage{ -polar_as_time(time_column) +convertTimeToPOSIXct(time_column) } \arguments{ -\item{time_column}{A column containing time information in a polar format.} +\item{time_column}{A column containing time information in a format.} } \value{ A character vector representing the time in POSIXct format ("\%H:\%M:\%S"). } \description{ -This function takes a time column in a polar format, extracts the time part, +This function takes a time column in a format, extracts the time part, and converts it to POSIXct format with a default date of "2020-01-01". The input time_column is expected to be in a format containing hours, minutes, and seconds. NA and an empty string will return NA. @@ -21,19 +21,19 @@ NA and an empty string will return NA. \examples{ # Test case 1: Valid time representation time_column_valid <- c("12:30:45", "08:15:00", "23:59:59") -result_valid <- polar_as_time(time_column_valid) +result_valid <- convertTimeToPOSIXct(time_column_valid) cat("Result for valid time representations:\n", result_valid, "\n\n") # Test case 2: NA input, should return NA time_column_na <- c(NA, NA, NA) -result_na <- polar_as_time(time_column_na) +result_na <- convertTimeToPOSIXct(time_column_na) cat("Result for NA input:\n", result_na, "\n\n") # Test case 3: Empty string input, should throw an error time_column_empty <- c("", "", "") tryCatch( { - result_empty <- polar_as_time(time_column_empty) + result_empty <- convertTimeToPOSIXct(time_column_empty) cat("Result for empty string input:\n", result_empty, "\n\n") }, error = function(e) cat("Error for empty string input:\n", e$message, "\n\n") diff --git a/R-etlutils/etlutils/man/data.table.as.character.Rd b/R-etlutils/etlutils/man/dataTableAsCharacter.Rd similarity index 81% rename from R-etlutils/etlutils/man/data.table.as.character.Rd rename to R-etlutils/etlutils/man/dataTableAsCharacter.Rd index 08314f74..81872d13 100644 --- a/R-etlutils/etlutils/man/data.table.as.character.Rd +++ b/R-etlutils/etlutils/man/dataTableAsCharacter.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{data.table.as.character} -\alias{data.table.as.character} +% Please edit documentation in R/lib_table.R +\name{dataTableAsCharacter} +\alias{dataTableAsCharacter} \title{Convert Data.Table to Character String} \usage{ -data.table.as.character(dt, header = FALSE, footer = FALSE) +dataTableAsCharacter(dt, header = FALSE, footer = FALSE) } \arguments{ \item{dt}{A data.table to be converted.} diff --git a/R-etlutils/etlutils/man/polar_add_common_request_params.Rd b/R-etlutils/etlutils/man/fhir_url_add_common_request_params.Rd similarity index 67% rename from R-etlutils/etlutils/man/polar_add_common_request_params.Rd rename to R-etlutils/etlutils/man/fhir_url_add_common_request_params.Rd index 68218b6a..f164f2e5 100644 --- a/R-etlutils/etlutils/man/polar_add_common_request_params.Rd +++ b/R-etlutils/etlutils/man/fhir_url_add_common_request_params.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{polar_add_common_request_params} -\alias{polar_add_common_request_params} +% Please edit documentation in R/lib_sample_resources.R +\name{fhir_url_add_common_request_params} +\alias{fhir_url_add_common_request_params} \title{Add Common Parameters to FHIR Resource Request} \usage{ -polar_add_common_request_params(parameters = NULL) +fhir_url_add_common_request_params(parameters = NULL) } \arguments{ \item{parameters}{A list of FHIR resource query parameters.} diff --git a/R-etlutils/etlutils/man/polar_fix_dates.Rd b/R-etlutils/etlutils/man/fixDateFormat.Rd similarity index 83% rename from R-etlutils/etlutils/man/polar_fix_dates.Rd rename to R-etlutils/etlutils/man/fixDateFormat.Rd index 4fefd21d..7ebcbdce 100644 --- a/R-etlutils/etlutils/man/polar_fix_dates.Rd +++ b/R-etlutils/etlutils/man/fixDateFormat.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{polar_fix_dates} -\alias{polar_fix_dates} +% Please edit documentation in R/lib_helper_functions.R +\name{fixDateFormat} +\alias{fixDateFormat} \title{Fix uncommon date formats} \usage{ -polar_fix_dates(dt, date_columns, preserve_time = TRUE) +fixDateFormat(dt, date_columns, preserve_time = TRUE) } \arguments{ \item{dt}{A data.table containing the data to be processed.} @@ -27,7 +27,7 @@ It performs the following tasks: and saves it into respective TimeSpec columns by appending ".TimeSpec" to the original date column names. \item It then converts the original date columns to Date format using the -\code{polar_as_date} function. +\code{convertDateInformation} function. } } \examples{ @@ -39,7 +39,7 @@ dt <- data.table::data.table( ) # Fix uncommon date formats with time preservation -polar_fix_dates(dt, c("date1", "date2"), preserve_time = TRUE) +fixDateFormat(dt, c("date1", "date2"), preserve_time = TRUE) # The resulting data.table will have additional columns date1_timespec and date2_timespec # containing the extracted time information, and the original date columns date1 and date2 @@ -54,5 +54,5 @@ dt } \seealso{ -\code{\link{polar_as_time}}, \code{\link{polar_as_date}} +\code{\link{convertTimeToPOSIXct}}, \code{\link{convertDateInformation}} } diff --git a/R-etlutils/etlutils/man/frame_string.Rd b/R-etlutils/etlutils/man/frame_string.Rd index ff3db58c..b1ea3cca 100644 --- a/R-etlutils/etlutils/man/frame_string.Rd +++ b/R-etlutils/etlutils/man/frame_string.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R +% Please edit documentation in R/lib_helper_functions.R \name{frame_string} \alias{frame_string} \title{Create a Framed String} diff --git a/R-etlutils/etlutils/man/get_pattern_YYYY.Rd b/R-etlutils/etlutils/man/get_pattern_YYYY.Rd deleted file mode 100644 index d11608e2..00000000 --- a/R-etlutils/etlutils/man/get_pattern_YYYY.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{get_pattern_YYYY} -\alias{get_pattern_YYYY} -\title{Get a regular expression pattern for matching YYYY format} -\usage{ -get_pattern_YYYY() -} -\value{ -A character vector representing the regular expression pattern for YYYY format. -} -\description{ -This function returns a regular expression pattern for matching the YYYY format -(four-digit year). It can be used for validating and extracting year information -from strings. -} -\examples{ -get_pattern_YYYY() - -} diff --git a/R-etlutils/etlutils/man/get_pattern_YYYY_MM.Rd b/R-etlutils/etlutils/man/get_pattern_YYYY_MM.Rd deleted file mode 100644 index 92f8bae0..00000000 --- a/R-etlutils/etlutils/man/get_pattern_YYYY_MM.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{get_pattern_YYYY_MM} -\alias{get_pattern_YYYY_MM} -\title{Get a regular expression pattern for matching YYYY-MM format} -\usage{ -get_pattern_YYYY_MM() -} -\value{ -A character vector representing the regular expression pattern for YYYY-MM format. -} -\description{ -This function returns a regular expression pattern for matching the YYYY-MM format -(four-digit year followed by a hyphen and two-digit month). It can be used for -validating and extracting year and month information from strings. -} -\examples{ -get_pattern_YYYY_MM() - -} diff --git a/R-etlutils/etlutils/man/log_run.Rd b/R-etlutils/etlutils/man/log_run.Rd deleted file mode 100644 index cc0c13e1..00000000 --- a/R-etlutils/etlutils/man/log_run.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{log_run} -\alias{log_run} -\title{Runs the given function surrounded with \code{\link[=START__]{START__()}} and \code{\link[=END__]{END__()}}.} -\usage{ -log_run(process, verbose = VERBOSE - 4, len = 104) -} -\arguments{ -\item{process}{a function} - -\item{verbose}{An integer of length 1, the verbose level. If verb is 0, no output will be produced.} - -\item{len}{An integer of length 1, the length of the underline.} -} -\description{ -Runs the given function surrounded with \code{\link[=START__]{START__()}} and \code{\link[=END__]{END__()}}. -} diff --git a/R-etlutils/etlutils/man/plural_s.Rd b/R-etlutils/etlutils/man/plural_s.Rd index c8eb8e22..75772712 100644 --- a/R-etlutils/etlutils/man/plural_s.Rd +++ b/R-etlutils/etlutils/man/plural_s.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R +% Please edit documentation in R/lib_helper_functions.R \name{plural_s} \alias{plural_s} \title{Pluralize Suffix Based on Count} diff --git a/R-etlutils/etlutils/man/polar_disclaimer.Rd b/R-etlutils/etlutils/man/polar_disclaimer.Rd deleted file mode 100644 index b7449d1f..00000000 --- a/R-etlutils/etlutils/man/polar_disclaimer.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{polar_disclaimer} -\alias{polar_disclaimer} -\title{Print a Disclaimer Text} -\usage{ -polar_disclaimer() -} -\description{ -This function prints a disclaimer text with detailed information about the project settings, -system details, hardware information, and request parameters. -} -\details{ -The disclaimer text includes information about the project name, time stamp, R version, system details, -hardware information, working directories, request parameters, and software versions. -It provides a comprehensive overview of the project configuration. -} diff --git a/R-etlutils/etlutils/man/polar_get_resources_by_ids.Rd b/R-etlutils/etlutils/man/polar_get_resources_by_ids.Rd index 4d11fd69..e35c7917 100644 --- a/R-etlutils/etlutils/man/polar_get_resources_by_ids.Rd +++ b/R-etlutils/etlutils/man/polar_get_resources_by_ids.Rd @@ -9,7 +9,7 @@ polar_get_resources_by_ids( resource, ids, id_param_str = "_id", - parameters = polar_add_common_request_params(c()), + parameters = fhir_url_add_common_request_params(c()), verbose = 0 ) } diff --git a/R-etlutils/etlutils/man/print_table_summary.Rd b/R-etlutils/etlutils/man/print_table_summary.Rd index 94a143ca..f8b99217 100644 --- a/R-etlutils/etlutils/man/print_table_summary.Rd +++ b/R-etlutils/etlutils/man/print_table_summary.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R +% Please edit documentation in R/lib_table.R \name{print_table_summary} \alias{print_table_summary} \title{Print a summary for a table} diff --git a/R-etlutils/etlutils/man/run.Rd b/R-etlutils/etlutils/man/run.Rd index 9feb1bca..4cc76382 100644 --- a/R-etlutils/etlutils/man/run.Rd +++ b/R-etlutils/etlutils/man/run.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{run} \alias{run} \title{Execute a script with specified message, process, and verbosity level} diff --git a/R-etlutils/etlutils/man/polar_run.Rd b/R-etlutils/etlutils/man/runProcess.Rd similarity index 84% rename from R-etlutils/etlutils/man/polar_run.Rd rename to R-etlutils/etlutils/man/runProcess.Rd index 290375e6..0a4d11e1 100644 --- a/R-etlutils/etlutils/man/polar_run.Rd +++ b/R-etlutils/etlutils/man/runProcess.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R -\name{polar_run} -\alias{polar_run} +% Please edit documentation in R/lib_logging.R +\name{runProcess} +\alias{runProcess} \title{Run and log a process} \usage{ -polar_run( +runProcess( message, process, single_line = TRUE, diff --git a/R-etlutils/etlutils/man/run_in.Rd b/R-etlutils/etlutils/man/run_in.Rd index d4d52e46..4d5cf99e 100644 --- a/R-etlutils/etlutils/man/run_in.Rd +++ b/R-etlutils/etlutils/man/run_in.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{run_in} \alias{run_in} \title{Execute an inner script with a specified message and process} diff --git a/R-etlutils/etlutils/man/run_in_in.Rd b/R-etlutils/etlutils/man/run_in_in.Rd index 3371fcf5..6a21bec1 100644 --- a/R-etlutils/etlutils/man/run_in_in.Rd +++ b/R-etlutils/etlutils/man/run_in_in.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{run_in_in} \alias{run_in_in} \title{Execute an inner script info with a specified message and process} diff --git a/R-etlutils/etlutils/man/run_in_in_ignore_error.Rd b/R-etlutils/etlutils/man/run_in_in_ignore_error.Rd index 3e9e1766..03d5ffbd 100644 --- a/R-etlutils/etlutils/man/run_in_in_ignore_error.Rd +++ b/R-etlutils/etlutils/man/run_in_in_ignore_error.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{run_in_in_ignore_error} \alias{run_in_in_ignore_error} \title{Execute an inner script info with a specified message and process} diff --git a/R-etlutils/etlutils/man/run_out.Rd b/R-etlutils/etlutils/man/run_out.Rd index f095fe2c..6846a967 100644 --- a/R-etlutils/etlutils/man/run_out.Rd +++ b/R-etlutils/etlutils/man/run_out.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{run_out} \alias{run_out} \title{Execute an outer script with a specified message and process} diff --git a/R-etlutils/etlutils/man/runs.Rd b/R-etlutils/etlutils/man/runs.Rd index ac485348..abfdd8b2 100644 --- a/R-etlutils/etlutils/man/runs.Rd +++ b/R-etlutils/etlutils/man/runs.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{runs} \alias{runs} \title{Execute a script with specified message, process, and verbosity level (single line)} diff --git a/R-etlutils/etlutils/man/runs_in.Rd b/R-etlutils/etlutils/man/runs_in.Rd index 7faef7f2..a4770bff 100644 --- a/R-etlutils/etlutils/man/runs_in.Rd +++ b/R-etlutils/etlutils/man/runs_in.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{runs_in} \alias{runs_in} \title{Execute an inner script with specified message and process (single line)} diff --git a/R-etlutils/etlutils/man/runs_in_in.Rd b/R-etlutils/etlutils/man/runs_in_in.Rd index c3740db7..b849934a 100644 --- a/R-etlutils/etlutils/man/runs_in_in.Rd +++ b/R-etlutils/etlutils/man/runs_in_in.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{runs_in_in} \alias{runs_in_in} \title{Execute an inner script info with specified message and process (single line)} diff --git a/R-etlutils/etlutils/man/runs_out.Rd b/R-etlutils/etlutils/man/runs_out.Rd index 4c0cb30b..21e82cb1 100644 --- a/R-etlutils/etlutils/man/runs_out.Rd +++ b/R-etlutils/etlutils/man/runs_out.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_helper_functions.R +% Please edit documentation in R/lib_logging.R \name{runs_out} \alias{runs_out} \title{Execute an outer script with specified message and process (single line)} diff --git a/R-etlutils/etlutils/man/save_performance.Rd b/R-etlutils/etlutils/man/save_performance.Rd index 23e94d91..30f55515 100644 --- a/R-etlutils/etlutils/man/save_performance.Rd +++ b/R-etlutils/etlutils/man/save_performance.Rd @@ -6,7 +6,7 @@ \usage{ save_performance( filename_without_extension, - clock = if (is.null(POLAR_CLOCK)) NULL else POLAR_CLOCK + clock = if (is.null(PROCESS_CLOCK)) NULL else PROCESS_CLOCK ) } \arguments{ diff --git a/R-etlutils/etlutils/man/stopOnError.Rd b/R-etlutils/etlutils/man/stopOnError.Rd new file mode 100644 index 00000000..2646f42f --- /dev/null +++ b/R-etlutils/etlutils/man/stopOnError.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/lib_helper_functions.R +\name{stopOnError} +\alias{stopOnError} +\title{Stop on Error} +\usage{ +stopOnError(...) +} +\arguments{ +\item{...}{Character vectors to be concatenated and printed as an error message.} +} +\value{ +This function does not return a value. It stops execution. +} +\description{ +This function stops execution and prints the concatenated error message. +} +\examples{ +stopOnError("Error: Something went wrong.") + +} diff --git a/R-etlutils/etlutils/man/verbose_numbers.Rd b/R-etlutils/etlutils/man/verbose_numbers.Rd index da455c6d..3cedfc40 100644 --- a/R-etlutils/etlutils/man/verbose_numbers.Rd +++ b/R-etlutils/etlutils/man/verbose_numbers.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/lib_misc.R +% Please edit documentation in R/lib_helper_functions.R \name{verbose_numbers} \alias{verbose_numbers} \title{Convert Numbers to Verbose Number Representations} diff --git a/R-etlutils/etlutils/tests/testthat/test-lib_helper_functions.R b/R-etlutils/etlutils/tests/testthat/test-lib_helper_functions.R index 84aaf523..1e6cad37 100644 --- a/R-etlutils/etlutils/tests/testthat/test-lib_helper_functions.R +++ b/R-etlutils/etlutils/tests/testthat/test-lib_helper_functions.R @@ -177,3 +177,86 @@ test_that("replacePatternsInString returns the original string when no matches a result <- replacePatternsInString(patternsAndReplacements, "hello world!", ignore.case = FALSE) expect_equal(result, "hello world!") }) + +########################### +# convertDateInformation # +########################### +#' @importFrom lubridate today + +test_that("convertDateInformation converts date representations correctly", { + # Test case 1: YYYY format + date_column_YYYY <- c("2022", "1990", "1980") + result_YYYY <- convertDateInformation(date_column_YYYY) + expect_equal(result_YYYY, lubridate::as_date(c("2022-01-01", "1990-01-01", "1980-01-01"))) + + # Test case 2: YYYY-MM format + date_column_YYYY_MM <- c("2022-12", "1990-05", "1980-11") + result_YYYY_MM <- convertDateInformation(date_column_YYYY_MM) + expect_equal(result_YYYY_MM, lubridate::as_date(c("2022-12-01", "1990-05-01", "1980-11-01"))) + + # Test case 3: Date with time, should be cleaned + date_column_with_time <- c("2022-12-01T15:30:00", "1990-05-01T08:45:00") + result_with_time <- convertDateInformation(date_column_with_time) + expect_equal(result_with_time, lubridate::as_date(c("2022-12-01", "1990-05-01"))) + + # Test case 4: Date with '/' separator, should be replaced with '-' + date_column_slash_separator <- c("2022/12/01", "1990/05/01") + result_slash_separator <- convertDateInformation(date_column_slash_separator) + expect_equal(result_slash_separator, lubridate::as_date(c("2022-12-01", "1990-05-01"))) +}) + +################## +# fixDateFormat # +################## + +test_that("fixDateFormat fixes uncommon date formats", { + # Erstellen Sie einen Beispiel-Datensatz + dt <- data.table::data.table( + date1 = c("2022", "1990-05", "1980-11"), + date2 = c("2022-12", "1990-05", "1980-11"), + value = c(1, 2, 3) + ) + + # Testen Sie die Funktion mit der Zeit beizubehalten + fixDateFormat(dt, c("date1", "date2"), preserve_time = TRUE) + + # Erwartete Ergebnisse für date1_timespec und date2_timespec + expected_time_cols <- data.table::data.table( + date1_timespec = c("00:00:00", "00:00:00", "00:00:00"), + date2_timespec = c("00:00:00", "00:00:00", "00:00:00") + ) + + # Überprüfen Sie, ob die Zeit-Spalten korrekt hinzugefügt wurden + expect_equal(dt[, .(date1_timespec, date2_timespec)], expected_time_cols) + + # Erwartete Ergebnisse für date1 und date2 + expected_date_cols <- data.table::data.table( + date1 = as.Date(c("2022-01-01", "1990-05-01", "1980-11-01")), + date2 = as.Date(c("2022-12-01", "1990-05-01", "1980-11-01")), + value = c(1, 2, 3) + ) + + # Überprüfen Sie, ob die Datum-Spalten korrekt hinzugefügt wurden + expect_equal(dt[, .(date1, date2, value)], expected_date_cols) +}) + +######################### +# convertTimeToPOSIXct # +######################### + +test_that("convertTimeToPOSIXct converts polar time representations to POSIXct", { + # Test case 1: Valid time representation + time_column_valid <- c("12:30:45", "08:15:00", "23:59:59") + result_valid <- convertTimeToPOSIXct(time_column_valid) + expect_equal(result_valid, c("12:30:45", "08:15:00", "23:59:59")) + + # Test case 2: NA input, should return NA + time_column_na <- c(NA, NA, NA) + result_na <- convertTimeToPOSIXct(time_column_na) + expect_equal(result_na, c(NA_character_, NA_character_, NA_character_)) + + # Test case 3: Empty string input, should throw an error + time_column_empty <- c("", NA, "") + result_na <- convertTimeToPOSIXct(time_column_empty) + expect_equal(result_na, c(NA_character_, NA_character_, NA_character_)) +}) diff --git a/R-etlutils/etlutils/tests/testthat/test-lib_misc.R b/R-etlutils/etlutils/tests/testthat/test-lib_misc.R deleted file mode 100644 index 2f236d08..00000000 --- a/R-etlutils/etlutils/tests/testthat/test-lib_misc.R +++ /dev/null @@ -1,73 +0,0 @@ -#' @importFrom lubridate today - -test_that("polar_as_date converts date representations correctly", { - # Test case 1: YYYY format - date_column_YYYY <- c("2022", "1990", "1980") - result_YYYY <- polar_as_date(date_column_YYYY) - expect_equal(result_YYYY, lubridate::as_date(c("2022-01-01", "1990-01-01", "1980-01-01"))) - - # Test case 2: YYYY-MM format - date_column_YYYY_MM <- c("2022-12", "1990-05", "1980-11") - result_YYYY_MM <- polar_as_date(date_column_YYYY_MM) - expect_equal(result_YYYY_MM, lubridate::as_date(c("2022-12-01", "1990-05-01", "1980-11-01"))) - - # Test case 3: Date with time, should be cleaned - date_column_with_time <- c("2022-12-01T15:30:00", "1990-05-01T08:45:00") - result_with_time <- polar_as_date(date_column_with_time) - expect_equal(result_with_time, lubridate::as_date(c("2022-12-01", "1990-05-01"))) - - # Test case 4: Date with '/' separator, should be replaced with '-' - date_column_slash_separator <- c("2022/12/01", "1990/05/01") - result_slash_separator <- polar_as_date(date_column_slash_separator) - expect_equal(result_slash_separator, lubridate::as_date(c("2022-12-01", "1990-05-01"))) -}) - - -test_that("polar_fix_dates fixes uncommon date formats", { - # Erstellen Sie einen Beispiel-Datensatz - dt <- data.table::data.table( - date1 = c("2022", "1990-05", "1980-11"), - date2 = c("2022-12", "1990-05", "1980-11"), - value = c(1, 2, 3) - ) - - # Testen Sie die Funktion mit der Zeit beizubehalten - polar_fix_dates(dt, c("date1", "date2"), preserve_time = TRUE) - - # Erwartete Ergebnisse für date1_timespec und date2_timespec - expected_time_cols <- data.table::data.table( - date1_timespec = c("00:00:00", "00:00:00", "00:00:00"), - date2_timespec = c("00:00:00", "00:00:00", "00:00:00") - ) - - # Überprüfen Sie, ob die Zeit-Spalten korrekt hinzugefügt wurden - expect_equal(dt[, .(date1_timespec, date2_timespec)], expected_time_cols) - - # Erwartete Ergebnisse für date1 und date2 - expected_date_cols <- data.table::data.table( - date1 = as.Date(c("2022-01-01", "1990-05-01", "1980-11-01")), - date2 = as.Date(c("2022-12-01", "1990-05-01", "1980-11-01")), - value = c(1, 2, 3) - ) - - # Überprüfen Sie, ob die Datum-Spalten korrekt hinzugefügt wurden - expect_equal(dt[, .(date1, date2, value)], expected_date_cols) -}) - - -test_that("polar_as_time converts polar time representations to POSIXct", { - # Test case 1: Valid time representation - time_column_valid <- c("12:30:45", "08:15:00", "23:59:59") - result_valid <- polar_as_time(time_column_valid) - expect_equal(result_valid, c("12:30:45", "08:15:00", "23:59:59")) - - # Test case 2: NA input, should return NA - time_column_na <- c(NA, NA, NA) - result_na <- polar_as_time(time_column_na) - expect_equal(result_na, c(NA_character_, NA_character_, NA_character_)) - - # Test case 3: Empty string input, should throw an error - time_column_empty <- c("", NA, "") - result_na <- polar_as_time(time_column_empty) - expect_equal(result_na, c(NA_character_, NA_character_, NA_character_)) -}) diff --git a/R-kds2db/StartRetrieval.R b/R-kds2db/StartRetrieval.R index 5a456e3a..331796a2 100644 --- a/R-kds2db/StartRetrieval.R +++ b/R-kds2db/StartRetrieval.R @@ -1,9 +1,13 @@ #################################################################################### # Preferences: The current working directory must be the main project directory. # # In interactive setting this is the parent directory of the R-kds2db # -# directory (default 'interpolar'). # +# directory (default 'INTERPOLAR'). # #################################################################################### +# chance the working directory to the main directory +if (grepl('/kds2db$', getwd())) setwd("../..") +if (grepl('/R-kds2db$', getwd())) setwd("../") + # free memory rm(list = ls()) diff --git a/R-kds2db/kds2db/R/00_Main.R b/R-kds2db/kds2db/R/00_Main.R index 6a588628..58473632 100644 --- a/R-kds2db/kds2db/R/00_Main.R +++ b/R-kds2db/kds2db/R/00_Main.R @@ -4,14 +4,10 @@ #' #' @export retrieve <- function() { - # Iniialzes the global STOP variable. If a subprocess sets this variable to TRUE then the execution will be stopped. - STOP <<- FALSE - ### # Read the module configuration toml file. ### - path2config_toml <- ifelse(interactive(), './R-kds2db', '.') - path2config_toml <- paste0(path2config_toml, '/kds2db_config.toml') + path2config_toml <- './R-kds2db/kds2db_config.toml' etlutils::initConstants(path2config_toml) ### @@ -27,9 +23,9 @@ retrieve <- function() { etlutils::create_dirs(PROJECT_NAME) ### - # Create globally used polar_clock + # Create globally used process_clock ### - POLAR_CLOCK <<- etlutils::createClock() + PROCESS_CLOCK <<- etlutils::createClock() ### # log all console outputs and save them at the end @@ -44,7 +40,8 @@ retrieve <- function() { err <- try(etlutils::run_in('Extract Patient IDs', { patientIDsPerWard <- getPatientIDsPerWard(ifelse(exists('PATH_TO_PID_LIST_FILE'), PATH_TO_PID_LIST_FILE, NA)) }), silent = TRUE) - print(POLAR_CLOCK) + print(PROCESS_CLOCK) + warnings() if(inherits(err, "try-error")) stop() etlutils::END__() @@ -52,18 +49,19 @@ retrieve <- function() { etlutils::START__() err <- try(etlutils::run_in('Load Table Description', { table_descriptions <- getTableDescriptions() - print(POLAR_CLOCK) }), silent = TRUE) - print(POLAR_CLOCK) + print(PROCESS_CLOCK) + warnings() if(inherits(err, "try-error")) stop() etlutils::END__() # Download and crack resources by Patient IDs per ward etlutils::START__() err <- try(etlutils::run_in('Download and crack resources by Patient IDs per ward', { - resource_table_list <<- loadResourcesByPatientIDFromFHIRServer(patientIDsPerWard, table_descriptions) + resource_table_list <- loadResourcesByPatientIDFromFHIRServer(patientIDsPerWard, table_descriptions) }), silent = TRUE) - print(POLAR_CLOCK) + print(PROCESS_CLOCK) + warnings() if(inherits(err, "try-error")) stop() etlutils::END__() @@ -72,20 +70,15 @@ retrieve <- function() { err <- try(etlutils::run_in('Write resource tables to database', { writeResourceTablesToDatabase(resource_table_list, clear_before_insert = FALSE) }), silent = TRUE) - print(POLAR_CLOCK) + print(PROCESS_CLOCK) + warnings() if(inherits(err, "try-error")) stop() etlutils::END__() - # # Maybe relevant in future - # if (STOP) { - # cat_red('An Error occured in a for the following Scripts relevant Script. So stop execution here.\n') - # cat(str.(err, fg = 1), '\n') - # break; - # } }) etlutils::END__() - #warnings() - print(POLAR_CLOCK) + warnings() + print(PROCESS_CLOCK) ### # Save all console logs ### diff --git a/R-kds2db/kds2db/R/01_Get_PIDs.R b/R-kds2db/kds2db/R/01_Get_PIDs.R index ccd725c7..0a676ff0 100644 --- a/R-kds2db/kds2db/R/01_Get_PIDs.R +++ b/R-kds2db/kds2db/R/01_Get_PIDs.R @@ -12,9 +12,9 @@ convertFilterPatterns <- function(filter_patterns_global_variable_name_prefix = 'ENCOUNTER_FILTER_PATTERN') { ward_pids_filter_patterns <- etlutils::getGlobalVariablesByPrefix(filter_patterns_global_variable_name_prefix) + if (!length(ward_pids_filter_patterns)) { - STOP <<- TRUE - stop(paste('No ward filter patterns found with prefix', filter_patterns_global_variable_name_prefix, 'in toml file')) + stopOnError('No ward filter patterns found with prefix', filter_patterns_global_variable_name_prefix, 'in toml file') } # the result list with all. The structure of the list is the following: diff --git a/R-kds2db/kds2db/R/04_Write_Tables_To_Database.R b/R-kds2db/kds2db/R/04_Write_Tables_To_Database.R index 26def404..1e07287c 100644 --- a/R-kds2db/kds2db/R/04_Write_Tables_To_Database.R +++ b/R-kds2db/kds2db/R/04_Write_Tables_To_Database.R @@ -42,6 +42,11 @@ writeResourceTablesToDatabase <- function(tables, table_names = NA, clear_before ) db_table_names <- etlutils::dbListTables(db_connection) + # Display the table names + print(paste("The following tables are found in database:", paste(db_table_names, collapse = ", "))) + if (is.null(db_table_names)) { + warning("There is no tables found in database") + } # write tables to DB for (table_name in table_names) { @@ -51,6 +56,8 @@ writeResourceTablesToDatabase <- function(tables, table_names = NA, clear_before etlutils::dbDeleteContent(db_connection, table_name) } etlutils::dbAddContent(db_connection, table_name, table) + } else { + warning(paste("Table", table_name, "not found in database")) } } diff --git a/README.md b/README.md index a990f1f3..c5153f60 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # KDS Pipeline -Dieses Repository enthält Module der KDS (Kerndatensatz) Pipeline zur Verarbeitung von [`MII KDS FHIR Ressourcen`](https://www.medizininformatik-initiative.de/de/basismodule-des-kerndatensatzes-der-mii) mit dem Ziel Medikationsprobleme (MRP) zu erkennen. Es handelt sich um eine Referenzimplementierung und ist modular aufgebaut. Hierbei werden FHIR-Ressourcen vom KDS (Kerndatensatz) FHIR Store heruntergeladen, in eine Tabellenstruktur überführt und in eine Posgres-Datenbank geschrieben. In einen nächsten Schritt werden die Daten geprüft, harmonisiert und mit Hilfe von Algorithmen MRPs berechnet. Anschließend werden die Daten über ein AMTS-Cockpit (hier Redcap) auf einer Oberfläche sichtbar gemacht. +Dieses Repository enthält Module der KDS (Kerndatensatz) Pipeline zur Verarbeitung von [`MII KDS FHIR Ressourcen`](https://www.medizininformatik-initiative.de/de/basismodule-des-kerndatensatzes-der-mii) mit dem Ziel Medikationsprobleme (MRP) zu erkennen. Es handelt sich um eine Referenzimplementierung und ist modular aufgebaut. Hierbei werden FHIR-Ressourcen vom KDS (Kerndatensatz) FHIR Store heruntergeladen, in eine Tabellenstruktur überführt und in eine Posgres-Datenbank geschrieben. In einen nächsten Schritt werden die Daten geprüft, harmonisiert und mit Hilfe von Algorithmen MRPs berechnet. Anschließend werden die Daten über ein AMTS-Cockpit (z.B. Redcap) auf einer Benutzeroberfläche sichtbar gemacht. + +![image](https://github.com/medizininformatik-initiative/INTERPOLAR/assets/11329281/b4396fda-5fcb-46b0-a7cb-e83b893df7ae) ## Module @@ -35,3 +37,7 @@ Dieses Verzeichnis enthält die REDCap Web-Anwendung inkl. Anweisungen zur Erzeu #### REDCap-db Die REDCap-app benötigt eine Datenbank (mariadb), welche in diesem Verzeichnis definiert (Passwörter, Umgebundgvariablen, etc.) imd initialisiert (init/redcap.sql) wird. Weitere Anweisungen befinden sich in der [REDCap-db/Readme.md](./REDCap-db/Readme.md) + +## Installation + +Folgende Anweisungen müssen ausgeführt werden, um die MRP-Pipeline zu verwenden: [Install.md](Install.md) diff --git a/REDCap-app/Readme.md b/REDCap-app/Readme.md index f0049ecf..7069c1bf 100644 --- a/REDCap-app/Readme.md +++ b/REDCap-app/Readme.md @@ -1,10 +1,15 @@ +# Frontend Setup (Redcap) + In diesem Ordner wird für das Frontend ein minimales Redcap aufgesetzt. -Dieser Vorgang läuft in 2 Stufen ab: -1. Docker-Image für die Ausführung von Redcap erzeugen (Ordner REDCap-app/build) -2. Redcap-(Installations)-Dateien zur Verfügung stellen (Ordner REDCap-app/html) -zu 1. - * REDCap-app/build/Dockerfile beschreibt eine PHP-8 Umgebung inkl. Extensions, wie sie für REDCap benötigt werden - * Im Verzeichnis REDCap-app/build/config liegen Konfigurationsdateien, die zur Build-Zeit verwendet werden. Diese können auch auch zur Laufzeit in der docker-compose.yml mittels Volumes überschrieben werden. Für den Mailversand aus dem REDCap-Container heraus ist die Konfigurationsdatei msmtprc aus der Vorlage (REDCap-app/build/config/template_msmtprc) entspr. anzupassen (Mailadressen, Mailhost, etc.). +Dies erfolgt in 2 Schritten: +1. Docker-Image für die Ausführung von Redcap erzeugen (Ordner [build](build)) +2. Redcap-(Installations)-Dateien zur Verfügung stellen (Ordner [html](html)) + +## zu 1. + * [build/Dockerfile](build/Dockerfile) beschreibt eine PHP-8 Umgebung inkl. Extensions, wie sie für REDCap benötigt werden + * Im Verzeichnis [build/config](build/config) liegen Konfigurationsdateien, die zur Build-Zeit verwendet werden. Diese können auch auch zur Laufzeit in der [../docker-compose.yml](../docker-compose.yml) mittels Volumes überschrieben werden. + * Für den Mailversand aus dem REDCap-Container heraus ist z.B. die Konfigurationsdatei [build/config/msmtprc](build/config/msmtprc) entspr. anzupassen (Mailadressen, Mailhost, etc.). -zu 2. siehe Anweisungen in [REDCap-app/html/Readme.md](./html/Readme.md) +## zu 2. +Siehe Anweisungen in [html/Readme.md](html/Readme.md) diff --git a/REDCap-app/build/config/template_msmtprc b/REDCap-app/build/config/msmtprc similarity index 79% rename from REDCap-app/build/config/template_msmtprc rename to REDCap-app/build/config/msmtprc index 01c7d89d..1638be4c 100644 --- a/REDCap-app/build/config/template_msmtprc +++ b/REDCap-app/build/config/msmtprc @@ -3,10 +3,10 @@ # A system wide configuration file is optional. # If it exists, it usually defines a default account. # This allows msmtp to be used like /usr/sbin/sendmail. -account some@mailaddress.mail +account redcap@mailhost.domain # The SMTP smarthost -host some.mailhost.host +host some.mailhost.domain # Use TLS on port 587 port 25 @@ -15,19 +15,19 @@ tls_starttls on # Construct envelope-from addresses of the form "user@oursite.example" auto_from on -maildomain some.maildomain.domain +maildomain mailhost.domain # Syslog logging with facility LOG_MAIL instead of the default LOG_USER syslog LOG_MAIL -from redcap@datrav.uni-leipzig.de +from redcap@mailhost.domain #auth on #user YOURUSERNAME #password YOURPASSWORD # Set a default account # TODO: Use your own mail address -account default: some@mailaddress.mail +account default: redacap@mailhost.domain # Map local users to mail addresses (for crontab) aliases /etc/aliases diff --git a/REDCap-app/build/config/php.ini b/REDCap-app/build/config/php.ini index d9f37f4b..8b4716f6 100644 --- a/REDCap-app/build/config/php.ini +++ b/REDCap-app/build/config/php.ini @@ -8,7 +8,7 @@ error_log = /var/log/apache2/error.log [mail function] mail.log = /var/log/php_mail.log ; mail.log = /var/log/mail.log -SMTP = server1.rz.uni-leipzig.de +SMTP = some.mailhost.domain smtp_port = 25 ; sendmail_path = "/usr/sbin/ssmtp -t" sendmail_path = "/usr/bin/msmtp -t" diff --git a/REDCap-app/html/Readme.md b/REDCap-app/html/Readme.md index f7a3a569..6efa520e 100644 --- a/REDCap-app/html/Readme.md +++ b/REDCap-app/html/Readme.md @@ -12,6 +12,15 @@ $db = 'redcap'; //your_mysql_db_name $username = 'redcap'; //your_mysql_db_username $password = 'password_for_redcap_user'; //your_mysql_db_password ``` +Ändern Sie außerdem die SALT Variable, z.B.: + +``` +$salt = '32534739'; +``` + + +Legen Sie das folgende Verzeichnis an: +REDCap-app/html/redcapdocs Passen Sie die Zugriffrechte für die folgenden Verzeichnisse an: REDCap-app/html/redcap/temp diff --git a/amts_db_config.toml b/amts_db_config.toml index 17bdca54..f188c739 100644 --- a/amts_db_config.toml +++ b/amts_db_config.toml @@ -4,7 +4,7 @@ DB_GENERAL_HOST = "amts_db" DB_GENERAL_PORT = 5432 -DB_GENERAL_NAME = "interpolar" +DB_GENERAL_NAME = "amts_db" ########################## # KDS2DB module settings # diff --git a/docker-compose.yml b/docker-compose.yml index 870abd94..9e0796a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -63,8 +63,8 @@ services: amts_db: build: ./Postgres-amts_db/build restart: unless-stopped - # healthcheck: - # test: [ "CMD-SHELL", "pg_isready -U postgres -d interpolar" ] + # healthcheck: + # test: [ "CMD-SHELL", "pg_isready -U postgres -d amts_db" ] # interval: 10s # timeout: 5s # retries: 5 @@ -72,12 +72,12 @@ services: - "15432:5432" environment: TZ: Europe/Berlin - POSTGRES_PASSWORD_FILE: /run/secrets/amts_db.password - POSTGRES_USER: interpolar_admin - POSTGRES_DB: interpolar + POSTGRES_PASSWORD_FILE: /run/secrets/amts_db_admin.password + POSTGRES_USER: amts_db_admin + POSTGRES_DB: amts_db command: "-c config_file=/etc/postgresql.conf" secrets: - - amts_db.password + - amts_db_admin.password networks: - internal volumes: @@ -133,8 +133,8 @@ networks: driver: bridge secrets: - amts_db.password: - file: ./Postgres-amts_db/.env_amts_db.password + amts_db_admin.password: + file: ./Postgres-amts_db/.env_amts_db_admin.password redcap_db_root.password: file: ./REDCap-db/.env_redcap_db_root.password redcap_db.password: