epiverse-trace / linelist

R package for handling linelist data
https://epiverse-trace.github.io/linelist/
Other
8 stars 4 forks source link

Document the meaning of each tag #74

Closed Bisaloo closed 8 months ago

Bisaloo commented 1 year ago

Tags provided by default in linelist currently don't include any explanation of their meaning. You can get a list of tags, or their allowed class, but that's it.

library(linelist)

tags_names()
#>  [1] "id"             "date_onset"     "date_reporting" "date_admission"
#>  [5] "date_discharge" "date_outcome"   "date_death"     "gender"        
#>  [9] "age"            "location"       "occupation"     "hcw"           
#> [13] "outcome"

tags_types()
#> $id
#> [1] "numeric"   "integer"   "character"
#> 
#> $date_onset
#> [1] "integer" "numeric" "Date"    "POSIXct" "POSIXlt"
#> 
#> $date_reporting
#> [1] "integer" "numeric" "Date"    "POSIXct" "POSIXlt"
#> 
#> $date_admission
#> [1] "integer" "numeric" "Date"    "POSIXct" "POSIXlt"
#> 
#> $date_discharge
#> [1] "integer" "numeric" "Date"    "POSIXct" "POSIXlt"
#> 
#> $date_outcome
#> [1] "integer" "numeric" "Date"    "POSIXct" "POSIXlt"
#> 
#> $date_death
#> [1] "integer" "numeric" "Date"    "POSIXct" "POSIXlt"
#> 
#> $gender
#> [1] "character" "factor"   
#> 
#> $age
#> [1] "numeric" "integer"
#> 
#> $location
#> [1] "character" "factor"   
#> 
#> $occupation
#> [1] "character" "factor"   
#> 
#> $hcw
#> [1] "logical"   "integer"   "character" "factor"   
#> 
#> $outcome
#> [1] "character" "factor"

tags_defaults()
#> $id
#> NULL
#> 
#> $date_onset
#> NULL
#> 
#> $date_reporting
#> NULL
#> 
#> $date_admission
#> NULL
#> 
#> $date_discharge
#> NULL
#> 
#> $date_outcome
#> NULL
#> 
#> $date_death
#> NULL
#> 
#> $gender
#> NULL
#> 
#> $age
#> NULL
#> 
#> $location
#> NULL
#> 
#> $occupation
#> NULL
#> 
#> $hcw
#> NULL
#> 
#> $outcome
#> NULL

Created on 2023-06-20 with reprex v2.0.2

This change should probably be done by creating a csv file containing the following columns:

The tag_names(), tag_types() and tag_defaults() functions should then be updated to read from this file.

Bisaloo commented 8 months ago

Default tags are documented here:

https://github.com/epiverse-trace/linelist/blob/395906f45a983b3138bfeda4b663c5af89895f87/man/make_linelist.Rd#L36-L54

https://epiverse-trace.github.io/linelist/reference/make_linelist.html#details

PR#111 solves the duplication between tag_defaults() and tags_types() revealed by this issue. This refactoring is a good preparation step for the major refactoring and generalization in linelist 2.0.0.