USEPA / ccdR

Utilities for Interacting with the CTX APIs in R without prior API knowledge. All data is also available on the CompTox Chemical Dashboard (CCD) https://comptox.epa.gov/dashboard/
https://api-ccte.epa.gov/docs/
GNU General Public License v3.0
2 stars 0 forks source link

bioactivity_API get_bioactivity_details discrepancy in nested field type #57

Closed cthunes closed 1 month ago

cthunes commented 1 month ago

After unnesting wider the mc3-6Param fields, their format is not consistent, just like our most recent ticket #52. m4id returns a good format, just in lists aeid, dtxsid, and spid return the following fields as lists of lists (an unnecessary outer list which is not consistent across function): -resp -logc -flag -mc6MthdId

In tcpl, this is our current solution to resolve this issue: if(tolower(fld) != "m4id") dat <- dat %>% unnest(cols = c("resp", "logc", "flag", "mc6MthdId")) %>% as.data.table() We believe it makes more sense for ccdR to instead handle the discrepancy between column types.

A similar solution could be good at line 105 , though, like the previous issue #52, the best way to check for this issue would be checking column types for the list columns that persist (resp, logc, flag, mc6MthdId) and unnesting them if they are lists of lists.