Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:clinicedc/edc-qareports into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
erikvw committed Oct 4, 2024
2 parents 0f0fc9a + 9d40365 commit dddc097
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions edc_qareports/sql_generator/requisition_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class RequisitionCase(CrfCase):
panel: str = None
subjectrequisition_dbtable: str | None = None
panel_dbtable: str | None = None
requisition_id_field: str | None = None

@property
def sql(self):
Expand Down
5 changes: 4 additions & 1 deletion edc_qareports/sql_generator/requisition_subquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class RequisitionSubquery(CrfSubquery):
panel: str = None
subjectrequisition_dbtable: str | None = None
panel_dbtable: str | None = None
requisition_id_field: str | None = None
template: str = field(
init=False,
default=Template(
Expand All @@ -32,7 +33,7 @@ class RequisitionSubquery(CrfSubquery):
"v.schedule_name, req.modified, '${label_lower}' as label_lower, "
"'${label}' as label, count(*) as records "
"from ${subjectrequisition_dbtable} as req "
"left join ${dbtable} as crf on req.id=crf.requisition_id "
"left join ${dbtable} as crf on req.id=crf.${requisition_id_field} "
"left join ${subjectvisit_dbtable} as v on v.id=req.subject_visit_id "
"${left_joins} "
"left join ${panel_dbtable} as panel on req.panel_id=panel.id "
Expand All @@ -57,3 +58,5 @@ def __post_init__(self):
)
if not self.panel_dbtable:
self.panel_dbtable = "edc_lab_panel"
if not self.requisition_id_field:
self.requisition_id_field = "requisition_id"

0 comments on commit dddc097

Please sign in to comment.