legal clojure now

legal clojure now

--- ddl.clj
+++ ddl.clj
@@ -1,1010 +1,1018 @@
 ; Oracle has a limit of varchar(4000), so we use 3900 for clob and
 ; any size larger than varchar(1000)

-:rm_case_assess
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :template_id                    "numeric(38)"
-  :listedness                     "numeric(38)"
-  :updated                        "date"
-  :outcome                        "numeric(38)"
-  :comment_id                     "numeric(38)"
-  :comp_comment_id                "numeric(38)"
-  :seriousness                    "numeric(38)"
-  :serious_notes                  "varchar(3900)"
-  :agent_suspect                  "numeric(38)"
-  :agent_notes                    "varchar(3900)"
-  :listedness_notes               "varchar(3900)"
-  :bfarm_causality                "numeric(10,0)"
-  :bfarm_manual_text              "varchar(3900)"
-  :company_diagnosis              "varchar(999)"
-  :company_diagnosis_notes        "varchar(3900)"
-  :diagnosis_dict_id              "numeric(38)"
-  :diagnosis_pref_code            "varchar(99)"
-  :diagnosis_inc_code             "varchar(99)"
-  :diagnosis_inc_term             "varchar(999)"
-  :diagnosis_hlgt_code            "varchar(99)"
-  :diagnosis_hlgt                 "varchar(999)"
-  :diagnosis_hlt_code             "varchar(99)"
-  :diagnosis_hlt                  "varchar(999)"
-  :diagnosis_soc_code             "varchar(99)"
-  :diagnosis_body_sys             "varchar(999)"
-  :ud_text_1                      "varchar(999)"
-  :ud_text_2                      "varchar(999)"
-  :ud_text_3                      "varchar(999)"
-  :ud_text_4                      "varchar(999)"
-  :ud_text_5                      "varchar(999)"
-  :ud_text_6                      "varchar(999)"
-  :ud_text_7                      "varchar(999)"
-  :ud_text_8                      "varchar(999)"
-  :ud_text_9                      "varchar(999)"
-  :ud_text_10                     "varchar(999)"
-  :ud_text_11                     "varchar(999)"
-  :ud_text_12                     "varchar(999)"
-  :ud_date_1                      "date"
-  :ud_date_2                      "date"
-  :ud_date_3                      "date"
-  :ud_date_4                      "date"
-  :ud_date_5                      "date"
-  :ud_date_6                      "date"
-  :ud_date_7                      "date"
-  :ud_date_8                      "date"
-  :ud_date_9                      "date"
-  :ud_date_10                     "date"
-  :ud_date_11                     "date"
-  :ud_date_12                     "date"
-  :ud_number_1                    "numeric(30,10)"
-  :ud_number_2                    "numeric(30,10)"
-  :ud_number_3                    "numeric(30,10)"
-  :ud_number_4                    "numeric(30,10)"
-  :ud_number_5                    "numeric(30,10)"
-  :ud_number_6                    "numeric(30,10)"
-  :ud_number_7                    "numeric(30,10)"
-  :ud_number_8                    "numeric(30,10)"
-  :ud_number_9                    "numeric(30,10)"
-  :ud_number_10                   "numeric(30,10)"
-  :ud_number_11                   "numeric(30,10)"
-  :ud_number_12                   "numeric(30,10)"
-  :evaluation                     "varchar(3900)"
-  :evaluation_j                   "varchar(3900)"
-  :co_suspect_count               "numeric(3,0)"
-  :event_synopsis                 "varchar(9)"
-  :event_primary                  "varchar(999)"
-  :diagnosis_reptd                "varchar(999)"
-  :diagnosis_coded                "varchar(999)"
-  :diagnosis_syn_code             "numeric(38)"
-  :diagnosis_code_status          "numeric(3,0)"
-  :event_primary_j                "varchar(999)"
-  :agent_notes_j                  "varchar(3900)"
-  :company_diagnosis_j            "varchar(999)"
-  :company_diagnosis_notes_j      "varchar(3900)"
-  :diagnosis_body_sys_j           "varchar(999)"
-  :diagnosis_coded_j              "varchar(999)"
-  :diagnosis_code_status_j        "numeric(38)"
-  :diagnosis_hlgt_j               "varchar(999)"
-  :diagnosis_hlt_j                "varchar(999)"
-  :diagnosis_inc_code_j           "varchar(99)"
-  :diagnosis_inc_term_j           "varchar(999)"
-  :diagnosis_reptd_j              "varchar(999)"
-  :listedness_notes_j             "varchar(3900)"
-  :serious_notes_j                "varchar(3900)"
-  :ud_text_1_j                    "varchar(999)"
-  :ud_text_2_j                    "varchar(999)"
-  :ud_text_3_j                    "varchar(999)"
-  :ud_text_4_j                    "varchar(999)"
-  :ud_text_5_j                    "varchar(999)"
-  :ud_text_6_j                    "varchar(999)"
-  :ud_text_7_j                    "varchar(999)"
-  :ud_text_8_j                    "varchar(999)"
-  :ud_text_9_j                    "varchar(999)"
-  :ud_text_10_j                   "varchar(999)"
-  :ud_text_11_j                   "varchar(999)"
-  :ud_text_12_j                   "varchar(999)"
-  :diagnosis_syn_code_j           "numeric(38)"
-  :deleted                        "date"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-}
-
-:rm_case_classifications
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :seq_num                        "numeric(38)"
-  :classification_id              "numeric(38)"
-  :deleted                        "date"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-}
-
-:rm_case_event
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :seq_num                        "numeric(38)"
-  :desc_reptd                     "varchar(999)"
-  :desc_coded                     "varchar(999)"
-  :diagnosis                      "numeric(38)"
-  :onset                          "date"
-  :onset_res                      "numeric(38)"
-  :onset_delay                    "varchar(99)"
-  :stop_date                      "date"
-  :stop_date_res                  "numeric(38)"
-  :duration                       "varchar(99)"
-  :onset_latency                  "varchar(99)"
-  :evt_intensity_id               "numeric(38)"
-  :evt_freq_id                    "numeric(38)"
-  :treated                        "numeric(38)"
-  :study_related                  "numeric(38)"
-  :rechall_related                "numeric(38)"
-  :prod_seq_num                   "numeric(38)"
-  :evt_outcome_id                 "numeric(38)"
-  :receipt_date                   "date"
-  :rpt_serious                    "numeric(38)"
-  :sc_death                       "numeric(38)"
-  :sc_hosp                        "numeric(38)"
-  :sc_cong_anom                   "numeric(38)"
-  :sc_threat                      "numeric(38)"
-  :sc_disable                     "numeric(38)"
-  :sc_int_req                     "numeric(38)"
-  :sc_other                       "numeric(38)"
-  :sc_other_text                  "varchar(99)"
-  :art_code                       "varchar(99)"
-  :pref_term                      "varchar(999)"
-  :inc_term                       "varchar(999)"
-  :body_sys                       "varchar(999)"
-  :med_serious                    "numeric(38)"
-  :past_hist                      "numeric(38)"
-  :dict_id                        "numeric(38)"
-  :dict_key                       "varchar(99)"
-  :code_status                    "numeric(38)"
-  :seriousness                    "numeric(38)"
-  :sort_id                        "numeric(38)"
-  :onset_date_partial             "varchar(99)"
-  :stop_date_partial              "varchar(99)"
-  :efficacy                       "numeric(38)"
-  :disease                        "numeric(38)"
-  :withdrawal                     "numeric(38)"
-  :hlgt                           "varchar(999)"
-  :hlt                            "varchar(999)"
-  :hlt_code                       "varchar(99)"
-  :hlgt_code                      "varchar(99)"
-  :soc_code                       "varchar(99)"
-  :study_dropped                  "numeric(4,0)"
-  :inc_code                       "varchar(99)"
-  :onset_minutes                  "numeric(38)"
-  :delay_minutes                  "numeric(38)"
-  :ud_text_1                      "varchar(999)"
-  :ud_text_2                      "varchar(999)"
-  :ud_text_3                      "varchar(999)"
-  :ud_text_4                      "varchar(999)"
-  :ud_text_5                      "varchar(999)"
-  :ud_text_6                      "varchar(999)"
-  :ud_text_7                      "varchar(999)"
-  :ud_text_8                      "varchar(999)"
-  :ud_text_9                      "varchar(999)"
-  :ud_text_10                     "varchar(999)"
-  :ud_text_11                     "varchar(999)"
-  :ud_text_12                     "varchar(999)"
-  :ud_date_1                      "date"
-  :ud_date_2                      "date"
-  :ud_date_3                      "date"
-  :ud_date_4                      "date"
-  :ud_date_5                      "date"
-  :ud_date_6                      "date"
-  :ud_date_7                      "date"
-  :ud_date_8                      "date"
-  :ud_date_9                      "date"
-  :ud_date_10                     "date"
-  :ud_date_11                     "date"
-  :ud_date_12                     "date"
-  :ud_number_1                    "numeric(30,10)"
-  :ud_number_2                    "numeric(30,10)"
-  :ud_number_3                    "numeric(30,10)"
-  :ud_number_4                    "numeric(30,10)"
-  :ud_number_5                    "numeric(30,10)"
-  :ud_number_6                    "numeric(30,10)"
-  :ud_number_7                    "numeric(30,10)"
-  :ud_number_8                    "numeric(30,10)"
-  :ud_number_9                    "numeric(30,10)"
-  :ud_number_10                   "numeric(30,10)"
-  :ud_number_11                   "numeric(30,10)"
-  :ud_number_12                   "numeric(30,10)"
-  :details                        "varchar(3900)"
-  :details_j                      "varchar(3900)"
-  :syn_code                       "numeric(38)"
-  :deleted                        "date"
-  :study_related_reptd            "numeric(1,0)"
-  :duration_unit_e2b              "numeric(38)"
-  :onset_latency_unit_e2b         "numeric(38)"
-  :onset_delay_unit_e2b           "numeric(38)"
-  :duration_seconds               "numeric(38)"
-  :onset_latency_seconds          "numeric(38)"
-  :onset_delay_seconds            "numeric(38)"
-  :body_sys_j                     "varchar(999)"
-  :code_status_j                  "numeric(38)"
-  :desc_coded_j                   "varchar(999)"
-  :desc_reptd_j                   "varchar(999)"
-  :hlgt_j                         "varchar(999)"
-  :hlt_j                          "varchar(999)"
-  :inc_code_j                     "varchar(99)"
-  :inc_term_j                     "varchar(999)"
-  :pref_term_j                    "varchar(999)"
-  :sc_other_text_j                "varchar(99)"
-  :report_exclusion               "numeric(38)"
-  :reportable                     "numeric(38)"
-  :ud_text_1_j                    "varchar(999)"
-  :ud_text_2_j                    "varchar(999)"
-  :ud_text_3_j                    "varchar(999)"
-  :ud_text_4_j                    "varchar(999)"
-  :ud_text_5_j                    "varchar(999)"
-  :ud_text_6_j                    "varchar(999)"
-  :ud_text_7_j                    "varchar(999)"
-  :ud_text_8_j                    "varchar(999)"
-  :ud_text_9_j                    "varchar(999)"
-  :ud_text_10_j                   "varchar(999)"
-  :ud_text_11_j                   "varchar(999)"
-  :ud_text_12_j                   "varchar(999)"
-  :syn_code_j                     "numeric(38)"
-  :infection                      "numeric(38)"
-  :rpt_exclude_cmt                "varchar(3900)"
-  :rpt_exclude_cmt_j              "varchar(3900)"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-}
-
-:rm_case_event_assess
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :event_seq_num                  "numeric(38)"
-  :prod_seq_num                   "numeric(38)"
-  :datasheet_id                   "numeric(38)"
-  :license_id                     "numeric(38)"
-  :seq_num                        "numeric(38)"
-  :updated                        "date"
-  :det_listedness_id              "numeric(38)"
-  :rpt_causality_id               "numeric(38)"
-  :det_causality_id               "numeric(38)"
-  :listed_justify                 "varchar(3900)"
-  :cause_justify                  "varchar(3900)"
-  :lam_assessed                   "numeric(12,0)"
-  :deleted                        "date"
-  :causality_assessment           "varchar(99)"
-  :causality_score                "numeric(38)"
-  :source_id                      "numeric(38)"
-  :prt_causality_id               "numeric(38)"
-  :cause_justify_j                "varchar(3900)"
-  :listed_justify_j               "varchar(3900)"
-  :dlp_revision_number            "numeric(38)"
-  :last_update_time               "date"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-}
-
-:rm_case_followup
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :seq_num                        "numeric(38)"
-  :receipt_date                   "date"
-  :safety_date                    "date"
-  :significant                    "numeric(1,0)"
-  :auditlog_type                  "numeric(38)"
-  :time_stamp                     "date"
-  :deleted                        "date"
-  :significant_device             "numeric(1,0)"
-  :data_cleanup                   "numeric(1,0)"
-  :justification                  "varchar(3900)"
-  :justification_id               "numeric(38)"
-  :justification_j                "varchar(3900)"
-  :just_receipt_date_j            "varchar(3900)"
-  :receipt_date_j                 "date"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-}
-
-:rm_case_master
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :case_num                       "varchar(99)"
-  :rev                            "numeric(38)"
-  :workflow_seq_num               "numeric(38)"
-  :last_workflow_seq_num          "numeric(38)"
-  :create_time                    "date"
-  :init_rept_date                 "date"
-  :user_id                        "numeric(38)"
-  :last_update_time               "date"
-  :last_update_user_id            "numeric(38)"
-  :requires_followup              "numeric(38)"
-  :followup_date                  "date"
-  :owner_id                       "numeric(38)"
-  :state_id                       "numeric(38)"
-  :country_id                     "numeric(38)"
-  :lang_id                        "numeric(38)"
-  :priority                       "numeric(38)"
-  :site_id                        "numeric(38)"
-  :seriousness                    "numeric(38)"
-  :rpt_type_id                    "numeric(38)"
-  :last_state_id                  "numeric(38)"
-  :assessment_needed              "numeric(38)"
-  :priority_override              "numeric(1,0)"
-  :sid                            "varchar(999)"
-  :safety_date                    "date"
-  :normal_time                    "date"
-  :max_time                       "date"
-  :report_scheduling              "numeric(38)"
-  :priority_assessment            "numeric(38)"
-  :close_user_id                  "numeric(38)"
-  :close_date                     "date"
-  :close_notes                    "varchar(999)"
-  :date_locked                    "date"
-  :ud_text_1                      "varchar(999)"
-  :ud_text_2                      "varchar(999)"
-  :ud_text_3                      "varchar(999)"
-  :ud_text_4                      "varchar(999)"
-  :ud_text_5                      "varchar(999)"
-  :ud_text_6                      "varchar(999)"
-  :ud_text_7                      "varchar(999)"
-  :ud_text_8                      "varchar(999)"
-  :ud_text_9                      "varchar(999)"
-  :ud_text_10                     "varchar(999)"
-  :ud_text_11                     "varchar(999)"
-  :ud_text_12                     "varchar(999)"
-  :ud_date_1                      "date"
-  :ud_date_2                      "date"
-  :ud_date_3                      "date"
-  :ud_date_4                      "date"
-  :ud_date_5                      "date"
-  :ud_date_6                      "date"
-  :ud_date_7                      "date"
-  :ud_date_8                      "date"
-  :ud_date_9                      "date"
-  :ud_date_10                     "date"
-  :ud_date_11                     "date"
-  :ud_date_12                     "date"
-  :ud_number_1                    "numeric(30,10)"
-  :ud_number_2                    "numeric(30,10)"
-  :ud_number_3                    "numeric(30,10)"
-  :ud_number_4                    "numeric(30,10)"
-  :ud_number_5                    "numeric(30,10)"
-  :ud_number_6                    "numeric(30,10)"
-  :ud_number_7                    "numeric(30,10)"
-  :ud_number_8                    "numeric(30,10)"
-  :ud_number_9                    "numeric(30,10)"
-  :ud_number_10                   "numeric(30,10)"
-  :ud_number_11                   "numeric(30,10)"
-  :ud_number_12                   "numeric(30,10)"
-  :deleted                        "date"
-  :due_soon                       "date"
-  :global_num                     "varchar(99)"
-  :priority_date_assessed         "date"
-  :lam_assess_done                "numeric(1,0)"
-  :e2b_ww_number                  "varchar(999)"
-  :worklist_owner_id              "numeric(38)"
-  :susar                          "numeric(38)"
-  :last_update_event              "date"
-  :initial_justification          "varchar(3900)"
-  :force_soon                     "date"
-  :due_soon_j                     "date"
-  :followup_date_j                "date"
-  :init_rept_date_j               "date"
-  :just_init_rept_date_j          "varchar(3900)"
-  :ud_text_1_j                    "varchar(999)"
-  :ud_text_2_j                    "varchar(999)"
-  :ud_text_3_j                    "varchar(999)"
-  :ud_text_4_j                    "varchar(999)"
-  :ud_text_5_j                    "varchar(999)"
-  :ud_text_6_j                    "varchar(999)"
-  :ud_text_7_j                    "varchar(999)"
-  :ud_text_8_j                    "varchar(999)"
-  :ud_text_9_j                    "varchar(999)"
-  :ud_text_10_j                   "varchar(999)"
-  :ud_text_11_j                   "varchar(999)"
-  :ud_text_12_j                   "varchar(999)"
-  :initial_justification_j        "varchar(3900)"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-}
-
-:rm_case_narrative
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :abbrev_narrative               "varchar(3900)"
-  :abbrev_narrative_j             "varchar(3900)"
-  :narrative                      "varchar(3900)"
-  :narrative_j                    "varchar(3900)"
-  :deleted                        "date"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-}
-
-:rm_case_pat_info
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :pat_id                         "varchar(99)"
-  :pat_subj_num                   "varchar(99)"
-  :pat_initials                   "varchar(99)"
-  :pat_firstname                  "varchar(99)"
-  :pat_mi                         "varchar(99)"
-  :pat_lastname                   "varchar(99)"
-  :pat_address                    "varchar(999)"
-  :pat_city                       "varchar(99)"
-  :pat_state                      "varchar(99)"
-  :pat_postal_code                "varchar(99)"
-  :pat_country                    "varchar(99)"
-  :pat_phone                      "varchar(99)"
-  :pat_dob                        "date"
-  :pat_dob_res                    "numeric(38)"
-  :pat_age                        "numeric(22,7)"
-  :age_unit_id                    "numeric(38)"
-  :age_group_id                   "numeric(38)"
-  :gender_id                      "numeric(38)"
-  :pat_weight_lbs                 "numeric(22,7)"
-  :pat_weight_kg                  "numeric(22,7)"
-  :pat_height_in                  "numeric(22,7)"
-  :pat_height_cm                  "numeric(22,7)"
-  :ethnicity_id                   "numeric(38)"
-  :occupation_id                  "numeric(38)"
-  :pat_stat_preg                  "numeric(38)"
-  :rel_test_id                    "numeric(38)"
-  :pat_dob_partial                "varchar(99)"
-  :rand_num                       "varchar(99)"
-  :confidential                   "numeric(1,0)"
-  :number_of_patients             "varchar(9)"
-  :ud_text_1                      "varchar(999)"
-  :ud_text_2                      "varchar(999)"
-  :ud_text_3                      "varchar(999)"
-  :ud_text_4                      "varchar(999)"
-  :ud_text_5                      "varchar(999)"
-  :ud_text_6                      "varchar(999)"
-  :ud_text_7                      "varchar(999)"
-  :ud_text_8                      "varchar(999)"
-  :ud_text_9                      "varchar(999)"
-  :ud_text_10                     "varchar(999)"
-  :ud_text_11                     "varchar(999)"
-  :ud_text_12                     "varchar(999)"
-  :ud_date_1                      "date"
-  :ud_date_2                      "date"
-  :ud_date_3                      "date"
-  :ud_date_4                      "date"
-  :ud_date_5                      "date"
-  :ud_date_6                      "date"
-  :ud_date_7                      "date"
-  :ud_date_8                      "date"
-  :ud_date_9                      "date"
-  :ud_date_10                     "date"
-  :ud_date_11                     "date"
-  :ud_date_12                     "date"
-  :ud_number_1                    "numeric(30,10)"
-  :ud_number_2                    "numeric(30,10)"
-  :ud_number_3                    "numeric(30,10)"
-  :ud_number_4                    "numeric(30,10)"
-  :ud_number_5                    "numeric(30,10)"
-  :ud_number_6                    "numeric(30,10)"
-  :ud_number_7                    "numeric(30,10)"
-  :ud_number_8                    "numeric(30,10)"
-  :ud_number_9                    "numeric(30,10)"
-  :ud_number_10                   "numeric(30,10)"
-  :ud_number_11                   "numeric(30,10)"
-  :ud_number_12                   "numeric(30,10)"
-  :deleted                        "date"
-  :child_only                     "numeric(1,0)"
-  :pat_bmi                        "numeric(22,7)"
-  :pat_body_area                  "numeric(22,7)"
-  :pat_address_j                  "varchar(999)"
-  :pat_city_j                     "varchar(99)"
-  :pat_firstname_j                "varchar(99)"
-  :pat_lastname_j                 "varchar(99)"
-  :pat_mi_j                       "varchar(99)"
-  :pat_state_j                    "varchar(99)"
-  :ud_text_1_j                    "varchar(999)"
-  :ud_text_2_j                    "varchar(999)"
-  :ud_text_3_j                    "varchar(999)"
-  :ud_text_4_j                    "varchar(999)"
-  :ud_text_5_j                    "varchar(999)"
-  :ud_text_6_j                    "varchar(999)"
-  :ud_text_7_j                    "varchar(999)"
-  :ud_text_8_j                    "varchar(999)"
-  :ud_text_9_j                    "varchar(999)"
-  :ud_text_10_j                   "varchar(999)"
-  :ud_text_11_j                   "varchar(999)"
-  :ud_text_12_j                   "varchar(999)"
-  :pat_country_id                 "numeric(38)"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-  :notes                          "varchar(3900)"
-  :notes_j                        "varchar(3900)"
-  :age_unit_id_at_vacc            "numeric(38)"
-  :pat_age_at_vacc                "numeric(38)"
-}
-
-:rm_case_prod_drugs
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :seq_num                        "numeric(38)"
-  :formulation_id                 "numeric(38)"
-  :concentration                  "varchar(99)"
-  :conc_units_id                  "numeric(38)"
-  :act_taken_id                   "numeric(38)"
-  :severity_id                    "numeric(38)"
-  :interaction                    "numeric(38)"
-  :contraind                      "numeric(38)"
-  :first_dose                     "date"
-  :first_dose_res                 "numeric(38)"
-  :last_dose                      "date"
-  :last_dose_res                  "numeric(38)"
-  :total_dose                     "numeric(22,7)"
-  :tot_dose_unit_id               "numeric(38)"
-  :prev_use                       "numeric(38)"
-  :abuse                          "numeric(38)"
-  :overdose                       "numeric(38)"
-  :protocol                       "numeric(38)"
-  :dechallenge                    "numeric(38)"
-  :dechall_date                   "date"
-  :rechallenge                    "numeric(38)"
-  :rechall_start                  "date"
-  :rechall_stop                   "date"
-  :rechall_outcome                "numeric(38)"
-  :sort_id                        "numeric(38)"
-  :b_weight_grams                 "numeric(38)"
-  :n_siblings                     "numeric(38)"
-  :b_weight_ozs                   "numeric(38)"
-  :first_dose_partial             "varchar(99)"
-  :last_dose_partial              "varchar(99)"
-  :tampering                      "numeric(4,0)"
-  :cumulative_dose                "numeric(22,7)"
-  :cumulative_dose_unit           "varchar(99)"
-  :deleted                        "date"
-  :ud_text_1                      "varchar(999)"
-  :ud_text_2                      "varchar(999)"
-  :ud_text_3                      "varchar(999)"
-  :ud_text_4                      "varchar(999)"
-  :ud_text_5                      "varchar(999)"
-  :ud_text_6                      "varchar(999)"
-  :ud_text_7                      "varchar(999)"
-  :ud_text_8                      "varchar(999)"
-  :ud_text_9                      "varchar(999)"
-  :ud_text_10                     "varchar(999)"
-  :ud_text_11                     "varchar(999)"
-  :ud_text_12                     "varchar(999)"
-  :ud_date_1                      "date"
-  :ud_date_2                      "date"
-  :ud_date_3                      "date"
-  :ud_date_4                      "date"
-  :ud_date_5                      "date"
-  :ud_date_6                      "date"
-  :ud_date_7                      "date"
-  :ud_date_8                      "date"
-  :ud_date_9                      "date"
-  :ud_date_10                     "date"
-  :ud_date_11                     "date"
-  :ud_date_12                     "date"
-  :ud_number_1                    "numeric(30,10)"
-  :ud_number_2                    "numeric(30,10)"
-  :ud_number_3                    "numeric(30,10)"
-  :ud_number_4                    "numeric(30,10)"
-  :ud_number_5                    "numeric(30,10)"
-  :ud_number_6                    "numeric(30,10)"
-  :ud_number_7                    "numeric(30,10)"
-  :ud_number_8                    "numeric(30,10)"
-  :ud_number_9                    "numeric(30,10)"
-  :ud_number_10                   "numeric(30,10)"
-  :ud_number_11                   "numeric(30,10)"
-  :ud_number_12                   "numeric(30,10)"
-  :cumulative_dose_unit_id        "numeric(38)"
-  :obtain_drug_country_id         "numeric(38)"
-  :drug_auth_country_id           "numeric(38)"
-  :duration_seconds               "numeric(38)"
-  :latency_seconds                "numeric(38)"
-  :delay_seconds                  "numeric(38)"
-  :ud_text_1_j                    "varchar(999)"
-  :ud_text_2_j                    "varchar(999)"
-  :ud_text_3_j                    "varchar(999)"
-  :ud_text_4_j                    "varchar(999)"
-  :ud_text_5_j                    "varchar(999)"
-  :ud_text_6_j                    "varchar(999)"
-  :ud_text_7_j                    "varchar(999)"
-  :ud_text_8_j                    "varchar(999)"
-  :ud_text_9_j                    "varchar(999)"
-  :ud_text_10_j                   "varchar(999)"
-  :ud_text_11_j                   "varchar(999)"
-  :ud_text_12_j                   "varchar(999)"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-}
-
-:rm_case_product
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :seq_num                        "numeric(38)"
-  :product_id                     "numeric(38)"
-  :drug_type                      "numeric(38)"
-  :pat_exposure                   "numeric(38)"
-  :manufacturer_id                "numeric(38)"
-  :protocol_followed              "numeric(38)"
-  :first_sus_prod                 "numeric(38)"
-  :selected_view                  "numeric(38)"
-  :sort_id                        "numeric(38)"
-  :views_available                "numeric(38)"
-  :country_id                     "numeric(38)"
-  :qc_safety_date                 "date"
-  :qc_sent_date                   "date"
-  :qc_result_date                 "date"
-  :qc_cross_reference             "varchar(99)"
-  :who_drug_code                  "varchar(99)"
-  :co_drug_code                   "varchar(99)"
-  :product_name                   "varchar(99)"
-  :generic_name                   "varchar(3900)"
-  :generic_name_j                 "varchar(3900)"
-  :ud_text_1                      "varchar(999)"
-  :ud_text_2                      "varchar(999)"
-  :ud_text_3                      "varchar(999)"
-  :ud_text_4                      "varchar(999)"
-  :ud_text_5                      "varchar(999)"
-  :ud_text_6                      "varchar(999)"
-  :ud_text_7                      "varchar(999)"
-  :ud_text_8                      "varchar(999)"
-  :ud_text_9                      "varchar(999)"
-  :ud_text_10                     "varchar(999)"
-  :ud_text_11                     "varchar(999)"
-  :ud_text_12                     "varchar(999)"
-  :ud_date_1                      "date"
-  :ud_date_2                      "date"
-  :ud_date_3                      "date"
-  :ud_date_4                      "date"
-  :ud_date_5                      "date"
-  :ud_date_6                      "date"
-  :ud_date_7                      "date"
-  :ud_date_8                      "date"
-  :ud_date_9                      "date"
-  :ud_date_10                     "date"
-  :ud_date_11                     "date"
-  :ud_date_12                     "date"
-  :ud_number_1                    "numeric(30,10)"
-  :ud_number_2                    "numeric(30,10)"
-  :ud_number_3                    "numeric(30,10)"
-  :ud_number_4                    "numeric(30,10)"
-  :ud_number_5                    "numeric(30,10)"
-  :ud_number_6                    "numeric(30,10)"
-  :ud_number_7                    "numeric(30,10)"
-  :ud_number_8                    "numeric(30,10)"
-  :ud_number_9                    "numeric(30,10)"
-  :ud_number_10                   "numeric(30,10)"
-  :ud_number_11                   "numeric(30,10)"
-  :ud_number_12                   "numeric(30,10)"
-  :include_frequency              "numeric(38)"
-  :sdrug_not_admin                "numeric(38)"
-  :prod_reptd                     "varchar(999)"
-  :prod_coded                     "varchar(999)"
-  :prod_syn_id                    "numeric(38)"
-  :prod_code_status               "numeric(3,0)"
-  :deleted                        "date"
-  :study_product_num              "numeric(2,0)"
-  :qc_quantity                    "varchar(99)"
-  :qc_return_date                 "date"
-  :qc_complaint_cat_date          "date"
-  :qc_analysis_cat_date           "date"
-  :qc_analysis_summary_date       "date"
-  :primary_event                  "numeric(38)"
-  :medicinal_prod_id              "varchar(99)"
-  :family_id                      "numeric(38)"
-  :existing_rpt_seq_mod_flg       "numeric(38)"
-  :drug_code_j                    "varchar(99)"
-  :drug_code_type_j               "numeric(38)"
-  :product_name_j                 "varchar(99)"
-  :prod_coded_j                   "varchar(999)"
-  :prod_reptd_j                   "varchar(999)"
-  :qc_cross_reference_j           "varchar(99)"
-  :ud_text_1_j                    "varchar(999)"
-  :ud_text_2_j                    "varchar(999)"
-  :ud_text_3_j                    "varchar(999)"
-  :ud_text_4_j                    "varchar(999)"
-  :ud_text_5_j                    "varchar(999)"
-  :ud_text_6_j                    "varchar(999)"
-  :ud_text_7_j                    "varchar(999)"
-  :ud_text_8_j                    "varchar(999)"
-  :ud_text_9_j                    "varchar(999)"
-  :ud_text_10_j                   "varchar(999)"
-  :ud_text_11_j                   "varchar(999)"
-  :ud_text_12_j                   "varchar(999)"
-  :dlp_revision_number            "numeric(38)"
-  :last_update_time               "date"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-  :notes                          "varchar(3900)"
-  :notes_j                        "varchar(3900)"
-  :qc_analysis_cat_text           "varchar(3900)"
-  :qc_analysis_cat_text_j         "varchar(3900)"
-  :qc_anal_summary_text           "varchar(3900)"
-  :qc_anal_summary_text_j         "varchar(3900)"
-  :qc_result                      "varchar(3900)"
-  :qc_result_j                    "varchar(3900)"
-  :qc_comment                     "varchar(3900)"
-  :qc_comment_j                   "varchar(3900)"
-  :qc_complaint_cat_text          "varchar(3900)"
-  :qc_complaint_cat_text_j        "varchar(3900)"
-  :vaers_block_id                 "numeric(38)"
-  :prod_lic_id                    "numeric(38)"
-}
-
-:rm_case_reporters
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :seq_num                        "numeric(38)"
-  :media_id                       "numeric(38)"
-  :occupation_id                  "numeric(38)"
-  :hcp_flag                       "numeric(38)"
-  :primary_contact                "numeric(38)"
-  :corr_contact                   "numeric(38)"
-  :reporter_type                  "numeric(38)"
-  :intermediary_id                "numeric(38)"
-  :rpt_sent                       "numeric(38)"
-  :sort_id                        "numeric(38)"
-  :confidential                   "numeric(1,0)"
-  :country_id                     "numeric(38)"
-  :suffix                         "varchar(99)"
-  :middle_name                    "varchar(99)"
-  :prefix                         "varchar(99)"
-  :first_name                     "varchar(99)"
-  :last_name                      "varchar(99)"
-  :reporter_id                    "varchar(99)"
-  :institution                    "varchar(99)"
-  :department                     "varchar(99)"
-  :city                           "varchar(99)"
-  :state                          "varchar(99)"
-  :postcode                       "varchar(99)"
-  :country                        "varchar(99)"
-  :phone                          "varchar(99)"
-  :altphone                       "varchar(99)"
-  :fax                            "varchar(99)"
-  :reporter_ref                   "varchar(99)"
-  :email                          "varchar(999)"
-  :address                        "varchar(999)"
-  :suffix_j                       "varchar(99)"
-  :address_j                      "varchar(999)"
-  :city_j                         "varchar(99)"
-  :department_j                   "varchar(99)"
-  :first_name_j                   "varchar(99)"
-  :institution_j                  "varchar(99)"
-  :last_name_j                    "varchar(99)"
-  :middle_name_j                  "varchar(99)"
-  :prefix_j                       "varchar(99)"
-  :state_j                        "varchar(99)"
-  :deleted                        "date"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-  :notes                          "varchar(3900)"
-  :notes_j                        "varchar(3900)"
-  :institution_id                 "varchar(99)"
-}
-
-:rm_case_study
-{
-  :enterprise_id                  "numeric(38)"
-  :case_id                        "numeric(38)"
-  :study_key                      "numeric(38)"
-  :study_num                      "varchar(99)"
-  :study_type                     "numeric(38)"
-  :center_id                      "numeric(38)"
-  :center_name                    "varchar(99)"
-  :protocol_id                    "numeric(38)"
-  :protocol_num                   "varchar(99)"
-  :other_id                       "varchar(99)"
-  :code_broken                    "numeric(38)"
-  :broken_by                      "numeric(38)"
-  :broken_date                    "date"
-  :reason                         "varchar(999)"
-  :week                           "varchar(9)"
-  :visit                          "varchar(9)"
-  :deleted                        "date"
-  :product_count                  "numeric(2,0)"
-  :classification_id              "numeric(38)"
-  :blind_name                     "varchar(99)"
-  :study_desc                     "varchar(3900)"
-  :study_desc_j                   "varchar(3900)"
-  :blind_name_j                   "varchar(99)"
-  :center_name_j                  "varchar(99)"
-  :clin_compound_num_j            "varchar(99)"
-  :protocol_num_j                 "varchar(99)"
-  :study_num_j                    "varchar(99)"
-  :dev_phase_id                   "numeric(38)"
-  :dlp_revision_number            "numeric(38)"
-  :revision_delete_flag           "numeric(38)"
-  :deleted_flag                   "numeric(1,0)"
-  :effective_start_date           "date"
-  :effective_end_date             "date"
-  :cohort_id                      "numeric(38)"
-}
-
-:rm_lm_case_classification
-{
-  :enterprise_id                  "numeric(38)"
-  :classification_id              "numeric(38)"
-  :description                    "varchar(99)"
-  :protected                      "numeric(38)"
-  :display                        "numeric(38)"
-  :description_j                  "varchar(99)"
-  :deleted                        "date"
-  :e2b_code                       "numeric(38)"
-}
-
-:rm_lm_causality
-{
-  :enterprise_id                  "numeric(38)"
-  :causality_id                   "numeric(38)"
-  :causality                      "varchar(99)"
-  :reportability                  "numeric(38)"
-  :protected                      "numeric(38)"
-  :display                        "numeric(38)"
-  :causality_j                    "varchar(99)"
-  :deleted                        "date"
-}
-
-:rm_lm_countries
-{
-  :enterprise_id                  "numeric(38)"
-  :country_id                     "numeric(38)"
-  :country                        "varchar(99)"
-  :a2                             "varchar(9)"
-  :a3                             "varchar(9)"
-  :num                            "numeric(38)"
-  :protected                      "numeric(38)"
-  :deleted                        "date"
-  :country_group_id               "numeric(38)"
-  :country_group                  "varchar(99)"
-  :country_j                      "varchar(99)"
-  :group_2_country                "numeric(38)"
-}
-
-:rm_lm_product
-{
-  :enterprise_id                  "numeric(38)"
-  :product_id                     "numeric(38)"
-  :prod_name                      "varchar(99)"
-  :family_id                      "numeric(38)"
-  :formulation_id                 "numeric(38)"
-  :manufacturer_id                "numeric(38)"
-  :concentration                  "varchar(99)"
-  :conc_unit_id                   "numeric(38)"
-  :indication_id                  "varchar(99)"
-  :code_dict                      "numeric(38)"
-  :indication_text                "varchar(999)"
-  :intl_birth_date                "date"
-  :model_no                       "varchar(99)"
-  :drl_id                         "varchar(99)"
-  :drug_code                      "varchar(99)"
-  :deleted                        "date"
-  :prod_generic_name              "varchar(3900)"
-  :prod_generic_name_j            "varchar(3900)"
-  :ind_llt_code                   "varchar(99)"
-  :ind_llt                        "varchar(999)"
-  :ind_hlt_code                   "varchar(99)"
-  :ind_hlt                        "varchar(999)"
-  :ind_hlgt_code                  "varchar(99)"
-  :ind_hlgt                       "varchar(999)"
-  :ind_soc_code                   "varchar(99)"
-  :ind_soc                        "varchar(999)"
-  :ind_syn_code                   "numeric(38)"
-  :ind_code_status                "numeric(38)"
-  :medicinal_prod_id              "varchar(99)"
-  :prod_name_abbrv                "varchar(9)"
-  :device_code                    "varchar(99)"
-  :psur_group_name                "varchar(99)"
-  :comments                       "varchar(3900)"
-  :ind_coded                      "varchar(999)"
-  :ind_reptd                      "varchar(999)"
-  :drl_id_j                       "varchar(99)"
-  :drug_code_j                    "varchar(99)"
-  :drug_code_type_j               "numeric(38)"
-  :indication_text_j              "varchar(999)"
-  :ind_code_status_j              "numeric(38)"
-  :ind_hlgt_j                     "varchar(999)"
-  :ind_hlt_j                      "varchar(999)"
-  :ind_llt_code_j                 "varchar(99)"
-  :ind_llt_j                      "varchar(999)"
-  :ind_soc_j                      "varchar(999)"
-  :prod_name_j                    "varchar(99)"
-  :ind_syn_code_j                 "numeric(38)"
-  :ind_coded_j                    "varchar(999)"
-  :ind_reptd_j                    "varchar(999)"
-  :dev_intl_birth_date            "date"
-  :comments_j                     "varchar(3900)"
-}
-
-:rm_lm_product_family
-{
-  :enterprise_id                  "numeric(38)"
-  :family_id                      "numeric(38)"
-  :name                           "varchar(99)"
-  :primary_view                   "numeric(38)"
-  :deleted                        "date"
-  :product_group_id               "numeric(38)"
-  :comments                       "varchar(3900)"
-  :search_equation_number         "varchar(99)"
-  :name_j                         "varchar(99)"
-  :comments_j                     "varchar(3900)"
-}
-
-:rm_lm_report_type
-{
-  :enterprise_id                  "numeric(38)"
-  :rpt_type_id                    "numeric(38)"
-  :report_type                    "varchar(99)"
-  :protected                      "numeric(38)"
-  :display                        "numeric(38)"
-  :incl_lit                       "numeric(38)"
-  :incl_trial                     "numeric(38)"
-  :e2b_code                       "numeric(38)"
-  :abrv                           "varchar(9)"
-  :investigational                "numeric(38)"
-  :report_type_j                  "varchar(99)"
-  :deleted                        "date"
-  :incl_research                  "numeric(38)"
-}
-
-:rm_meddra_smq_content
-{
-  :global_dict_id                 "numeric(38)"
-  :smq_code                       "numeric(38)"
-  :term_code                      "numeric(38)"
-  :term_level                     "numeric(38)"
-  :term_scope                     "numeric(38)"
-  :term_category                  "varchar(9)"
-  :term_weight                    "numeric(38)"
-  :term_status                    "varchar(9)"
-  :term_addition_version          "varchar(9)"
-  :term_last_modified_version     "varchar(9)"
-}
-
-:rm_meddra_smq_list
-{
-  :global_dict_id                 "numeric(38)"
-  :smq_code                       "numeric(38)"
-  :smq_name                       "varchar(999)"
-  :smq_level                      "numeric(38)"
-  :smq_description                "varchar(3900)"
-  :smq_source                     "varchar(3900)"
-  :smq_note                       "varchar(3900)"
-  :meddra_version                 "varchar(9)"
-  :status                         "varchar(9)"
-  :smq_algorithm                  "varchar(999)"
-}
+(def table-ddl
+  "A map from table-name (as keyword) to ddl (as map)"
+  {
+    :rm_case_assess   ; table-name keyword
+    ; table-ddl map
+    {
+  ;   column-name                     column-type
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :template_id                    "numeric(38)"
+      :listedness                     "numeric(38)"
+      :updated                        "date"
+      :outcome                        "numeric(38)"
+      :comment_id                     "numeric(38)"
+      :comp_comment_id                "numeric(38)"
+      :seriousness                    "numeric(38)"
+      :serious_notes                  "varchar(3900)"
+      :agent_suspect                  "numeric(38)"
+      :agent_notes                    "varchar(3900)"
+      :listedness_notes               "varchar(3900)"
+      :bfarm_causality                "numeric(10,0)"
+      :bfarm_manual_text              "varchar(3900)"
+      :company_diagnosis              "varchar(999)"
+      :company_diagnosis_notes        "varchar(3900)"
+      :diagnosis_dict_id              "numeric(38)"
+      :diagnosis_pref_code            "varchar(99)"
+      :diagnosis_inc_code             "varchar(99)"
+      :diagnosis_inc_term             "varchar(999)"
+      :diagnosis_hlgt_code            "varchar(99)"
+      :diagnosis_hlgt                 "varchar(999)"
+      :diagnosis_hlt_code             "varchar(99)"
+      :diagnosis_hlt                  "varchar(999)"
+      :diagnosis_soc_code             "varchar(99)"
+      :diagnosis_body_sys             "varchar(999)"
+      :ud_text_1                      "varchar(999)"
+      :ud_text_2                      "varchar(999)"
+      :ud_text_3                      "varchar(999)"
+      :ud_text_4                      "varchar(999)"
+      :ud_text_5                      "varchar(999)"
+      :ud_text_6                      "varchar(999)"
+      :ud_text_7                      "varchar(999)"
+      :ud_text_8                      "varchar(999)"
+      :ud_text_9                      "varchar(999)"
+      :ud_text_10                     "varchar(999)"
+      :ud_text_11                     "varchar(999)"
+      :ud_text_12                     "varchar(999)"
+      :ud_date_1                      "date"
+      :ud_date_2                      "date"
+      :ud_date_3                      "date"
+      :ud_date_4                      "date"
+      :ud_date_5                      "date"
+      :ud_date_6                      "date"
+      :ud_date_7                      "date"
+      :ud_date_8                      "date"
+      :ud_date_9                      "date"
+      :ud_date_10                     "date"
+      :ud_date_11                     "date"
+      :ud_date_12                     "date"
+      :ud_number_1                    "numeric(30,10)"
+      :ud_number_2                    "numeric(30,10)"
+      :ud_number_3                    "numeric(30,10)"
+      :ud_number_4                    "numeric(30,10)"
+      :ud_number_5                    "numeric(30,10)"
+      :ud_number_6                    "numeric(30,10)"
+      :ud_number_7                    "numeric(30,10)"
+      :ud_number_8                    "numeric(30,10)"
+      :ud_number_9                    "numeric(30,10)"
+      :ud_number_10                   "numeric(30,10)"
+      :ud_number_11                   "numeric(30,10)"
+      :ud_number_12                   "numeric(30,10)"
+      :evaluation                     "varchar(3900)"
+      :evaluation_j                   "varchar(3900)"
+      :co_suspect_count               "numeric(3,0)"
+      :event_synopsis                 "varchar(9)"
+      :event_primary                  "varchar(999)"
+      :diagnosis_reptd                "varchar(999)"
+      :diagnosis_coded                "varchar(999)"
+      :diagnosis_syn_code             "numeric(38)"
+      :diagnosis_code_status          "numeric(3,0)"
+      :event_primary_j                "varchar(999)"
+      :agent_notes_j                  "varchar(3900)"
+      :company_diagnosis_j            "varchar(999)"
+      :company_diagnosis_notes_j      "varchar(3900)"
+      :diagnosis_body_sys_j           "varchar(999)"
+      :diagnosis_coded_j              "varchar(999)"
+      :diagnosis_code_status_j        "numeric(38)"
+      :diagnosis_hlgt_j               "varchar(999)"
+      :diagnosis_hlt_j                "varchar(999)"
+      :diagnosis_inc_code_j           "varchar(99)"
+      :diagnosis_inc_term_j           "varchar(999)"
+      :diagnosis_reptd_j              "varchar(999)"
+      :listedness_notes_j             "varchar(3900)"
+      :serious_notes_j                "varchar(3900)"
+      :ud_text_1_j                    "varchar(999)"
+      :ud_text_2_j                    "varchar(999)"
+      :ud_text_3_j                    "varchar(999)"
+      :ud_text_4_j                    "varchar(999)"
+      :ud_text_5_j                    "varchar(999)"
+      :ud_text_6_j                    "varchar(999)"
+      :ud_text_7_j                    "varchar(999)"
+      :ud_text_8_j                    "varchar(999)"
+      :ud_text_9_j                    "varchar(999)"
+      :ud_text_10_j                   "varchar(999)"
+      :ud_text_11_j                   "varchar(999)"
+      :ud_text_12_j                   "varchar(999)"
+      :diagnosis_syn_code_j           "numeric(38)"
+      :deleted                        "date"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+    }
+
+    :rm_case_classifications
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :seq_num                        "numeric(38)"
+      :classification_id              "numeric(38)"
+      :deleted                        "date"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+    }
+
+    :rm_case_event
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :seq_num                        "numeric(38)"
+      :desc_reptd                     "varchar(999)"
+      :desc_coded                     "varchar(999)"
+      :diagnosis                      "numeric(38)"
+      :onset                          "date"
+      :onset_res                      "numeric(38)"
+      :onset_delay                    "varchar(99)"
+      :stop_date                      "date"
+      :stop_date_res                  "numeric(38)"
+      :duration                       "varchar(99)"
+      :onset_latency                  "varchar(99)"
+      :evt_intensity_id               "numeric(38)"
+      :evt_freq_id                    "numeric(38)"
+      :treated                        "numeric(38)"
+      :study_related                  "numeric(38)"
+      :rechall_related                "numeric(38)"
+      :prod_seq_num                   "numeric(38)"
+      :evt_outcome_id                 "numeric(38)"
+      :receipt_date                   "date"
+      :rpt_serious                    "numeric(38)"
+      :sc_death                       "numeric(38)"
+      :sc_hosp                        "numeric(38)"
+      :sc_cong_anom                   "numeric(38)"
+      :sc_threat                      "numeric(38)"
+      :sc_disable                     "numeric(38)"
+      :sc_int_req                     "numeric(38)"
+      :sc_other                       "numeric(38)"
+      :sc_other_text                  "varchar(99)"
+      :art_code                       "varchar(99)"
+      :pref_term                      "varchar(999)"
+      :inc_term                       "varchar(999)"
+      :body_sys                       "varchar(999)"
+      :med_serious                    "numeric(38)"
+      :past_hist                      "numeric(38)"
+      :dict_id                        "numeric(38)"
+      :dict_key                       "varchar(99)"
+      :code_status                    "numeric(38)"
+      :seriousness                    "numeric(38)"
+      :sort_id                        "numeric(38)"
+      :onset_date_partial             "varchar(99)"
+      :stop_date_partial              "varchar(99)"
+      :efficacy                       "numeric(38)"
+      :disease                        "numeric(38)"
+      :withdrawal                     "numeric(38)"
+      :hlgt                           "varchar(999)"
+      :hlt                            "varchar(999)"
+      :hlt_code                       "varchar(99)"
+      :hlgt_code                      "varchar(99)"
+      :soc_code                       "varchar(99)"
+      :study_dropped                  "numeric(4,0)"
+      :inc_code                       "varchar(99)"
+      :onset_minutes                  "numeric(38)"
+      :delay_minutes                  "numeric(38)"
+      :ud_text_1                      "varchar(999)"
+      :ud_text_2                      "varchar(999)"
+      :ud_text_3                      "varchar(999)"
+      :ud_text_4                      "varchar(999)"
+      :ud_text_5                      "varchar(999)"
+      :ud_text_6                      "varchar(999)"
+      :ud_text_7                      "varchar(999)"
+      :ud_text_8                      "varchar(999)"
+      :ud_text_9                      "varchar(999)"
+      :ud_text_10                     "varchar(999)"
+      :ud_text_11                     "varchar(999)"
+      :ud_text_12                     "varchar(999)"
+      :ud_date_1                      "date"
+      :ud_date_2                      "date"
+      :ud_date_3                      "date"
+      :ud_date_4                      "date"
+      :ud_date_5                      "date"
+      :ud_date_6                      "date"
+      :ud_date_7                      "date"
+      :ud_date_8                      "date"
+      :ud_date_9                      "date"
+      :ud_date_10                     "date"
+      :ud_date_11                     "date"
+      :ud_date_12                     "date"
+      :ud_number_1                    "numeric(30,10)"
+      :ud_number_2                    "numeric(30,10)"
+      :ud_number_3                    "numeric(30,10)"
+      :ud_number_4                    "numeric(30,10)"
+      :ud_number_5                    "numeric(30,10)"
+      :ud_number_6                    "numeric(30,10)"
+      :ud_number_7                    "numeric(30,10)"
+      :ud_number_8                    "numeric(30,10)"
+      :ud_number_9                    "numeric(30,10)"
+      :ud_number_10                   "numeric(30,10)"
+      :ud_number_11                   "numeric(30,10)"
+      :ud_number_12                   "numeric(30,10)"
+      :details                        "varchar(3900)"
+      :details_j                      "varchar(3900)"
+      :syn_code                       "numeric(38)"
+      :deleted                        "date"
+      :study_related_reptd            "numeric(1,0)"
+      :duration_unit_e2b              "numeric(38)"
+      :onset_latency_unit_e2b         "numeric(38)"
+      :onset_delay_unit_e2b           "numeric(38)"
+      :duration_seconds               "numeric(38)"
+      :onset_latency_seconds          "numeric(38)"
+      :onset_delay_seconds            "numeric(38)"
+      :body_sys_j                     "varchar(999)"
+      :code_status_j                  "numeric(38)"
+      :desc_coded_j                   "varchar(999)"
+      :desc_reptd_j                   "varchar(999)"
+      :hlgt_j                         "varchar(999)"
+      :hlt_j                          "varchar(999)"
+      :inc_code_j                     "varchar(99)"
+      :inc_term_j                     "varchar(999)"
+      :pref_term_j                    "varchar(999)"
+      :sc_other_text_j                "varchar(99)"
+      :report_exclusion               "numeric(38)"
+      :reportable                     "numeric(38)"
+      :ud_text_1_j                    "varchar(999)"
+      :ud_text_2_j                    "varchar(999)"
+      :ud_text_3_j                    "varchar(999)"
+      :ud_text_4_j                    "varchar(999)"
+      :ud_text_5_j                    "varchar(999)"
+      :ud_text_6_j                    "varchar(999)"
+      :ud_text_7_j                    "varchar(999)"
+      :ud_text_8_j                    "varchar(999)"
+      :ud_text_9_j                    "varchar(999)"
+      :ud_text_10_j                   "varchar(999)"
+      :ud_text_11_j                   "varchar(999)"
+      :ud_text_12_j                   "varchar(999)"
+      :syn_code_j                     "numeric(38)"
+      :infection                      "numeric(38)"
+      :rpt_exclude_cmt                "varchar(3900)"
+      :rpt_exclude_cmt_j              "varchar(3900)"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+    }
+
+    :rm_case_event_assess
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :event_seq_num                  "numeric(38)"
+      :prod_seq_num                   "numeric(38)"
+      :datasheet_id                   "numeric(38)"
+      :license_id                     "numeric(38)"
+      :seq_num                        "numeric(38)"
+      :updated                        "date"
+      :det_listedness_id              "numeric(38)"
+      :rpt_causality_id               "numeric(38)"
+      :det_causality_id               "numeric(38)"
+      :listed_justify                 "varchar(3900)"
+      :cause_justify                  "varchar(3900)"
+      :lam_assessed                   "numeric(12,0)"
+      :deleted                        "date"
+      :causality_assessment           "varchar(99)"
+      :causality_score                "numeric(38)"
+      :source_id                      "numeric(38)"
+      :prt_causality_id               "numeric(38)"
+      :cause_justify_j                "varchar(3900)"
+      :listed_justify_j               "varchar(3900)"
+      :dlp_revision_number            "numeric(38)"
+      :last_update_time               "date"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+    }
+
+    :rm_case_followup
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :seq_num                        "numeric(38)"
+      :receipt_date                   "date"
+      :safety_date                    "date"
+      :significant                    "numeric(1,0)"
+      :auditlog_type                  "numeric(38)"
+      :time_stamp                     "date"
+      :deleted                        "date"
+      :significant_device             "numeric(1,0)"
+      :data_cleanup                   "numeric(1,0)"
+      :justification                  "varchar(3900)"
+      :justification_id               "numeric(38)"
+      :justification_j                "varchar(3900)"
+      :just_receipt_date_j            "varchar(3900)"
+      :receipt_date_j                 "date"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+    }
+
+    :rm_case_master
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :case_num                       "varchar(99)"
+      :rev                            "numeric(38)"
+      :workflow_seq_num               "numeric(38)"
+      :last_workflow_seq_num          "numeric(38)"
+      :create_time                    "date"
+      :init_rept_date                 "date"
+      :user_id                        "numeric(38)"
+      :last_update_time               "date"
+      :last_update_user_id            "numeric(38)"
+      :requires_followup              "numeric(38)"
+      :followup_date                  "date"
+      :owner_id                       "numeric(38)"
+      :state_id                       "numeric(38)"
+      :country_id                     "numeric(38)"
+      :lang_id                        "numeric(38)"
+      :priority                       "numeric(38)"
+      :site_id                        "numeric(38)"
+      :seriousness                    "numeric(38)"
+      :rpt_type_id                    "numeric(38)"
+      :last_state_id                  "numeric(38)"
+      :assessment_needed              "numeric(38)"
+      :priority_override              "numeric(1,0)"
+      :sid                            "varchar(999)"
+      :safety_date                    "date"
+      :normal_time                    "date"
+      :max_time                       "date"
+      :report_scheduling              "numeric(38)"
+      :priority_assessment            "numeric(38)"
+      :close_user_id                  "numeric(38)"
+      :close_date                     "date"
+      :close_notes                    "varchar(999)"
+      :date_locked                    "date"
+      :ud_text_1                      "varchar(999)"
+      :ud_text_2                      "varchar(999)"
+      :ud_text_3                      "varchar(999)"
+      :ud_text_4                      "varchar(999)"
+      :ud_text_5                      "varchar(999)"
+      :ud_text_6                      "varchar(999)"
+      :ud_text_7                      "varchar(999)"
+      :ud_text_8                      "varchar(999)"
+      :ud_text_9                      "varchar(999)"
+      :ud_text_10                     "varchar(999)"
+      :ud_text_11                     "varchar(999)"
+      :ud_text_12                     "varchar(999)"
+      :ud_date_1                      "date"
+      :ud_date_2                      "date"
+      :ud_date_3                      "date"
+      :ud_date_4                      "date"
+      :ud_date_5                      "date"
+      :ud_date_6                      "date"
+      :ud_date_7                      "date"
+      :ud_date_8                      "date"
+      :ud_date_9                      "date"
+      :ud_date_10                     "date"
+      :ud_date_11                     "date"
+      :ud_date_12                     "date"
+      :ud_number_1                    "numeric(30,10)"
+      :ud_number_2                    "numeric(30,10)"
+      :ud_number_3                    "numeric(30,10)"
+      :ud_number_4                    "numeric(30,10)"
+      :ud_number_5                    "numeric(30,10)"
+      :ud_number_6                    "numeric(30,10)"
+      :ud_number_7                    "numeric(30,10)"
+      :ud_number_8                    "numeric(30,10)"
+      :ud_number_9                    "numeric(30,10)"
+      :ud_number_10                   "numeric(30,10)"
+      :ud_number_11                   "numeric(30,10)"
+      :ud_number_12                   "numeric(30,10)"
+      :deleted                        "date"
+      :due_soon                       "date"
+      :global_num                     "varchar(99)"
+      :priority_date_assessed         "date"
+      :lam_assess_done                "numeric(1,0)"
+      :e2b_ww_number                  "varchar(999)"
+      :worklist_owner_id              "numeric(38)"
+      :susar                          "numeric(38)"
+      :last_update_event              "date"
+      :initial_justification          "varchar(3900)"
+      :force_soon                     "date"
+      :due_soon_j                     "date"
+      :followup_date_j                "date"
+      :init_rept_date_j               "date"
+      :just_init_rept_date_j          "varchar(3900)"
+      :ud_text_1_j                    "varchar(999)"
+      :ud_text_2_j                    "varchar(999)"
+      :ud_text_3_j                    "varchar(999)"
+      :ud_text_4_j                    "varchar(999)"
+      :ud_text_5_j                    "varchar(999)"
+      :ud_text_6_j                    "varchar(999)"
+      :ud_text_7_j                    "varchar(999)"
+      :ud_text_8_j                    "varchar(999)"
+      :ud_text_9_j                    "varchar(999)"
+      :ud_text_10_j                   "varchar(999)"
+      :ud_text_11_j                   "varchar(999)"
+      :ud_text_12_j                   "varchar(999)"
+      :initial_justification_j        "varchar(3900)"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+    }
+
+    :rm_case_narrative
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :abbrev_narrative               "varchar(3900)"
+      :abbrev_narrative_j             "varchar(3900)"
+      :narrative                      "varchar(3900)"
+      :narrative_j                    "varchar(3900)"
+      :deleted                        "date"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+    }
+
+    :rm_case_pat_info
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :pat_id                         "varchar(99)"
+      :pat_subj_num                   "varchar(99)"
+      :pat_initials                   "varchar(99)"
+      :pat_firstname                  "varchar(99)"
+      :pat_mi                         "varchar(99)"
+      :pat_lastname                   "varchar(99)"
+      :pat_address                    "varchar(999)"
+      :pat_city                       "varchar(99)"
+      :pat_state                      "varchar(99)"
+      :pat_postal_code                "varchar(99)"
+      :pat_country                    "varchar(99)"
+      :pat_phone                      "varchar(99)"
+      :pat_dob                        "date"
+      :pat_dob_res                    "numeric(38)"
+      :pat_age                        "numeric(22,7)"
+      :age_unit_id                    "numeric(38)"
+      :age_group_id                   "numeric(38)"
+      :gender_id                      "numeric(38)"
+      :pat_weight_lbs                 "numeric(22,7)"
+      :pat_weight_kg                  "numeric(22,7)"
+      :pat_height_in                  "numeric(22,7)"
+      :pat_height_cm                  "numeric(22,7)"
+      :ethnicity_id                   "numeric(38)"
+      :occupation_id                  "numeric(38)"
+      :pat_stat_preg                  "numeric(38)"
+      :rel_test_id                    "numeric(38)"
+      :pat_dob_partial                "varchar(99)"
+      :rand_num                       "varchar(99)"
+      :confidential                   "numeric(1,0)"
+      :number_of_patients             "varchar(9)"
+      :ud_text_1                      "varchar(999)"
+      :ud_text_2                      "varchar(999)"
+      :ud_text_3                      "varchar(999)"
+      :ud_text_4                      "varchar(999)"
+      :ud_text_5                      "varchar(999)"
+      :ud_text_6                      "varchar(999)"
+      :ud_text_7                      "varchar(999)"
+      :ud_text_8                      "varchar(999)"
+      :ud_text_9                      "varchar(999)"
+      :ud_text_10                     "varchar(999)"
+      :ud_text_11                     "varchar(999)"
+      :ud_text_12                     "varchar(999)"
+      :ud_date_1                      "date"
+      :ud_date_2                      "date"
+      :ud_date_3                      "date"
+      :ud_date_4                      "date"
+      :ud_date_5                      "date"
+      :ud_date_6                      "date"
+      :ud_date_7                      "date"
+      :ud_date_8                      "date"
+      :ud_date_9                      "date"
+      :ud_date_10                     "date"
+      :ud_date_11                     "date"
+      :ud_date_12                     "date"
+      :ud_number_1                    "numeric(30,10)"
+      :ud_number_2                    "numeric(30,10)"
+      :ud_number_3                    "numeric(30,10)"
+      :ud_number_4                    "numeric(30,10)"
+      :ud_number_5                    "numeric(30,10)"
+      :ud_number_6                    "numeric(30,10)"
+      :ud_number_7                    "numeric(30,10)"
+      :ud_number_8                    "numeric(30,10)"
+      :ud_number_9                    "numeric(30,10)"
+      :ud_number_10                   "numeric(30,10)"
+      :ud_number_11                   "numeric(30,10)"
+      :ud_number_12                   "numeric(30,10)"
+      :deleted                        "date"
+      :child_only                     "numeric(1,0)"
+      :pat_bmi                        "numeric(22,7)"
+      :pat_body_area                  "numeric(22,7)"
+      :pat_address_j                  "varchar(999)"
+      :pat_city_j                     "varchar(99)"
+      :pat_firstname_j                "varchar(99)"
+      :pat_lastname_j                 "varchar(99)"
+      :pat_mi_j                       "varchar(99)"
+      :pat_state_j                    "varchar(99)"
+      :ud_text_1_j                    "varchar(999)"
+      :ud_text_2_j                    "varchar(999)"
+      :ud_text_3_j                    "varchar(999)"
+      :ud_text_4_j                    "varchar(999)"
+      :ud_text_5_j                    "varchar(999)"
+      :ud_text_6_j                    "varchar(999)"
+      :ud_text_7_j                    "varchar(999)"
+      :ud_text_8_j                    "varchar(999)"
+      :ud_text_9_j                    "varchar(999)"
+      :ud_text_10_j                   "varchar(999)"
+      :ud_text_11_j                   "varchar(999)"
+      :ud_text_12_j                   "varchar(999)"
+      :pat_country_id                 "numeric(38)"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+      :notes                          "varchar(3900)"
+      :notes_j                        "varchar(3900)"
+      :age_unit_id_at_vacc            "numeric(38)"
+      :pat_age_at_vacc                "numeric(38)"
+    }
+
+    :rm_case_prod_drugs
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :seq_num                        "numeric(38)"
+      :formulation_id                 "numeric(38)"
+      :concentration                  "varchar(99)"
+      :conc_units_id                  "numeric(38)"
+      :act_taken_id                   "numeric(38)"
+      :severity_id                    "numeric(38)"
+      :interaction                    "numeric(38)"
+      :contraind                      "numeric(38)"
+      :first_dose                     "date"
+      :first_dose_res                 "numeric(38)"
+      :last_dose                      "date"
+      :last_dose_res                  "numeric(38)"
+      :total_dose                     "numeric(22,7)"
+      :tot_dose_unit_id               "numeric(38)"
+      :prev_use                       "numeric(38)"
+      :abuse                          "numeric(38)"
+      :overdose                       "numeric(38)"
+      :protocol                       "numeric(38)"
+      :dechallenge                    "numeric(38)"
+      :dechall_date                   "date"
+      :rechallenge                    "numeric(38)"
+      :rechall_start                  "date"
+      :rechall_stop                   "date"
+      :rechall_outcome                "numeric(38)"
+      :sort_id                        "numeric(38)"
+      :b_weight_grams                 "numeric(38)"
+      :n_siblings                     "numeric(38)"
+      :b_weight_ozs                   "numeric(38)"
+      :first_dose_partial             "varchar(99)"
+      :last_dose_partial              "varchar(99)"
+      :tampering                      "numeric(4,0)"
+      :cumulative_dose                "numeric(22,7)"
+      :cumulative_dose_unit           "varchar(99)"
+      :deleted                        "date"
+      :ud_text_1                      "varchar(999)"
+      :ud_text_2                      "varchar(999)"
+      :ud_text_3                      "varchar(999)"
+      :ud_text_4                      "varchar(999)"
+      :ud_text_5                      "varchar(999)"
+      :ud_text_6                      "varchar(999)"
+      :ud_text_7                      "varchar(999)"
+      :ud_text_8                      "varchar(999)"
+      :ud_text_9                      "varchar(999)"
+      :ud_text_10                     "varchar(999)"
+      :ud_text_11                     "varchar(999)"
+      :ud_text_12                     "varchar(999)"
+      :ud_date_1                      "date"
+      :ud_date_2                      "date"
+      :ud_date_3                      "date"
+      :ud_date_4                      "date"
+      :ud_date_5                      "date"
+      :ud_date_6                      "date"
+      :ud_date_7                      "date"
+      :ud_date_8                      "date"
+      :ud_date_9                      "date"
+      :ud_date_10                     "date"
+      :ud_date_11                     "date"
+      :ud_date_12                     "date"
+      :ud_number_1                    "numeric(30,10)"
+      :ud_number_2                    "numeric(30,10)"
+      :ud_number_3                    "numeric(30,10)"
+      :ud_number_4                    "numeric(30,10)"
+      :ud_number_5                    "numeric(30,10)"
+      :ud_number_6                    "numeric(30,10)"
+      :ud_number_7                    "numeric(30,10)"
+      :ud_number_8                    "numeric(30,10)"
+      :ud_number_9                    "numeric(30,10)"
+      :ud_number_10                   "numeric(30,10)"
+      :ud_number_11                   "numeric(30,10)"
+      :ud_number_12                   "numeric(30,10)"
+      :cumulative_dose_unit_id        "numeric(38)"
+      :obtain_drug_country_id         "numeric(38)"
+      :drug_auth_country_id           "numeric(38)"
+      :duration_seconds               "numeric(38)"
+      :latency_seconds                "numeric(38)"
+      :delay_seconds                  "numeric(38)"
+      :ud_text_1_j                    "varchar(999)"
+      :ud_text_2_j                    "varchar(999)"
+      :ud_text_3_j                    "varchar(999)"
+      :ud_text_4_j                    "varchar(999)"
+      :ud_text_5_j                    "varchar(999)"
+      :ud_text_6_j                    "varchar(999)"
+      :ud_text_7_j                    "varchar(999)"
+      :ud_text_8_j                    "varchar(999)"
+      :ud_text_9_j                    "varchar(999)"
+      :ud_text_10_j                   "varchar(999)"
+      :ud_text_11_j                   "varchar(999)"
+      :ud_text_12_j                   "varchar(999)"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+    }
+
+    :rm_case_product
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :seq_num                        "numeric(38)"
+      :product_id                     "numeric(38)"
+      :drug_type                      "numeric(38)"
+      :pat_exposure                   "numeric(38)"
+      :manufacturer_id                "numeric(38)"
+      :protocol_followed              "numeric(38)"
+      :first_sus_prod                 "numeric(38)"
+      :selected_view                  "numeric(38)"
+      :sort_id                        "numeric(38)"
+      :views_available                "numeric(38)"
+      :country_id                     "numeric(38)"
+      :qc_safety_date                 "date"
+      :qc_sent_date                   "date"
+      :qc_result_date                 "date"
+      :qc_cross_reference             "varchar(99)"
+      :who_drug_code                  "varchar(99)"
+      :co_drug_code                   "varchar(99)"
+      :product_name                   "varchar(99)"
+      :generic_name                   "varchar(3900)"
+      :generic_name_j                 "varchar(3900)"
+      :ud_text_1                      "varchar(999)"
+      :ud_text_2                      "varchar(999)"
+      :ud_text_3                      "varchar(999)"
+      :ud_text_4                      "varchar(999)"
+      :ud_text_5                      "varchar(999)"
+      :ud_text_6                      "varchar(999)"
+      :ud_text_7                      "varchar(999)"
+      :ud_text_8                      "varchar(999)"
+      :ud_text_9                      "varchar(999)"
+      :ud_text_10                     "varchar(999)"
+      :ud_text_11                     "varchar(999)"
+      :ud_text_12                     "varchar(999)"
+      :ud_date_1                      "date"
+      :ud_date_2                      "date"
+      :ud_date_3                      "date"
+      :ud_date_4                      "date"
+      :ud_date_5                      "date"
+      :ud_date_6                      "date"
+      :ud_date_7                      "date"
+      :ud_date_8                      "date"
+      :ud_date_9                      "date"
+      :ud_date_10                     "date"
+      :ud_date_11                     "date"
+      :ud_date_12                     "date"
+      :ud_number_1                    "numeric(30,10)"
+      :ud_number_2                    "numeric(30,10)"
+      :ud_number_3                    "numeric(30,10)"
+      :ud_number_4                    "numeric(30,10)"
+      :ud_number_5                    "numeric(30,10)"
+      :ud_number_6                    "numeric(30,10)"
+      :ud_number_7                    "numeric(30,10)"
+      :ud_number_8                    "numeric(30,10)"
+      :ud_number_9                    "numeric(30,10)"
+      :ud_number_10                   "numeric(30,10)"
+      :ud_number_11                   "numeric(30,10)"
+      :ud_number_12                   "numeric(30,10)"
+      :include_frequency              "numeric(38)"
+      :sdrug_not_admin                "numeric(38)"
+      :prod_reptd                     "varchar(999)"
+      :prod_coded                     "varchar(999)"
+      :prod_syn_id                    "numeric(38)"
+      :prod_code_status               "numeric(3,0)"
+      :deleted                        "date"
+      :study_product_num              "numeric(2,0)"
+      :qc_quantity                    "varchar(99)"
+      :qc_return_date                 "date"
+      :qc_complaint_cat_date          "date"
+      :qc_analysis_cat_date           "date"
+      :qc_analysis_summary_date       "date"
+      :primary_event                  "numeric(38)"
+      :medicinal_prod_id              "varchar(99)"
+      :family_id                      "numeric(38)"
+      :existing_rpt_seq_mod_flg       "numeric(38)"
+      :drug_code_j                    "varchar(99)"
+      :drug_code_type_j               "numeric(38)"
+      :product_name_j                 "varchar(99)"
+      :prod_coded_j                   "varchar(999)"
+      :prod_reptd_j                   "varchar(999)"
+      :qc_cross_reference_j           "varchar(99)"
+      :ud_text_1_j                    "varchar(999)"
+      :ud_text_2_j                    "varchar(999)"
+      :ud_text_3_j                    "varchar(999)"
+      :ud_text_4_j                    "varchar(999)"
+      :ud_text_5_j                    "varchar(999)"
+      :ud_text_6_j                    "varchar(999)"
+      :ud_text_7_j                    "varchar(999)"
+      :ud_text_8_j                    "varchar(999)"
+      :ud_text_9_j                    "varchar(999)"
+      :ud_text_10_j                   "varchar(999)"
+      :ud_text_11_j                   "varchar(999)"
+      :ud_text_12_j                   "varchar(999)"
+      :dlp_revision_number            "numeric(38)"
+      :last_update_time               "date"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+      :notes                          "varchar(3900)"
+      :notes_j                        "varchar(3900)"
+      :qc_analysis_cat_text           "varchar(3900)"
+      :qc_analysis_cat_text_j         "varchar(3900)"
+      :qc_anal_summary_text           "varchar(3900)"
+      :qc_anal_summary_text_j         "varchar(3900)"
+      :qc_result                      "varchar(3900)"
+      :qc_result_j                    "varchar(3900)"
+      :qc_comment                     "varchar(3900)"
+      :qc_comment_j                   "varchar(3900)"
+      :qc_complaint_cat_text          "varchar(3900)"
+      :qc_complaint_cat_text_j        "varchar(3900)"
+      :vaers_block_id                 "numeric(38)"
+      :prod_lic_id                    "numeric(38)"
+    }
+
+    :rm_case_reporters
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :seq_num                        "numeric(38)"
+      :media_id                       "numeric(38)"
+      :occupation_id                  "numeric(38)"
+      :hcp_flag                       "numeric(38)"
+      :primary_contact                "numeric(38)"
+      :corr_contact                   "numeric(38)"
+      :reporter_type                  "numeric(38)"
+      :intermediary_id                "numeric(38)"
+      :rpt_sent                       "numeric(38)"
+      :sort_id                        "numeric(38)"
+      :confidential                   "numeric(1,0)"
+      :country_id                     "numeric(38)"
+      :suffix                         "varchar(99)"
+      :middle_name                    "varchar(99)"
+      :prefix                         "varchar(99)"
+      :first_name                     "varchar(99)"
+      :last_name                      "varchar(99)"
+      :reporter_id                    "varchar(99)"
+      :institution                    "varchar(99)"
+      :department                     "varchar(99)"
+      :city                           "varchar(99)"
+      :state                          "varchar(99)"
+      :postcode                       "varchar(99)"
+      :country                        "varchar(99)"
+      :phone                          "varchar(99)"
+      :altphone                       "varchar(99)"
+      :fax                            "varchar(99)"
+      :reporter_ref                   "varchar(99)"
+      :email                          "varchar(999)"
+      :address                        "varchar(999)"
+      :suffix_j                       "varchar(99)"
+      :address_j                      "varchar(999)"
+      :city_j                         "varchar(99)"
+      :department_j                   "varchar(99)"
+      :first_name_j                   "varchar(99)"
+      :institution_j                  "varchar(99)"
+      :last_name_j                    "varchar(99)"
+      :middle_name_j                  "varchar(99)"
+      :prefix_j                       "varchar(99)"
+      :state_j                        "varchar(99)"
+      :deleted                        "date"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+      :notes                          "varchar(3900)"
+      :notes_j                        "varchar(3900)"
+      :institution_id                 "varchar(99)"
+    }
+
+    :rm_case_study
+    {
+      :enterprise_id                  "numeric(38)"
+      :case_id                        "numeric(38)"
+      :study_key                      "numeric(38)"
+      :study_num                      "varchar(99)"
+      :study_type                     "numeric(38)"
+      :center_id                      "numeric(38)"
+      :center_name                    "varchar(99)"
+      :protocol_id                    "numeric(38)"
+      :protocol_num                   "varchar(99)"
+      :other_id                       "varchar(99)"
+      :code_broken                    "numeric(38)"
+      :broken_by                      "numeric(38)"
+      :broken_date                    "date"
+      :reason                         "varchar(999)"
+      :week                           "varchar(9)"
+      :visit                          "varchar(9)"
+      :deleted                        "date"
+      :product_count                  "numeric(2,0)"
+      :classification_id              "numeric(38)"
+      :blind_name                     "varchar(99)"
+      :study_desc                     "varchar(3900)"
+      :study_desc_j                   "varchar(3900)"
+      :blind_name_j                   "varchar(99)"
+      :center_name_j                  "varchar(99)"
+      :clin_compound_num_j            "varchar(99)"
+      :protocol_num_j                 "varchar(99)"
+      :study_num_j                    "varchar(99)"
+      :dev_phase_id                   "numeric(38)"
+      :dlp_revision_number            "numeric(38)"
+      :revision_delete_flag           "numeric(38)"
+      :deleted_flag                   "numeric(1,0)"
+      :effective_start_date           "date"
+      :effective_end_date             "date"
+      :cohort_id                      "numeric(38)"
+    }
+
+    :rm_lm_case_classification
+    {
+      :enterprise_id                  "numeric(38)"
+      :classification_id              "numeric(38)"
+      :description                    "varchar(99)"
+      :protected                      "numeric(38)"
+      :display                        "numeric(38)"
+      :description_j                  "varchar(99)"
+      :deleted                        "date"
+      :e2b_code                       "numeric(38)"
+    }
+
+    :rm_lm_causality
+    {
+      :enterprise_id                  "numeric(38)"
+      :causality_id                   "numeric(38)"
+      :causality                      "varchar(99)"
+      :reportability                  "numeric(38)"
+      :protected                      "numeric(38)"
+      :display                        "numeric(38)"
+      :causality_j                    "varchar(99)"
+      :deleted                        "date"
+    }
+
+    :rm_lm_countries
+    {
+      :enterprise_id                  "numeric(38)"
+      :country_id                     "numeric(38)"
+      :country                        "varchar(99)"
+      :a2                             "varchar(9)"
+      :a3                             "varchar(9)"
+      :num                            "numeric(38)"
+      :protected                      "numeric(38)"
+      :deleted                        "date"
+      :country_group_id               "numeric(38)"
+      :country_group                  "varchar(99)"
+      :country_j                      "varchar(99)"
+      :group_2_country                "numeric(38)"
+    }
+
+    :rm_lm_product
+    {
+      :enterprise_id                  "numeric(38)"
+      :product_id                     "numeric(38)"
+      :prod_name                      "varchar(99)"
+      :family_id                      "numeric(38)"
+      :formulation_id                 "numeric(38)"
+      :manufacturer_id                "numeric(38)"
+      :concentration                  "varchar(99)"
+      :conc_unit_id                   "numeric(38)"
+      :indication_id                  "varchar(99)"
+      :code_dict                      "numeric(38)"
+      :indication_text                "varchar(999)"
+      :intl_birth_date                "date"
+      :model_no                       "varchar(99)"
+      :drl_id                         "varchar(99)"
+      :drug_code                      "varchar(99)"
+      :deleted                        "date"
+      :prod_generic_name              "varchar(3900)"
+      :prod_generic_name_j            "varchar(3900)"
+      :ind_llt_code                   "varchar(99)"
+      :ind_llt                        "varchar(999)"
+      :ind_hlt_code                   "varchar(99)"
+      :ind_hlt                        "varchar(999)"
+      :ind_hlgt_code                  "varchar(99)"
+      :ind_hlgt                       "varchar(999)"
+      :ind_soc_code                   "varchar(99)"
+      :ind_soc                        "varchar(999)"
+      :ind_syn_code                   "numeric(38)"
+      :ind_code_status                "numeric(38)"
+      :medicinal_prod_id              "varchar(99)"
+      :prod_name_abbrv                "varchar(9)"
+      :device_code                    "varchar(99)"
+      :psur_group_name                "varchar(99)"
+      :comments                       "varchar(3900)"
+      :ind_coded                      "varchar(999)"
+      :ind_reptd                      "varchar(999)"
+      :drl_id_j                       "varchar(99)"
+      :drug_code_j                    "varchar(99)"
+      :drug_code_type_j               "numeric(38)"
+      :indication_text_j              "varchar(999)"
+      :ind_code_status_j              "numeric(38)"
+      :ind_hlgt_j                     "varchar(999)"
+      :ind_hlt_j                      "varchar(999)"
+      :ind_llt_code_j                 "varchar(99)"
+      :ind_llt_j                      "varchar(999)"
+      :ind_soc_j                      "varchar(999)"
+      :prod_name_j                    "varchar(99)"
+      :ind_syn_code_j                 "numeric(38)"
+      :ind_coded_j                    "varchar(999)"
+      :ind_reptd_j                    "varchar(999)"
+      :dev_intl_birth_date            "date"
+      :comments_j                     "varchar(3900)"
+    }
+
+    :rm_lm_product_family
+    {
+      :enterprise_id                  "numeric(38)"
+      :family_id                      "numeric(38)"
+      :name                           "varchar(99)"
+      :primary_view                   "numeric(38)"
+      :deleted                        "date"
+      :product_group_id               "numeric(38)"
+      :comments                       "varchar(3900)"
+      :search_equation_number         "varchar(99)"
+      :name_j                         "varchar(99)"
+      :comments_j                     "varchar(3900)"
+    }
+
+    :rm_lm_report_type
+    {
+      :enterprise_id                  "numeric(38)"
+      :rpt_type_id                    "numeric(38)"
+      :report_type                    "varchar(99)"
+      :protected                      "numeric(38)"
+      :display                        "numeric(38)"
+      :incl_lit                       "numeric(38)"
+      :incl_trial                     "numeric(38)"
+      :e2b_code                       "numeric(38)"
+      :abrv                           "varchar(9)"
+      :investigational                "numeric(38)"
+      :report_type_j                  "varchar(99)"
+      :deleted                        "date"
+      :incl_research                  "numeric(38)"
+    }
+
+    :rm_meddra_smq_content
+    {
+      :global_dict_id                 "numeric(38)"
+      :smq_code                       "numeric(38)"
+      :term_code                      "numeric(38)"
+      :term_level                     "numeric(38)"
+      :term_scope                     "numeric(38)"
+      :term_category                  "varchar(9)"
+      :term_weight                    "numeric(38)"
+      :term_status                    "varchar(9)"
+      :term_addition_version          "varchar(9)"
+      :term_last_modified_version     "varchar(9)"
+    }
+
+    :rm_meddra_smq_list
+    {
+      :global_dict_id                 "numeric(38)"
+      :smq_code                       "numeric(38)"
+      :smq_name                       "varchar(999)"
+      :smq_level                      "numeric(38)"
+      :smq_description                "varchar(3900)"
+      :smq_source                     "varchar(3900)"
+      :smq_note                       "varchar(3900)"
+      :meddra_version                 "varchar(9)"
+      :status                         "varchar(9)"
+      :smq_algorithm                  "varchar(999)"
+    }
+
+  }
+)


Add support for making new observations!

Add support for making new observations of a selected sort by clicking a
button.

--- src/scavenger/client/main.cljs
+++ src/scavenger/client/main.cljs
@@ -42,18 +42,56 @@
 ; Mutator for state
 (defmulti mutate om/dispatch)

+(defmethod mutate 'observations/add [{:keys [state]} _ entity]
+  {:value {:keys [:observations]}
+   :action
+   (fn []
+     (edn-xhr
+      {:method "POST"
+       :path "/observations"
+       :data (merge entity {:observation/lat 60.029427 :observation/lng 9.955025})
+       :on-complete (fn [data] (d/transact! state [data]))}))})
+
 ; Scavenger sorts list
 (defui SortsList
   Object
   (render [this]
-    (let [sorts (om/props this)]
-      (apply dom/ul nil
+    (let [{:keys [sorts onSelect]} (om/props this)]
+      (apply
+       dom/select #js
+       {:onChange
+        (fn [e]
+          (let [value (.. e -target -value)]
+            (onSelect (if (empty? value) nil (reader/read-string value)))))}
+       (cons
+        (dom/option #js {:value ""} "-- Select sort --")
         (map
-          (fn [sort]
-            (dom/li nil (:sort/name sort)))
-          sorts)))))
+         (fn [sort]
+           (dom/option #js {:value (:db/id sort)} (:sort/name sort)))
+         sorts))))))

 (def sorts-list (om/factory SortsList))
+
+(defui AddObservation
+  static om/IQuery
+  (query [this] [:observations])
+  Object
+  (render [this]
+    (let [sorts (om/props this)]
+      (dom/div
+       nil
+       (sorts-list
+        {:sorts sorts
+         :onSelect (fn [sort-id] (om/set-state! this {:sort-id sort-id}))})
+       (dom/button
+        #js {:onClick
+             (fn [e]
+               (let [{:keys [sort-id]} (om/get-state this)]
+                 (om/transact!
+                  this `[(observations/add {:observation/sort ~sort-id})])))}
+        "New observation")))))
+
+(def add-observation (om/factory AddObservation))

 ; Keep state property for name text in AddSort component instance up to date
 (defn update-state [component event]
@@ -70,7 +108,7 @@
     (let [{:keys [sorts]} (om/props this)]
       (dom/div nil
         (dom/h1 nil "Scavenger sorts")
-        (sorts-list sorts)
+        (add-observation sorts)
         (maps/google-map {:center {:lat 60 :lng 10},
                      :zoom 12}
           (maps/marker {:lat 60 :lng 10})


Revert to more direct pattern listener args

--- src/re_db/core.cljs
+++ src/re_db/core.cljs
@@ -269,20 +269,20 @@
   (when-let [listeners (get* db-after :listeners)]
     (let [seen-ids (atom #{})]

-      (doseq [datom datoms]
+      (doseq [[id a v prev-v :as datom] datoms]

         (swap! seen-ids conj (datom 0))

         ;; entity-attr listeners
-        (doseq [f (get-in* listeners [:entity-attr (datom 0) (datom 1)])]
-          (f datom))
+        (doseq [f (get-in* listeners [:entity-attr id a])]
+          (f v))

         ;; attr-val listeners
-        (doseq [f (get-in* listeners [:attr-val (datom 1) (or (datom 2) (datom 3))])]
-          (f datom))
+        (doseq [f (get-in* listeners [:attr-val a (or v prev-v)])]
+          (f id))

         ;; attr listeners
-        (doseq [f (get-in* listeners [:attr (datom 1)])]
+        (doseq [f (get-in* listeners [:attr a])]
           (f datom)))

       (doseq [id @seen-ids]


Use old versions since they are correctly running

--- frontend/project.clj
+++ frontend/project.clj
@@ -7,8 +7,8 @@
   :min-lein-version "2.6.1"

   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.495"]
-                 [org.clojure/core.async "0.3.441" :exclusions [org.clojure/tools.reader]]
+                 [org.clojure/clojurescript "1.9.198"]
+                 [org.clojure/core.async "0.2.385" :exclusions [org.clojure/tools.reader]]
                  [org.omcljs/om "1.0.0-alpha40"]
                  [cljs-ajax "0.5.8"]                        ; AJAX for om
                  [com.cognitect/transit-cljs "0.8.239"]]


fix compiler warning

fix compiler warning

--- frontend/routes.cljs
+++ frontend/routes.cljs
@@ -36,7 +36,7 @@
     (put! nav-ch [:project-settings {:project-name project-name
                                      :subpage subpage}])))

-(defn define-routes! [app history-imp]
+(defn define-routes! [app]
   (let [nav-ch (get-in @app [:comms :nav])]
     (defroute v1-org-dashboard "/gh/:org" {:as params}
       (open-to-dashboard! nav-ch params))