MechanicalRabbit / OHDSICohortExpressions.jl

reimplementation of OHDSI's Circe JSON->SQL compiler
Other
7 stars 1 forks source link

[BUG] OHDSICohortExpressions not Yielding Cohort While CirceR Does #3

Closed TheCedarPrince closed 2 weeks ago

TheCedarPrince commented 2 years ago

Hi @xitology ,

I was using OHDSICohortExpressions the other day and ran into a strange issue concerning the creation of a cohort. When using the following Cohort Definition, I do not get an expected returned Cohort on my OMOP database. Yet, when I use the same definition in CirceR and CohortGenerator, I do get people matched to my cohort. There seems to be some kind of bug here but I do not know what else to report. Thank you!

Here is my code:

using DBInterface
using LibPQ
using OHDSICohortExpressions: translate, Model

cohort = read("depression_total.json", String)

model = Model(
    cdm_version = v"5.3.1",
    cdm_schema = "test",
    vocabulary_schema = "test",
    results_schema = "test",
    target_schema = "test",
    target_table = "my_cohort_table",
);

tsql = translate(cohort, dialect = :postgresql, model = model, cohort_definition_id = 1);

LibPQ.execute(conn, tsql)
Cohort Definition ```json { "ConceptSets": [ { "id": 3, "name": "[JZ] Depression", "expression": { "items": [ { "concept": { "CONCEPT_CLASS_ID": "Clinical Finding", "CONCEPT_CODE": "35489007", "CONCEPT_ID": 440383, "CONCEPT_NAME": "Depressive disorder", "DOMAIN_ID": "Condition", "INVALID_REASON": "V", "INVALID_REASON_CAPTION": "Valid", "STANDARD_CONCEPT": "S", "STANDARD_CONCEPT_CAPTION": "Standard", "VOCABULARY_ID": "SNOMED" }, "includeDescendants": true } ] } } ], "PrimaryCriteria": { "CriteriaList": [ { "ConditionOccurrence": { "CodesetId": 3 } } ], "ObservationWindow": { "PriorDays": 365, "PostDays": 0 }, "PrimaryCriteriaLimit": { "Type": "First" } }, "AdditionalCriteria": { "Type": "ANY", "CriteriaList": [], "DemographicCriteriaList": [], "Groups": [] }, "QualifiedLimit": { "Type": "First" }, "ExpressionLimit": { "Type": "First" }, "InclusionRules": [], "CensoringCriteria": [], "CollapseSettings": { "CollapseType": "ERA", "EraPad": 0 }, "CensorWindow": {}, "cdmVersionRange": ">=5.0.0" } ```
TheCedarPrince commented 2 years ago

Maybe it has something to do with the cdm_version variable?

xitology commented 2 years ago

This should be fixed in cdba8851c14909695f9b649890315d7c0f675514.

xitology commented 2 years ago

The fix is included to the new release v0.1.4.

clarkevans commented 2 months ago

@TheCedarPrince -- would you verify this is complete with v0.2 and if it works as expected, close this ticket?

TheCedarPrince commented 2 weeks ago

Yes, this is fixed now. Thanks! :smile: