def get_query(self, req: CamcopsRequest) -> SelectBase: which_idnum = req.get_int_param(ViewParam.WHICH_IDNUM) inclusion_dx = req.get_str_list_param( ViewParam.DIAGNOSES_INCLUSION, validator=validate_restricted_sql_search_literal, ) exclusion_dx = req.get_str_list_param( ViewParam.DIAGNOSES_EXCLUSION, validator=validate_restricted_sql_search_literal, ) age_minimum = req.get_int_param(ViewParam.AGE_MINIMUM) age_maximum = req.get_int_param(ViewParam.AGE_MAXIMUM) q = get_diagnosis_inc_exc_report_query( req, diagnosis_class=DiagnosisIcd9CM, item_class=DiagnosisIcd9CMItem, item_fk_fieldname="diagnosis_icd9cm_id", system="ICD-9-CM", which_idnum=which_idnum, inclusion_dx=inclusion_dx, exclusion_dx=exclusion_dx, age_minimum_y=age_minimum, age_maximum_y=age_maximum, ) q = q.order_by(*ORDER_BY) # log.debug("Final query:\n{}", get_literal_query(q, bind=req.engine)) return q
def get_query(self, req: CamcopsRequest) -> SelectBase: which_idnum = req.get_int_param(ViewParam.WHICH_IDNUM) inclusion_dx = req.get_str_list_param(ViewParam.DIAGNOSES_INCLUSION) exclusion_dx = req.get_str_list_param(ViewParam.DIAGNOSES_EXCLUSION) age_minimum = req.get_int_param(ViewParam.AGE_MINIMUM) age_maximum = req.get_int_param(ViewParam.AGE_MAXIMUM) q = get_diagnosis_inc_exc_report_query( req, diagnosis_class=DiagnosisIcd10, item_class=DiagnosisIcd10Item, item_fk_fieldname='diagnosis_icd10_id', system='ICD-10', which_idnum=which_idnum, inclusion_dx=inclusion_dx, exclusion_dx=exclusion_dx, age_minimum_y=age_minimum, age_maximum_y=age_maximum, ) q = q.order_by(*ORDER_BY) # log.debug("Final query:\n{}", get_literal_query(q, bind=req.engine)) return q