varchar(9), varchar(99), varchar(999)

varchar(9), varchar(99), varchar(999)

--- ddl.clj
+++ ddl.clj
@@ -16,30 +16,30 @@
   "listedness_notes" varchar(1000),
   "bfarm_causality" numeric(10,0),
   "bfarm_manual_text" varchar(3900),
-  "company_diagnosis" varchar(250),
+  "company_diagnosis" varchar(999),
   "company_diagnosis_notes" varchar(1000),
   "diagnosis_dict_id" numeric(38),
-  "diagnosis_pref_code" varchar(30),
-  "diagnosis_inc_code" varchar(30),
-  "diagnosis_inc_term" varchar(250),
-  "diagnosis_hlgt_code" varchar(30),
-  "diagnosis_hlgt" varchar(250),
-  "diagnosis_hlt_code" varchar(30),
-  "diagnosis_hlt" varchar(250),
-  "diagnosis_soc_code" varchar(30),
-  "diagnosis_body_sys" varchar(250),
-  "ud_text_1" varchar(100),
-  "ud_text_2" varchar(100),
-  "ud_text_3" varchar(100),
-  "ud_text_4" varchar(100),
-  "ud_text_5" varchar(100),
-  "ud_text_6" varchar(100),
-  "ud_text_7" varchar(100),
-  "ud_text_8" varchar(100),
-  "ud_text_9" varchar(100),
-  "ud_text_10" varchar(100),
-  "ud_text_11" varchar(100),
-  "ud_text_12" varchar(100),
+  "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,
@@ -67,38 +67,38 @@
   "evaluation" varchar(3900),
   "evaluation_j" varchar(3900),
   "co_suspect_count" numeric(3,0),
-  "event_synopsis" varchar(5),
-  "event_primary" varchar(400),
-  "diagnosis_reptd" varchar(255),
-  "diagnosis_coded" varchar(255),
+  "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(400),
+  "event_primary_j" varchar(999),
   "agent_notes_j" varchar(1000),
-  "company_diagnosis_j" varchar(250),
+  "company_diagnosis_j" varchar(999),
   "company_diagnosis_notes_j" varchar(1000),
-  "diagnosis_body_sys_j" varchar(250),
-  "diagnosis_coded_j" varchar(255),
+  "diagnosis_body_sys_j" varchar(999),
+  "diagnosis_coded_j" varchar(999),
   "diagnosis_code_status_j" numeric(38),
-  "diagnosis_hlgt_j" varchar(250),
-  "diagnosis_hlt_j" varchar(250),
-  "diagnosis_inc_code_j" varchar(30),
-  "diagnosis_inc_term_j" varchar(250),
-  "diagnosis_reptd_j" varchar(255),
+  "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(1000),
   "serious_notes_j" varchar(1000),
-  "ud_text_1_j" varchar(100),
-  "ud_text_2_j" varchar(100),
-  "ud_text_3_j" varchar(100),
-  "ud_text_4_j" varchar(100),
-  "ud_text_5_j" varchar(100),
-  "ud_text_6_j" varchar(100),
-  "ud_text_7_j" varchar(100),
-  "ud_text_8_j" varchar(100),
-  "ud_text_9_j" varchar(100),
-  "ud_text_10_j" varchar(100),
-  "ud_text_11_j" varchar(100),
-  "ud_text_12_j" varchar(100),
+  "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),
@@ -127,16 +127,16 @@
   "enterprise_id" numeric(38),
   "case_id" numeric(38),
   "seq_num" numeric(38),
-  "desc_reptd" varchar(250),
-  "desc_coded" varchar(255),
+  "desc_reptd" varchar(999),
+  "desc_coded" varchar(999),
   "diagnosis" numeric(38),
   "onset" date,
   "onset_res" numeric(38),
-  "onset_delay" varchar(40),
+  "onset_delay" varchar(99),
   "stop_date" date,
   "stop_date_res" numeric(38),
-  "duration" varchar(40),
-  "onset_latency" varchar(40),
+  "duration" varchar(99),
+  "onset_latency" varchar(99),
   "evt_intensity_id" numeric(38),
   "evt_freq_id" numeric(38),
   "treated" numeric(38),
@@ -153,44 +153,44 @@
   "sc_disable" numeric(38),
   "sc_int_req" numeric(38),
   "sc_other" numeric(38),
-  "sc_other_text" varchar(30),
-  "art_code" varchar(30),
-  "pref_term" varchar(250),
-  "inc_term" varchar(250),
-  "body_sys" varchar(250),
+  "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(20),
+  "dict_key" varchar(99),
   "code_status" numeric(38),
   "seriousness" numeric(38),
   "sort_id" numeric(38),
-  "onset_date_partial" varchar(20),
-  "stop_date_partial" varchar(20),
+  "onset_date_partial" varchar(99),
+  "stop_date_partial" varchar(99),
   "efficacy" numeric(38),
   "disease" numeric(38),
   "withdrawal" numeric(38),
-  "hlgt" varchar(250),
-  "hlt" varchar(250),
-  "hlt_code" varchar(30),
-  "hlgt_code" varchar(30),
-  "soc_code" varchar(30),
+  "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(30),
+  "inc_code" varchar(99),
   "onset_minutes" numeric(38),
   "delay_minutes" numeric(38),
-  "ud_text_1" varchar(100),
-  "ud_text_2" varchar(100),
-  "ud_text_3" varchar(100),
-  "ud_text_4" varchar(100),
-  "ud_text_5" varchar(100),
-  "ud_text_6" varchar(100),
-  "ud_text_7" varchar(100),
-  "ud_text_8" varchar(100),
-  "ud_text_9" varchar(100),
-  "ud_text_10" varchar(100),
-  "ud_text_11" varchar(100),
-  "ud_text_12" varchar(100),
+  "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,
@@ -226,30 +226,30 @@
   "duration_seconds" numeric(38),
   "onset_latency_seconds" numeric(38),
   "onset_delay_seconds" numeric(38),
-  "body_sys_j" varchar(250),
+  "body_sys_j" varchar(999),
   "code_status_j" numeric(38),
-  "desc_coded_j" varchar(255),
-  "desc_reptd_j" varchar(250),
-  "hlgt_j" varchar(250),
-  "hlt_j" varchar(250),
-  "inc_code_j" varchar(30),
-  "inc_term_j" varchar(250),
-  "pref_term_j" varchar(250),
-  "sc_other_text_j" varchar(30),
+  "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(100),
-  "ud_text_2_j" varchar(100),
-  "ud_text_3_j" varchar(100),
-  "ud_text_4_j" varchar(100),
-  "ud_text_5_j" varchar(100),
-  "ud_text_6_j" varchar(100),
-  "ud_text_7_j" varchar(100),
-  "ud_text_8_j" varchar(100),
-  "ud_text_9_j" varchar(100),
-  "ud_text_10_j" varchar(100),
-  "ud_text_11_j" varchar(100),
-  "ud_text_12_j" varchar(100),
+  "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(1000),
@@ -278,7 +278,7 @@
   "cause_justify" varchar(1000),
   "lam_assessed" numeric(12,0),
   "deleted" date,
-  "causality_assessment" varchar(50),
+  "causality_assessment" varchar(99),
   "causality_score" numeric(38),
   "source_id" numeric(38),
   "prt_causality_id" numeric(38),
@@ -321,7 +321,7 @@
 (
   "enterprise_id" numeric(38),
   "case_id" numeric(38),
-  "case_num" varchar(20),
+  "case_num" varchar(99),
   "rev" numeric(38),
   "workflow_seq_num" numeric(38),
   "last_workflow_seq_num" numeric(38),
@@ -343,7 +343,7 @@
   "last_state_id" numeric(38),
   "assessment_needed" numeric(38),
   "priority_override" numeric(1,0),
-  "sid" varchar(128),
+  "sid" varchar(999),
   "safety_date" date,
   "normal_time" date,
   "max_time" date,
@@ -351,20 +351,20 @@
   "priority_assessment" numeric(38),
   "close_user_id" numeric(38),
   "close_date" date,
-  "close_notes" varchar(200),
+  "close_notes" varchar(999),
   "date_locked" date,
-  "ud_text_1" varchar(100),
-  "ud_text_2" varchar(100),
-  "ud_text_3" varchar(100),
-  "ud_text_4" varchar(100),
-  "ud_text_5" varchar(100),
-  "ud_text_6" varchar(100),
-  "ud_text_7" varchar(100),
-  "ud_text_8" varchar(100),
-  "ud_text_9" varchar(100),
-  "ud_text_10" varchar(100),
-  "ud_text_11" varchar(100),
-  "ud_text_12" varchar(100),
+  "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,
@@ -391,10 +391,10 @@
   "ud_number_12" numeric(30,10),
   "deleted" date,
   "due_soon" date,
-  "global_num" varchar(20),
+  "global_num" varchar(99),
   "priority_date_assessed" date,
   "lam_assess_done" numeric(1,0),
-  "e2b_ww_number" varchar(100),
+  "e2b_ww_number" varchar(999),
   "worklist_owner_id" numeric(38),
   "susar" numeric(38),
   "last_update_event" date,
@@ -404,18 +404,18 @@
   "followup_date_j" date,
   "init_rept_date_j" date,
   "just_init_rept_date_j" varchar(1000),
-  "ud_text_1_j" varchar(100),
-  "ud_text_2_j" varchar(100),
-  "ud_text_3_j" varchar(100),
-  "ud_text_4_j" varchar(100),
-  "ud_text_5_j" varchar(100),
-  "ud_text_6_j" varchar(100),
-  "ud_text_7_j" varchar(100),
-  "ud_text_8_j" varchar(100),
-  "ud_text_9_j" varchar(100),
-  "ud_text_10_j" varchar(100),
-  "ud_text_11_j" varchar(100),
-  "ud_text_12_j" varchar(100),
+  "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(1000),
   "dlp_revision_number" numeric(38),
   "revision_delete_flag" number default 0,
@@ -444,18 +444,18 @@
 (
   "enterprise_id" numeric(38),
   "case_id" numeric(38),
-  "pat_id" varchar(10),
-  "pat_subj_num" varchar(20),
-  "pat_initials" varchar(10),
-  "pat_firstname" varchar(35),
-  "pat_mi" varchar(15),
-  "pat_lastname" varchar(50),
-  "pat_address" varchar(120),
-  "pat_city" varchar(35),
-  "pat_state" varchar(40),
-  "pat_postal_code" varchar(15),
-  "pat_country" varchar(50),
-  "pat_phone" varchar(20),
+  "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),
@@ -470,22 +470,22 @@
   "occupation_id" numeric(38),
   "pat_stat_preg" numeric(38),
   "rel_test_id" numeric(38),
-  "pat_dob_partial" varchar(20),
-  "rand_num" varchar(15),
+  "pat_dob_partial" varchar(99),
+  "rand_num" varchar(99),
   "confidential" numeric(1,0),
-  "number_of_patients" varchar(8),
-  "ud_text_1" varchar(100),
-  "ud_text_2" varchar(100),
-  "ud_text_3" varchar(100),
-  "ud_text_4" varchar(100),
-  "ud_text_5" varchar(100),
-  "ud_text_6" varchar(100),
-  "ud_text_7" varchar(100),
-  "ud_text_8" varchar(100),
-  "ud_text_9" varchar(100),
-  "ud_text_10" varchar(100),
-  "ud_text_11" varchar(100),
-  "ud_text_12" varchar(100),
+  "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,
@@ -514,24 +514,24 @@
   "child_only" numeric(1,0),
   "pat_bmi" numeric(22,7),
   "pat_body_area" numeric(22,7),
-  "pat_address_j" varchar(120),
-  "pat_city_j" varchar(35),
-  "pat_firstname_j" varchar(35),
-  "pat_lastname_j" varchar(50),
-  "pat_mi_j" varchar(15),
-  "pat_state_j" varchar(40),
-  "ud_text_1_j" varchar(100),
-  "ud_text_2_j" varchar(100),
-  "ud_text_3_j" varchar(100),
-  "ud_text_4_j" varchar(100),
-  "ud_text_5_j" varchar(100),
-  "ud_text_6_j" varchar(100),
-  "ud_text_7_j" varchar(100),
-  "ud_text_8_j" varchar(100),
-  "ud_text_9_j" varchar(100),
-  "ud_text_10_j" varchar(100),
-  "ud_text_11_j" varchar(100),
-  "ud_text_12_j" varchar(100),
+  "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" number default 0,
@@ -550,7 +550,7 @@
   "case_id" numeric(38),
   "seq_num" numeric(38),
   "formulation_id" numeric(38),
-  "concentration" varchar(10),
+  "concentration" varchar(99),
   "conc_units_id" numeric(38),
   "act_taken_id" numeric(38),
   "severity_id" numeric(38),
@@ -576,24 +576,24 @@
   "b_weight_grams" numeric(38),
   "n_siblings" numeric(38),
   "b_weight_ozs" numeric(38),
-  "first_dose_partial" varchar(20),
-  "last_dose_partial" varchar(20),
+  "first_dose_partial" varchar(99),
+  "last_dose_partial" varchar(99),
   "tampering" numeric(4,0),
   "cumulative_dose" numeric(22,7),
-  "cumulative_dose_unit" varchar(10),
-  "deleted" date,
-  "ud_text_1" varchar(100),
-  "ud_text_2" varchar(100),
-  "ud_text_3" varchar(100),
-  "ud_text_4" varchar(100),
-  "ud_text_5" varchar(100),
-  "ud_text_6" varchar(100),
-  "ud_text_7" varchar(100),
-  "ud_text_8" varchar(100),
-  "ud_text_9" varchar(100),
-  "ud_text_10" varchar(100),
-  "ud_text_11" varchar(100),
-  "ud_text_12" varchar(100),
+  "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,
@@ -624,18 +624,18 @@
   "duration_seconds" numeric(38),
   "latency_seconds" numeric(38),
   "delay_seconds" numeric(38),
-  "ud_text_1_j" varchar(100),
-  "ud_text_2_j" varchar(100),
-  "ud_text_3_j" varchar(100),
-  "ud_text_4_j" varchar(100),
-  "ud_text_5_j" varchar(100),
-  "ud_text_6_j" varchar(100),
-  "ud_text_7_j" varchar(100),
-  "ud_text_8_j" varchar(100),
-  "ud_text_9_j" varchar(100),
-  "ud_text_10_j" varchar(100),
-  "ud_text_11_j" varchar(100),
-  "ud_text_12_j" varchar(100),
+  "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" number default 0,
   "deleted_flag" numeric(1,0),
@@ -661,24 +661,24 @@
   "qc_safety_date" date,
   "qc_sent_date" date,
   "qc_result_date" date,
-  "qc_cross_reference" varchar(16),
-  "who_drug_code" varchar(45),
-  "co_drug_code" varchar(20),
-  "product_name" varchar(70),
+  "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(100),
-  "ud_text_2" varchar(100),
-  "ud_text_3" varchar(100),
-  "ud_text_4" varchar(100),
-  "ud_text_5" varchar(100),
-  "ud_text_6" varchar(100),
-  "ud_text_7" varchar(100),
-  "ud_text_8" varchar(100),
-  "ud_text_9" varchar(100),
-  "ud_text_10" varchar(100),
-  "ud_text_11" varchar(100),
-  "ud_text_12" varchar(100),
+  "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,
@@ -705,39 +705,39 @@
   "ud_number_12" numeric(30,10),
   "include_frequency" numeric(38),
   "sdrug_not_admin" numeric(38),
-  "prod_reptd" varchar(255),
-  "prod_coded" varchar(255),
+  "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(10),
+  "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(10),
+  "medicinal_prod_id" varchar(99),
   "family_id" numeric(38),
   "existing_rpt_seq_mod_flg" numeric(38),
-  "drug_code_j" varchar(20),
+  "drug_code_j" varchar(99),
   "drug_code_type_j" numeric(38),
-  "product_name_j" varchar(70),
-  "prod_coded_j" varchar(255),
-  "prod_reptd_j" varchar(255),
-  "qc_cross_reference_j" varchar(16),
-  "ud_text_1_j" varchar(100),
-  "ud_text_2_j" varchar(100),
-  "ud_text_3_j" varchar(100),
-  "ud_text_4_j" varchar(100),
-  "ud_text_5_j" varchar(100),
-  "ud_text_6_j" varchar(100),
-  "ud_text_7_j" varchar(100),
-  "ud_text_8_j" varchar(100),
-  "ud_text_9_j" varchar(100),
-  "ud_text_10_j" varchar(100),
-  "ud_text_11_j" varchar(100),
-  "ud_text_12_j" varchar(100),
+  "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" number default 0,
@@ -776,34 +776,34 @@
   "sort_id" numeric(38),
   "confidential" numeric(1,0),
   "country_id" numeric(38),
-  "suffix" varchar(15),
-  "middle_name" varchar(15),
-  "prefix" varchar(50),
-  "first_name" varchar(35),
-  "last_name" varchar(50),
-  "reporter_id" varchar(20),
-  "institution" varchar(60),
-  "department" varchar(60),
-  "city" varchar(35),
-  "state" varchar(40),
-  "postcode" varchar(15),
-  "country" varchar(50),
-  "phone" varchar(20),
-  "altphone" varchar(20),
-  "fax" varchar(50),
-  "reporter_ref" varchar(20),
-  "email" varchar(100),
-  "address" varchar(120),
-  "suffix_j" varchar(15),
-  "address_j" varchar(120),
-  "city_j" varchar(35),
-  "department_j" varchar(60),
-  "first_name_j" varchar(35),
-  "institution_j" varchar(60),
-  "last_name_j" varchar(50),
-  "middle_name_j" varchar(15),
-  "prefix_j" varchar(50),
-  "state_j" varchar(40),
+  "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" number default 0,
@@ -812,7 +812,7 @@
   "effective_end_date" date,
   "notes" varchar(3900),
   "notes_j" varchar(3900),
-  "institution_id" varchar(15)
+  "institution_id" varchar(99)
 )

 create table rm_case_study
@@ -820,30 +820,30 @@
   "enterprise_id" numeric(38),
   "case_id" numeric(38),
   "study_key" numeric(38),
-  "study_num" varchar(35),
+  "study_num" varchar(99),
   "study_type" numeric(38),
   "center_id" numeric(38),
-  "center_name" varchar(40),
+  "center_name" varchar(99),
   "protocol_id" numeric(38),
-  "protocol_num" varchar(40),
-  "other_id" varchar(20),
+  "protocol_num" varchar(99),
+  "other_id" varchar(99),
   "code_broken" numeric(38),
   "broken_by" numeric(38),
   "broken_date" date,
-  "reason" varchar(100),
-  "week" varchar(5),
-  "visit" varchar(5),
+  "reason" varchar(999),
+  "week" varchar(9),
+  "visit" varchar(9),
   "deleted" date,
   "product_count" numeric(2,0),
   "classification_id" numeric(38),
-  "blind_name" varchar(70),
+  "blind_name" varchar(99),
   "study_desc" varchar(3900),
   "study_desc_j" varchar(3900),
-  "blind_name_j" varchar(70),
-  "center_name_j" varchar(40),
-  "clin_compound_num_j" varchar(70),
-  "protocol_num_j" varchar(40),
-  "study_num_j" varchar(35),
+  "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" number default 0,
@@ -857,10 +857,10 @@
 (
   "enterprise_id" numeric(38),
   "classification_id" numeric(38),
-  "description" varchar(30),
+  "description" varchar(99),
   "protected" numeric(38),
   "display" numeric(38),
-  "description_j" varchar(30),
+  "description_j" varchar(99),
   "deleted" date,
   "e2b_code" number
 )
@@ -869,11 +869,11 @@
 (
   "enterprise_id" numeric(38),
   "causality_id" numeric(38),
-  "causality" varchar(35),
+  "causality" varchar(99),
   "reportability" numeric(38),
   "protected" numeric(38),
   "display" numeric(38),
-  "causality_j" varchar(35),
+  "causality_j" varchar(99),
   "deleted" date
 )

@@ -881,15 +881,15 @@
 (
   "enterprise_id" numeric(38),
   "country_id" numeric(38),
-  "country" varchar(50),
-  "a2" varchar(2),
-  "a3" varchar(3),
+  "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(50),
-  "country_j" varchar(50),
+  "country_group" varchar(99),
+  "country_j" varchar(99),
   "group_2_country" number
 )

@@ -897,53 +897,53 @@
 (
   "enterprise_id" numeric(38),
   "product_id" numeric(38),
-  "prod_name" varchar(70),
+  "prod_name" varchar(99),
   "family_id" numeric(38),
   "formulation_id" numeric(38),
   "manufacturer_id" numeric(38),
-  "concentration" varchar(10),
+  "concentration" varchar(99),
   "conc_unit_id" numeric(38),
-  "indication_id" varchar(50),
+  "indication_id" varchar(99),
   "code_dict" numeric(38),
-  "indication_text" varchar(250),
+  "indication_text" varchar(999),
   "intl_birth_date" date,
-  "model_no" varchar(20),
-  "drl_id" varchar(45),
-  "drug_code" varchar(20),
+  "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(50),
-  "ind_llt" varchar(250),
-  "ind_hlt_code" varchar(50),
-  "ind_hlt" varchar(250),
-  "ind_hlgt_code" varchar(50),
-  "ind_hlgt" varchar(250),
-  "ind_soc_code" varchar(50),
-  "ind_soc" varchar(250),
+  "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(10),
-  "prod_name_abbrv" varchar(5),
-  "device_code" varchar(50),
-  "psur_group_name" varchar(50),
+  "medicinal_prod_id" varchar(99),
+  "prod_name_abbrv" varchar(9),
+  "device_code" varchar(99),
+  "psur_group_name" varchar(99),
   "comments" varchar(1000),
-  "ind_coded" varchar(250),
-  "ind_reptd" varchar(250),
-  "drl_id_j" varchar(45),
-  "drug_code_j" varchar(20),
+  "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(250),
+  "indication_text_j" varchar(999),
   "ind_code_status_j" numeric(38),
-  "ind_hlgt_j" varchar(250),
-  "ind_hlt_j" varchar(250),
-  "ind_llt_code_j" varchar(50),
-  "ind_llt_j" varchar(250),
-  "ind_soc_j" varchar(250),
-  "prod_name_j" varchar(70),
+  "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(250),
-  "ind_reptd_j" varchar(250),
+  "ind_coded_j" varchar(999),
+  "ind_reptd_j" varchar(999),
   "dev_intl_birth_date" date,
   "comments_j" varchar(1000)
 )
@@ -952,13 +952,13 @@
 (
   "enterprise_id" numeric(38),
   "family_id" numeric(38),
-  "name" varchar(40),
+  "name" varchar(99),
   "primary_view" numeric(38),
   "deleted" date,
   "product_group_id" numeric(38),
   "comments" varchar(1000),
-  "search_equation_number" varchar(10),
-  "name_j" varchar(40),
+  "search_equation_number" varchar(99),
+  "name_j" varchar(99),
   "comments_j" varchar(1000)
 )

@@ -966,15 +966,15 @@
 (
   "enterprise_id" numeric(38),
   "rpt_type_id" numeric(38),
-  "report_type" varchar(30),
+  "report_type" varchar(99),
   "protected" numeric(38),
   "display" numeric(38),
   "incl_lit" numeric(38),
   "incl_trial" numeric(38),
   "e2b_code" numeric(38),
-  "abrv" varchar(3),
+  "abrv" varchar(9),
   "investigational" numeric(38),
-  "report_type_j" varchar(30),
+  "report_type_j" varchar(99),
   "deleted" date,
   "incl_research" number
 )
@@ -986,23 +986,23 @@
   "term_code" numeric(38),
   "term_level" numeric(38),
   "term_scope" numeric(38),
-  "term_category" varchar(1),
+  "term_category" varchar(9),
   "term_weight" numeric(38),
-  "term_status" varchar(1),
-  "term_addition_version" varchar(5),
-  "term_last_modified_version" varchar(5)
+  "term_status" varchar(9),
+  "term_addition_version" varchar(9),
+  "term_last_modified_version" varchar(9)
 )

 create table rm_meddra_smq_list
 (
   "global_dict_id" numeric(38),
   "smq_code" numeric(38),
-  "smq_name" varchar(100),
+  "smq_name" varchar(999),
   "smq_level" numeric(38),
   "smq_description" varchar(3000),
   "smq_source" varchar(2000),
   "smq_note" varchar(2000),
-  "meddra_version" varchar(5),
-  "status" varchar(1),
-  "smq_algorithm" varchar(100)
-)
+  "meddra_version" varchar(9),
+  "status" varchar(9),
+  "smq_algorithm" varchar(999)
+)


Update hello-world.

Update hello-world.

--- examples/hello-world/project.clj
+++ examples/hello-world/project.clj
@@ -1,7 +1,7 @@
-(defproject hello-world "0.21.0-SNAPSHOT"
+(defproject hello-world "0.22.0"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.10.0"]
-                 [uncomplicate/neanderthal "0.21.0"]]
+                 [uncomplicate/neanderthal "0.22.0"]]
   :exclusions [[org.jcuda/jcuda-natives :classifier "apple-x86_64"]
                [org.jcuda/jcublas-natives :classifier "apple-x86_64"]])


Trying to fix data loading issues

Trying to fix data loading issues

Need to understand the code first

--- src/webapp/framework/client/coreclient.cljs
+++ src/webapp/framework/client/coreclient.cljs
@@ -1383,14 +1383,16 @@
 -----------------------------------------------------------"
 (defn update-all-views-for-query [ query-key ]

-  (let [  data-query         @(get @data-queries-v2  query-key)
-          list-of-views      @(get data-query  :list-of-view-keys)   ]
-
-    (doall
-
-     (map
-      (fn[view-key]  (update-view-for-query  view-key  query-key))
-      list-of-views ))))
+  (let [
+          data-query         @(get @data-queries-v2  query-key)
+          list-of-views      @(get data-query  :list-of-view-keys)
+          ]
+
+          (doall
+                (map
+                    (fn[view-key]
+                                 (update-view-for-query  view-key  query-key))
+                    list-of-views ))))

@@ -1585,18 +1587,25 @@
 (defn add-data-query-result-v2  [query-key   params  records-count  records]

   (let [
-         query-atom          (get @data-queries-v2   query-key)
-         list-of-positions   (range (:start params) (inc (:end params)))
+         query-atom                 (get @data-queries-v2   query-key)
+         list-of-record-positions   (range (:start params) (inc (:end params)))
        ]

-    ;(log (pr-str "Record copunt returned: " records-count))
-
+    ;(log (pr-str "Record count returned: " records-count))
+
+    ; -----------------------------------------------
     ; update the record count in the query
+    ; -----------------------------------------------
     (reset!  query-atom
              (assoc @query-atom :count records-count))
     ;(log (str "Query Count: " records-count))

-    ; update the values in the query
+
+
+
+    ; -----------------------------------------------
+    ; update the record IDs in the query
+    ; -----------------------------------------------
     (reset!  query-atom
              (assoc @query-atom :values
                (merge
@@ -1604,25 +1613,30 @@
                               (fn[record-pos
                                   record-id]   {record-pos  record-id})

-                              list-of-positions
+                              list-of-record-positions
                               records
                               ))
                 (get @query-atom :values))))

+    ; -----------------------------------------------
+    ; load the records in
+    ; -----------------------------------------------
     (let [
-          list-of-ids         (map (fn[id]
-                                     (get (@query-atom :values) id))
-                                   list-of-positions)
+          list-of-ids         (map
+                                  (fn[id] (get (@query-atom :values) id))
+                                   list-of-record-positions)
           ]

       (doall
        (map
         (fn [ record-id ] (load-record  query-key  record-id))
         list-of-ids
-        ))
-
-      (update-all-views-for-query    query-key)
+        )
+       (update-all-views-for-query    query-key)
+
+        )
+
       )))

@@ -1641,11 +1655,10 @@

 Get SQL queries requests from the database

-
-
- this waits for requests on the channel
- 'data-query-requests-v2' and then gets the corresponding
- data and updates the internal cache
+This waits for query requests on the channel 'data-query-requests-v2'
+and then asks the server for the results of the query. When the result
+comes back then it goes through all the record IDs and tries to load the
+records

 -----------------------------------------------------------"
 (go
@@ -1696,7 +1709,7 @@
    (let [request  (<! data-record-requests-v2)]  ; <-- reads the record request from the channel
      (log (pr-str "Loading record " (get request :id)))
      (let [
-           record             (remote  !get-record-result-v2 request)
+           record             (remote  !get-record-result-v2  request)
            record-value       (get record :value)

            source-name        (:source  request)


Fix bug if all touched registers driven negative

--- src/advent_2017/day_08.cljc
+++ src/advent_2017/day_08.cljc
@@ -20,7 +20,7 @@
 (def register-history
   (reductions (fn [acc {:keys [tgt upd val lhs cmp rhs]}]
                 (eval `(cond-> '~acc (~cmp ('~acc '~lhs 0) ~rhs) (update '~tgt (fnil ~upd 0) ~val))))
-    {}
+    (zipmap (map :lhs data) (repeat 0))
     data))

 (defn max-register-val [registers]


Formatting

Formatting

--- src/advent_2017/day_21.cljc
+++ src/advent_2017/day_21.cljc
@@ -27,21 +27,25 @@
         (partition-all size)
         (map transpose)))

-(def join-xf
-  (comp (mapcat transpose)
-        (map flatten)))
+(def join-xf (comp (mapcat transpose)
+                   (map flatten)))

 (defn step* [pattern-map input]
   (let [size (if (even? (count (first input)))
                2
                3)]
-    (eduction (split-xf size) (map #(map pattern-map %)) join-xf input)))
+    (eduction (split-xf size)
+              (map #(map pattern-map %))
+              join-xf
+              input)))

 (defn solve [iterations]
   (let [step (partial step* (make-pattern-map input))]
     (->> iterations
       (util/nth (iterate step [".#." "..#" "###"]))
-      (transduce (comp (map #(filter #{\#} %)) (map count)) +))))
+      (transduce (comp (map #(filter #{\#} %))
+                       (map count))
+        +))))

 (defn part-1 []
   (solve 5))


unique element descriptor

unique element descriptor

--- src/latte/quant.clj
+++ src/latte/quant.clj
@@ -8,8 +8,13 @@
   The elimination rule for ∀ (for all) is application, and introduction
   is through lambda-abstraction."

-  (:require [latte.core :as latte :refer [definition defthm proof forall exist
+  (:refer-clojure :exclude [and or not])
+
+  (:require [latte.core :as latte :refer [definition defthm defaxiom proof forall exist
                                           assume have]])
+
+  (:require [latte.prop :as p :refer [and]])
+  (:require [latte.equal :as eq :refer [equal]])
   )

@@ -69,3 +74,54 @@
                    A)) :discharge [A (c)])
     (qed d)))

+(definition single
+  "The constraint that \"there exists at most\"..."
+  [[T :type] [P (==> T :type)]]
+  (forall [x y T]
+    (==> (P x)
+         (P y)
+         (equal T x y))))
+
+(definition unique
+  "The constraint that \"there exists a unique\" ..."
+  [[T :type] [P (==> T :type)]]
+  (and (ex T P)
+       (single T P)))
+
+(defaxiom the
+  "The unique element descriptor.
+
+  `(the T P u)` defines the unique inhabitant of type
+ `T` satisfying the predicate `P`. This is provided
+ thanks to the uniqueness proof `u`."
+  [[T :type] [P (==> T :type)] [u (unique T P)]]
+  T)
+
+(defaxiom the-prop
+  "The property of the unique element descriptor."
+  [[T :type] [P (==> T :type)] [u (unique T P)]]
+  (P (the T P u)))
+
+(defthm the-lemma
+  "The unique element is ... unique."
+  [[T :type] [P (==> T :type)] [u (unique T P)]]
+  (forall [y T]
+    (==> (P y)
+         (equal T y (the T P u)))))
+
+(proof the-lemma :script
+  (have a (single T P) :by ((p/and-elim-right (ex T P)
+                                              (single T P)) u))
+  (have b (P (the T P u)) :by (the-prop T P u))
+  (assume [y T
+           Hy (P y)]
+    (have c (==> (P y)
+                 (P (the T P u))
+                 (equal T y (the T P u))) :by ((a) y (the T P u)))
+    (have d (equal T y (the T P u)) :by ((c) Hy (b)))
+    (have e _ :discharge [Hy (d)])
+    (have f _ :discharge [y (e)]))
+  (qed f))
+
+
+


Remove applicative validation related tests.

--- test/cats/applicative/validation_spec.cljc
+++ test/cats/applicative/validation_spec.cljc
@@ -1,136 +0,0 @@
-(ns cats.applicative.validation-spec
-  #?@(:cljs
-      [(:require [cljs.test :as t]
-                 [clojure.test.check]
-                 [clojure.test.check.generators :as gen]
-                 [clojure.test.check.properties :as prop :include-macros true]
-                 [cats.labs.test :as lt]
-                 [cats.builtin :as b]
-                 [cats.protocols :as p]
-                 [cats.applicative.validation :as validation]
-                 [cats.monad.either :as either]
-                 [cats.context :as ctx :include-macros true]
-                 [cats.core :as m :include-macros true])
-       (:require-macros [clojure.test.check.clojure-test :refer (defspec)])])
-  #?(:clj
-     (:require [clojure.test :as t]
-               [clojure.test.check.clojure-test :refer [defspec]]
-               [clojure.test.check :as tc]
-               [clojure.test.check.generators :as gen]
-               [clojure.test.check.properties :as prop]
-               [cats.labs.test :as lt]
-               [cats.builtin :as b]
-               [cats.protocols :as p]
-               [cats.applicative.validation :as validation]
-               [cats.monad.either :as either]
-               [cats.context :as ctx]
-               [cats.core :as m])))
-
-(t/deftest basic-operations-test
-  (t/is (= 42 (m/extract (validation/ok 42))))
-  (t/is (= {:foo "bar"} (m/extract (validation/fail {:foo "bar"})))))
-
-(t/deftest ideref-test
-  (t/is (= 1 @(validation/fail 1)))
-  (t/is (= 1 @(validation/ok 1))))
-
-(t/deftest predicates-test
-  (let [m1 (validation/ok 1)
-        m2 (validation/fail 42)]
-    (t/is (validation/validation? m1))
-    (t/is (validation/validation? m2))
-    (t/is (validation/ok? m1))
-    (t/is (validation/fail? m2))))
-
-(t/deftest either-conversion-test
-  (let [ok1    (validation/ok 42)
-        fail1  (validation/fail 42)
-        left1  (either/left 42)
-        right1 (either/right 42)]
-    (t/is (= (either/right 42) (validation/validation->either ok1)))
-    (t/is (= (either/left 42) (validation/validation->either fail1)))
-
-    (t/is (= (validation/ok 42) (validation/either->validation right1)))
-    (t/is (= (validation/fail 42) (validation/either->validation left1)))))
-
-(t/deftest foldable-test
-  (t/testing "Foldl"
-    (t/is (= (validation/ok 2)
-             (m/foldl #(m/pure (+ %1 %2)) 1 (validation/ok 1))))
-    (t/is (= 1
-             (m/foldl #(m/pure (+ %1 %2)) 1 (validation/fail)))))
-
-  (t/testing "Foldr"
-    (t/is (= (validation/ok 2)
-             (m/foldr #(m/pure (+ %1 %2)) 1 (validation/ok 1))))
-    (t/is (= 1
-             (m/foldr #(m/pure (+ %1 %2)) 1 (validation/fail))))))
-
-;; Generators
-
-(defn oks-of [g]
-  (gen/fmap validation/ok g))
-
-(def ok-gen
-  (oks-of gen/any))
-
-(def fail-gen
-  (gen/return (validation/fail [:oh-no])))
-
-(def validation-gen
-  (gen/one-of [ok-gen fail-gen]))
-
-(def vectors-gen
-  (gen/vector gen/any))
-
-;; Semigroup
-
-(defspec validation-semigroup 10
-  (lt/semigroup-associativity
-   {:ctx validation/context
-    :gen (oks-of (gen/not-empty vectors-gen))}))
-
-;; Monoid
-
-(defspec validation-monoid 10
-  (lt/monoid-identity-element
-   {:ctx   validation/context
-    :gen   (oks-of (gen/not-empty vectors-gen))
-    :empty (validation/fail [])}))
-
-;; Functor
-
-(defspec validation-first-functor-law 10
-  (lt/first-functor-law {:gen validation-gen}))
-
-(defspec validation-second-functor-law 10
-  (lt/second-functor-law
-   {:gen validation-gen
-    :f   str
-    :g   count}))
-
-;; Applicative
-
-(defspec validation-applicative-identity 10
-  (lt/applicative-identity-law
-   {:ctx validation/context
-    :gen validation-gen}))
-
-(defspec validation-applicative-homomorphism 10
-  (lt/applicative-homomorphism
-   {:ctx validation/context
-    :gen gen/any
-    :f   (constantly false)}))
-
-(defspec validation-applicative-interchange 10
-  (lt/applicative-interchange
-   {:ctx  validation/context
-    :gen  gen/int
-    :appf (validation/ok inc)}))
-
-(defspec validation-applicative-composition 10
-  (lt/applicative-composition
-   {:ctx  validation/context
-    :gen  gen/int
-    :appf (validation/ok inc)
-    :appg (validation/ok dec)}))


Wip test fix.

Wip test fix.

--- test/onyx/coordinator/single_peer_test.clj
+++ test/onyx/coordinator/single_peer_test.clj
@@ -143,34 +143,26 @@
          (let [event (<!! sync-spy)]
            (fact (:path event) => payload-node)))

-  (facts "It receives the task"
-         (let [task (:task (extensions/read-place sync payload-node))
-               state-path (extensions/resolve-node sync :peer-state (:id (extensions/read-place sync peer-node)))
-               state (extensions/dereference sync state-path)
-               peer-task (extensions/read-place sync (:task-node state))]
-           (= peer-task task)))
-
-  #_(facts "It receives the task"
-         (let [task (:task (extensions/read-place sync payload-node))
-               query '[:find ?task :in $ ?t-name :where
-                       [?task :task/name ?t-name]]]
-           (fact (:db/id task) => (ffirst (d/q query db task-name)))))
-
-  #_(facts "The peer is marked as :acking the task"
-           (let [query '[:find ?task :in $ ?t-name :where
-                         [?peer :peer/status :acking]
-                         [?peer :peer/task ?task]
-                         [?task :task/name ?t-name]]]
-             (fact (count (d/q query db task-name)) => 1)))
-
-  #_(facts "The payload node contains the other node paths"
-         (let [nodes (:nodes (extensions/read-place sync payload-node))]
-           (fact (into #{} (keys nodes)) =>
-                 #{:payload :ack :completion :status :catalog
-                   :workflow :peer :exhaust :seal})
-           (extensions/on-change sync (:status nodes) #(>!! status-spy %))
-           (extensions/on-change sync (:seal nodes) #(>!! seal-node-spy %))))
-
+  (let [task (:task (extensions/read-place sync payload-node))
+        state-path (extensions/resolve-node sync :peer-state (:id (extensions/read-place sync peer-node)))
+        state (extensions/dereference sync state-path)]
+
+    (fact "It receives the task"
+          (extensions/read-place sync (:task-node state)) => task)
+
+    (fact "The peer's state is :acking the task"
+          (:state state) => :acking)
+
+
+    (fact "The payload node contains the other node paths"
+          (fact (into #{} (keys (:nodes state)))
+                => #{:node/payload :node/ack :node/completion
+                     :node/status :node/catalog :node/workflow
+                     :node/peer :node/exhaust :node/seal}))
+
+    (extensions/on-change sync (:node/status (:nodes state)) #(>!! status-spy %))
+    (extensions/on-change sync (:node/seal (:nodes state)) #(>!! seal-node-spy %)))
+
   #_(facts "Touching the ack node triggers the callback"
          (let [nodes (:nodes (extensions/read-place sync payload-node))]
            (extensions/touch-place sync (:ack nodes))


Reading JENKINS_URL + (empty) calls for creating/deleting jobs and for restarting jobs

--- src/branch_handler/core.clj
+++ src/branch_handler/core.clj
@@ -12,6 +12,8 @@
 (def verbose false)
 (def port 3000)
 (def workdir "work")
+
+(def jenkins-url (System/getenv "JENKINS_URL"))

 (defn slurp-
     [filename]
@@ -87,6 +89,14 @@
               (fetch-mirror-repo workdir group reponame repository-url)
               (clone-mirror-repo workdir group reponame repository-url))))

+(defn start-jenkins-jobs
+    [action]
+)
+
+(defn create-or-delete-jenkins-job
+    [action]
+)
+
 (defn create-action-queue
     []
     (java.util.concurrent.LinkedBlockingQueue.))
@@ -97,6 +107,8 @@
         (when-let [action (.take actions-queue)] ; blocking operation
             (log/info "Started action for repository" action)
             (clone-or-fetch-mirror-repo action)
+            (create-or-delete-jenkins-job action)
+            (start-jenkins-jobs action)
             ; create-new-jenkins-jobs
             ; start-new-jobs
             (log/info "Finished action for repository" action)
@@ -135,7 +147,7 @@

 (defn api-call-handler
     [request]
-    (let [gitlab-info (parse-gitlab-info request)
+    (let [gitlab-info      (parse-gitlab-info request)
           repository-url   (-> gitlab-info :repository :url)
           repository-name  (-> gitlab-info :repository :name)
           repository-group (-> gitlab-info :project :namespace)
@@ -156,7 +168,8 @@
             (let [action {:action :clone-or-fetch-repository
                           :name  repository-name
                           :group repository-group
-                          :url   repository-url}]
+                          :url   repository-url
+                          :original-data gitlab-info}]
                  (new-action actions-queue action))) ; add new action into the queue that will serialize it
         ))

@@ -183,6 +196,7 @@
     "Entry point to the branch handler service server."
     [& args]
     (log/info "Started app on port" port)
+    (log/info "JENKINS_URL is set to" jenkins-url)
     (start-action-consumer actions-queue)
     (start-server ring-app port))


(PDB-4599) Don't spam log with HTTP request received

In active installs, this makes the startup logs (especially migration
progress logs), nearly unreadable because the vast majority of the lines
are this message.

The 503 error code can also be found in the puppetdb_access.log to
monitor declined HTTP requests.

--- src/puppetlabs/puppetdb/pdb_routing.clj
+++ src/puppetlabs/puppetdb/pdb_routing.clj
@@ -27,7 +27,6 @@
 (defn maint-mode-handler [maint-mode-fn]
   (fn [req]
     (when (maint-mode-fn)
-      (log/info (trs "HTTP request received while in maintenance mode"))
       {:status 503
        :body (tru "PuppetDB is currently down. Try again later.")})))


(maint) workaround postgresql bug #15865

PostgreSQL 9.6.14 introduced a bug:

BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist

See: https://www.postgresql.org/message-id/15865-17940eacc8f8b081%40postgresql.org

This will make any ALTER TABLE statement only affect a single column per
statement.

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1275,9 +1275,12 @@
           "  FROM edges e"
           "  INNER JOIN certnames c ON e.certname = c.certname")
      (str "ALTER TABLE edges_transform"
-          "  ALTER COLUMN certname SET NOT NULL,"
-          "  ALTER COLUMN source SET NOT NULL,"
-          "  ALTER COLUMN target SET NOT NULL,"
+          "  ALTER COLUMN certname SET NOT NULL")
+     (str "ALTER TABLE edges_transform"
+          "  ALTER COLUMN source SET NOT NULL")
+     (str "ALTER TABLE edges_transform"
+          "  ALTER COLUMN target SET NOT NULL")
+     (str "ALTER TABLE edges_transform"
           "  ALTER COLUMN type SET NOT NULL")
      (str "DROP TABLE edges")
      (str "ALTER TABLE edges_transform RENAME TO edges")
@@ -1452,13 +1455,21 @@
 (defn varchar-columns-to-text []
   (jdbc/do-commands
     "alter table reports
-     alter column puppet_version type text,
+     alter column puppet_version type text"
+
+    "alter table reports
      alter column configuration_version type text"

     "alter table resource_events
-     alter column status type text,
-     alter column property type text,
-     alter column containing_class type text,
+     alter column status type text"
+
+    "alter table resource_events
+     alter column property type text"
+
+    "alter table resource_events
+     alter column containing_class type text"
+
+    "alter table resource_events
      alter column file type text"))

 (def migrations


clearing debug

clearing debug

--- src/celestial/workflows.clj
+++ src/celestial/workflows.clj
@@ -77,7 +77,6 @@
   "Deletes a system"
   [{:keys [system-id machine] :as spec}]
   (let [vm (vconstruct spec)]
-    (debug (.status vm))
     (when (.status vm)
       (.stop vm)
       (.delete vm))


formatting

formatting

--- src/chat/server/handler.clj
+++ src/chat/server/handler.clj
@@ -114,7 +114,9 @@
   (->
     (routes
       (wrap-defaults
-        (routes sync-routes api-routes)
+        (routes
+          api-routes
+          sync-routes)
         (-> api-defaults
             (assoc-in [:session :cookie-attrs :secure] (= (env :environment) "prod"))
             (assoc-in [:session :store] session-store)))


Integration tests for gif

Integration tests for gif

--- test/vignette/http/integration_gif_test.clj
+++ test/vignette/http/integration_gif_test.clj
@@ -22,34 +22,35 @@
 (with-state-changes [(before :facts (start system-local default-port))
                      (after :facts (stop system-local))]

-  (let [response (client/get (format "http://localhost:%d/bucket/a/ab/chuck-large-animated.gif/revision/latest" default-port) {:as :byte-array, :accept "image/webp"})]
-    (:status response) => 200
-    (get (:headers response) "Surrogate-Key") => "936b19e79decb9240a0b65ff437ae5ea033c0f69"
-    (get (:headers response) "Content-Disposition") => "inline; filename=\"chuck-large-animated.webp\"; filename*=UTF-8''chuck-large-animated.webp"
-    (Integer/parseInt (get (:headers response) "Content-Length")) => (roughly 1405790 50)
-    (get (:headers response) "Connection") => "close"
-    (get (:headers response) "Cache-Control") => "public, max-age=31536000"
-    (get (:headers response) "Content-Type") => "image/webp"
-    (vec (:body response)) => (has-prefix riff-header)
-    (vec (:body response)) => (contains webp-header))
+  (facts :requests :thumbnail-integration :original
+                   (let [response (client/get (format "http://localhost:%d/bucket/a/ab/chuck-large-animated.gif/revision/latest" default-port) {:as :byte-array, :accept "image/webp"})]
+                     (:status response) => 200
+                     (get (:headers response) "Surrogate-Key") => "936b19e79decb9240a0b65ff437ae5ea033c0f69"
+                     (get (:headers response) "Content-Disposition") => "inline; filename=\"chuck-large-animated.webp\"; filename*=UTF-8''chuck-large-animated.webp"
+                     (Integer/parseInt (get (:headers response) "Content-Length")) => (roughly 1405790 50)
+                     (get (:headers response) "Connection") => "close"
+                     (get (:headers response) "Cache-Control") => "public, max-age=31536000"
+                     (get (:headers response) "Content-Type") => "image/webp"
+                     (vec (:body response)) => (has-prefix riff-header)
+                     (vec (:body response)) => (contains webp-header))

-  (let [response (client/get (format "http://localhost:%d/bucket/a/ab/chuck-large-animated.gif/revision/latest/scale-to-width/200" default-port) {:as :byte-array, :accept "image/webp"})]
-    (:status response) => 200
-    (get (:headers response) "Surrogate-Key") => "936b19e79decb9240a0b65ff437ae5ea033c0f69"
-    (get (:headers response) "Content-Disposition") => "inline; filename=\"chuck-large-animated.webp\"; filename*=UTF-8''chuck-large-animated.webp"
-    (Integer/parseInt (get (:headers response) "Content-Length")) => (roughly 183990 50)
-    (get (:headers response) "Connection") => "close"
-    (get (:headers response) "Cache-Control") => "public, max-age=31536000"
-    (get (:headers response) "Content-Type") => "image/webp"
-    (vec (:body response)) => (has-prefix riff-header)
-    (vec (:body response)) => (contains webp-header))
+         (let [response (client/get (format "http://localhost:%d/bucket/a/ab/chuck-large-animated.gif/revision/latest/scale-to-width/200" default-port) {:as :byte-array, :accept "image/webp"})]
+           (:status response) => 200
+           (get (:headers response) "Surrogate-Key") => "936b19e79decb9240a0b65ff437ae5ea033c0f69"
+           (get (:headers response) "Content-Disposition") => "inline; filename=\"chuck-large-animated.webp\"; filename*=UTF-8''chuck-large-animated.webp"
+           (Integer/parseInt (get (:headers response) "Content-Length")) => (roughly 183990 50)
+           (get (:headers response) "Connection") => "close"
+           (get (:headers response) "Cache-Control") => "public, max-age=31536000"
+           (get (:headers response) "Content-Type") => "image/webp"
+           (vec (:body response)) => (has-prefix riff-header)
+           (vec (:body response)) => (contains webp-header))

-  (let [response (client/get (format "http://localhost:%d/bucket/a/ab/chuck-large-animated.gif/revision/latest/scale-to-width/200" default-port) {:as :byte-array})]
-    (:status response) => 200
-    (get (:headers response) "Surrogate-Key") => "936b19e79decb9240a0b65ff437ae5ea033c0f69"
-    (get (:headers response) "Content-Disposition") => "inline; filename=\"chuck-large-animated.gif\"; filename*=UTF-8''chuck-large-animated.gif"
-    (Integer/parseInt (get (:headers response) "Content-Length")) => (roughly 519260 50)
-    (get (:headers response) "Connection") => "close"
-    (get (:headers response) "Cache-Control") => "public, max-age=31536000"
-    (get (:headers response) "Content-Type") => "image/gif"
-    (vec (:body response)) => (contains gif-header)))+         (let [response (client/get (format "http://localhost:%d/bucket/a/ab/chuck-large-animated.gif/revision/latest/scale-to-width/200" default-port) {:as :byte-array})]
+           (:status response) => 200
+           (get (:headers response) "Surrogate-Key") => "936b19e79decb9240a0b65ff437ae5ea033c0f69"
+           (get (:headers response) "Content-Disposition") => "inline; filename=\"chuck-large-animated.gif\"; filename*=UTF-8''chuck-large-animated.gif"
+           (Integer/parseInt (get (:headers response) "Content-Length")) => (roughly 519260 50)
+           (get (:headers response) "Connection") => "close"
+           (get (:headers response) "Cache-Control") => "public, max-age=31536000"
+           (get (:headers response) "Content-Type") => "image/gif"
+           (vec (:body response)) => (contains gif-header))))


Fix sync! fn. WIP.

Fix sync! fn. WIP.

--- src/clj/geschichte/sync.clj
+++ src/clj/geschichte/sync.clj
@@ -62,23 +62,26 @@

 (defn subscribe [sub-ch bus-out out]
   (go-loop [{:keys [user repo] :as s} (<! sub-ch)]
-             (async/sub bus-out [user repo] out)
-             (println "subscribed: " [user repo])
-             (recur (<! sub-ch))))
+           (async/sub bus-out [user repo] out)
+           (println "subscribed: " [user repo])
+           (recur (<! sub-ch))))

 (defn publish [pub-ch fetch-ch store bus-in out]
   (go-loop [{:keys [user meta] :as ps} (<! pub-ch)]
            (let [repo (:id meta)
                  nc (<! (new-commits! store meta (<! (-get-in store [user repo]))))]
-             (println "fetching" nc)
              (>! out {:type :fetch
                       :ids nc})
-             (doseq [[repo-id val] (:fetched (<! fetch-ch))]
-               (<! (-assoc-in store [repo-id] val)))
-             (<! (-update-in store [user repo] #(if % (update % meta) meta)))
-             (>! bus-in ps)
-             (println "published:" [user repo])
+             (let [fetched (<! fetch-ch)]
+               (doseq [[repo-id val] (:fetched fetched)]
+                 (<! (-assoc-in store [repo-id] val))))
+             ;; TODO find cleaner way to atomically update
+             (let [old-meta (<! (-get-in store [user repo]))
+                   up-meta (<! (-update-in store [user repo] #(if % (update % meta) meta)))]
+               (when (not= old-meta up-meta)
+                 (println "publishing:" [user repo])
+                 (>! bus-in ps)))
              (recur (<! pub-ch)))))

@@ -97,7 +100,7 @@
             sub-ch (chan)
             fetch-ch (chan)]
         (async/sub p :new-meta sub-ch false)
-        (subscribe sub-ch bus-out (print-chan "SUBSOUT" out))
+        (subscribe sub-ch bus-out out #_(print-chan "SUBSOUT" out))

         (async/sub p :meta-up pub-ch false)
         (async/sub p :fetched fetch-ch false)
@@ -117,7 +120,6 @@
 (defn stop [state]
   ((get-in @state [:volatile :server])))

-#_(def mem-store (new-store))

 #_(stop peer-a)

@@ -144,64 +146,57 @@

 (defn sync! [peer stage]
-  (go (let [{:keys [type author chans new-values meta]} (<! (ensure-conn peer stage))
+  (go (let [{:keys [type author chans new-values meta] :as new-stage} (<! (ensure-conn peer stage))
             [in out] chans
             p (async/pub in :type)
             fch (chan)]

+        (async/sub p :fetch fch)
         (case type
           :meta-up (>! out {:type :meta-up :user author :meta meta})
           :new-meta (do
                       (>! out {:type :new-meta :user author :repo (:id meta)})
                       (>! out {:type :meta-up :user author :meta meta})))

-        (async/sub p :fetch fch)
         (let [to-fetch (select-keys new-values (:ids (<! fch)))]
           (>! out {:type :fetched
                    :fetched to-fetch}))

-        (dissoc stage :type :new-values))))
-
-
-#_(let [p (fake-peer mem-store)]
-    (go  (<! (sync!
-                       p
-                       (repo/new-repository "me@mail.com"
-                                            {:type "s" :version 1}
-                                            "Testing."
-                                            false
-                                            {:some 42})))
-      (println "pubz:" (<! (first (:chans (:volatile p)))))))
-
-
-(defn fake-peer [store]
-  (let [fake-id (str "FAKE" (rand-int 100))
-        in (print-chan (str fake-id "-IN"))
-        out (print-chan (str fake-id "-OUT")
-                        (async/pub in (fn [{:keys [user id]}] [user id])))]
-    {:volatile {:server nil
-                :chans [in out]
-                :store store}
-     :ip fake-id}))
+        (dissoc new-stage :type :new-values))))
+
+
+#_(def mem-store (new-store))
+#_(def peer (fake-peer mem-store))
+
+#_(go (let [peer (fake-peer mem-store)
+          new-stage (<! (sync! peer (repo/new-repository "me@mail.com"
+                                                         {:type "s" :version 1}
+                                                         "Testing."
+                                                         false
+                                                         {:some 42})))
+          in (first (:chans new-stage))]
+
+      (println "publication:" (<! in))))
+

 #_(let [in (chan)
       out (chan)
-      peer (fake-peer mem-store)
       p (async/onto-chan out [{:type :new-meta
-
                                :user "john" :repo 1}
-                              #_{:type :publish
-                                 :user "maria" :repo 3 :meta {:win :ning}}
+                              #_{:type :publish :user "maria" :repo 3 :meta {:win :ning}}
                               #_{:type :subscribe
                                  :user "maria" :repo 3}
                               {:type :meta-up
                                :user "john" :meta {:id 1
                                                    :causal-order {1 #{}
                                                                   2 #{1}}
-                                                   :last-update (java.util.Date.)}}]
+                                                   :last-update (java.util.Date. 0)
+                                                   :schema {:type ::geschichte
+                                                            :version 1}}}]
                          false)]
-  (go (wire peer [in out]))
+    (go (wire peer [in out])
+        (<! p))

   (go-loop [i (<! in)]
            (println "received:" i)
@@ -209,6 +204,17 @@
                                              2 42
                                              3 43}})
            (recur (<! in))))
+
+
+(defn fake-peer [store]
+  (let [fake-id (str "FAKE" (rand-int 100))
+        in (chan) #_(print-chan (str fake-id "-IN"))
+        out (async/pub in (fn [{:keys [user meta]}] [user (:id meta)]))
+        #_(print-chan (str fake-id "-OUT"))]
+    {:volatile {:server nil
+                :chans [in out]
+                :store store}
+     :ip fake-id}))

 (defn realize-value [stage store eval-fn]


GM: Retrieve env variables from project profiles

--- src/clj/ona/viewer/main.clj
+++ src/clj/ona/viewer/main.clj
@@ -8,19 +8,19 @@

 (def app
   (do
-    (log/start! "/dev/stdout")
+    (log/start! (env :stdout))
     routes/ona-viewer))

 (def app-production
   (do
-    (log/start! "/var/log/ona-viewer/current")
+    (log/start! (env :file))
     routes/ona-viewer))

 (defn start [port]
   (ring/run-jetty app-production {:port port
                                   :join? false
-                                  :min-threads 10
-                                  :max-threads 80}))
+                                  :min-threads (env :jetty-min-threads)
+                                  :max-threads (env :jetty-max-threads)}))

 (defn -main []
   (let [port (Integer. (or (System/getenv "PORT") "8080"))]


Add http request example

Add http request example

--- src/clj_gatling/example.clj
+++ src/clj_gatling/example.clj
@@ -1,11 +1,16 @@
-(ns clj-gatling.example)
+(ns clj-gatling.example
+  (:require [org.httpkit.client :as http]))

 (defn run-request [id]
   ;(println (str "Simulating request for " id))
   (Thread/sleep (rand 1000))
   (> 0.7 (rand 1)))

+(defn http-request [url id]
+  (let [{:keys [status headers body error] :as resp} @(http/get url)]
+    (= 200 status)))
+
 (def test-scenario
   {:name "Test scenario"
    :requests [{:name "Request1" :fn run-request}
-              {:name "Request2" :fn run-request}]})
+              {:name "GoogleRequest" :fn (partial http-request "http://www.google.fi")}]})


Add dato update-state* methods

Add dato update-state* methods

--- src/cljs/dato/lib/core.cljs
+++ src/cljs/dato/lib/core.cljs
@@ -389,6 +389,16 @@
   (set-state-nr! owner map)
   (om/refresh! owner))

+(defn update-state! [owner f]
+  (let [current-state (get-state owner)
+        new-state     (f (dsu/touch+ current-state))]
+    (set-state! owner new-state)))
+
+(defn update-state-nr! [owner f]
+  (let [current-state (get-state owner)
+        new-state     (f (dsu/touch+ current-state))]
+    (set-state-nr! owner new-state)))
+
 (defn unmount! [owner]
   (let [conn (conn (om/get-shared owner [:dato]))
         eid  (dato-node-id owner)]


Factorization

Factorization

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -173,25 +173,28 @@
 ;; ARTIFICIAL INTELLIGENCE
 ;; -----------------------------------------

+(defn- best-immediate-move-with
+  "Return the move with the highest immediate score increase:
+   * For the provided player
+   * And with move scope limitation"
+  [game player move-filter]
+  (apply max-key
+    #(transduce
+       (comp
+         (filter move-filter)
+         (map (comp count :taken)))
+       + (second %))
+    (get-in game [:moves player])))
+
 (defn best-immediate-move
   "Return the move with the highest immediate score increase for the provided player"
   [game player]
-  (apply max-key
-    (fn [[_ v]]
-      (transduce (map (comp count :taken)) + v))
-    (get-in game [:moves player])))
+  (best-immediate-move-with game player identity))

 (defn worst-immediate-loss
   "Return the next game move that would reduce the score the most for the provided player"
   [game player]
-  (apply max-key
-    (fn [[_ v]]
-      (transduce
-        (comp
-          (filter #(= player (:looser %)))
-          (map (comp count :taken)))
-        + v))
-    (get-in game [:moves (:player game)])))
+  (best-immediate-move-with game (:player game) #(= player (:looser %))))

 ;; -----------------------------------------


Create confirm modal if there available moves

--- src/cljs/zetawar/views.cljs
+++ src/cljs/zetawar/views.cljs
@@ -162,7 +162,10 @@
      ;; TODO: make link red
      [:a {:href "#" :on-click (fn [e]
                                 (.preventDefault e)
-                                (dispatch [::events.ui/end-turn]))}
+                                (if @(subs/available-moves-left? conn)
+                                  (if (js/confirm (translate :end-turn-alert))
+                                    (dispatch [::events.ui/end-turn]))
+                                  (dispatch [::events.ui/end-turn])))}
       (translate :end-turn-link)]
      (when show-copy-link
        [:span " · " [copy-url-link view-ctx]])


updating doc strings for background and against-background

--- src/midje/sweet.clj
+++ src/midje/sweet.clj
@@ -30,8 +30,8 @@
 (defmacro background
   "Runs facts against setup code which is run before, around, or after
    :contents, :facts or :checks. Optionally, contains one or more provided forms
-   that apply for all facts run within the against-background form.
-   Runs against the rest of the file."
+   that apply for all facts until the end of the file.
+   All effects of `background` last until the end of the file."
   [& forms]
   (when (user-desires-checking?)
     (put-wrappers-into-effect (background/background-wrappers forms))))
@@ -40,7 +40,7 @@
   "Runs facts against setup code which is run before, around, or after
    :contents, :facts or :checks. Optionally, contains one or more provided forms
    that apply for all facts run within the against-background form.
-   Runs against the code it surrounds."
+   All effects of `against-background` last until the end of the scope it surrounds."
   [background-forms & foreground-forms]
   (if (user-desires-checking?)
     (midjcoexpand `(against-background ~background-forms ~@foreground-forms))


fix get-post-options

fix get-post-options

--- src/misaki/core.clj
+++ src/misaki/core.clj
@@ -31,7 +31,7 @@
 (defn get-post-options
   "Get post's template options from post file(java.io.File)"
   [#^File file]
-  (->> (.getName file) (str *post-dir*) slurp parse-template-options))
+  (->> file io/reader slurp parse-template-options))

 ; =get-content
 (defn get-content


export added

export added

--- src/NoteHub/views/pages.clj
+++ src/NoteHub/views/pages.clj
@@ -73,18 +73,22 @@
                         [:div#preview-start-line.hidden]
                         [:article#preview]))

-(defn get-article-page [theme [[year month day] :as date] title]
-         (let [post (get-note date title)
-               title (-?> post (split #"\n") first (sreplace #"[_\*#]" ""))]
-           (if post
-             (common/layout {:theme theme} title [:article (md-to-html post)])
-             (status 404 ""))))
+(defn wrap [theme md-text]
+  (let [title (-?> md-text (split #"\n") first (sreplace #"[_\*#]" ""))]
+  (common/layout {:theme theme} title [:article (md-to-html md-text)])))
+
+(defn get-md [[[year month day] :as date] title]
+         (let [post (get-note date title)]
+           (if post post (status 404 ""))))

 (defpage "/:year/:month/:day/:title/theme/:theme" {:keys [year month day title theme]}
-         (get-article-page theme [year month day] title))
+         (wrap theme (get-md [year month day] title)))

 (defpage "/:year/:month/:day/:title" {:keys [year month day title]}
-         (get-article-page :default [year month day] title))
+         (wrap :default (get-md [year month day] title)))
+
+(defpage "/:year/:month/:day/:title/export" {:keys [year month day title]}
+         (get-md [year month day] title))

 ; New Note Posting
 (defpage [:post "/post-note"] {:keys [draft session-key session-value]}


telinevoimistelu

telinevoimistelu

--- src/ontrail/nlp.clj
+++ src/ontrail/nlp.clj
@@ -40,7 +40,8 @@
                "Suunnistus" "suunnisti"
                "Sähly" "pelasi sählyä"
                "Tanssi" "tanssi"
-               "Tennis" "pelasi tennistä"
+               "Tennis" "pelasi tennistä"
+               "Telinevoimistelu" "telinevoimisteli"
                "Triathlon" "ui, pyöräili ja juoksi"
                "Uinti" "ui"
                "Vaellus" "vaelsi"


helper for moving doc to a team

helper for moving doc to a team

--- src/pc/admin/db.clj
+++ src/pc/admin/db.clj
@@ -87,3 +87,6 @@
             :let [cust (d/entity db cust-id)]]
       (log/infof "updating %s" (:cust/email cust))
       (update-user-from-sub cust))))
+
+(defn transfer-doc-to-team [doc team]
+  @(d/transact (pcd/conn) [[:db/add (:db/id doc) :document/team (:db/id team)]]))


Adds docstrings to handler functions.

Adds docstrings to handler functions.

--- src/tumblr_identity_manager/handler.clj
+++ src/tumblr_identity_manager/handler.clj
@@ -9,7 +9,8 @@
             [ring.util.response :as response]
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

-(defn json-200 [to-render]
+(defn json-200
+  "Returns a successful 200 (OK) message." [to-render]
   {:status 200
    :headers {"Content-Type" "text/json; charset=utf-8"
              "Cache-Control" "no-cache, no-store, must-revalidate"
@@ -18,29 +19,32 @@
    :body (cheshire/generate-string
           (util/kebab->camel to-render))})

-(defn json-404 []
+(defn json-404
+  "Return a 404 (Not Found) message." []
   {:status 404
    :headers {"Content-Type" "text/html; charset=utf-8"}
-   :body "Not found"})
+   :body "Not Found"})

 (defn link-children
   "Embeds maps in a parent that exists in vector v who references their :_id
   fields in sub-vector k." [col k v]
   (assoc col k (for [id (k col)]
-               (some (fn [m] (if (= (:_id m) id) m)) v))))
+                 (some #(if (= (:_id %) id) %) v))))

 (defn get-maps
-  "Simulates a function that goes to the database and grabs the specified table
-  and does something with it prior to returning it to the front end.  Here,
-  we're just assuming it's the identity table and only returning top-level
-  records, then manually splicing in the child records." [table]
+  "Simulates a function that goes to the datastore and grabs the specified
+  table and does something with it prior to returning it to the front end.
+  Here, we're just assuming it's the identity table and only returning
+  top-level records, then manually splicing in the child records." [table]
   (let [ref-ids (flatten (map #(concat (:headmates %) (:tuplas %)) table))]
     (->> (filter #(not (some #{(:_id %)} ref-ids)) table)
-      (map #(link-children % :headmates table))
-      (map #(link-children % :tuplas table)))))
+         (map #(link-children % :headmates table))
+         (map #(link-children % :tuplas table)))))

-(defn get-by-id [table id]
-  (some #(if (= (:_id %) (util/str->int id)) %) (get-maps table)))
+(defn get-by-id
+  "Simulates a function that goes to the datastore and retrieves a record of
+  matching id from the specified table." [table id]
+  (some #(when (= (:_id %) (util/str->int id)) %) (get-maps table)))

 (cc/defroutes app-routes
   (cc/GET "/identity" [] (json-200 (get-maps data/identities)))


implement run-phase-2 method for wgseq

implement run-phase-2 method for wgseq

--- src/aerobio/htseq/wgseq.clj
+++ src/aerobio/htseq/wgseq.clj
@@ -114,7 +114,7 @@
 (defn get-comparison-files-
   ([eid]
    (get-comparison-files- eid "ComparisonSheet.csv"))
-  ([eid comp-filename]
+  ([eid comp-filename & _]
    (let [samps (cmn/get-exp-info eid :samples)
          outs  (cmn/get-exp-info eid :out)
          refbase (cmn/get-exp-info eid :refs)
@@ -128,12 +128,29 @@
                        (fs/join refbase (str (refxref ref) ".gbk"))
                        (fs/join outs samp)])
                     compvec)]
+     (apply cmn/ensure-dirs (cons outs (mapv last quads)))
      quads)))

 (defmethod cmn/get-comparison-files :wgseq
   [_ & args]
   (apply get-comparison-files- args))

+
+(defn run-wgseq-comparison
+  "Run set of population and/or clones against reference seqs defined
+  by experiement designated by eid (experiment id) and the input
+  comparison sheet CSV comparison-file"
+  [eid recipient comparison-file get-toolinfo template]
+  (let [cfg (assoc-in template
+                      [:nodes :ph2 :args]
+                      [eid comparison-file :NA recipient])
+        cfgjob (future (cmn/flow-program cfg get-toolinfo :run true))]
+    cfgjob))
+
+(defmethod cmn/run-phase-2 :wgseq
+  [_ eid recipient get-toolinfo template]
+  (run-wgseq-comparison
+   eid recipient "ComparisonSheet.csv" get-toolinfo template))

 (comment


(sem-impl (empty? = true)) => {}

(sem-impl (empty? = true)) => {}

--- src/babel/encyclopedia.cljc
+++ src/babel/encyclopedia.cljc
@@ -130,6 +130,7 @@
                              (log/debug (str "original call of sem-impl: (" (get-in input [:pred]) ")" (strip-refs input)))
                              input))]
     (cond
+      (empty? input) {}
       (= input :top) input
       (= input :fail) :fail
       true


Layer removal!

Layer removal!

--- frontend/src/cljs/frontend/core.cljs
+++ frontend/src/cljs/frontend/core.cljs
@@ -47,17 +47,32 @@
      [:option {:key (:key item)}
       (:label item)])])

+(defn rand-id []
+    (let [chars (apply vector "abcdefghijklmnopqrstuvwxyz0123456789")
+                   num-chars (count chars)]
+           (apply str
+                         (take 8 (repeatedly #(get chars (rand-int num-chars)))))))
+
+(defn create-layer []
+  (let [new-layer (atom {:connectivity-type :fully-connected
+                         :neuron-count 3
+                         :neuron-type :sigmoid
+                         :id (rand-id)})]
+    (put! :layers (conj (get-state :layers) new-layer))))
+
+(defn remove-layer [layer]
+  (println "Removing " (:id @layer))
+
+  (put! :layers (filter #(not= (:id @%) (:id @layer)) (get-state :layers))))
+
 (defn neuron-config [layer]
   [:div
    [selection-list layer :neuron-type neuron-types]
    [selection-list layer :connectivity-type connectivity-types]
-   [atom-input layer :neuron-count "number"]])
-
-(defn create-layer []
-  (put! :layers (conj (get-state :layers)
-                      (atom {:connectivity-type :fully-connected
-                             :neuron-count 3
-                             :neuron-type :sigmoid}))))
+   [atom-input layer :neuron-count "number"]
+   [:div (@layer :id)]
+   [:button {:on-click #(remove-layer layer)}
+    "x"]])

 (defn main-page []
   (let [training-data (atom "[]")
@@ -68,6 +83,7 @@
        [:button {:on-click create-layer}
         "Create new layer."]
        [:p "Layers:" (for [layer (get-state :layers)]
+
                        (neuron-config layer))]])))
 ;; -------------------------
 ;; Initialize app


:bug: Check data type when reading d&d data

--- frontend/src/uxbox/util/dom/dnd.cljs
+++ frontend/src/uxbox/util/dom/dnd.cljs
@@ -8,6 +8,7 @@
 (ns uxbox.util.dom.dnd
   "Drag & Drop interop helpers."
   (:require
+    [cuerdas.core :as str]
     [uxbox.util.data :refer (read-string)]
     [uxbox.util.transit :as t]))

@@ -77,7 +78,10 @@
    (get-data e "uxbox/data"))
   ([e data-type]
    (let [dt (.-dataTransfer e)]
-     (t/decode (.getData dt data-type)))))
+     (if (or (str/starts-with? data-type "uxbox")
+             (= data-type "application/json"))
+       (t/decode (.getData dt data-type))
+       (.getData dt data-type)))))

 (defn get-files
   [e]


One last class-name

One last class-name

--- src/cljs/wombats_web_client/components/chat_box.cljs
+++ src/cljs/wombats_web_client/components/chat_box.cljs
@@ -57,7 +57,7 @@
                             element.scrollHeight)
                      0))

-    [:ul {:class-name "chat-box-message-container"}
+    [:ul.chat-box-message-container
      (if (pos? (count messages))
        (for [[index {:keys [username
                             message


Cosmetics

Cosmetics

--- demo/sitetools/core.cljs
+++ demo/sitetools/core.cljs
@@ -18,8 +18,7 @@
   {:pre [(satisfies? ISwap a)
          (ifn? f)]}
   (if a.rswapping
-    (-> (or a.rswapfs
-            (set! a.rswapfs (array)))
+    (-> (or a.rswapfs (set! a.rswapfs (array)))
         (.push #(apply f % args)))
     (do (set! a.rswapping true)
         (try (swap! a (fn [state]
@@ -138,7 +137,7 @@
     (r/render-to-static-markup
      [:html
       [:head
-       [:meta {:charset "utf-8"}]
+       [:meta {:charset 'utf-8}]
        [:meta {:name 'viewport
                :content "width=device-width, initial-scale=1.0"}]
        [:base {:href (prefix "" (:page-name page-conf))}]
@@ -155,7 +154,7 @@
   (let [b (:body conf)
         _ (assert (vector? b))
         bhtml (r/render-component-to-string b)]
-    (str "<!doctype html>"
+    (str "<!doctype html>\n"
          (html-template (assoc conf
                                :page-conf {:page-name page-name}
                                :body-html bhtml)))))


Comma delimitted growth values.

Comma delimitted growth values.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -98,11 +98,17 @@
         (str value " " currency-text)
         (str value)))))

+(defn value-output [value]
+  (cond
+    (integer? value) (format "%,d" (biginteger value))
+    (float? value) (str (format "%,d" (biginteger (Math/floor value))) "." (last (s/split (str value) #"\.")))
+    :else "0"))
+
 (defn- with-format [format-symbol value]
   (cond
-    (= format-symbol "%") (str value "%")
-    (not (nil? format-symbol)) (with-currency format-symbol value)
-    :else value))
+    (= format-symbol "%") (str (value-output value) "%")
+    (not (nil? format-symbol)) (with-currency format-symbol (value-output value))
+    :else (value-output value)))

 (defn- metric
   ([label value] (metric label value false))
@@ -183,7 +189,7 @@
 (defn- data-topic [snapshot topic-name topic topic-url]
   (let [currency (:currency snapshot)
         data? (seq (:data topic))
-        body? (s/blank? (:body topic))
+        body? (not (s/blank? (:body topic)))
         view-charts? (> (count (:data topic)) 1)]
     [:table {:class "row topic"}
       [:tr
@@ -192,13 +198,13 @@
           [:p {:class "topic-title"} (s/upper-case (:title topic))]
           (spacer 1)
           [:p {:class "topic-headline"} (:headline topic)]
-          (when data? (spacer 15))
+          (when body? (spacer 2))
+          (when body? (:body topic))
+          (when data? (spacer 20))
           (when data?
             (if (= topic-name "finances")
               (finance-metrics topic currency)
               (growth-metrics topic currency)))
-          (when body? (spacer 20))
-          (when body? [:p (:body topic)])
           (when view-charts? (spacer 20))
           (when view-charts? [:a {:class "topic-read-more", :href topic-url} "VIEW CHARTS"])
           (spacer 30)]


Remove duplicate spec for eip (#118)

Remove duplicate spec for eip (#118)

fixes: https://github.com/brabster/crucible/issues/117

--- src/crucible/aws/ec2.clj
+++ src/crucible/aws/ec2.clj
@@ -35,7 +35,6 @@

 (s/def ::allocation-id (spec-or-ref string?))
 (s/def ::subnet-id (spec-or-ref string?))
-(s/def ::eip string?)
 (s/def ::private-ip-address string?)

 (s/def ::eip-association (s/keys :opt [::allocation-id


temp change to test sentry configuration

--- src/open_company/app.clj
+++ src/open_company/app.clj
@@ -3,6 +3,7 @@
   (:gen-class)
   (:require
     [liberator.dev :refer (wrap-trace)]
+    [raven-clj.core :as raven]
     [raven-clj.ring :refer (wrap-sentry)]
     [ring.middleware.reload :refer (wrap-reload)]
     [ring.middleware.cors :refer (wrap-cors)]
@@ -33,6 +34,14 @@
     cors-routes))

 (defonce app
+  ;; Temp test sentry config
+  (raven/capture c/dsn {
+    :message "Test Exception Message"
+    :tags {:version "0.0.1"}
+    :logger "main-logger"
+    :extra {
+      :my-key 1
+      :some-other-value "foo bar"}})
   ;; Use sentry middleware to report runtime errors if we have a raven DSN.
   (if c/dsn
     (wrap-sentry hot-reload-routes c/dsn)


routing dedup calls

routing dedup calls

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -103,7 +103,7 @@
     (to-vertex vertex-label where))))

 (defn from-dedup
-  ([edge-label vertex-label] (from edge-label vertex-label {}))
+  ([edge-label vertex-label] (from-dedup edge-label vertex-label {}))
   ([edge-label vertex-label where]
    (concat
     (from-edge edge-label)
@@ -111,7 +111,7 @@
     (from-vertex vertex-label where))))

 (defn to-dedup
-  ([edge-label vertex-label] (to edge-label vertex-label {}))
+  ([edge-label vertex-label] (to-dedup edge-label vertex-label {}))
   ([edge-label vertex-label where]
    (concat
     (to-edge edge-label)


make both on-server-sync and with-server-sync return the result of action-fn

--- src/overtone/sc/core.clj
+++ src/overtone/sc/core.clj
@@ -382,7 +382,7 @@

 (defn on-server-sync
   "Registers the handler to be executed when all the osc messages generated
-   by executing the action-fn have completed."
+   by executing the action-fn have completed. Returns result of action-fn."
   [action-fn handler-fn]
   (let [id (update-server-sync-id)]
     (on-event "/synced" (uuid)
@@ -390,11 +390,14 @@
                          (do
                            (handler-fn)
                            :done))))
-    (action-fn)
-    (snd "/sync" id)))
+
+    (let [res (action-fn)]
+      (snd "/sync" id)
+      res)))

 (defn with-server-sync
-  "Blocks current thread until all osc messages in action-fn have completed"
+  "Blocks current thread until all osc messages in action-fn have completed.
+  Returns result of action-fn."
   [action-fn]
   (let [id (update-server-sync-id)
         prom (promise)]
@@ -403,9 +406,10 @@
                          (do
                            (deliver prom true)
                            :done))))
-    (action-fn)
-    (snd "/sync" id)
-    (await-promise! prom)))
+    (let [res (action-fn)]
+      (snd "/sync" id)
+      (await-promise! prom)
+      res)))

 (defn stop


Update comments in dev namespace to explain the hackery

--- src/clj/chocolatier/dev.clj
+++ src/clj/chocolatier/dev.clj
@@ -11,8 +11,14 @@
 (defn connect-to-brepl [repl-env]
   (brepl/cljs-repl repl-env))

+;; HACK This circumvents the need to have clojure.browser.repl
+;; required by a compiled js file. Otherwise it causes race conditions
+;; and may not load the brepl at all after the page is loaded.

-;; HACK to get access to repl client js
+;; After reading through the austin source code we see that the server
+;; <session-id>repl/start url always works and it always has a script
+;; tag before the browser repl js that looks like all the goog code
+;; for dependencies. Having goog present fixes it all up.
 (defn repl-client-js [session-id]
   (if-let [session (get (deref @#'aus/sessions) session-id)]
     (slurp @(:client-js session))


Added simple boot task.

Added simple boot task.

--- src/clj/io/cogitat/boot.clj
+++ src/clj/io/cogitat/boot.clj
@@ -1,6 +1,9 @@
 (ns io.cogitat.boot
-  (:require [boot.task :as task]))
+  (:require [boot.core :refer [deftask]]))

-(deftask []
-  )
+(deftask foo [boot]
+  (fn [continue]
+    (fn [event]
+      (println "Hello, boot!")
+      (continue event))))


Partial implementation of cannon

Partial implementation of cannon

--- src/clj/minijava/cannon.clj
+++ src/clj/minijava/cannon.clj
@@ -42,11 +42,34 @@
   )
  )

+ (defmethod cannon :minijava.ir/ExpSeq
+  [x]
+ 	(let ( (stms  cannon (:seqs x))
+ 				(b (cannon (:exp x))))
+ 			(ExpSeq (seq stms (:stm b)) (:exp b)))
+ 	)
+
+ (defmethod cannon :minijava.ir/ExpSeq
+  [x]
+ 	(reorder x)
+ )
+
  (defmethod cannon :default
   [x]
  	(reorder x)
  )

+
+  static ESEQ do_exp(ESEQ e) {
+		IRStm stms = do_stm(e.stm);
+		ESEQ b = do_exp(e.exp);
+		return new ESEQ(seq(stms,b.stm), b.exp);
+	}
+
+	static ESEQ do_exp (IRExp e) {
+		if (e instanceof ESEQ) return do_exp((ESEQ)e);
+		else return reorder_exp(e);
+	}

 (defn reorderExpCall [x]


leave doc display preference as was in subsequent sdoc invocations

--- src/clj_ns_browser/sdoc.clj
+++ src/clj_ns_browser/sdoc.clj
@@ -44,8 +44,7 @@
               (invoke-soon (selection! ns-cbx "loaded"))
               (invoke-soon (selection! ns-lb ns1))
               (invoke-soon (selection! vars-cbx "publics"))
-              (invoke-soon (selection! vars-lb name1))
-              (invoke-soon (selection! doc-cbx "Doc")))
+              (invoke-soon (selection! vars-lb name1)))
             (if (find-ns (symbol name1))
               ;; should be namespace
               (do


Use VCFv4.3 as a default file format version of BCF

--- src/cljam/io/bcf/writer.clj
+++ src/cljam/io/bcf/writer.clj
@@ -22,6 +22,7 @@
   (write-variants [this variants]
     (write-variants this variants)))

+(def ^:private ^:const default-fileformat "VCFv4.3")
 (def ^:private ^:const bcf-meta-keys
   [:fileformat :file-date :source :reference :contig :phasing :info :filter
    :format :alt :sample :pedigree])
@@ -86,8 +87,11 @@
        (WRITING-BCF))"
   [f meta-info header]
   (let [bos (bgzf/bgzf-output-stream f)
-        dos (DataOutputStream. bos)]
-    (doto (BCFWriter. (util/as-url f) (index-meta meta-info) header dos)
+        dos (DataOutputStream. bos)
+        indexed-meta (->> meta-info
+                          (merge {:fileformat default-fileformat})
+                          index-meta)]
+    (doto (BCFWriter. (util/as-url f) indexed-meta header dos)
       (write-file-header))))

 (defn- value-type