OHDSI / ROhdsiWebApi

An R package for interfacing with a WebAPI instance
https://ohdsi.github.io/ROhdsiWebApi
10 stars 17 forks source link

Dynamically generate 'safe' (portable) names for a cohort from cohort json expression #145

Closed gowthamrao closed 3 years ago

gowthamrao commented 4 years ago

Issue: if the cohort does not have a OS safe name, it seems to cause issues when used across OS.

See issues: https://github.com/OHDSI/ROhdsiWebApi/issues/139 https://github.com/OHDSI/WebAPI/issues/1510 https://github.com/OHDSI/ROhdsiWebApi/issues/43 https://github.com/OHDSI/Atlas/issues/2182

There are changes being done on webApi/Atlas to ensure the names are safe/portable. In HADES R packages, a convention is being used where safe/portable names may be specified by user e.g. CohortsToCreate.csv in ROhdsiWebApi::insertCohortDefinitionSetInPackage

The CSV file should have at least the following fields: 
- atlasId:The cohort ID in ATLAS.
- cohortId:The cohort ID that will be used when instantiating the cohort (can be different from atlasId).
- name:The name to be used for the cohort. This name will be used to generate file names, so please use letters and numbers only (no spaces).

In the above, 'name' is expected to be safe/portable. This name is used while creating exportable definitions of the cohort (e.g. json, sql)..

But many times (because it is user dependent) it may not be. e.g. trailing space issue above. One approach was to create a warning. But what should raise the warning

per https://en.wikipedia.org/wiki/Filename image

Another option is to dynamically generate such a file name - i.e. create a option for the package to generate file name that is both unique and compatible with safe/portable name rules.

This name may be informative and created from the json expression - to represent a high level description of the cohort definition.

Impacts: ROhdsiWebApi::insertCohortDefinitionInPackage ROhdsiWebApi::insertCohortDefinitionSetInPackage

gowthamrao commented 3 years ago

Resolved by WebApi