Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow external definitions #10

Closed
abhidg opened this issue Jan 31, 2023 · 1 comment · Fixed by #66
Closed

Allow external definitions #10

abhidg opened this issue Jan 31, 2023 · 1 comment · Fixed by #66
Assignees
Labels
enhancement New feature or request

Comments

@abhidg
Copy link
Contributor

abhidg commented Jan 31, 2023

We should be able to lookup from an external data source. Use cases for this functionality:

  • Looking up names of countries from ISO codes
  • Looking up latitude, longitude from name
  • Mapping unique IDs from another source
@abhidg
Copy link
Contributor Author

abhidg commented May 17, 2023

Detailed description

Allow external definitions in adtl. Two kinds of external definitions are supported:

  • Passed on the command line as --def that will add the definition(s) to the definition map
  • Included statically in include_defs section in the top-level adtl header

Example of including an external definition:

[adtl]
include_defs = ["./country.toml"]

This will add the country.toml file in the same folder to the definitions map. For example, country.toml could look like this

[countryMap.values]
1 = "ALB"
2 = "ZZZ"

Similarly, RELSUB files for clinical data are mappings from the visit IDs to subject IDs and should be used in a similar way as countryMap. However, unlike the above, RELSUB files should not be committed to version control as they are sensitive data (patient IDs). In that case, we could call adtl with the --def option as follows

adtl parsers/someparser.toml data.csv --def relsub.json

Assuming relsub.json has the following structure

{ "RELSUB":
  {
     "values": {
	 "S-001": 1,
	 "S-002": 2,
	 "S-003": 3,
     }
  }
}

this will create a RELSUB reference that within the adtl parser that can be used like any other reference.

@abhidg abhidg changed the title Allow lookups from external table in CSV or JSON format Allow external definitions May 17, 2023
abhidg added a commit that referenced this issue May 17, 2023
abhidg added a commit that referenced this issue May 17, 2023
abhidg added a commit that referenced this issue May 18, 2023
@abhidg abhidg linked a pull request May 18, 2023 that will close this issue
abhidg added a commit that referenced this issue May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant