thru rm_case_pmda_rpt_version

thru rm_case_pmda_rpt_version

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -1567,6 +1567,123 @@
               PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
           ); " }

+    { "rm_case_pmda_license"
+          "CREATE TABLE rm_case_pmda_license (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              LICENSE_ID numeric NOT NULL,
+              PROD_SEQ_NUM numeric NOT NULL,
+              LIC_CATEGORY_ID numeric,
+              REPORT_TYPE numeric,
+              RPT_CATEGORY_ID numeric,
+              CASE_COMPLETE numeric,
+              PMDA_NUMBER varchar(100),
+              INCOMPLETE_COMMENT text,
+              FUTURE_ACTIONS text,
+              FORM_2_MEMO text,
+              SENDER_COMMENT text,
+              DOWNGRADED numeric,
+              SERIOUS_DISEASE numeric,
+              SIGNIFICANT_CHANGE numeric,
+              EFFECTIVENESS numeric,
+              PROBLEM_DESC text,
+              SORT_ID numeric,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_pmda_lic_studies"
+          "CREATE TABLE rm_case_pmda_lic_studies (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              LICENSE_ID numeric NOT NULL,
+              STUDIES text,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,LICENSE_ID,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_pmda_mgmt_num"
+          "CREATE TABLE rm_case_pmda_mgmt_num (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              PROD_SEQ_NUM numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              RECEIVED_DATE timestamp,
+              ACK_BRANCH_NUMBER varchar(8),
+              REG_BRANCH_NUMBER varchar(8),
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,PROD_SEQ_NUM,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_pmda_notes"
+          "CREATE TABLE rm_case_pmda_notes (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              REMARK1 text,
+              REMARK2 text,
+              REMARK3 text,
+              REMARK4 text,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_pmda_reportability"
+          "CREATE TABLE rm_case_pmda_reportability (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              PROD_SEQ_NUM numeric NOT NULL,
+              EVENT_SEQ_NUM numeric NOT NULL,
+              LICENSE_ID numeric NOT NULL,
+              LISTEDNESS numeric,
+              REPORTABILITY numeric,
+              TIMEFRAME numeric,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,PROD_SEQ_NUM,EVENT_SEQ_NUM,LICENSE_ID,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_pmda_rpt_version"
+          "CREATE TABLE rm_case_pmda_rpt_version (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              REVISION numeric NOT NULL,
+              LAST_UPDATE_TIME timestamp,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,REVISION,DLP_REVISION_NUMBER)
+          ); " }
+
   ] ))

 (def dummy


added thru rm_case_followup

added thru rm_case_followup

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -333,6 +333,599 @@
               PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
           ); " }

+    { "rm_case_company_cmts"
+          "CREATE TABLE rm_case_company_cmts (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              DELETED timestamp,
+              COMMENT_TXT text,
+              COMMENT_TXT_J text,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_contact_log"
+          "CREATE TABLE rm_case_contact_log (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              CONTACT_DATE timestamp,
+              CONTACT_TYPE numeric,
+              DESCRIPTION varchar(1000),
+              USER_ID numeric,
+              DATE_SENT timestamp,
+              SORT_ID numeric,
+              CODE numeric,
+              GROUP_ID numeric,
+              LAM_ID numeric(10),
+              LAM_CONTACT_LOG_ID numeric(10),
+              DESCRIPTION_J varchar(1000),
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          );
+          " }
+
+    { "rm_case_death"
+          "CREATE TABLE rm_case_death (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              DEATH_DATE timestamp,
+              AUTOPSY numeric,
+              DEATH_DATE_RES numeric,
+              DEATH_DATE_PARTIAL varchar(20),
+              DETERMINE_AUTOPSY varchar(250),
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_death_details"
+          "CREATE TABLE rm_case_death_details (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              SORT_ID numeric,
+              TERM_TYPE numeric,
+              CAUSE_REPTD varchar(1000),
+              CAUSE_CODED varchar(1000),
+              CAUSE varchar(1000),
+              CAUSE_CODE varchar(50),
+              CAUSE_LLT varchar(250),
+              CAUSE_LLT_CODE varchar(50),
+              CAUSE_HLT varchar(250),
+              CAUSE_HLT_CODE varchar(50),
+              CAUSE_HLGT varchar(250),
+              CAUSE_HLGT_CODE varchar(50),
+              CAUSE_SOC varchar(250),
+              CAUSE_SOC_CODE varchar(50),
+              CAUSE_SYN_CODE numeric,
+              CAUSE_DICT numeric,
+              CAUSE_CODE_STATUS numeric(3),
+              CAUSE_CODED_J varchar(1000),
+              CAUSE_SOC_J varchar(250),
+              CAUSE_CODE_STATUS_J numeric,
+              CAUSE_HLGT_J varchar(250),
+              CAUSE_HLT_J varchar(250),
+              CAUSE_J varchar(1000),
+              CAUSE_LLT_CODE_J varchar(50),
+              CAUSE_LLT_J varchar(250),
+              CAUSE_REPTD_J varchar(1000),
+              CAUSE_SYN_CODE_J numeric,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_device_prod_deliv"
+          "CREATE TABLE rm_case_device_prod_deliv (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              PROD_SEQ_NUM numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              PROD_DELIV_SEQ numeric,
+              DELETED timestamp,
+              TYPE numeric,
+              OTHER_MFG_PROD varchar(100),
+              OTHER_MFG_PROD_J varchar(100),
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,PROD_SEQ_NUM,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_dose_regimens"
+          "CREATE TABLE rm_case_dose_regimens (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              LOG_NO numeric NOT NULL,
+              START_DATETIME timestamp,
+              START_DATETIME_RES numeric,
+              STOP_DATETIME timestamp,
+              STOP_DATETIME_RES numeric,
+              ONGOING numeric,
+              OFF_LABEL numeric,
+              DOSE numeric(22,7),
+              DOSE_UNIT_ID numeric,
+              FREQ_ID numeric,
+              ADMIN_ROUTE_ID numeric,
+              DAILY_DOSE numeric(22,7),
+              DAILY_DOSE_UNIT_ID numeric,
+              EXP_DATE timestamp,
+              EXP_DATE_RES numeric,
+              TOTAL_REG_DOSE numeric(22,7),
+              TOT_REG_DOSE_UNIT_ID numeric,
+              SORT_ID numeric,
+              PARENT_SEQ_NUM numeric,
+              LOCATION_ID numeric,
+              DOSE_NO numeric,
+              PAR_ADMIN_ROUTE numeric,
+              EXP_DATE_PARTIAL varchar(20),
+              START_DATE_PARTIAL varchar(20),
+              STOP_DATE_PARTIAL varchar(20),
+              DOSE_DESCRIPTION varchar(100),
+              PACKAGE_ID varchar(20),
+              LOT_NO varchar(35),
+              PACK_UNITS numeric,
+              ACCIDENTAL_EXPOSURE numeric,
+              DELETED timestamp,
+              LOT_ID numeric,
+              LOT_JUST varchar(1000),
+              LOT_STATUS numeric(1),
+              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_DATE_1 timestamp,
+              UD_DATE_2 timestamp,
+              UD_DATE_3 timestamp,
+              UD_DATE_4 timestamp,
+              UD_DATE_5 timestamp,
+              UD_DATE_6 timestamp,
+              UD_DATE_7 timestamp,
+              UD_DATE_8 timestamp,
+              UD_DATE_9 timestamp,
+              UD_DATE_10 timestamp,
+              UD_DATE_11 timestamp,
+              UD_DATE_12 timestamp,
+              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),
+              DURATION_SECONDS numeric,
+              DOSE_DESCRIPTION_J varchar(100),
+              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),
+              LOT_JUST_J varchar(1000),
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              LAST_UPDATE_TIME timestamp,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              VAERS_BLOCK_10 numeric,
+              VAERS_BLOCK_14 numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,LOG_NO,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_eu_device"
+          "CREATE TABLE rm_case_eu_device (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              ACCESSORIES varchar(90),
+              VERSION varchar(40),
+              IDENTIFICATION varchar(90),
+              PREVIOUSLY_REPORTED numeric,
+              INCIDENT numeric,
+              COUNTRY varchar(1000),
+              EXPECTED_DATE timestamp,
+              EXPECTED_DATE_RES numeric,
+              EXPECTED_DATE_PARTIAL varchar(20),
+              PROJECTED_TIMING text,
+              PROJECTED_TIMING_FINAL text,
+              CORRECTIVE_ACTION_FINAL text,
+              INVESTIGATION_RESULT text,
+              FURTHER_INVESTIGATION text,
+              CURRENT_DEV_LOCATIONS text,
+              COUNTRIES_OF_DISTRIBUTION text,
+              DELETED timestamp,
+              CORRECTIVE_ACTION text,
+              DEVICE_PURCHASED varchar(120),
+              ADDRESS varchar(120),
+              DEVICE_STERILE numeric(1),
+              IMPORTER_NAME varchar(100),
+              IMPORTER_ADDRESS varchar(120),
+              IMPORTER_POSTCODE varchar(15),
+              IMPORTER_PHONE varchar(20),
+              IMPORTER_FAX varchar(50),
+              SEQ_NUM numeric NOT NULL,
+              PROD_SEQ_NUM numeric,
+              NCA_REF_NUM varchar(100),
+              INDENTIF text,
+              PATS_INVOLVED numeric,
+              DEVS_INVOLVED numeric,
+              USER_FAC_REF varchar(20),
+              REMEDIAL_ACTION varchar(1000),
+              DEV_USAGE numeric,
+              OTHER varchar(15),
+              UPDATE_TO_REPORT numeric(1),
+              FINAL_REPORT numeric(1),
+              PUBLIC_THREAT numeric,
+              SIMILAR_INCIDENT_NUM numeric(3),
+              MANUFACTURER_COMMENTS text,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_event"
+          "CREATE TABLE rm_case_event (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              DESC_REPTD varchar(250),
+              DESC_CODED varchar(255),
+              DIAGNOSIS numeric,
+              ONSET timestamp,
+              ONSET_RES numeric,
+              ONSET_DELAY varchar(40),
+              STOP_DATE timestamp,
+              STOP_DATE_RES numeric,
+              DURATION varchar(40),
+              ONSET_LATENCY varchar(40),
+              EVT_INTENSITY_ID numeric,
+              EVT_FREQ_ID numeric,
+              TREATED numeric,
+              STUDY_RELATED numeric,
+              RECHALL_RELATED numeric,
+              PROD_SEQ_NUM numeric,
+              EVT_OUTCOME_ID numeric,
+              RECEIPT_DATE timestamp,
+              RPT_SERIOUS numeric,
+              SC_DEATH numeric,
+              SC_HOSP numeric,
+              SC_CONG_ANOM numeric,
+              SC_THREAT numeric,
+              SC_DISABLE numeric,
+              SC_INT_REQ numeric,
+              SC_OTHER numeric,
+              SC_OTHER_TEXT varchar(30),
+              ART_CODE varchar(30),
+              PREF_TERM varchar(250),
+              INC_TERM varchar(250),
+              BODY_SYS varchar(250),
+              MED_SERIOUS numeric,
+              PAST_HIST numeric,
+              DICT_ID numeric,
+              DICT_KEY varchar(20),
+              CODE_STATUS numeric,
+              SERIOUSNESS numeric,
+              SORT_ID numeric,
+              ONSET_DATE_PARTIAL varchar(20),
+              STOP_DATE_PARTIAL varchar(20),
+              EFFICACY numeric,
+              DISEASE numeric,
+              WITHDRAWAL numeric,
+              HLGT varchar(250),
+              HLT varchar(250),
+              HLT_CODE varchar(30),
+              HLGT_CODE varchar(30),
+              SOC_CODE varchar(30),
+              STUDY_DROPPED numeric(4),
+              INC_CODE varchar(30),
+              ONSET_MINUTES numeric,
+              DELAY_MINUTES numeric,
+              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_DATE_1 timestamp,
+              UD_DATE_2 timestamp,
+              UD_DATE_3 timestamp,
+              UD_DATE_4 timestamp,
+              UD_DATE_5 timestamp,
+              UD_DATE_6 timestamp,
+              UD_DATE_7 timestamp,
+              UD_DATE_8 timestamp,
+              UD_DATE_9 timestamp,
+              UD_DATE_10 timestamp,
+              UD_DATE_11 timestamp,
+              UD_DATE_12 timestamp,
+              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 text,
+              DETAILS_J text,
+              SYN_CODE numeric,
+              DELETED timestamp,
+              STUDY_RELATED_REPTD numeric(1),
+              DURATION_UNIT_E2B numeric,
+              ONSET_LATENCY_UNIT_E2B numeric,
+              ONSET_DELAY_UNIT_E2B numeric,
+              DURATION_SECONDS numeric,
+              ONSET_LATENCY_SECONDS numeric,
+              ONSET_DELAY_SECONDS numeric,
+              BODY_SYS_J varchar(250),
+              CODE_STATUS_J numeric,
+              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),
+              REPORT_EXCLUSION numeric,
+              REPORTABLE numeric,
+              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),
+              SYN_CODE_J numeric,
+              INFECTION numeric,
+              RPT_EXCLUDE_CMT varchar(1000),
+              RPT_EXCLUDE_CMT_J varchar(1000),
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_event_assess"
+          "CREATE TABLE rm_case_event_assess (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              EVENT_SEQ_NUM numeric NOT NULL,
+              PROD_SEQ_NUM numeric NOT NULL,
+              DATASHEET_ID numeric NOT NULL,
+              LICENSE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              UPDATED timestamp,
+              DET_LISTEDNESS_ID numeric,
+              RPT_CAUSALITY_ID numeric,
+              DET_CAUSALITY_ID numeric,
+              LISTED_JUSTIFY varchar(1000),
+              CAUSE_JUSTIFY varchar(1000),
+              LAM_ASSESSED numeric(12),
+              DELETED timestamp,
+              CAUSALITY_ASSESSMENT varchar(50),
+              CAUSALITY_SCORE numeric,
+              SOURCE_ID numeric,
+              PRT_CAUSALITY_ID numeric,
+              CAUSE_JUSTIFY_J varchar(1000),
+              LISTED_JUSTIFY_J varchar(1000),
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              LAST_UPDATE_TIME timestamp,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,EVENT_SEQ_NUM,PROD_SEQ_NUM,DATASHEET_ID,LICENSE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_event_consequence"
+          "CREATE TABLE rm_case_event_consequence (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              ED_SEQ_NUM numeric NOT NULL,
+              EVT_CONSEQUENCE_ID numeric NOT NULL,
+              CONSEQUENCE varchar(100),
+              TERM varchar(250),
+              CONSEQUENCE_J varchar(100),
+              TERM_J varchar(250),
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_event_detail"
+          "CREATE TABLE rm_case_event_detail (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              PROD_SEQ_NUM numeric NOT NULL,
+              EVENT_SEQ_NUM numeric NOT NULL,
+              ONSET_DELAY varchar(40),
+              ONSET_DELAY_SECONDS numeric,
+              ONSET_LATENCY varchar(40),
+              ONSET_LATENCY_SECONDS numeric,
+              TOTAL_DOSE numeric(22,7),
+              TOTAL_DOSE_UNIT_ID numeric,
+              MOST_IMPORTANT numeric,
+              MORE_SPECIFIC numeric,
+              ACT_TAKEN_ID numeric,
+              OTHER_INFORMATION varchar(250),
+              DECHALLENGE numeric,
+              RECHALLENGE numeric,
+              OTHER_INFORMATION_J varchar(250),
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_event_imputability"
+          "CREATE TABLE rm_case_event_imputability (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              EVENT_SEQ_NUM numeric NOT NULL,
+              AGENT_SEQ_NUM numeric NOT NULL,
+              CHRONOLOGY varchar(4),
+              SEMIOLOGY varchar(4),
+              BIBLIOGRAPHY varchar(4),
+              IMPUTABILITY varchar(4),
+              DELETED timestamp,
+              TIME_TO_ONSET numeric,
+              READMINISTRATION numeric,
+              DRUG_STOPPED numeric,
+              SEMIOLOGY_OUTCOME numeric,
+              COMPLEMENTARY_TEST numeric,
+              OTHER_EXPLANATION numeric,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,EVENT_SEQ_NUM,AGENT_SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_event_nature"
+          "CREATE TABLE rm_case_event_nature (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              EVENT_SEQ_NUM numeric NOT NULL,
+              EVT_NATURE_ID numeric NOT NULL,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_event_product_rptblty"
+          "CREATE TABLE rm_case_event_product_rptblty (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              PROD_SEQ_NUM numeric NOT NULL,
+              EVENT_SEQ_NUM numeric,
+              REPORTABILITY numeric,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,PROD_SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_event_rech_prod"
+          "CREATE TABLE rm_case_event_rech_prod (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              EVENT_SEQ_NUM numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              PRODUCT_SEQ_NUM numeric,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,EVENT_SEQ_NUM,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_followup"
+          "CREATE TABLE rm_case_followup (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              RECEIPT_DATE timestamp,
+              SAFETY_DATE timestamp,
+              SIGNIFICANT numeric(1),
+              AUDITLOG_TYPE numeric,
+              TIME_STAMP timestamp,
+              DELETED timestamp,
+              SIGNIFICANT_DEVICE numeric(1),
+              DATA_CLEANUP numeric(1),
+              JUSTIFICATION varchar(1000),
+              JUSTIFICATION_ID numeric,
+              JUSTIFICATION_J varchar(1000),
+              JUST_RECEIPT_DATE_J varchar(1000),
+              RECEIPT_DATE_J timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
   ] ))

 (def dummy


add default scale to progress bar

add default scale to progress bar

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -74,7 +74,8 @@
     (.generateTexture box false)))

 (defn add-prog-bar [stage options]
-  (let [s (sprite/make-sprite (progress-texture 0 options))]
+  (let [s (sprite/make-sprite (progress-texture 0 options)
+                              :scale (get options :scale sprite/*default-scale*))]
     (set! (.-alpha s) 0)
     (.addChild stage s)
     s))


Last bit of hookup of weights in clustering code.

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -249,7 +249,7 @@
                     (clean-start-clusters data last-clusters k :weights weights)
                     (init-clusters data k))]
     (loop [clusters clusters iter max-iters]
-      (let [new-clusters (cluster-step data-iter k clusters)]
+      (let [new-clusters (cluster-step data-iter k clusters :weights weights)]
         (if (or (= iter 0) (same-clustering? clusters new-clusters))
           new-clusters
           (recur new-clusters (dec iter)))))))


Revert "cast repness to double"

Revert "cast repness to double"

This reverts commit da0fb9198cdfc0843c852aa95ddefe8139328ce9.

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -99,7 +99,7 @@
               (/ up not-up)))]
     (let [in-cols  (columns (:matrix in-part))
           out-cols (columns (:matrix out-part))]
-      (map #(double (/ (frac-up %1) (frac-up %2))) in-cols out-cols))))
+      (map #(/ (frac-up %1) (frac-up %2)) in-cols out-cols))))

 (defn conv-repness [data clusters]


include :proj in math_main output

include :proj in math_main output

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -47,6 +47,7 @@
                                :n
                                :n-cmts
                                :pca
+                               :proj
                                :repness
                                :consensus
                                :zid


fix: missing auth for create-comment in composite pr action

--- src/github_bot_app/action/composite_pr.clj
+++ src/github_bot_app/action/composite_pr.clj
@@ -35,7 +35,8 @@
          (gh-issues/create-comment
           owner repo pull-id
           (str "This pull request includes pull requests "
-               (str/join ", " pr-strs))))
+               (str/join ", " pr-strs))
+          (:auth-options config)))
         (log/info (pr-str {:api-call :create-comment
                            :number pull-id
                            :info :composite-pr}))))))


Don't try to unmount on error

Don't try to unmount on error

React gets very confused when there are errors...

--- src/reagent/impl/util.cljs
+++ src/reagent/impl/util.cljs
@@ -108,8 +108,8 @@
   ;; If render throws, React may get confused, and throw on
   ;; unmount as well, so try to force React to start over.
   (try
-    (.' js/React unmountComponentAtNode node)
-    (catch js/Object e
+    (.! node :innerHTML "")
+    (catch :default e
       (do (warn "Error unmounting:")
           (log e)))))

@@ -122,7 +122,7 @@
               (swap! roots assoc container [comp container])
               (if (some? callback)
                 (callback))))))
-    (catch js/Object e
+    (catch :default e
       (do (clear-container container)
           (throw e)))))


scheduler: Fix error when recycling offer-stash.

offer-stash was initialized to nil and was only being reset! to its own
value, @offer-stash - meaning it could never acquire a value other than
nil.

Thus, attempting to put its value back on the channel in the exception
handling block would in turn raise an exception (can't put nil on
channel).  Since this exception was not handled, the thread would die,
and handle-resource-offers! would stop happening, resulting in no offers
to match until Cook was restarted.

I believe the var offers-scheduled contains what @offer-stash USED to
be reset! to, prior to commit a134d1f8776eb1b0627eb74a073bae125bf6d52a.

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -581,7 +581,7 @@
                                      lease leases]
                                  (:offer lease))
               offers-not-scheduled (clojure.set/intersection (set offers) (set offers-scheduled))
-              _ (reset! offer-stash @offer-stash)
+              _ (reset! offer-stash offers-scheduled)
               matched-jobs (for [match matches
                                  ^TaskAssignmentResult task-result (:tasks match)
                                  :let [task-request (.getRequest task-result)]]


Fix matched-head? bug (#255)

Fix matched-head? bug (#255)

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -566,7 +566,7 @@
                                                :let [task-request (.getRequest task-result)]
                                                :when (= :gpu (util/categorize-job (:job task-request)))]
                                            (:job/uuid (:job task-request))))
-              matched-head? (contains? matched-normal-job-uuids (-> considerable-by :normal first))
+              matched-head? (contains? matched-normal-job-uuids (-> considerable-by :normal first :job/uuid))
               remove-matched-jobs (fn remove-matched-jobs [existing-jobs matched-job-uuids]
                                     (remove #(contains? matched-job-uuids (:job/uuid %)) existing-jobs))
               update-scheduler-contents (fn update-scheduler-contents [scheduler-contents-by]


Improved `add-paths` documentation.

Improved `add-paths` documentation.

--- lambda-blog/src/lambda_blog/middleware.clj
+++ lambda-blog/src/lambda_blog/middleware.clj
@@ -18,11 +18,13 @@
        (apply str)))

 (defn add-paths
-  "Returns a middleware function that adds paths to an `entity` based on `path-spec`. `path-spec` can use various `entity` keys by naming them in angle brackets (i.e. `\"posts/<year>/<month>/<title>.html\"`). Each key is stringified and [[lambda-blog.utils/sanitize]]d before including in the path."
+  "Returns a middleware function that adds paths to an `entity` based on `path-spec` (e.g. `/{{value-1}}/{{value-2}}.html`). Each templated value is [[lambda-blog.utils/substitute]]d into the path using `entity` keys."
   [path-spec]
   (fn [entity]
     (let [p (utils/substitute path-spec entity)]
       (assoc entity
+             ;; NOTE Uses `path-spec` instead of `p` since additional
+             ;; NOTE slashes might have beed added by the substitution.
              :path-to-root (path-to-root path-spec)
              :path (utils/pathcat p)))))


(SERVER-1375) Adds a pool lock check to pool-lock-supersedes test

This commit adds some logic to the
pool-lock-supersedes-existing-borrows-test to try to wait until
.isLocked() returns true for a requested lock until the test moves on to
validating that borrow requests are held off by the lock.  Without this
change, it was more likely (although still somewhat rare) for the test
to return instances to the pool before the .lock() request was even
made, leading to borrow requests being granted immediately rather than
being held off by the lock.  Test assertions would fail as a result.

--- test/unit/puppetlabs/puppetserver/lockable_pool_test.clj
+++ test/unit/puppetlabs/puppetserver/lockable_pool_test.clj
@@ -235,6 +235,11 @@
       @blocked-borrow-thread-started?
       @lock-thread-started?
       (is (not (realized? blocked-borrow-thread-borrowed?)))
+      (let [start (System/currentTimeMillis)]
+        (while (and (not (.isLocked pool))
+                    (< (- (System/currentTimeMillis) start) 10000))
+          (Thread/yield)))
+      (is (.isLocked pool))
       (is (not (realized? lock-acquired?)))

       (return-instances pool instances)


Fix alignemnt on middle resize handlers when grid is active.

--- src/uxbox/common/geom.cljs
+++ src/uxbox/common/geom.cljs
@@ -157,7 +157,13 @@
     :top-left (gpt/point x1 y1)
     :top-right (gpt/point x2 y1)
     :bottom-left (gpt/point x1 y2)
-    :bottom-right (gpt/point x2 y2)))
+    :bottom-right (gpt/point x2 y2)
+    :top (gpt/point (/ (+ x1 x2) 2) y1)
+    :right (gpt/point x2 (/ (+ y1 y2) 2))
+    :left (gpt/point x1 (/ (+ y1 y2) 2))
+    :bottom (gpt/point (/ (+ x1 x2) 2)
+                       (/ (+ y1 y2) 2))))
+

 (defn- get-circle-vertext-point
   [{:keys [rx ry]} id]


`explain-with` docstring didn't have an example

--- src/structural_typing/guts/shapes/pred.clj
+++ src/structural_typing/guts/shapes/pred.clj
@@ -42,7 +42,10 @@
 (defn explain-with
   "After the `predicate` fails, the failure will need to be explained. Arrange for
    the `explainer` function to be called with the [[oopsie]] that results from the
-   failure."
+   failure.
+
+        (explain-with \"too small\" #(< (count %) 54))
+"
   [explainer predicate]
   (-> predicate
       stash-defaults


CMR-3703 pr comments

CMR-3703 pr comments

--- umm-spec-lib/src/cmr/umm_spec/validation/related_url.clj
+++ umm-spec-lib/src/cmr/umm_spec/validation/related_url.clj
@@ -51,7 +51,7 @@
        [(vu/escape-error-string (format "Only URLContentType: DistributionURL Type: GET SERVICE can contain GetService, RelatedUrl contains URLContentType: %s Type: %s" URLContentType Type))]})))

 (defn- get-data-validation
-  "Validates that DistributionURL URLContentType with GET SERVICE types are the only
+  "Validates that DistributionURL URLContentType with GET DATA types are the only
   RelatedUrls that contain GetData"
   [field-path value]
   (let [{:keys [URLContentType Type GetData]} value]


Improve disabled categories messaging

Improve disabled categories messaging

--- src/yetibot/core/hooks.clj
+++ src/yetibot/core/hooks.clj
@@ -71,8 +71,9 @@
           (let [disabled-cats (set (r/cat-settings-key settings))
                 fn-cats (set (:yb/cat (meta sub-fn)))]
             (if-let [matched-disabled-cats (seq (intersection disabled-cats fn-cats))]
-              (str "Categories matching this command are disabled: "
-                   (s/join ", " matched-disabled-cats))
+              (str
+                (s/join ", " (map name matched-disabled-cats))
+                "categories are disabled.")
               (sub-fn (merge extra {:cmd cmd :args args :match match}))))
           ; couldn't find any sub commands so default to help.
           (yetibot.core.handler/handle-unparsed-expr (str "help " (get @re-prefix->topic (str cmd-re))))))


fix bench cluster code

fix bench cluster code

--- bench.clj
+++ bench.clj
@@ -1,5 +1,5 @@
 (use 'dwc-analysis.aoo)
-(use [ 'dwc-analysis.populations :only ['populations] ])
+(use [ 'dwc-analysis.clusters :only ['clusters] ])

 (println "Go")
 (Thread/sleep 5000)
@@ -734,7 +734,7 @@
 (time (aoo vicia300))

 (println "Vicia faba population with 300 points")
-(time (populations vicia300))
+(time (clusters vicia300))

 (shutdown-agents)
 (println "Done")


more TODO

more TODO

--- test/com/billpiel/mem_tracer/core_test.clj
+++ test/com/billpiel/mem_tracer/core_test.clj
@@ -572,12 +572,32 @@
    - other places?
 x change query syntax -- single vector and get-some
 x destructure arglist
+  - filter out dummy __ args
+x query evals (rather than gets) a `set`
+- rendering strings is deadly slow?
+- use pmap all over the place?
+  -- add pmap mode to walk18???
+- ws-load bug???
+  = 'sour1 or (delay $ws/sour1) works
+
+  sourcerer.user> (mt/ws-load!)
+  ArityException Wrong number of args (0) passed to: core$ws-load-BANG-  clojure.lang.AFn.throwArity (AFn.java:437)
+
+  sourcerer.user> (mt/ws-load! $ws/sour1)
+  ClassCastException clojure.lang.PersistentArrayMap cannot be cast to java.util.concurrent.Future  clojure.core/deref-future (core.clj:2108)
+
+  sourcerer.user> (mt/ws-load! :sour1)
+  ClassCastException clojure.lang.Keyword cannot be cast to java.util.concurrent.Future  clojure.core/deref-future (core.clj:2108)
+
 - cursors
    - bisect recording trees to find bugs
 - split ns and fn name in trace rec and output
+- some kind of string output length limit options?
 - trace individual fns
 - show file and line num in output
 - deep trace (inside fn)
+- profiling features?
+  - use joda
 - wrap args that are funcs
  - and deep search values for funcs?
 - wrap returns that are funcs


Temporarily disable metadata queries tests for redshift/crate :cry:

--- test/metabase/db/metadata_queries_test.clj
+++ test/metabase/db/metadata_queries_test.clj
@@ -1,5 +1,6 @@
 (ns metabase.db.metadata-queries-test
-  (:require [expectations :refer :all]
+  (:require [clojure.set :as set]
+            [expectations :refer :all]
             [metabase.db :as db]
             [metabase.db.metadata-queries :refer :all]
             (metabase.models [field :refer [Field]]
@@ -9,30 +10,33 @@
             [metabase.test.data.datasets :as datasets]))

+;; Redshift & Crate tests are randomly failing -- see https://github.com/metabase/metabase/issues/2767
+(def ^:private ^:const metadata-queries-test-engines
+  (set/difference  qp-test/non-timeseries-engines #{:redshift :crate}))

 ;; ### FIELD-DISTINCT-COUNT
-; (datasets/expect-with-engines qp-test/non-timeseries-engines
-;   100
-;   (field-distinct-count (Field (id :checkins :venue_id))))
+(datasets/expect-with-engines metadata-queries-test-engines
+  100
+  (field-distinct-count (Field (id :checkins :venue_id))))

-; (datasets/expect-with-engines qp-test/non-timeseries-engines
-;   15
-;   (field-distinct-count (Field (id :checkins :user_id))))
+(datasets/expect-with-engines metadata-queries-test-engines
+  15
+  (field-distinct-count (Field (id :checkins :user_id))))

 ;; ### FIELD-COUNT
-; (datasets/expect-with-engines qp-test/non-timeseries-engines
-;   1000
-;   (field-count (Field (id :checkins :venue_id))))
+(datasets/expect-with-engines metadata-queries-test-engines
+  1000
+  (field-count (Field (id :checkins :venue_id))))

 ;; ### TABLE-ROW-COUNT
-; (datasets/expect-with-engines qp-test/non-timeseries-engines
-;   1000
-;   (table-row-count (Table (id :checkins))))
+(datasets/expect-with-engines metadata-queries-test-engines
+  1000
+  (table-row-count (Table (id :checkins))))

 ;; ### FIELD-DISTINCT-VALUES
-; (datasets/expect-with-engines qp-test/non-timeseries-engines
-;   [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
-;   (field-distinct-values (Field (id :checkins :user_id))))
+(datasets/expect-with-engines metadata-queries-test-engines
+  [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
+  (field-distinct-values (Field (id :checkins :user_id))))


update plugins

update plugins

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -2,4 +2,5 @@
   {:plugins
     [[lein-midje "3.2"]
      [lein-marginalia "0.8.0"]
-     [lein-ancient "0.6.8"]]}}
+     [lein-ancient "0.6.15"]
+     [com.jakemccrary/lein-test-refresh "0.23.0"]]}}


Bump nrepl tools version

Bump nrepl tools version

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -34,7 +34,7 @@
                        [org.codehaus.plexus/plexus-utils "3.0"]
                        [org.clojure/java.classpath "0.2.2"]
                        [org.clojure/tools.namespace "0.2.10"]
-                       [org.clojure/tools.nrepl "0.2.10" :exclusions [org.clojure/clojure]]
+                       [org.clojure/tools.nrepl "0.2.12" :exclusions [org.clojure/clojure]]
                        [pjstadig/humane-test-output "0.7.0"]
                        ;; Q: Is there any point to this next one?
                        [ritz/ritz-nrepl-middleware "0.7.0"]


and another

and another

--- dada-core/src/test/clojure/org/dada/core/test_clojure.clj
+++ dada-core/src/test/clojure/org/dada/core/test_clojure.clj
@@ -102,8 +102,10 @@
 ;; another fn (causing it to be auto-boxed) is still 5-10x faster than
 ;; just reading an Integer out of a record and passing it straight
 ;; into the same fn...
-(deftest record-boxed-int-vs-integer
-  (let [f (Foo. 1)
-	b (Bar. 1)]
-    (is (faster 1000000000 (identity (.a b))  (identity (.a f))))))
+
+(if (not (ibm?))
+  (deftest record-boxed-int-vs-integer
+    (let [f (Foo. 1)
+	  b (Bar. 1)]
+      (is (faster 1000000000 (identity (.a b))  (identity (.a f)))))))


lose unreliable test

lose unreliable test

--- dada-core/src/test/clojure/org/dada/core/test_clojure.clj
+++ dada-core/src/test/clojure/org/dada/core/test_clojure.clj
@@ -26,8 +26,8 @@
 (if (not (.contains (.toLowerCase (System/getProperty "java.vm.vendor")) "ibm")) ;TODO - these assumptions do not hold true on IBM - maybe we should generate code accordingly ?
   (do

-    (deftest test-get
-      (let [^Value v (Value. 0)] (is (faster 100000000 (.v v)(:v v)))))
+    ;; (deftest test-get
+    ;;   (let [^Value v (Value. 0)] (is (faster 100000000 (.v v)(:v v)))))

     (deftest int-arithmetic
       (is (faster 10000000
@@ -51,8 +51,8 @@

 ;; this may be needed for where we need to access a field via a function rather than a java accessor... - not much in it...

-(deftest test-get
-  (let [^Value v (Value. 0)] (is (faster 1000000000 ((fn [^Value v] (.v v)) v) (:v v)))))
+;; (deftest test-get
+;;   (let [^Value v (Value. 0)] (is (faster 1000000000 ((fn [^Value v] (.v v)) v) (:v v)))))

 ;; doseq nearly twice as fast


Add some tests for magic sparkles

Add some tests for magic sparkles

--- test/caesium/binding_test.clj
+++ test/caesium/binding_test.clj
@@ -1,6 +1,7 @@
 (ns caesium.binding-test
   (:require [caesium.binding :as b]
-            [clojure.test :refer [deftest is]])
+            [caesium.byte-bufs :as bb]
+            [clojure.test :refer [deftest is are]])
   (:import [caesium.binding Sodium]
            [java.lang.annotation Annotation]
            [java.lang.reflect Method Type AnnotatedElement]
@@ -103,3 +104,34 @@
       Long/TYPE (is (= #{size_t}
                        (clean-annotations (.getAnnotations method))))
       (is (= String rtype)))))
+
+(defmacro with-ns
+  [ns & body]
+  `(let [old-ns# *ns*
+         result# (volatile! nil)]
+     (try
+       (in-ns ~ns)
+       (vreset! result# ~@body)
+       (finally
+         (in-ns (ns-name old-ns#))
+         @result#))))
+
+(def buf-tag
+  {:tag 'java.nio.ByteBuffer})
+
+(deftest magic-sparkles-test
+  (are [ns expr expected-form expected-metas]
+      (with-ns ns
+        (let [[_ _ & args :as expanded] (macroexpand-1 expr)]
+          (and (is (= expected-form expanded))
+               (is (= expected-metas (map meta args))))))
+    'caesium.crypto.box
+    '(b/✨ keypair sk pk)
+    `(.crypto_box_keypair b/sodium ~'pk ~'sk)
+    [buf-tag buf-tag]
+
+    'caesium.crypto.box
+    '(b/✨ open-easy m c n pk sk)
+    `(.crypto_box_open_easy
+      b/sodium ~'m ~'c (long (bb/buflen ~'c)) ~'n ~'pk ~'sk)
+    [buf-tag buf-tag nil buf-tag buf-tag buf-tag]))


current passing tests

current passing tests

--- test/cljs/cljs/core_test.cljs
+++ test/cljs/cljs/core_test.cljs
@@ -2337,9 +2337,39 @@
   (assert (.equiv #{:cat :dog :bird} #{:cat :dog :bird}))

   ;; transducers
+  (assert (= (sequence (map inc) (array 1 2 3)) '(2 3 4)))
+  (assert (= (apply str (sequence (map #(.toUpperCase %)) "foo")) "FOO"))
   (assert (== (hash [1 2 3]) (hash (sequence (map inc) (range 3)))))
   (assert (= [1 2 3] (sequence (map inc) (range 3))))
   (assert (= (sequence (map inc) (range 3)) [1 2 3]))
-
+  (assert (= (sequence (remove even?) (range 10)) '(1 3 5 7 9)))
+  (assert (= (sequence (take 5) (range 10))
+             '(0 1 2 3 4)))
+  (assert (= (sequence (take-while #(< % 5)) (range 10))
+             '(0 1 2 3 4)))
+  (assert (= (sequence (drop 5) (range 10))
+             '(5 6 7 8 9)))
+  (assert (= (sequence (drop-while #(< % 5)) (range 10))
+             '(5 6 7 8 9)))
+  (assert (= (sequence (take-nth 2) (range 10))
+             '(0 2 4 6 8)))
+  (assert (= (sequence (replace {:foo :bar}) '(:foo 1 :foo 2))
+             '(:bar 1 :bar 2)))
+  (let [ret (into [] (map inc) (range 3))]
+    (assert (and (vector? ret)
+                 (= ret '(1 2 3)))))
+  (let [ret (into [] (filter even?) (range 10))]
+    (assert (and (vector? ret)
+                 (= ret '(0 2 4 6 8)))))
+  (assert (= (map inc (sequence (map inc) (range 3)))
+             '(2 3 4)))
+  (assert (= (sequence (dedupe) [1 1 2 2 3 3])
+             '(1 2 3)))
+  (assert (= (flatmap reverse [[3 2 1 0] [6 5 4] [9 8 7]])
+             (range 10)))
+  (assert (= (sequence (flatmap reverse) [[3 2 1 0] [6 5 4] [9 8 7]])
+             (range 10)))
+  (assert (= (seq (iteration (map inc) [1 2 3])) '(2 3 4)))
+
   :ok
   )


Kilo : Test : Removing unused require element for clojure.java.jdbc

--- test/kilo/api_test_config.clj
+++ test/kilo/api_test_config.clj
@@ -2,8 +2,7 @@
   (:require [kilo.web :as k-web]
             [clojure.test :refer :all]
             [ring.mock.request :as rmr]
-            [kilo.db-config :as k-testdb]
-            [clojure.java.jdbc :refer [with-connection] ]))
+            [kilo.db-config :as k-testdb]))

 (defn set-up-test []
   ;; this is where we would also initialize and populate test db


Remove tryclojure tests.

Remove tryclojure tests.

--- test/tryclojure/eval_test.clj
+++ test/tryclojure/eval_test.clj
@@ -1,18 +0,0 @@
-(ns tryclojure.eval-test
-  (:use tryclojure.models.eval
-        clojure.test)
-  (:require noir.session))
-
-(def sb (make-sandbox))
-
-(deftest eval-form-test
-  (let [form "(do (println 10) (+ 3 3))"
-        result (eval-string form sb)]
-    (is (= "10\n" (-> result :result first str)))
-    (is (= "6" (-> result :result second str)))
-    (is (= (read-string form) (-> result :expr)))))
-
-(alter-var-root #'noir.session/*noir-session* (constantly (atom {})))
-
-(deftest eval-request-test
-  (is (= "Execution Timed Out!" (:message (eval-request "(while true)")))))


Don't create :target-path unless tasks change the fileset (fixes #152)

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -93,8 +93,10 @@
 (defn- user-asset-dirs    [] (get-dirs {:dirs @tempdirs} #{:user :asset}))
 (defn- user-source-dirs   [] (get-dirs {:dirs @tempdirs} #{:user :source}))
 (defn- user-resource-dirs [] (get-dirs {:dirs @tempdirs} #{:user :resource}))
-(defn- non-user-temp-dirs [] (-> (apply set/union (map :dir @tempdirs))
-                                 (set/difference (user-temp-dirs))))
+(defn- non-user-temp-dirs [] (->> [:asset :source :resource]
+                                  (map #(get-dirs {:dirs @tempdirs} #{%}))
+                                  (apply set/union)
+                                  (#(set/difference % (user-temp-dirs)))))

 (defn- sync-user-dirs!
   []
@@ -656,17 +658,22 @@
           (let [[opts argv] (parse-task-opts args spec)]
             (recur (conj ret (apply (var-get op) opts)) argv)))))))

+(defn- sync-target
+  "FIXME: document"
+  [before after]
+  (let [tgt  (get-env :target-path)
+        diff (fileset-diff before after)]
+    (when (seq (output-files diff))
+      (binding [file/*hard-link* false]
+        (apply file/sync! :time tgt (output-dirs after)))
+      (file/delete-empty-subdirs! tgt))))
+
 (defn- run-tasks
   "FIXME: document"
   [task-stack]
-  (let [sync! #(let [tgt (get-env :target-path)]
-                 (binding [file/*hard-link* false]
-                   (apply file/sync! :time tgt (output-dirs %)))
-                 (file/delete-empty-subdirs! tgt)
-                 (sync-user-dirs!))]
-    (binding [*warnings* (atom 0)]
-      (reset-build!)
-      ((task-stack #(do (sync! %) %)) (commit! (reset-fileset))))))
+  (binding [*warnings* (atom 0)]
+    (let [fs (commit! (reset-fileset))]
+      ((task-stack #(do (sync-target fs %) (sync-user-dirs!) %)) fs))))

 (defmacro boot
   "The REPL equivalent to the command line 'boot'. If all arguments are


lein-release plugin: bumped version from 0.4.8 to 0.4.9-SNAPSHOT for next development cycle

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view "0.4.8"
+(defproject re-view "0.4.9-SNAPSHOT"
   :description "ClojureScript React Library"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"


lein-release plugin: bumped version from 0.3.33 to 0.3.34-SNAPSHOT for next development cycle

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view "0.3.33"
+(defproject re-view "0.3.34-SNAPSHOT"
   :description "Tiny React wrapper"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"


Explicit refer

Explicit refer

--- test/caesium/util_test.clj
+++ test/caesium/util_test.clj
@@ -1,20 +1,21 @@
 (ns caesium.util-test
-  (:require [caesium.util :refer :all]
-            [clojure.test :refer :all]))
+  (:require
+   [caesium.util :as u]
+   [clojure.test :refer :all]))

 (deftest array-eq-test
   (testing "array equality works"
-    (are [a] (array-eq a a)
+    (are [a] (u/array-eq a a)
       (byte-array [])
       (byte-array [90])))
   (testing "array inequality works"
-    (are [a b] (not (array-eq a b))
+    (are [a b] (not (u/array-eq a b))
       (byte-array []) (byte-array [90])
       (byte-array [90]) (byte-array []))))

 (deftest unhexify-test
   (testing "unhexify works"
-    (are [hex raw] (= (vec (unhexify hex))
+    (are [hex raw] (= (vec (u/unhexify hex))
                       (vec (byte-array raw)))
       "" []
       "01" [1]
@@ -24,8 +25,7 @@

 (deftest hexify-text
   (testing "hexify works"
-    (are [hex raw] (= (hexify (byte-array raw))
-                      hex)
+    (are [hex raw] (= hex (u/hexify (byte-array raw)))
       "" []
       "01" [1]
       "02" [2]


Update test for array valued api.

Update test for array valued api.

--- test/cavm/sqleval_test.clj
+++ test/cavm/sqleval_test.clj
@@ -18,11 +18,12 @@
                             (zipmap r
                                     (map (data field) r))))}]
       (ct/is (= (sorted-set 4 5 7)
-                (sqleval/op-in rows
-                               rows
-                               store
-                               "a"
-                               [:e :f :h]))))))
+                (sqleval/op-in-cmp sqleval/in-set
+                                   rows
+                                   rows
+                                   store
+                                   "a"
+                                   [:e :f :h]))))))

 (ct/deftest eval-test
   (ct/testing "eval")


[Fix] some test for ref data

[Fix] some test for ref data

--- test/clj_elm/core_test.clj
+++ test/clj_elm/core_test.clj
@@ -104,30 +104,33 @@

 (facts "test-update-exp-data"
   (fact "(update-exp-data pred fact exp)"
-    (let [exp {:TP 0 :FP 0 :TN 10 :FN 10}]
-      (:TP (update-exp-data 1 1 exp))
+    (let [exp (atom {:TP 0 :FP 0 :TN 10 :FN 10})]
+      (:TP @(update-exp-data 1 1 exp))
       => 1
-      (:FP (update-exp-data 1 -1 exp))
+      (:FP @(update-exp-data 1 -1 exp))
       => 1
-      (:TN (update-exp-data -1 -1 exp))
+      (:TN @(update-exp-data -1 -1 exp))
       => 11
-      (:FN (update-exp-data -1 1 exp))
+      (:FN @(update-exp-data -1 1 exp))
       => 11)))

 (facts "test-confusion-matrix"
   (fact "(confusion-matrix preds facts exp)"
-    (confusion-matrix [1 1 -1 -1] [1 1 -1 -1] {:TP 0 :FP 0 :TN 0 :FN 0})
+    (let [exp (atom {:TP 0 :FP 0 :TN 0 :FN 0})]
+      (confusion-matrix [1 1 -1 -1] [1 1 -1 -1] exp))
     => {:TP 2, :FP 0, :TN 2, :FN 0, :Accuracy 1, :Recall 1, :Precision 1}))

 (facts "test-evaluation"
-  (let [dummy {:TP 0 :FP 0 :TN 0 :FN 0}]
-    (facts "(evaluation results facts)"
-      (:Accuracy (evaluation [1 1 1 1 1 1 1 1 1 1] [1 1 1 1 1 1 1 1 1 1] dummy))
-      => 1
-      (:Accuracy (evaluation [-1 -1 -1 -1 -1 1 1 1 1 1] [1 1 1 1 1 1 1 1 1 1] dummy))
-      => 1/2
-      (:Accuracy (evaluation [-1 -1 -1 -1 -1 -1 -1 -1 -1 1] [1 1 1 1 1 1 1 1 1 1] dummy))
-      => 1/10)))
+  (facts "(evaluation results facts)"
+    (let [dummy (atom {:TP 0 :FP 0 :TN 0 :FN 0})]
+      (:Accuracy (evaluation [1 1 1 1 1 1 1 1 1 1] [1 1 1 1 1 1 1 1 1 1] dummy)))
+    => 1
+    (let [dummy (atom {:TP 0 :FP 0 :TN 0 :FN 0})]
+      (:Accuracy (evaluation [-1 -1 -1 -1 -1 1 1 1 1 1] [1 1 1 1 1 1 1 1 1 1] dummy)))
+    => 1/2
+    (let [dummy (atom {:TP 0 :FP 0 :TN 0 :FN 0})]
+      (:Accuracy (evaluation [-1 -1 -1 -1 -1 -1 -1 -1 -1 1] [1 1 1 1 1 1 1 1 1 1] dummy)))
+    => 1/10))

 (facts "test-select-count"
   (fact "(select-count cond dataset)"


refactor test to assert cache state

refactor test to assert cache state

--- test/keypin/store_test.clj
+++ test/keypin/store_test.clj
@@ -14,7 +14,8 @@
     [keypin.store :as ks]
     [keypin.util  :as ku])
   (:import
-    [java.util.concurrent TimeoutException]))
+    [java.util.concurrent TimeoutException]
+    [keypin.type.record CachingStore]))

 (deftest dynamic-store-test
@@ -86,10 +87,14 @@
   (testing "Cache busts on underlying store changes"
     (let [ds (ks/make-dynamic-store (fn [_] {:foo "10"}) {:foo "20"})
           cs (ks/make-caching-store ds)
-          t1 (System/currentTimeMillis)]
+          gc (fn [] (:cache-data @(.-state-agent ^CachingStore cs)))]
       (is (= 20 (kfoo ds)))
+      (is (= {} (gc)) "before cache build up")
       (is (= 20 (kfoo cs)))
-      (dotimes [_ 5000] (kfoo cs))  ; warmup
-      (let [d1 (nanos (kfoo cs))]
-        (Thread/sleep (- (+ t1 1500) (System/currentTimeMillis)))  ; wait for dynamic store 1s refresh window to elapse
-        (is (< d1 (nanos (kfoo cs))) "busted cache should take longer to fetch")))))
+      (is (= {:foo 20} (gc)) "after cache populating")
+      (Thread/sleep 1000)  ; wait for dynamic store 01 second refresh window to elapse
+      (is (= 10 (kfoo cs)))
+      (is (= {} (gc)) "busted cache")
+      (Thread/sleep 100)
+      (is (= 10 (kfoo cs)))
+      (is (= {:foo 10} (gc)) "re-populated cache"))))


cassandra trigger for seq and metrics tables

This trigger creates indexes the data on those tables.

--- src/storaged/src/leela/storaged/cassandra/triggers.clj
+++ src/storaged/src/leela/storaged/cassandra/triggers.clj
@@ -5,65 +5,161 @@
    org.slf4j.LoggerFactory

    org.apache.cassandra.utils.ByteBufferUtil
-
+
    org.apache.cassandra.db.Cell
+   org.apache.cassandra.db.Mutation
    org.apache.cassandra.db.ColumnFamily
    org.apache.cassandra.triggers.ITrigger
+   org.apache.cassandra.db.composites.CType
+   org.apache.cassandra.cql3.ColumnIdentifier
    org.apache.cassandra.db.composites.CellName
+   org.apache.cassandra.db.composites.Composite
    org.apache.cassandra.cql3.ColumnSpecification
-   org.apache.cassandra.db.marshal.CompositeType))
+   org.apache.cassandra.db.marshal.CompositeType
+   org.apache.cassandra.db.ArrayBackedSortedColumns))

 (def ^{:dynamic true :tag Logger} *logger*)
+
+(defmacro select-coll-names [cf selector-fn]
+  (letfn [(get-name [^ColumnSpecification x]
+            (.-name x))]
+    `(let [cols# (.. ~cf (metadata) (~selector-fn))]
+       (map ~get-name cols#))))

 (defn- warn [msg]
   (.warn *logger* msg))

-(defn- reduce-with-set [m kv]
+(defn- mmap [& args]
+  (apply vector (reverse args)))
+
+(defn- mget
+  ([mm key] (mget mm key nil))
+  ([mm key default]
+   (let [v ((reduce #(fn [] (get %2 key (%1))) (constantly default) mm))]
+     (if (coll? v) v [v]))))
+
+(defn- reduce-with-conj [m kv]
   (letfn [(assoc-with [m [k v]]
             (if-let [oval (get m k)]
               (assoc m k (conj oval v))
-              (assoc m k #{v})))]
+              (assoc m k v)))]
     (reduce assoc-with m kv)))

-(defn- pack [^ColumnSpecification spec key]
-  [(ByteBufferUtil/string (.. spec -name -bytes)) (ByteBufferUtil/string key)])
+(defn- empty-bbuff? [^ByteBuffer buff]
+  (= 0 (.remaining buff)))

 (defn- empty-cell? [^Cell cell]
-  (= 0 (.. cell (value) (remaining))))
+  (empty-bbuff? (.value cell)))

-(defn- split-type [^CompositeType type key]
-  (.split type key))
+(defn- split-type [^Composite c]
+  (map #(.get c %) (range (.size c))))

-(defn- cells-names [^ColumnFamily cf]
+(defn- pack [k v]
+  (list k v))
+
+(defn- seq-cell-names [^ColumnFamily cf]
   (letfn [(cell-name [^Cell cell]
             (.name cell))
-          (split-name [^CellName cname]
-            (map #(.get cname %) (range (.clusteringSize cname))))]
-    (map (comp split-name cell-name)
+          (split-c-name [^CellName cname]
+            (map #(.get cname %) (range (.clusteringSize cname))))
+          (split-r-name [^CellName cname]
+            (map #(.get cname %) (range (.clusteringSize cname) (.size cname))))
+          (split-names [^CellName cname]
+            [(split-c-name cname) (split-r-name cname)])]
+    (map (comp split-names cell-name)
          (filter (complement empty-cell?) (seq cf)))))

-(defn partition-keys [^ColumnFamily cf key]
-  (let [cols (.. cf (metadata) (partitionKeyColumns))]
-    (if (= 1 (count cols))
-      (apply (partial assoc {}) (pack (first cols) key))
-      (let [type (.. cf (metadata) (getKeyValidator))]
-        (reduce #(apply (partial assoc %1) %2) {}
-                (map pack cols (split-type type key)))))))
+(defn- partition-column-names [^ColumnFamily cf]
+  (select-coll-names cf partitionKeyColumns))

-(defn clustering-keys [^ColumnFamily cf]
-  (let [cnames (seq (.. cf (metadata) (clusteringColumns)))
-        cells (map (partial map pack cnames) (cells-names cf))]
-    (reduce reduce-with-set {} cells)))
+(defn- regular-column-names [^ColumnFamily cf]
+  (select-coll-names cf regularAndStaticColumns))

-(defn augment [key cf]
-  (let [ckeys (clustering-keys cf)
-        pkeys (partition-keys cf key)]
-    (warn (format "ckeys=%s" (str ckeys)))
-    (warn (format "pkeys=%s" (str pkeys)))))
+(defn- cluster-column-names [^ColumnFamily cf]
+  (select-coll-names cf clusteringColumns))

-(deftype MetricsIndexTrigger []
+(defn- partition-columns [^ColumnFamily cf key]
+  (let [names (partition-column-names cf)
+        ctype (.. cf (metadata) (getKeyValidatorAsCType) (fromByteBuffer key))]
+    (reduce #(apply (partial assoc %1) %2) {}
+            (map pack names (split-type ctype)))))
+
+(defn- cell-values [^ColumnFamily cf]
+  (filter (complement empty-bbuff?) (map (fn [^Cell c] (.value c)) (seq cf))))
+
+(defn- regular-columns [^ColumnFamily cf]
+  (let [names (regular-column-names cf)
+        pairs (map pack names (cell-values cf))]
+    (reduce (partial apply assoc) {} pairs)))
+
+(defn- cluster-columns [^ColumnFamily cf]
+  (let [names (cluster-column-names cf)
+        cells (map (partial map pack names) (map first (seq-cell-names cf)))]
+    (reduce reduce-with-conj {} cells)))
+
+(defn- equalize-list [xss]
+  (let [size (apply max (map count xss))]
+    (map #(take size (cycle %)) xss)))
+
+(defn- transpose [xss]
+  (apply map list xss))
+
+(defn- make-keys ^ByteBuffer [^ColumnFamily cf parts]
+  (let [ctype  (.. cf (metadata) (getKeyValidatorAsCType))
+        names  (partition-column-names cf)
+        values (equalize-list (map #(mget parts % []) names))]
+    (map #(.toByteBuffer (.make ctype (into-array ByteBuffer %))) (transpose values))))
+
+(defn- conj-last [xs x]
+  (if (vector? xs)
+    (conj xs x)
+    (concat xs [x])))
+
+(defn- make-cols [^ColumnFamily cf parts name values]
+  (let [ctype  (.getComparator cf)
+        names  (cluster-column-names cf)
+        values (equalize-list (map #(mget parts % values) names))]
+    (map #(.makeCellName ctype (into-array Object (conj-last % name))) (transpose values))))
+
+(defn- mutate [^ColumnFamily cf ^ByteBuffer pkey ckeys cvals]
+  (let [cfname   (.. cf (metadata) -cfName)
+        ksname   (.. cf (metadata) -ksName)
+        mutation (Mutation. ksname pkey)]
+    (doseq [[key val] (map list ckeys cvals)]
+      (.add mutation cfname key val (System/currentTimeMillis)))
+    mutation))
+
+(defn index-sequence [o-key ^ColumnFamily o-cf]
+  (let [n-cf   (.create ArrayBackedSortedColumns/factory (.. o-cf (metadata) -ksName) "seq_index")
+        vname  (ColumnIdentifier. "object" true)
+        parts  (mmap (partition-columns o-cf o-key)
+                     (cluster-columns o-cf)
+                     (regular-columns o-cf))
+        n-keys (make-keys n-cf parts)
+        c-keys (make-cols n-cf parts (.-bytes vname) (cell-values o-cf))
+        values (mget parts vname [])]
+    [(mutate n-cf (first n-keys) c-keys (mget parts vname))]))
+
+(defn index-metric [o-key ^ColumnFamily o-cf]
+  (let [n-cf  (.create ArrayBackedSortedColumns/factory (.. o-cf (metadata) -ksName) "data_index")
+        parts (mmap (partition-columns o-cf o-key)
+                    (cluster-columns o-cf)
+                    (regular-columns o-cf)
+                    {(ColumnIdentifier. "location" true) (ByteBufferUtil/bytes "cassandra://")})
+        n-keys (make-keys n-cf parts)
+        c-keys (make-cols n-cf parts ByteBufferUtil/EMPTY_BYTE_BUFFER  (cell-values o-cf))]
+    [(mutate n-cf (first n-keys) c-keys (repeat ByteBufferUtil/EMPTY_BYTE_BUFFER))]))
+
+(deftype SeqTrigger []
   ITrigger
   (augment [this key cf]
     (require 'leela.storaged.cassandra.triggers)
-    (binding [*logger* (LoggerFactory/getLogger MetricsIndexTrigger)]
-      (augment key cf))))
+    (binding [*logger* (LoggerFactory/getLogger SeqTrigger)]
+      (index-sequence key cf))))
+
+(deftype MetricTrigger []
+  ITrigger
+  (augment [this key cf]
+    (require 'leela.storaged.cassandra.triggers)
+    (binding [*logger* (LoggerFactory/getLogger MetricTrigger)]
+      (index-metric key cf))))


move to mainline tests for unchanged code

--- test/open_company/integration/company/company_list.clj
+++ test/open_company/integration/company/company_list.clj
@@ -95,14 +95,13 @@
     (fact "all existing companies are listed when providing a JWToken"
       (let [response (mock/api-request :get "/companies")
             body (mock/body-from-response response)
-            companies (get-in body [:collection :companies])
-            uni-slug  (slugify (:name r/uni))]
+            companies (get-in body [:collection :companies])]
         (:status response) => 200
         (map :name companies) => (just (set (map :name [r/open r/uni r/buffer]))) ; verify names
-        (map :slug companies) => (just (set [(:slug r/open) uni-slug (:slug r/buffer)])) ; verify slugs
+        (map :slug companies) => (just (set [(:slug r/open) (slugify (:name r/uni)) (:slug r/buffer)])) ; verify slugs
         (doseq [company companies] ; verify HATEOAS links
-          (hateoas/verify-link "self" "GET" (company-rep/url company) company-rep/media-type (:links company))
-          (count (:links company)) => 1)))
+          (count (:links company)) => 1
+          (hateoas/verify-link "self" "GET" (company-rep/url company) company-rep/media-type (:links company)))))

     (fact "removed companies are not listed"
       (company/delete-company (:slug r/buffer))


updated heatmap to include hover values for the tds

--- src/cljs/gointermod/heatmap/views.cljs
+++ src/cljs/gointermod/heatmap/views.cljs
@@ -49,31 +49,52 @@
     {:background (str "rgb(" bg-color "," mid-color "," "255)")}
 )))

-(defn organism-orthologue-tds [result]
+(defn organism-orthologue-tds
+  "Visually outputs the first two tds in the heatmap, orthologue and organism.  They require some custom logic compared to the basic number cells"
+  [result]
   (let [organism-name (first result)
         organism-id (utils/organism-name-to-id organism-name)
         orthologue-counts (re-frame/subscribe [:ortholog-count])
-        org-count (organism-id @orthologue-counts)]
+        org-count (organism-id @orthologue-counts)
+        ortholog (second result)]
   [:tr {:class organism-id}
     [:td organism-name]
-   (if (number? (second result))
-    [:td
-      (if (= org-count 1)
-        (second result)
-        [:span {:on-click #(re-frame/dispatch [:expand-heatmap organism-id])} org-count " genes " [:svg.icon [:use {:xlinkHref "#icon-circle-right"}]]])]
-    [:td (second result)]
+    (if (number? ortholog)
+      ;;handle aggregate result counts
+      [:td
+        (if (= org-count 1)
+          ;;don't say "1 gene", just output the gene itself.
+          ortholog
+          [:span {:on-click #(re-frame/dispatch [:expand-heatmap organism-id])} org-count " genes " [:svg.icon [:use {:xlinkHref "#icon-circle-right"}]]])]
+      ;;if the results aren't aggregate (e.g. the user expanded them) we just output its name
+      [:td ortholog]
      )]))

-(defn counts []
+(defn make-cell-title
+  "Creates hover text for td cells"
+  [result go-term]
+  (let [ortholog-name (second result)
+        organism (first result)]
+  (str organism ", " ortholog-name
+       (if (number? ortholog-name) " genes" )
+    ".\nGO term: " go-term ".")
+))
+
+(defn counts
+  "Visually output the table of annotation counts."
+  []
   ;;subscribe to the heatmap data
-  (let [heatmap (re-frame/subscribe [:heatmap-aggregate])]
+  (let [heatmap (re-frame/subscribe [:heatmap-aggregate])
+        go-terms (:headers @heatmap)]
   ;;output tr, one per organism,ortholog combo
     (into [:tbody]
       (map (fn [result]
         (into (organism-orthologue-tds result)
-          (map (fn [val]
+          (map-indexed (fn [index val]
              ;;one td per go term
-             [:td {:style (calc-color val)} val]) (drop 2 result)))
+             [:td {:style (calc-color val)
+                   :title (make-cell-title result (nth go-terms index)) } val]
+          ) (drop 2 result)))
       )) (:rows @heatmap))
 ))


Remove first sorted key in cache when full

--- src/cljs/hacker_agent/hacker-base.cljs
+++ src/cljs/hacker_agent/hacker-base.cljs
@@ -98,7 +98,8 @@
        (when-not (get-in @data child-path)
          (when (and (> limit 0)
                     (>= (count cached) limit))
-           (unbind! data (conj path (key (first cached)))))
+           (let [[first-key _] (-> cached sort first)]
+             (unbind! data (conj path first-key))))
          (bind! data child-path
                 (id->fbref id)
                 story-binder))))))


Added url generator.

Added url generator.

--- src/cmr/common/test/test_check_ext.clj
+++ src/cmr/common/test/test_check_ext.clj
@@ -142,3 +142,25 @@
 (def date-time
   "A generator that will return a Joda DateTime between 1970-01-01T00:00:00.000Z and 2114-01-01T00:00:00.000Z"
   (gen/fmap c/from-long (gen/choose 0 4544208000000)))
+
+(def http-schemes
+  "Some URL schemes."
+  (gen/elements ["ftp" "http" "https" "file"]))
+
+(def domain-exts
+  "Some url domain extenstions."
+  (gen/elements ["com" "org" "gov"]))
+
+(def file-exts
+  "Some file extensions."
+  (gen/elements ["jpg" "png" "gif" "tiff" "txt"]))
+
+(def file-url-string
+  "A generator that will create a simple URL string for a file resource."
+  (gen/fmap (fn [[scheme domain domain-ext file-name-base file-ext]]
+              (str scheme "://" domain "." domain-ext "/" file-name-base "." file-ext))
+            (gen/tuple http-schemes
+                       (gen/not-empty gen/string-alpha-numeric)
+                       domain-exts
+                       (gen/not-empty gen/string-alpha-numeric)
+                       file-exts)))


Update builtins.clj

Update builtins.clj

--- src/iyye/subcon/knowledge/builtins.clj
+++ src/iyye/subcon/knowledge/builtins.clj
@@ -53,7 +53,7 @@
             new-p1-type (assoc p1-type :Relations
                                        (conj (:Relations p1-type) p1-supertype))
             new-p2-type (assoc p2-type :Relations
-                                       (conj (:Relations p1-type) p2-subtype))]
+                                       (conj (:Relations p2-type) p2-subtype))]
       (do
         (words/set-iyye-type! new-p1-type)
         (words/set-iyye-type! new-p2-type))))))
@@ -95,7 +95,7 @@

 (defn- create-entry [entry] {(:Uname (:atom entry)) entry})

-(defn init-builtin-words []
+(defn- init-builtin-words []
   (let [actor (words/create-iyye-type "actor" true)
         ai (words/create-iyye-type "ai" true)
         iyye (words/create-iyye-type "iyye" true)


note to avoid copy/paste drift

note to avoid copy/paste drift

--- pedestal-app/app/src/semtag_web/start.cljs
+++ pedestal-app/app/src/semtag_web/start.cljs
@@ -38,6 +38,7 @@
                    (get-in behavior/example-app [:focus :default]))
         behavior (cond-> behavior/example-app
                    true (assoc-in [:focus :default] screen)
+                   ;; needs to match what's generated in rendering/url-search
                    (re-find #"^search" (name screen)) (assoc-in [:focus screen]
                                                                 [[:app-model :search screen] [:app-model :home] [:app-model :navbar]]))
         app (app/build behavior)


CMR-3286 fixed authorized function

CMR-3286 fixed authorized function

--- access-control-app/src/cmr/access_control/services/acl_authorization.clj
+++ access-control-app/src/cmr/access_control/services/acl_authorization.clj
@@ -51,7 +51,7 @@
 (defn- has-self-permission?
   "Returns true if ACL itself matches sids for user in context for a given action"
   [context action concept-id]
-  (let [condition (qm/string-conditions :concept-id concept-id true)
+  (let [condition (qm/string-condition :concept-id concept-id true false)
         returned-acl (get-acls-by-condition context condition)
         echo-acl (acl/echo-style-acl (first (:acls returned-acl)))]
     ;; read is special, if the user has any permission for the acl
@@ -71,38 +71,40 @@
 (defn action-permitted-on-acl?
   "Returns true if any ACLs grant the current context user the given permission
   keyword (:create, :update, etc.) on the given acl."
-  [context permission acl & concept-id]
-  (cond
-    ;; system token or system-level ANY_ACL permission can do anything
-    (or (transmit-config/echo-system-token? context)
-        (has-system-access? context permission "ANY_ACL")
-        (when concept-id
-          (has-self-permission? context permission concept-id)))
-    true
+  ([context permission acl]
+   (action-permitted-on-acl? context permission acl nil))
+  ([context permission acl concept-id]
+   (cond
+     ;; system token or system-level ANY_ACL permission can do anything
+     (or (transmit-config/echo-system-token? context)
+         (has-system-access? context permission "ANY_ACL")
+         (when concept-id
+           (has-self-permission? context permission concept-id)))
+     true

-    ;; If the user does not have system-level permissions, they may not perform any actions
-    ;; on system-level ACLs.
-    (:system-identity acl)
-    false
+     ;; If the user does not have system-level permissions, they may not perform any actions
+     ;; on system-level ACLs.
+     (:system-identity acl)
+     false

-    ;;TODO the catalog item check is reduntant with the self permission check earlier,
-    ;;we might want to pass concept-id during update and create to remove this redundancy.
-    ;;Currently, concept-id is only specified for acl searches.
-    (:provider-identity acl)
-    (if (= (:target (:provider-identity acl)) "CATALOG_ITEM_ACL")
-      (has-provider-access? context permission "CATALOG_ITEM_ACL"
-                            (:provider-id (:provider-identity acl)))
-      (has-provider-access? context permission "PROVIDER_OBJECT_ACL"
-                            (:provider-id (:provider-identity acl))))
+     ;;TODO the catalog item check is reduntant with the self permission check earlier,
+     ;;we might want to pass concept-id during update and create to remove this redundancy.
+     ;;Currently, concept-id is only specified for acl searches.
+     (:provider-identity acl)
+     (if (= (:target (:provider-identity acl)) "CATALOG_ITEM_ACL")
+       (has-provider-access? context permission "CATALOG_ITEM_ACL"
+                             (:provider-id (:provider-identity acl)))
+       (has-provider-access? context permission "PROVIDER_OBJECT_ACL"
+                             (:provider-id (:provider-identity acl))))

-    (:catalog-item-identity acl)
-    (has-provider-access? context permission "CATALOG_ITEM_ACL"
-                          (:provider-id (:catalog-item-identity acl)))
+     (:catalog-item-identity acl)
+     (has-provider-access? context permission "CATALOG_ITEM_ACL"
+                           (:provider-id (:catalog-item-identity acl)))

-    (:single-instance-identity acl)
-    (let [target-group (group-service/get-group context (get-in acl [:single-instance-identity :target-id]))]
-      (and (:provider-id target-group)
-           (has-provider-access? context permission "PROVIDER_OBJECT_ACL" (:provider-id target-group))))))
+     (:single-instance-identity acl)
+     (let [target-group (group-service/get-group context (get-in acl [:single-instance-identity :target-id]))]
+       (and (:provider-id target-group)
+            (has-provider-access? context permission "PROVIDER_OBJECT_ACL" (:provider-id target-group)))))))

 (defn authorize-acl-action
   "Throws service error if user doesn't have permission to intiate a given action for a given acl.


[#3073] Refactor fetch-2-query and adapting result

Using columnNames instead of sourceColumnNames in final insert

--- backend/src/akvo/lumen/lib/transformation/merge_datasets.clj
+++ backend/src/akvo/lumen/lib/transformation/merge_datasets.clj
@@ -100,27 +100,32 @@
   [conn {:keys [source-data-group source target]}]
   (let [simple-query?           (= (:source-table-name source-data-group)
                                    (:table-name source))
-        source-selected-columns (s/join ", "
+        source-selected-columns (filter #(not= "instance_id" (get % "columnName")) (:columns source-data-group))
+        source-selected-columns-select  (s/join ", "
                                         (map (partial str "s.")
-                                             (map #(get % "sourceColumnName" "instance_id")
-                                                  (:columns source-data-group))))
+                                             (map #(get % "sourceColumnName")
+                                                  source-selected-columns)))
         subquery                (if simple-query?
                                   (format "select %1$s from %2$s s"
-                                          source-selected-columns
+                                          source-selected-columns-select
                                           (-> source :table-name))
                                   (format "select %1$s, %2$s from %3$s s, %4$s b where s.instance_id = b.instance_id"
                                           (str  "b." (-> source :merge-column)) ;; merge column
-                                          source-selected-columns
+                                          source-selected-columns-select
                                           (-> source-data-group :source-table-name) ;; table of selected columns
                                           (-> source :table-name) ;; merge-column table
                                           ))
         sql                     (format "select t.instance_id, %1$s from (%2$s) s, %3$s t where t.%4$s = s.%5$s"
-                                        source-selected-columns
+                                        source-selected-columns-select
                                         subquery
                                         (-> target :table-name)
                                         (-> target :merge-column)
-                                        (-> source :merge-column))]
-    (rest (jdbc/query conn [sql]))))
+                                        (-> source :merge-column))
+        result (rest (jdbc/query conn [sql]))
+        rename-keys-map (reduce (fn [c co]
+                                  (assoc c (keyword (get co "sourceColumnName")) (keyword (get co "columnName")))
+                                  ) {} source-selected-columns)]
+    (map #(set/rename-keys % rename-keys-map) result)))

 (defn add-columns
   "Add the new columns to the target dataset"


rm command.

rm command.

--- src/mash_commander/nix/filesystem.cljs
+++ src/mash_commander/nix/filesystem.cljs
@@ -39,8 +39,18 @@
     (get-in (:root fs) (interleave (repeat :files) (:cwd fs)))))

 (defn create-file-in-fs [fs name file]
-  (let [path (apply concat [:root] (interleave (repeat :files) (:cwd fs)) [[:files name]])]
+  (let [path (apply concat
+                    [:root]
+                    (interleave (repeat :files) (:cwd fs))
+                    [[:files name]])]
     (assoc-in fs path file)))
+
+(defn delete-file-in-fs [fs name]
+  (let [path (concat
+              [:root]
+              (interleave (repeat :files) (:cwd fs))
+              [:files])]
+    (update-in fs path #(dissoc % name))))

 (defn ls-cmd []
   (str/join "\t" (keys (:files (cwd)))))
@@ -98,6 +108,16 @@
       "409 error: permission denied"
       :default
       (:contents f))))
+
+(defn rm-cmd [param]
+  (let [f (get (:files (cwd)) param)]
+    (cond
+      (not (contains? (:mod f) :w))
+      "409 error: permission denied"
+      :default
+      (om/transact!
+       (fs-cursor)
+       #(delete-file-in-fs % param)))))

 (defn init []
   (om/update!
@@ -140,7 +160,12 @@
                                          :type :file
                                          :fn cat-cmd
                                          :args [:file]
-                                         :help "`cat` shows the contents of a file"}}}
+                                         :help "`cat` shows the contents of a file"}
+                                  "rm" {:mod #{:x}
+                                        :type :file
+                                        :fn rm-cmd
+                                        :args [:file]
+                                        :help "`rm` removes a files."}}}
                    "usr" {:mod #{:r :w}
                           :type :dir
                           :files {}}}}


update misaki.compiler.default.config to use misaki.config/make-output-url

--- src/misaki/compiler/default/config.clj
+++ src/misaki/compiler/default/config.clj
@@ -107,8 +107,7 @@
   "Make post url from java.io.File"
   [#^File file]
   {:pre [(file? file)]}
-  (combine-path (:url-base *config*)
-                (remove-extension (cnf/make-post-output-filename file))))
+  (remove-extension (cnf/make-output-url file)))

 ; =make-tag-url
 (defn make-tag-url


Ignore keywords when more than 3 are given.

--- Spraff/src/spraff/core.clj
+++ Spraff/src/spraff/core.clj
@@ -110,7 +110,8 @@
         (send-message irc channel
             (join " " (generate-sentence
                 @state-ref
-                (set (filter #(not (.contains % (:name @irc))) (split-sentence-to-words message))))))))
+                (let [keywords (set (filter #(not (.contains % (:name @irc))) (split-sentence-to-words message)))]
+                    (if (<= (count keywords) 3) keywords #{})))))))

 (defn -main
     [& args]


Show pics in the posts tab

Show pics in the posts tab

--- common/clojure/nightweb/db.clj
+++ common/clojure/nightweb/db.clj
@@ -201,7 +201,10 @@
                     :user [(str "SELECT * FROM user LEFT JOIN pic "
                                 "ON user.userhash = pic.userhash "
                                 "AND user.userhash = pic.ptrhash")]
-                    :post ["SELECT * FROM post ORDER BY time DESC"]
+                    :post [(str "SELECT * FROM post LEFT JOIN pic "
+                                "ON post.userhash = pic.userhash "
+                                "AND post.posthash = pic.ptrhash "
+                                "ORDER BY post.time DESC")]
                     :user-fav
                     [(str "SELECT * FROM user "
                           "INNER JOIN fav ON user.userhash = fav.favhash "


return proper ID when make a new Neo4j object

--- src/webapp/framework/client/neo4j.cljs
+++ src/webapp/framework/client/neo4j.cljs
@@ -36,6 +36,11 @@
 (defn neo-outgoing [x k] (-> x (neo-data) (get k) :outgoing_relationships))

+(defn neo-id [x]
+    (js/parseInt (.substring x (+ (.indexOf x "data/node/") 10)))
+)
+
+
 (comment go
    (.log js/console (str (neo-outgoing (<! (neo4j "START x = node(0) RETURN x" {} )) "x")))
 )
@@ -49,7 +54,7 @@
 )

-(defn neo-id [x]
+(comment defn neo-id [x]
   (comment  go
       (get (first (<! (neo4j "START x = node(1) RETURN ID(x)" {} ) "x")) "ID(x)")
   )
@@ -68,11 +73,15 @@
                  rr (<! (neo4j "CREATE (n {values}) return n" {:values properties}  ) )
                 ]
                (str
-                   (neo-properties
-                       rr
-                       "n")
-                       " : ID : "
-                       (neo-id (:self (get (first rr) "n")))
+                   (merge
+                      (neo-properties
+                         rr
+                         "n")
+                       {
+                            :id (neo-id (:self (get (first rr) "n")))
+                        }
+                     )
+
                 )
             )
         )
@@ -91,9 +100,6 @@
 )

-(defn neo-id [x]
-    (js/parseInt (.substring x (+ (.indexOf x "data/node/") 10)))
-)

 (go


Eliminate inadvertent whitespace

Eliminate inadvertent whitespace

--- ClojureScript/src/goby/core.cljs
+++ ClojureScript/src/goby/core.cljs
@@ -4,7 +4,6 @@
   (:require-macros [goby.macros :refer [reify]]))

 (def env "Contains a map of environment values such as whether running a release build, etc." (atom {}))
-

 (def table-view-scroll-positions
   "Defines a map from keywords to `UITableViewScrollPosition` values."


add notes about future budget specs

add notes about future budget specs

--- test/clj_money/models/budgets_test.clj
+++ test/clj_money/models/budgets_test.clj
@@ -39,3 +39,15 @@
     (is (not (nil? (:id budget))) "The returned value has an id")
     (is (= ["2017"] (map :name budgets))
         "A query for budgets returns the new budget")))
+
+; entity-id is required
+; name is required
+; start-date is required
+; start-date can be a string
+; start-date can be a LocalDate
+; period is required
+; period must be :month :week or :quarter
+; period-count is required
+; period-count must be greater than zero
+; items are required
+; each item just have number of items equal to period count


Test for function get-job-name

Test for function get-job-name

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -385,3 +385,11 @@
             [1 2 3 4]   "[1,2,3,4]"
             {:a 1 :b 2} "{\"a\":1, \"b\":2}")))

+(deftest test-get-job-name
+    "Check the function emender-jenkins.rest-api/get-job-name."
+    (testing "the function emender-jenkins.rest-api/get-job-name."
+        (are [x y] (= x (get-job-name y))
+            nil       nil
+            nil       {:namex "jobname"}
+            "jobname" {:name "jobname"})))
+


[#532] wip pivot query backend

[#532] wip pivot query backend

--- backend/src/akvo/lumen/lib/pivot_impl.clj
+++ backend/src/akvo/lumen/lib/pivot_impl.clj
@@ -1,5 +1,129 @@
-(ns akvo.lumen.lib.pivot-impl)
+(ns akvo.lumen.lib.pivot-impl
+  (:require [clojure.java.jdbc :as jdbc]
+            [clojure.string :as str]
+            [hugsql.core :as hugsql]))

-(defn query [tenant-conn id query]
-  {:status 200
-   :body {}})
+(hugsql/def-db-fns "akvo/lumen/lib/dataset.sql")
+
+(defn not-found [body]
+  {:status 404
+   :body body})
+
+(defn bad-request [body]
+  {:status 400
+   :body body})
+
+
+;; {
+;;  "categoryColumn": "c16",
+;;  "rowColumn": "c4",
+;;  "valueColumn": "c19",
+;;  "aggregation": "avg"
+;;  "filter": [{"c2": "Ethiopia"}]
+;;  }
+
+(defn unique-values-sql [table-name category-column]
+  (format "SELECT DISTINCT %s FROM %s ORDER BY 1"
+          (get category-column "columnName") table-name))
+
+(defn unique-values [conn table-name category-column]
+  (->> (jdbc/query conn
+                   [(unique-values-sql table-name category-column)]
+                   {:as-arrays? true})
+       rest
+       (map first)))
+
+(defn escape-quotes [s]
+  (str/replace s "\"" "\"\""))
+
+;; TODO filter
+(defn source-sql [table-name {:keys [category-column
+                                     row-column
+                                     value-column
+                                     aggregation
+                                     filter]}]
+  (str
+   (format "SELECT %s, %s, %s(%s) FROM %s\n"
+           (get row-column "columnName")
+           (get category-column "columnName")
+           aggregation
+           (get value-column "columnName")
+           table-name)
+   "GROUP BY 1,2 ORDER BY 1,2\n"))
+
+(defn pivot-sql [table-name query categories-count]
+  (str "SELECT * FROM crosstab ($$\n"
+       (source-sql table-name query)
+       "$$,$$\n"
+       (unique-values-sql table-name (:category-column query))
+       "$$) AS ct (c1 text, \n"
+       (str/join "," (map #(format "c%s double precision" (+ % 2))
+                          (range categories-count)))
+       ");"))
+
+(defn run-query [conn dataset query]
+  (let [categories (unique-values conn (:table-name dataset) (:category-column query))
+        category-columns (map (fn [title]
+                                {"title" title
+                                 "type" "number"})
+                              categories)
+        columns (cons (select-keys (:row-column query)
+                                   ["title" "type"])
+                      category-columns)]
+    {:rows (rest
+            (jdbc/query conn
+                        [(pivot-sql (:table-name dataset) query (count categories))]
+                        {:as-arrays? true}))
+     :columns columns}))
+
+
+(defn find-column [columns column-name]
+  (first (filter #(= column-name (get % "columnName"))
+                 columns)))
+
+(defn build-query
+  "Replace column names with proper column metadata from the dataset"
+  [columns query]
+  {:category-column (find-column columns (get query "categoryColumn"))
+   :row-column (find-column columns (get query "rowColumn"))
+   :value-column (find-column columns (get query "valueColumn"))
+   :aggregation (get query "aggregation")
+   :filter (get query "filter")})
+
+(defn valid-query? [query]
+  true)
+
+(defn query [tenant-conn dataset-id query]
+  (jdbc/with-db-transaction [conn tenant-conn]
+    (let [dataset (dataset-by-id conn {:id dataset-id})]
+      (if dataset
+        (let [q (build-query (:columns dataset) query)]
+          (if (valid-query? q)
+            (try
+              {:status 200
+               :body (run-query conn dataset q)}
+              (catch Exception e
+                {:status 500
+                 :body {"error" (.getMessage e)}}))
+            (bad-request {"query" query})))
+        (not-found {"datasetId" dataset-id})))))
+
+
+(comment
+  (def dataset-id "589346d9-9a47-4911-8365-a6023272d2bb")
+  (def tenant-conn "jdbc:postgresql://localhost/lumen_tenant_1")
+
+  (def dataset  (dataset-by-id tenant-conn {:id dataset-id}))
+
+  (def q {"categoryColumn" "c16"
+          "rowColumn" "c4"
+          "valueColumn" "c19"
+          "aggregation" "avg"})
+
+  (run-query tenant-conn dataset {:category-column (second (:columns dataset))})
+
+  (query tenant-conn dataset-id q)
+
+  (unique-categories tenant-conn dataset-id)
+
+  )


allow list entities to be viewed in IGV track selector

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/analysis/track_selector.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/analysis/track_selector.cljs
@@ -6,6 +6,7 @@
     [org.broadinstitute.firecloud-ui.common.entity-table :refer [EntityTable]]
     [org.broadinstitute.firecloud-ui.common.modal :as modal]
     [org.broadinstitute.firecloud-ui.common.style :as style]
+    [org.broadinstitute.firecloud-ui.common.table-utils :refer [default-render]]
     [org.broadinstitute.firecloud-ui.page.workspace.analysis.igv-utils :as igv-utils]
     [org.broadinstitute.firecloud-ui.utils :as utils]
     ))
@@ -32,7 +33,7 @@
                         (style/left-ellipses {:style {:marginRight "0.5em"}}
                                              (style/create-link {:text data
                                                                  :onClick #((:on-select props) data)}))
-                        data))}]])})
+                        (default-render data)))}]])})

 (react/defc Right