-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KH-532: Orders table to provide more meaningfully flattened data. (#12)
- Loading branch information
Showing
6 changed files
with
223 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,58 @@ | ||
CREATE TABLE `orders` ( | ||
`order_id` BIGINT, | ||
`patient_id` BIGINT, | ||
`order_type_id` BIGINT, | ||
`order_type_name` VARCHAR, | ||
`order_type_uuid` VARCHAR, | ||
`order_type_java_class_name` VARCHAR, | ||
`concept_id` BIGINT, | ||
`orderer` BIGINT, | ||
`encounter_id` BIGINT, | ||
`encounter_datetime` TIMESTAMP, | ||
`encounter_type_name` VARCHAR, | ||
`encounter_type_uuid` VARCHAR, | ||
`care_setting` BIGINT, | ||
`care_setting_name` VARCHAR, | ||
`care_setting_type` VARCHAR, | ||
`care_setting_uuid` VARCHAR, | ||
`instructions` VARCHAR, | ||
`date_activated` TIMESTAMP, | ||
`auto_expire_date` TIMESTAMP, | ||
`date_stopped` TIMESTAMP, | ||
`order_reason` BIGINT, | ||
`order_reason_non_coded` VARCHAR, | ||
`date_created` TIMESTAMP, | ||
`creator` BIGINT, | ||
`voided_by` BIGINT, | ||
`date_voided` TIMESTAMP, | ||
`void_reason` VARCHAR, | ||
`accession_number` VARCHAR, | ||
`uuid` VARCHAR, | ||
`order_number` VARCHAR, | ||
`previous_order_id` BIGINT, | ||
`order_action` VARCHAR, | ||
`comment_to_fulfiller` VARCHAR, | ||
`scheduled_date` TIMESTAMP, | ||
`order_group_id` BIGINT, | ||
`sort_weight` DOUBLE, | ||
`encounter_voided` BOOLEAN, | ||
`voided` BOOLEAN, | ||
`order_type_retired` BOOLEAN, | ||
`encounter_type_retired` BOOLEAN, | ||
`care_setting_retired` BOOLEAN | ||
`order_id` int, | ||
`patient_uuid` VARCHAR, | ||
`order_type_name` VARCHAR, | ||
`order_type_uuid` VARCHAR, | ||
`order_type_java_class_name` VARCHAR, | ||
`order_name` VARCHAR, | ||
`concept_uuid` VARCHAR, | ||
`orderer` int, | ||
`encounter_uuid` VARCHAR, | ||
`encounter_datetime` datetime, | ||
`encounter_type_name` VARCHAR, | ||
`encounter_type_uuid` VARCHAR, | ||
`care_setting_name` VARCHAR, | ||
`care_setting_type` VARCHAR, | ||
`care_setting_uuid` VARCHAR, | ||
`instructions` VARCHAR, | ||
`date_activated` TIMESTAMP, | ||
`auto_expire_date` TIMESTAMP, | ||
`date_stopped` TIMESTAMP, | ||
`order_reason` VARCHAR, | ||
`order_reason_uuid` VARCHAR, | ||
`order_reason_non_coded` VARCHAR, | ||
`date_created` datetime, | ||
`creator_uuid` VARCHAR, | ||
`voided_by` int, | ||
`date_voided` TIMESTAMP, | ||
`void_reason` VARCHAR, | ||
`accession_number` VARCHAR, | ||
`uuid` VARCHAR, | ||
`order_number` VARCHAR, | ||
`previous_order_id` int, | ||
`order_action` VARCHAR, | ||
`comment_to_fulfiller` VARCHAR, | ||
`scheduled_date` TIMESTAMP, | ||
`order_group_id` int, | ||
`sort_weight` DOUBLE, | ||
`encounter_voided` BOOLEAN, | ||
`voided` BOOLEAN, | ||
`order_type_retired` BOOLEAN, | ||
`encounter_type_retired` BOOLEAN, | ||
`care_setting_retired` BOOLEAN, | ||
`drug_name` VARCHAR, | ||
`dose` DOUBLE, | ||
`dose_unit_name` VARCHAR, | ||
`frequency` VARCHAR, | ||
`route_name` VARCHAR, | ||
`quantity` DOUBLE, | ||
`quantity_unit_name` VARCHAR, | ||
`duration` int, | ||
`duration_unit_name` VARCHAR, | ||
`drug_uuid` VARCHAR, | ||
`dose_unit_uuid` VARCHAR, | ||
`quantity_unit_uuid` VARCHAR, | ||
`route_uuid` VARCHAR, | ||
`duration_unit_uuid` VARCHAR, | ||
`frequency_uuid` VARCHAR | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE TABLE `drug` ( | ||
`drug_id` int, | ||
`concept_id` int, | ||
`name` VARCHAR, | ||
`combination` BOOLEAN, | ||
`dosage_form` int, | ||
`maximum_daily_dose` double, | ||
`minimum_daily_dose` double, | ||
`route` int, | ||
`creator` int, | ||
`date_created` TIMESTAMP, | ||
`retired` BOOLEAN, | ||
`changed_by` int, | ||
`date_changed` TIMESTAMP, | ||
`retired_by` int, | ||
`date_retired` TIMESTAMP, | ||
`retire_reason` VARCHAR, | ||
`uuid` VARCHAR, | ||
`strength` VARCHAR, | ||
`dose_limit_units` int, | ||
PRIMARY KEY (`drug_id`) NOT ENFORCED | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CREATE TABLE `drug_order` ( | ||
`order_id` int, | ||
`drug_inventory_id` int, | ||
`dose` double, | ||
`as_needed` BOOLEAN, | ||
`dosing_type` VARCHAR, | ||
`quantity` double, | ||
`as_needed_condition` VARCHAR, | ||
`num_refills` int, | ||
`dosing_instructions` VARCHAR, | ||
`duration` int, | ||
`duration_units` int, | ||
`quantity_units` int, | ||
`route` int, | ||
`dose_units` int, | ||
`frequency` int, | ||
`brand_name` VARCHAR, | ||
`dispense_as_written` BOOLEAN, | ||
`drug_non_coded` VARCHAR, | ||
PRIMARY KEY (`order_id`) NOT ENFORCED | ||
) |
15 changes: 15 additions & 0 deletions
15
analytics/dsl/flattening/tables/openmrs/order_frequency.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CREATE TABLE `order_frequency` ( | ||
`order_frequency_id` int, | ||
`concept_id` int, | ||
`frequency_per_day` double, | ||
`creator` int, | ||
`date_created` TIMESTAMP, | ||
`retired` BOOLEAN, | ||
`retired_by` int, | ||
`date_retired` TIMESTAMP, | ||
`retire_reason` varchar, | ||
`changed_by` int, | ||
`date_changed` TIMESTAMP, | ||
`uuid` VARCHAR, | ||
PRIMARY KEY (`order_frequency_id`) NOT ENFORCED | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters