Coder Social home page Coder Social logo

Comments (3)

pa-nathaniel avatar pa-nathaniel commented on July 17, 2024

We tried the method below and looks like we got this to work in Capr 2.0.7.

ch <- cohort(
  entry = entry(
    conditionOccurrence(cs0, 
                        startDate(methods::new("opAttributeDate", op = "gte", value = as.Date("2022-01-01"))),
                        endDate(methods::new("opAttributeDate", op = "lte", value = as.Date("2023-12-31"))))
  ),
  exit = exit(
    endStrategy = observationExit()
  )
)

Note this didn't work in version 2.0.5 but seems to have been addressed as of 2.0.6 according to (https://github.com/OHDSI/Capr/blob/main/NEWS.md#capr-206). Thanks for those updates Capr team!

While the results look right I wonder if there is a simpler way to do this than calling methods::new(). Curious what @mdlavallee92 thinks.

from capr.

mdlavallee92 avatar mdlavallee92 commented on July 17, 2024

you shouldnt need to make a new method that is hidden behind the op functions (gt, gte, lt, lte, eq, neq, bt, nbt).

The attribute class op is built by these functions and nested within the attribute domain. For example

age <- age(gte(18))
startDate <- startDate(bt(lubridate::as_date("2022-01-01"), lubridate::as_date("2023-12-31")))

So for your cohort it would look something like this.

ch <- cohort(
  entry = entry(
    conditionOccurrence(
      cs0,
      startDate(gte(lubridate::as_date("2022-01-01"))),
      endDate(lte(lubridate::as_date("2023-12-31")))),
    observationWindow = continuousObservation(priorDays = 365)
  ),
  exit = exit(
    endStrategy = observationExit()
  )
)

You can also set a censor window in the eras:

ch <- cohort(
  entry = entry(
    conditionOccurrence(
      cs0,
    observationWindow = continuousObservation(priorDays = 365)
  ),
  exit = exit(
    endStrategy = observationExit()
  ),
  era = era(
    studyStartDate = lubridate::as_date("2022-01-01"),
    studyEndDate = lubridate::as_date("2023-12-31")
  )
)

from capr.

pa-nathaniel avatar pa-nathaniel commented on July 17, 2024

Ah makes sense, thank you!!!!

from capr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.