Coder Social home page Coder Social logo

Comments (5)

mdlavallee92 avatar mdlavallee92 commented on July 17, 2024 1

If you are using age as an attribute to a condition this is indeed correct. However, circe allows you to use a demographic attribute as a point of attrition. This is not covered in Capr v2 and needs to be added.

from capr.

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

I just found some relevant documentation in at

t1dConceptSet <- cs(descendants(195771), name = "T1D")
maleT1D <- conditionOccurrence(t1dConceptSet, male())
maleT1D18andOlder <- conditionOccurrence(t1dConceptSet, male(), age(gte(18)))
maleT1D18andOlderFirstDx <- conditionOccurrence(
t1dConceptSet, male(), age(gte(18)), firstOccurrence())
I'll keep learning and post an answer if I can solve it!

from capr.

mdlavallee92 avatar mdlavallee92 commented on July 17, 2024

@pa-nathaniel thanks for your question. you have indeed found a bug. If you want to observe the attrition based on age you can add the age as a demographic criteria to a group. This is what happens in ATLAS. I need to add a container that holds the demographic criteria to apply it to the group. A group must take in a criteria class. Code would look as such:

library(Capr)
  
  t1dConceptSet <- cs(descendants(195771), name = "T1D") 
  
  cd <- cohort(
    entry = entry(
      t1dConceptSet,
      observationWindow = continuousObservation(priorDays = 365L),
      primaryCriteriaLimit = "All"
    ),
    attrition = attrition(
      'atLeast18' = withAll(
        demographic(age(gte(18L))) # function to add
      )
    )
  )

from capr.

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

Ah interesting, I thought I had solved it yesterday evening by doing something like the code below. Would this not do it?

library(Capr)
 
 t1dConceptSet <- cs(descendants(195771), name = "T1D") 
  
 cd <- cohort(
    entry = entry(
      t1dConceptSet,
      observationWindow = continuousObservation(priorDays = 365L),
      primaryCriteriaLimit = "All"
    ),
    attrition = attrition(
     "At least 18 at entry" = withAll(
      atLeast(
        1,
        conditionOccurrence(
          t1dConceptSet,
          age(gte(18)), firstOccurrence()
        )
      )
  )

from capr.

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

Ah great glad I wasn't too far off, thanks!

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.