You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal of readepi is to provide a unified interface to various health information system or common epidemiological databases. A key principle and the challenge is the harmonization of these very different data sources.
This harmony should also visible internally in low-level parsers to 1. facilitate the understanding of the package structure, thus making easier to maintain it and detect potential issues, 2. possibly eventually export these low-level parsers, as discussed in #45.
I see the following sources of inconsistency that should be addressed:
naming conventions. Function names should all be based on the same model. In particular, there should not be functions with names such as login() or make_api_request() when they only apply to a specific data source. This video from Felienne Hermans, a researcher in software engineering, is a good resource of this topic.
function signature. Right now, the same argument can be in different orders and have different name in different functions, which make it error-prone and require an extra verification step each time one wants to use these functions. A good way to enforce good practice here is to rely on roxygen's documentation inheritance. One example among others:
argument defaults. On a related note, arguments do not consistently include (or not) default values. A global policy for the whole package should be picked and applied to all low-level parsers.
argument checking. At the moment, the same arguments are not validated as strictly across different functions. A good way to enforce good practices and coherence here could be to create checking helpers (such as assert_credentials(username, password), or assert_url())
return values. Some functions return list(data) where others return list(data, metadata). I understand metadata may be available only in some cases but the return values should be consistent across functions, even if it means returning list(data = data, metadata = NA). This can again be enforced via roxygen's documentation inheritance.
(patterns. This last one is more difficult but important as well for readability and maintainability. The exact same operation is performed via different patterns in different sections of the code. For example do.call(rbind.data.frame, ...) vs dplyr::bind_rows(...); paste(collapse) vs glue::glue_collapse(), passing request parameters to httr::GET() as a list or directly in the URL, etc.)
The text was updated successfully, but these errors were encountered:
The goal of readepi is to provide a unified interface to various health information system or common epidemiological databases. A key principle and the challenge is the harmonization of these very different data sources.
This harmony should also visible internally in low-level parsers to 1. facilitate the understanding of the package structure, thus making easier to maintain it and detect potential issues, 2. possibly eventually export these low-level parsers, as discussed in #45.
I see the following sources of inconsistency that should be addressed:
login()
ormake_api_request()
when they only apply to a specific data source. This video from Felienne Hermans, a researcher in software engineering, is a good resource of this topic.readepi/R/read_from_dhis2.R
Lines 39 to 41 in 11aa71e
readepi/R/read_from_dhis2-helpers.R
Line 13 in 11aa71e
assert_credentials(username, password)
, orassert_url()
)list(data)
where others returnlist(data, metadata)
. I understand metadata may be available only in some cases but the return values should be consistent across functions, even if it means returninglist(data = data, metadata = NA)
. This can again be enforced via roxygen's documentation inheritance.do.call(rbind.data.frame, ...)
vsdplyr::bind_rows(...)
;paste(collapse)
vsglue::glue_collapse()
, passing request parameters tohttr::GET()
as a list or directly in the URL, etc.)The text was updated successfully, but these errors were encountered: