pepfar-datim / datimutils Goto Github PK
View Code? Open in Web Editor NEWLicense: Creative Commons Zero v1.0 Universal
License: Creative Commons Zero v1.0 Universal
non_mil_types_of_org_units <-
datapackcommons::getMetadata("dimensions",
"id:eq:mINJi7rR1a6",
"items[name,id]") %>%
tidyr::unnest(c("items")) %>%
dplyr::filter(name != "Military") %>%
.[["id"]]
mech_codes <- datapackcommons::getMetadata("categories",
"id:eq:SH885jaRe0o",
"categoryOptions[id,code]") %>%
.[["categoryOptions"]] %>%
.[[1]] %>%
dplyr::rename(mechanism_co_uid = "id", mechanism_code = "code")
Show that the old code and new code produce equivalent output.
@jason-p-pickering @sam-bao - Please add any suggested functions to include in this package (what it should do, not a name suggestion) for its initial launch:
categoryOptions
, dataElements
, organisationUnits
) from endpoint, and allow easy, magrittr
-friendly filtering and field selection.The goal is to accumulate upfront as many ideas for potential functions as are possible, and then to later convert these into epics or issues in our backlog.
Would be good to run this list past ICPI users as they seem to be the largest potential user base. These functions should also allow offload of any generic DATIM API interactions from datapackr
and datimvalidation
.
Goal is to complete first pass of this list by Aug 30, 2019.
The datapackr package and apps make a few calls to necessary sqlViews in DATIM. We have implemented a few different approaches to getting this, but it would make sense to centralize how we retrieve them from the server.
Based on the DHIS2 developer documentation, the prototype function should look something like this
getSQLView<-function(id,criteria,vars,filters) {...}
id: The UID of the sqlView
criteria: A simple server side filter which can be specified. Should accept a list and collapse it.
/api/sqlViews/{id}/data?criteria=col1:value1&criteria=col2:value2
vars: Should accept a named list or a data frame consisting of key-value pairs
/api/sqlViews/{id}/data?var=key1:value1&var=key2:value2
filters: : Should function the same as getMetadata, allowing for multiple filters and operators, or alternatively, a user constructed filter string.
/api/sqlViews/w3UxFykyHFy/data.json?filter=orgunit_level:eq:2&filter=orgunit_name:ilike:bo
Retrieval of sqlViews appears to be quicker and easier to implement using the CSV response.
glue::glue("{d2_session$base_url}api/sqlViews/IMg2pQJRHCr/data.csv") %>%
httr::GET(., handle = d2_session$handle ) %>%
httr::content(.,"text") %>%
readr::read_csv(.)
The JSON response could also be used and does contain a bit metadata information, and could also be considered to be used.
FYI @sam-bao
This line still doesn't seem to be hit by out unit tests.
datimutils/R/getMetadataEndpoint.R
Line 17 in 1024eb5
Hi,
I have installed both datimvalidation and datimutils R packages for pepfar data validation purposes. When I try to use the logintodatim function, however, I get the error Error: lexical error: invalid char in json text. <!DOCTYPE HTML> <html class="lo (right here) ------^
This is how I used it: loginToDATIM(base_url = "https://dev-de.datim.org/dhis-web-commons/security/login.action", username = "xxx", password = "xxxxxxx")
. The base url from the manual says I should use http://dev-de.datim.org which gives an error Error in curl::curl_fetch_memory(url, handle = handle) : Could not resolve host: dev-de.datim.orgapi
With this error, I changed to the resolved URL which is https://dev-de.datim.org/dhis-web-commons/security/login.action but then faces the lexical error explained. I am stuck and cannot make any progress; any help would be appreciated. Just to add, I have an existing account in Datim.
Augustine
getDataStore(namespace,key)
which would return a datastore object.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.