Skip to content

Add circe json to Capr serialization#111

Open
mdlavallee92 wants to merge 9 commits intodevelopfrom
ml_to_capr
Open

Add circe json to Capr serialization#111
mdlavallee92 wants to merge 9 commits intodevelopfrom
ml_to_capr

Conversation

@mdlavallee92
Copy link
Collaborator

Be able to coerce a circe json into a capr format. Use case is Capr allows for easier "quick" edits of a definition programatically.

See #101 this is the same feature request. @azimov also requested

Use case code:

# import circe json and coerce into Capr
cd <- readInCirce(path = "my_complex_cohort.json")
# add an inclusion rule into my cohort
cd@attrition@rules[[3]] <- withAll(
      exactly(1,
              observationPeriod(),
              duringInterval(eventStarts(-Inf, -365), eventEnds(-1, Inf))
      )
    )

@mdlavallee92
Copy link
Collaborator Author

mdlavallee92 commented Mar 7, 2025

Status: @azimov if you want to help

Added new file called toCapr.R. In here add internal functions for readInCirce. See old capr code for original version of circe to capr.

  • Convert concept sets to Capr
  • convert query attributes to Capr attributes
  • add source concept attribute
  • convert correlated criteria attribute
  • convert query to Capr query with domain
  • convert circe count to Capr criteria
  • convert circe group to Capr group
  • convert primary criteria to Capr entry
  • convert inclusion rules to Capr attrition
  • convert censor and end strategy to capr exit
  • convert collapse strategy to capr era
  • combine individual coersions to a capr cohort
  • write and test readInCirce UI fn

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

Successfully merging this pull request may close these issues.

2 participants