Skip to content

Commit

Permalink
fix-issue-16
Browse files Browse the repository at this point in the history
  • Loading branch information
Karim-Mane committed Sep 10, 2023
1 parent a273574 commit eb55928
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 44 deletions.
12 changes: 6 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ show_example_file()
credentials_file <- system.file("extdata", "test.ini", package = "readepi")
# READING FILE FROM A PROJECT IN A REDCap DATABASE
data <- readepi(
dat <- readepi(
data_source = "https://bbmc.ouhsc.edu/redcap/api/",
credentials_file = credentials_file
)
project_data <- data$data # accessing the actual data
project_metadeta <- data$metadata # accessing the metadata associated with project
project_data <- dat$data # accessing the actual data
project_metadeta <- dat$metadata # accessing the metadata associated with project
# VIEWING THE LIST OF ALL TABLES IN A MySQL DATABASE
show_tables(
Expand All @@ -95,15 +95,15 @@ visualise_table(
)
# READING ALL FILEDS AND RECORDS FROM A MySQL SERVER
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "author", # this is the table name
driver_name = ""
)
# READING DATA FROM DHIS2
data <- readepi(
dat <- readepi(
data_source = "https://play.dhis2.org/dev",
credentials_file = credentials_file,
dataset = "pBOMPrpg1QX",
Expand All @@ -114,7 +114,7 @@ data <- readepi(
)
# READING DATA FROM THE FINGERTIPS REPOSITORY
data <- readepi(
dat <- readepi(
indicator_id = 90362,
area_type_id = 202,
parent_area_type_id = 6 # optional
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ show_example_file()
credentials_file <- system.file("extdata", "test.ini", package = "readepi")

# READING FILE FROM A PROJECT IN A REDCap DATABASE
data <- readepi(
dat <- readepi(
data_source = "https://bbmc.ouhsc.edu/redcap/api/",
credentials_file = credentials_file
)
project_data <- data$data # accessing the actual data
project_metadeta <- data$metadata # accessing the metadata associated with project
project_data <- dat$data # accessing the actual data
project_metadeta <- dat$metadata # accessing the metadata associated with project

# VIEWING THE LIST OF ALL TABLES IN A MySQL DATABASE
show_tables(
Expand All @@ -114,15 +114,15 @@ visualise_table(
)

# READING ALL FILEDS AND RECORDS FROM A MySQL SERVER
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "author", # this is the table name
driver_name = ""
)

# READING DATA FROM DHIS2
data <- readepi(
dat <- readepi(
data_source = "https://play.dhis2.org/dev",
credentials_file = credentials_file,
dataset = "pBOMPrpg1QX",
Expand All @@ -133,7 +133,7 @@ data <- readepi(
)

# READING DATA FROM THE FINGERTIPS REPOSITORY
data <- readepi(
dat <- readepi(
indicator_id = 90362,
area_type_id = 202,
parent_area_type_id = 6 # optional
Expand Down
64 changes: 32 additions & 32 deletions vignettes/readepi.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ visualise_table(
)
# READING ALL FIELDS AND ALL RECORDS FROM ONE TABLE (`author`)
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "author", # this is the table name
Expand All @@ -192,7 +192,7 @@ data <- readepi(
# READING SPECIFIED FIELDS AND ALL RECORDS FROM ONE TABLE
fields <- "author_id,name,last_name,initials"
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "author", # this is the table name
Expand All @@ -202,7 +202,7 @@ data <- readepi(
# READING SPECIFIED RECORDS AND ALL FIELDS FROM ONE TABLE
records <- "1, 34, 15, 70, 118, 20"
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "author", # this is the table name
Expand All @@ -212,7 +212,7 @@ data <- readepi(
)
# READING SPECIFIED FIELDS AND RECORDS ONE THE TABLE
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "author", # this is the table name
Expand All @@ -224,7 +224,7 @@ data <- readepi(
# READING DATA FROM SEVERAL TABLES
table_names <- c("author", "family_author")
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = table_names, # this is the table name
Expand All @@ -239,7 +239,7 @@ fields <- c(
# the first string in the field vector corresponds to the name of the
# columns of interest from the first table specified in the `table_names`
# argument and so on...
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = table_names, # this is the table name
Expand All @@ -256,7 +256,7 @@ records <- c(
# interest from the first table specified in the `table_name` argument and so
# on... when the id column is not the first column in a table,
# use the `id_position`"
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = table_names, # this is the table name
Expand All @@ -267,7 +267,7 @@ data <- readepi(
# READING DATA FROM SEVERAL TABLES AND SUBSETTING RECORDS AND FIELDS ACROSS
# TABLES
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = table_names, # this is the table name
Expand All @@ -282,7 +282,7 @@ data <- readepi(

```{r eval=FALSE}
# SELECT FEW COLUMNS FROM ONE TABLE AND LEFT JOIN WITH ANOTHER TABLE
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "select author.author_id, author.name,
Expand All @@ -292,31 +292,31 @@ data <- readepi(
)
# SELECT ALL DATA FROM THE author TABLE
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "select * from author",
driver_name = ""
)
# SELECT FEW COLUMNS FROM THE author TABLE
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "select author_id, name, last_name from author",
driver_name = ""
)
# SELECT FEW RECORDS FROM THE author TABLE
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
source = "select * from author where author_id in ('1','20','50')",
driver_name = ""
)
# SELECT FEW RECORDS AND FIELDS FROM THE author TABLE
data <- readepi(
dat <- readepi(
data_source = "mysql-rfam-public.ebi.ac.uk",
credentials_file = credentials_file,
from = "select author_id, name, last_name from author where
Expand All @@ -343,40 +343,40 @@ Both the data and its associated metadata will be returned after a successful im

```{r eval=FALSE}
# READING ALL FIELDS AND RECORDS FROM A REDCap PROJECT
data <- readepi(
dat <- readepi(
data_source = "https://bbmc.ouhsc.edu/redcap/api/",
credentials_file = credentials_file
)
project_data <- data[["data"]]
project_metadeta <- data[["metadata"]]
project_data <- dat[["data"]]
project_metadeta <- dat[["metadata"]]
# READING SPECIFIC FIELDS AND ALL RECORDS FROM THE PROJECT
fields <- c("record_id", "name_first", "age", "bmi")
data <- readepi(
dat <- readepi(
data_source = "https://bbmc.ouhsc.edu/redcap/api/",
credentials_file = credentials_file,
fields = fields
)
# READING SPECIFIC RECORDS AND ALL FIELDS FROM THE PROJECT
records <- c("1", "3", "5")
data <- readepi(
dat <- readepi(
data_source = "https://bbmc.ouhsc.edu/redcap/api/",
credentials_file = credentials_file,
records = records,
id_col_name = "record_id"
)
# READING SPECIFIC RECORDS AND FIELDS FROM THE PROJECT
data <- readepi(
dat <- readepi(
data_source = "https://bbmc.ouhsc.edu/redcap/api/",
credentials_file = credentials_file,
records = records,
fields = fields,
id_col_name = "record_id"
)
project_data <- data[["data"]]
project_metadeta <- data[["metadata"]]
project_data <- dat[["data"]]
project_metadeta <- dat[["metadata"]]
```


Expand Down Expand Up @@ -429,7 +429,7 @@ data_element_groups <- get_dhis2_attributes(
)
# READING THE DATASET ID `pBOMPrpg1QX`
data <- readepi(
dat <- readepi(
data_source = "https://play.dhis2.org/dev",
credentials_file = credentials_file,
dataset = "pBOMPrpg1QX",
Expand All @@ -440,7 +440,7 @@ data <- readepi(
)
# READING DATA FROM 2 DATASETS `pBOMPrpg1QX`
data <- readepi(
dat <- readepi(
data_source = "https://play.dhis2.org/dev",
credentials_file = credentials_file,
dataset = "pBOMPrpg1QX,BfMAe6Itzgt",
Expand All @@ -452,7 +452,7 @@ data <- readepi(
# READING SPECIFIC DATA ELEMENTS FROM THE DATASET ID `pBOMPrpg1QX`
data_elts <- c("FTRrcoaog83", "eY5ehpbEsB7", "Ix2HsbDMLea")
data <- readepi(
dat <- readepi(
data_source = "https://play.dhis2.org/dev",
credentials_file = credentials_file,
dataset = "pBOMPrpg1QX",
Expand All @@ -465,7 +465,7 @@ data <- readepi(
)
# READING SPECIFIC COLUMNS FROM A DATASET
data <- readepi(
dat <- readepi(
data_source = "https://play.dhis2.org/dev",
credentials_file = credentials_file,
dataset = "pBOMPrpg1QX,BfMAe6Itzgt",
Expand Down Expand Up @@ -509,37 +509,37 @@ head(metadata[["indicator_ids_names"]])
head(metadata[["area_type"]])
# IMPORTING DATA USING THE INDICATOR ID
data <- readepi(
dat <- readepi(
indicator_id = 90362L,
area_type_id = 202L
)
# IMPORTING DATA USING THE INDICATOR NAME
data <- readepi(
dat <- readepi(
indicator_name = "Healthy life expectancy at birth",
area_type_id = 202L
)
# IMPORTING DATA USING THE DOMAIN NAME
data <- readepi(
dat <- readepi(
domain_name = "A. Overarching indicators",
area_type_id = 202L
)
data <- readepi(
dat <- readepi(
indicator_name = "Healthy life expectancy at birth",
area_type_id = 202L,
domain_name = "A. Overarching indicators"
)
# IMPORTING DATA USING THE PROFILE ID
data <- readepi(
dat <- readepi(
profile_id = 19L,
area_type_id = 202L
)
# IMPORTING DATA FROM SPECIFIC INDICATOR, DOMAIN, PROFILE, AREA TYPE
data <- readepi(
dat <- readepi(
indicator_id = 90362L,
indicator_name = "Healthy life expectancy at birth",
area_type_id = 202L,
Expand All @@ -555,7 +555,7 @@ data <- readepi(
)
# IMPORTING DATA AND SUBSETTING SPECIFIC RECORDS AND FIELDS
data <- readepi(
dat <- readepi(
indicator_id = 90362L,
area_type_id = 202L,
fields = c("IndicatorID", "AreaCode", "Age", "Value"),
Expand Down

0 comments on commit eb55928

Please sign in to comment.