Coder Social home page Coder Social logo

Comments (5)

gowthamrao avatar gowthamrao commented on July 17, 2024

I was able to parse this into JSON as follows

cdJson <- RJSONIO::toJSON(x = list(cd))
cdJSon <- RJSONIO::fromJSON(content = cdJson)[[1]]
cdJSon <- RJSONIO::toJSON(x = cdJSon, pretty = TRUE)

from capr.

gowthamrao avatar gowthamrao commented on July 17, 2024

The JSON is below - but it cannot be imported into ATLAs


{
	"CohortDetails" : {
		"Name" : "Testing Cohort",
		"Description" : "Description for Testing Cohort",
		"Author" : null,
		"cdmVersionRange" : ">=5.0.0"
	},
	"PrimaryCriteria" : {
		"MetaData" : {
			"ComponentClass" : "PrimaryCriteria",
			"Name" : "Concept Set Condition Occurrence",
			"Description" : null
		},
		"CriteriaExpression" : {
			"CriteriaList" : [
				{
					"Domain" : "ConditionOccurrence",
					"CodesetId" : "47ada7d4-56e6-4cdc-909a-91694b48eec8",
					"Attributes" : [
						{
							"Name" : "Age",
							"Op" : "lt",
							"Contents" : {
								"Value" : 10,
								"Extent" : null
							}
						}
					]
				}
			],
			"ObservationWindow" : {
				"PriorDays" : 0,
				"PostDays" : 0
			}
		},
		"Limit" : {
			"PrimaryCriteriaLimit" : {
				"Type" : "All"
			}
		},
		"ConceptSetExpression" : [
			{
				"id" : "47ada7d4-56e6-4cdc-909a-91694b48eec8",
				"Name" : "Diabetes Melltius",
				"Expression" : [
					{
						"Concept" : {
							"CONCEPT_ID" : 201820,
							"CONCEPT_NAME" : "Diabetes mellitus",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "73211009",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4008576,
							"CONCEPT_NAME" : "Diabetes mellitus without complication",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "111552007",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4058243,
							"CONCEPT_NAME" : "Diabetes mellitus during pregnancy, childbirth and the puerperium",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "199223000",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 192691,
							"CONCEPT_NAME" : "Diabetes mellitus during pregnancy - baby not yet delivered",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "199227004",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4144583,
							"CONCEPT_NAME" : "Diabetes mellitus due to cystic fibrosis",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "427089005",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4192852,
							"CONCEPT_NAME" : "Diabetes mellitus due to insulin receptor antibodies",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "75682002",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4240589,
							"CONCEPT_NAME" : "Diabetes mellitus associated with hormonal etiology",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "59079001",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4136889,
							"CONCEPT_NAME" : "Diabetes mellitus induced by non-steroid drugs without complication",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "413183008",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4079850,
							"CONCEPT_NAME" : "Diabetes mellitus in neonate small for gestational age",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "276560009",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4.575747e+07,
							"CONCEPT_NAME" : "Diabetes mellitus type 2 without retinopathy",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "1481000119100",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4237068,
							"CONCEPT_NAME" : "Diabetes mellitus due to structurally abnormal insulin",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "91352004",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4245270,
							"CONCEPT_NAME" : "Diabetes mellitus associated with genetic syndrome",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "5969009",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4178452,
							"CONCEPT_NAME" : "Diabetes mellitus associated with pancreatic disease",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "51002006",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4129516,
							"CONCEPT_NAME" : "Diabetes-deafness syndrome maternally transmitted",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "237619009",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4322638,
							"CONCEPT_NAME" : "Diabetes mellitus AND insipidus with optic atrophy AND deafness",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "70694009",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4235410,
							"CONCEPT_NAME" : "Diabetes mellitus induced by non-steroid drugs",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "408540003",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4.575708e+07,
							"CONCEPT_NAME" : "Diabetes mellitus due to pancreatic injury",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "105401000119101",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4143529,
							"CONCEPT_NAME" : "Diabetes mellitus associated with cystic fibrosis",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "426705001",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4.576605e+07,
							"CONCEPT_NAME" : "Diabetes mellitus in remission",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "703136005",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4.575767e+07,
							"CONCEPT_NAME" : "Diabetes mellitus type 1 without retinopathy",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "31321000119102",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 3.668483e+07,
							"CONCEPT_NAME" : "Diabetes mellitus type 2 with periodontal disease",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "368101000119109",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4.253768e+07,
							"CONCEPT_NAME" : "Diabetes mellitus caused by chemical",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "737212004",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4.076934e+07,
							"CONCEPT_NAME" : "History of Diabetes (regardless of treatment) [PhenX]",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "66678-4",
							"DOMAIN_ID" : "Observation",
							"VOCABULARY_ID" : "LOINC",
							"CONCEPT_CLASS_ID" : "Clinical Observation"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4.353102e+07,
							"CONCEPT_NAME" : "Diabetes mellitus, transient neonatal 2",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "609580007",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					},
					{
						"Concept" : {
							"CONCEPT_ID" : 4.479311e+07,
							"CONCEPT_NAME" : "Diabetes mellitus with multiple complications",
							"STANDARD_CONCEPT" : "S",
							"STANDARD_CONCEPT_CAPTION" : "Standard",
							"INVALID_REASON" : "V",
							"INVALID_REASON_CAPTION" : "Valid",
							"CONCEPT_CODE" : "385041000000108",
							"DOMAIN_ID" : "Condition",
							"VOCABULARY_ID" : "SNOMED",
							"CONCEPT_CLASS_ID" : "Clinical Finding"
						},
						"isExcluded" : false,
						"includeDescendants" : true,
						"includeMapped" : false
					}
				]
			}
		]
	},
	"AdditionalCriteria" : {
		"MetaData" : {
			"ComponentClass" : "Empty",
			"Name" : null,
			"Description" : null
		},
		"CriteriaExpression" : [],
		"Limit" : [],
		"ConceptSetExpression" : []
	},
	"InclusionRules" : {
		"MetaData" : {
			"ComponentClass" : "InclusionRules",
			"Name" : "Inclusion Rules",
			"Description" : null
		},
		"CriteriaExpression" : [],
		"Limit" : {
			"ExpressionLimit" : {
				"Type" : "First"
			}
		},
		"ConceptSetExpression" : []
	},
	"EndStrategy" : {
		"MetaData" : {
			"ComponentClass" : "EndStrategy",
			"Name" : "End Strategy Date Offset",
			"Description" : null
		},
		"CriteriaExpression" : [
			{
				"DateField" : "EndDate",
				"Offset" : 0
			}
		],
		"Limit" : [],
		"ConceptSetExpression" : []
	},
	"CensoringCriteria" : {
		"MetaData" : {
			"ComponentClass" : "Empty",
			"Name" : null,
			"Description" : null
		},
		"CriteriaExpression" : [],
		"Limit" : [],
		"ConceptSetExpression" : []
	},
	"CohortEra" : {
		"MetaData" : {
			"ComponentClass" : "CohortEra",
			"Name" : "Cohort Era Details",
			"Description" : null
		},
		"CriteriaExpression" : {
			"CollapseSettings" : {
				"CollapseType" : "ERA",
				"EraPad" : 1
			},
			"CensorWindow" : {
				"StartDate" : null,
				"EndDate" : null
			}
		},
		"Limit" : [],
		"ConceptSetExpression" : []
	}
}

from capr.

gowthamrao avatar gowthamrao commented on July 17, 2024

image

from capr.

mdlavallee92 avatar mdlavallee92 commented on July 17, 2024

@gowthamrao Sorry for the delayed response. When you create the cohort definition use Capr::createCohortDefinition this generates the R object version of the cohort definition. In order to get into the ATLAS version of the cohort you need to compile it into the Circe structure. In the vignette go to the next chunk you will see commands that compile the R object into a circe json and ohdisql structure. Capr::compileCohortDefinition(cd,genOps). The genOps object in this call is made from CirceR::createGenerateOptions. Let me know if this is still an issue. Code block below:

cd <- Capr::createCohortDefinition( Name = "Testing Cohort", Description = desc, PrimaryCriteria = pc, InclusionRules = irs, EndStrategy = es, CohortEra = cohortEra)

genOp <- CirceR::createGenerateOptions(cohortIdFieldName = "cohort_definition_id", cohortId = 9999, cdmSchema = connectionDetails$schema, targetTable = "cohort", resultSchema = "results", vocabularySchema = connectionDetails$schema, generateStats = F)

#compile the cohort definition to create json and ohdisql
cohortInfo <- compileCohortDefinition(cd, genOp)

#if no errors preview the json and ohdisql
cat(cohortInfo$circeJson)
cat(cohortInfo$cohortRead)
cat(cohortInfo$ohdiSQL)

from capr.

mdlavallee92 avatar mdlavallee92 commented on July 17, 2024

This issue should be resolved. Also fixed a bug when compiling cohort definitions without additional criteria or inclusion rules. Can reopen if issue persists

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.