OHDSI Home | Forums | Wiki | Github

Covid19 study Json cohort definition not working on "atlas-demo.ohdsi.org"

(Javier Gracia-Tabuenca) #1

Short story
Why if i copy for example this

and paste in atlas-demo.ohdsi.org/ in a cohort definition Atlas does not recognice it ???

Long story

Im running Covid19HospitalizationCharacterization on our database.

I get the error:

  • Creating characterization for cohort COVID-19 narrow - no prior observation required [SIDIAP]
    Cohort with ID 108 appears to be empty. Was it instantiated?Cohort characterization took 0.0591 secs
    Error in round(data$mean, 3) : non-numeric argument to mathematical function
Traking down I'm sure that is bcs it does not find any patients. 

I'm tried to check this by just copy-pasting one of the json cohort definitions in atlas. However, atlas does not recognice it as valid. Same occurs also in  atlas-demo.ohdsi.org/.

(Chris Knoll) #2

So, something corrupted the JSON, there are two fields which are simple Strings but they are being serialized as an array:

  "QualifiedLimit": {
    "Type": ["All"]
  "ExpressionLimit": {
    "Type": ["First"]

and in other places where it should not be an array:

    "ObservationWindow": {
      "PriorDays": [0],
      "PostDays": [0]
    "PrimaryCriteriaLimit": {
      "Type": ["All"]
  "AdditionalCriteria": {
    "Type": ["ANY"],

So, that’s the problem in the UI code: it’s trying to see if the value starts with AT_ and you can’t get a substring from an array object.

To me, this looks like a serialization problem from RJSONIO to a string: sometimes single-value properties become arrays, which is clearly a problem, but in a ‘discussion’ i had about it with the RJSON devs, they say this is by design. I’m not sure how the cohort definitions were serialized into the study package, but that’s where the problem is.

Anyone on the Covid study-a-thon have information about how those cohort definitions were generated/saved?

Update: I tracked down the commit made by @krfeeney. @krfeeney, can you describe how you pushed the study artifacts (cohorts, etc) into the repository? It got corrupted somehow.

(Martijn Schuemie) #3

I think this is my fault. Currently, ROhdsiWebApi uses jsonlite to write the JSON file. This has this odd behavior. It seems the RJSONIO package works fine, so I’ll switch to that. @Gowtham_Rao and I are close to finalizing ROhdsiWebApi version 1.0.0, and we’ll incorporate this change.

(Kristin Kostka, MPH) #4

Don’t shoot the messenger. :wink: I was migrating @edburn and @anthonysena’s code from a private repo into a public OHDSI repo.

@Javier, if you’re looking COVID-19 cohorts to re-use, I would suggest keeping an eye on Project Charybdis (Characterization) and Project Scylla (Estimation). @Patrick_Ryan @Azza_Shoaibi and team have built an entire new library of phenotypes that will have a bunch more COVID-19 cohorts in it.

This morning I’m working on updating our OHDSI Studies repo to have more documentation on where we’re at with Project Charybdis: https://github.com/ohdsi-studies/Covid19CharacterizationCharybdis

We’ll be keeping all Cohorts in the “inst” (short for Install) folder here: https://github.com/ohdsi-studies/Covid19CharacterizationCharybdis/tree/master/inst/cohorts

Please feel free to reach out if there’s any questions. We will soon be promoting and disseminating this characterization package!

(Javier Gracia-Tabuenca) #5

Thanks a lot to everyone, Im always so amaze how fast and precise this community always answers.

Thanks @Chris_Knoll, I edited by hand the few squared brakes and now it works.

@schuemie. I this info may help: I also tipically work with jsonlite. I tried to fix the .json file using jsonlite::writeJSON with the flag auto_unbox=TRUE. But still atlas didnt read it.

@krfeeney, Thanks, I’ll have a look. Our data is not the best, last time updated is dec-2018. The corona cases added manually are isolated in time from the rest. The ELT is also inmature. It is just me working on this. I want to characterised our patients so they can be compare to your resutls, so that my colleges see how important OHDSI and i get more help on this :slight_smile:

Now the Covid19HospitalizationCharacterization finds my patients but only calcualtes age covariates.
I’m guessing that im missing the ERA_ tables, tanks to @krfeeney links i saw how to calculate them.

(Javier Gracia-Tabuenca) #6

By the way,

The project I work for is FinnGen. We have DNA from 220k Fins and the associated longitudinal data (diagnoses, drugs purchases, and procedures) we identify 250 patiens in our data base that tested positive in COVID-19.

If some how this gentic information could help you we are are happy to colaborate.

(Martijn Schuemie) #7

So I’ve switched to RJSONIO and now this problem appears solved.

This does mean people will need to rerun insertCohortDefinitionSetInPackage using the develop version of ROhdsiWebApi to fix the JSON files. (Or wait a bit. We’re almost done with the new release)