The data entry backend is a MariaDB database so more people can enter data simultaneously.
The frontends are UI-s (one per table) based on shiny and rhandsontable.
Individual checks are done by validators.
A collection of validators makes an inspector.
Data is checked before it is saved to the DB by the inspector.
Each time the inspector runs, the exact position of the offending cell(s) and the reasons for errors are returned.
Validation is kept in the data entry layer because unusual observations are not always mistakes. Hard database constraints are useful for structural integrity, but they can also make it impossible to record a real but unexpected observation in the field.
The user can bypass the data validation. However the entries saved without validation are flagged in the database and the user is encouraged to explain why the validation was ignored. The aim is to make questionable data visible and traceable, not to silently discard observations that may be real.
| App type | UI function | Server function | Description |
|---|---|---|---|
newData |
ui_append_rows() |
server_append_rows() |
Opens an empty table-specific data entry form. New rows are checked with the inspector for that table before they are appended to the database. |
editData |
ui_edit_table() |
server_edit_table() |
Loads existing rows from a database table, lets the user edit them, and runs the same validation workflow before saving changes back to the database. |
editInspector |
ui_edit_rcode() |
server_edit_rcode() |
A special editRcode setup linked to the inspectors table. Each row stores validation R code that is later loaded by another app to check a database table. |
editRcode |
ui_edit_rcode() |
server_edit_rcode() |
A general app type for editing R code stored in a database table. When it is not linked to the inspectors table, the table can be used to store R code artefacts that can later be loaded and used by another app. |
Each app is available for testing within the package
shiny::runApp(
system.file("UI", "newData", package = "DataEntry"),
launch.browser = TRUE
)
shiny::runApp(
system.file("UI", "editData", package = "DataEntry"),
launch.browser = TRUE
)
shiny::runApp(
system.file("UI", "editInspector", package = "DataEntry"),
launch.browser = TRUE
)
shiny::runApp(
system.file("UI", "editRcode", package = "DataEntry"),
launch.browser = TRUE
)
These apps expect the test database configured by:
system.file("UI", ".testdb.R", package = "DataEntry")The SQL installer for the data_entry_tests database is available at:
system.file("database", "install_testdb.sql", package = "DataEntry")From a shell, install it with something like:
mariadb -u root -p < path/to/install_testdb.sqlThe SQL creates the data_entry_tests database, the test user, and the
tables used by the example apps.
install.packages("remotes")
remotes::install_github("ornitho-logics/DataEntry")
