Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential issue with index_date not updating in dummy data #857

Open
alschaffer opened this issue Aug 19, 2022 · 0 comments
Open

Potential issue with index_date not updating in dummy data #857

alschaffer opened this issue Aug 19, 2022 · 0 comments

Comments

@alschaffer
Copy link

alschaffer commented Aug 19, 2022

I am extracting data on people prescribed an opioid in each month (see example code below). When extracting dummy data, the index_date doesn't update, it only takes on the initial value (i.e. the match date variable only results in dates from the first month of the series [2018-01-01], not subsequent months). Note that --index-date-range "2018-01-01 to 2022-03-01 by month" is specified in the project.yaml. We have confirmed that this doesn't happen with real data, it appears to only be an issue when creating dummy data.

More details are available in this Slack thread: https://bennettoxford.slack.com/archives/C33TWNQ1J/p1660747406136349

opioid_any = patients.with_these_medications(
    opioid_codes,
    between = ["first_day_of_month(index_date)", "last_day_of_month(index_date)"],
    returning = "binary_flag",
    find_first_match_in_period = True,
    include_date_of_match = True,
    date_format = "YYYY-MM-DD",
    return_expectations= {
      "date": {
        "earliest": "first_day_of_month(index_date)",
        "latest": "last_day_of_month(index_date)",
        },
      "incidence": 0.15
      },
  ),
  generate_cohort:
    run: >
      cohortextractor:latest generate_cohort
        --study-definition study_definition
        --index-date-range "2018-01-01 to 2022-03-01 by month"
        --output-dir=output
    outputs:
      highly_sensitive:
        cohort: output/input_*.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant