You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request - Support for filtering specific schemas for collection filter #239
class HospitalClaims(dy.Collection):
invoices: dy.LazyFrame[InvoiceSchema]
diagnoses: dy.LazyFrame[DiagnosisSchema]
@dy.filter(members=["diagnoses"]) # Apply filter only to diagnoses member
def diagnosis_date_after_admission(self) -> pl.LazyFrame:
"""
Filter diagnoses to only include those where diagnosis_date >= admission_date.
This requires joining with invoices to get admission_date.
Returns: LazyFrame with valid diagnoses rows
"""
return self.diagnoses.join(
self.invoices.select(["invoice_id", "admission_date"]),
on="invoice_id",
how="left"
).filter(
pl.col("diagnosis_date") >= pl.col("admission_date")
)
@dy.rule() # Collection-level validation across members
def diagnosis_before_discharge(self) -> pl.LazyFrame:
"""
Validate that all diagnosis dates occur before or on discharge date.
Returns: LazyFrame with rows that violate this rule (diagnosis_date > discharge_date)
"""
invalid_rows = self.diagnoses.join(
self.invoices.select(["invoice_id", "discharge_date"]),
on="invoice_id",
how="inner"
).filter(
pl.col("diagnosis_date") > pl.col("discharge_date")
)
return invalid_rows
Ability to filter only specifc schema for filtering collection.
Thanks for reaching out ereb2impact ! We currently only support member-based filtering if you define the filtering in the member schemas themselves. Necessarily, that won't work for your example because you are using multiple members as the same time in order to determine how to filter one specific member. Your use case seems reasonable to me and I can't immediately think of anything we would break with this suggestion
Hey ereb2impact! I have closed the PR because Copilot's suggestion was not directly usable. Unfortunately, I cannot promise a timeline when we will get back to this. Feel free to open a PR to kickstart this though.
Activity
AndreasAlbertQC commentedon Dec 10, 2025
Thanks for reaching out ereb2impact ! We currently only support member-based filtering if you define the filtering in the member schemas themselves. Necessarily, that won't work for your example because you are using multiple members as the same time in order to determine how to filter one specific member. Your use case seems reasonable to me and I can't immediately think of anything we would break with this suggestion
ereb2impact commentedon Dec 16, 2025
Can we please have this member filtering then? Andreas Albert (@AndreasAlbertQC)
ereb2impact commentedon Feb 23, 2026
Hi Andreas Albert (@AndreasAlbertQC) is there any update on this please?
ereb2impact commentedon May 25, 2026
HI, I see the PR was abanoned. I have been waiting for this for so long. Can we please have any update on this?
borchero commentedon May 25, 2026
Hey ereb2impact! I have closed the PR because Copilot's suggestion was not directly usable. Unfortunately, I cannot promise a timeline when we will get back to this. Feel free to open a PR to kickstart this though.