OHDSI / Achilles

Automated Characterization of Health Information at Large-scale Longitudinal Evidence Systems (ACHILLES) - descriptive statistics about a OMOP CDM database
https://ohdsi.github.io/Achilles/
130 stars 121 forks source link

Error in exportToAres() with duckdb output format #749

Open ganisimov opened 9 months ago

ganisimov commented 9 months ago

When I run exportToAres() with outputFormat="duckdb", I see following error:

arguments imply differing number of rows: 1, 0

Here is log:

...
Connecting using Redshift driver
Generating Measurement reports
Generating Measurement reports
Connecting using Redshift driver
Error in data.frame(CONCEPT_ID = concept_id, CONCEPT_NAME = report$CONCEPT_NAME,  :
  arguments imply differing number of rows: 1, 0

This happens when concept_id is 0 and some other fields, like concept_name, are NAs. normalizeEmptyValue() replaces NAs with empty vectors and subsequent call to createConceptMedatataTable() tries to create data.frame out of concept_id of length 1 and the empty vectors.

Not sure if having concept_id 0 with empty concept_name is a valid situation. When running with JSON output format against the same data, no error is produced.

Mikhail-iontsev commented 8 months ago

Pushed fix to https://github.com/OHDSI/Achilles/pull/742