ScotGovAnalysis / opendatascot

An R package to pull data from statistics.gov.scot into R
https://scotgovanalysis.github.io/opendatascot/
MIT License
47 stars 6 forks source link

removed csv download and corrected ref area test #72

Closed thomascrines closed 5 years ago

thomascrines commented 5 years ago

Have removed the read csv functions and removed the '= NULL' part from where ods_print_query is being called (lines 31-30 of ods_dataset.R).

I also changed one of the unit tests for ods_dataset as now that the filtering is behaving as expected we can assume that a geography code of 'S12000039' will always return data with a reference area of 'West Dunbartonshire'.

Also, I remembered to add you as reviewers so hopefully you'll get an email request this time!

lintr-bot commented 5 years ago

tests/testthat/test_ods_print_query.R:1:2: style: Commented code should be removed.

​#context("ods_print_query")
 ^~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:3:2: style: Commented code should be removed.

​#expected_return_value1 <- "PREFIX qb: <http://purl.org/linked-data/cube#>"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:4:2: style: Commented code should be removed.

​#expected_return_value2 <- "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:5:2: style: Commented code should be removed.

​#expected_return_value3 <- "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:6:2: style: Commented code should be removed.

​#expected_return_value4 <- "select  \\?value where \\{ \\?data qb:dataSet <http://statistics\\.gov\\.scot/data/average-house-size>\\. \\?data  \\.  rdfs:label \\. \\?data  \\.  rdfs:label \\. \\?data \\?measureTypeURI \\?value\\. \\}"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:7:2: style: Commented code should be removed.

​#expected_return_value5 <- "select  \\?value where \\{ \\?data qb:dataSet <http://statistics\\.gov\\.scot/data/average-house-size>\\. \\?data  \\.  rdfs:label \\. \\?data  \\.  rdfs:label \\. FILTER \\(\\?refPeriod >= '2017'\\^\\^xsd:date && \\?refPeriod <= '2018'\\^\\^xsd:date\\) \\?data \\?measureTypeURI \\?value\\. \\}"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:9:2: style: Commented code should be removed.

​#printed_query <- ods_print_query("average-house-size")
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:15:4: style: Commented code should be removed.

​#  skip_on_cran()
   ^~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:16:4: style: Commented code should be removed.

​#  expect_match(printed_query, expected_return_value1)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:17:4: style: Commented code should be removed.

​#  expect_match(printed_query, expected_return_value2)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:18:4: style: Commented code should be removed.

​#  expect_match(printed_query, expected_return_value3)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:19:4: style: Commented code should be removed.

​#  expect_match(printed_query, expected_return_value4)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:23:4: style: Commented code should be removed.

​#  skip_on_cran()
   ^~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:24:4: style: Commented code should be removed.

​#  expect_match(printed_query_with_filter, expected_return_value1)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:25:4: style: Commented code should be removed.

​#  expect_match(printed_query_with_filter, expected_return_value2)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:26:4: style: Commented code should be removed.

​#  expect_match(printed_query_with_filter, expected_return_value3)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:27:4: style: Commented code should be removed.

​#  expect_match(printed_query_with_filter, expected_return_value5)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
codecov-io commented 5 years ago

Codecov Report

Merging #72 into master will increase coverage by 11.69%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #72       +/-   ##
===========================================
+ Coverage   83.33%   95.03%   +11.69%     
===========================================
  Files           7        7               
  Lines         174      161       -13     
===========================================
+ Hits          145      153        +8     
+ Misses         29        8       -21
Impacted Files Coverage Δ
R/ods_dataset.R 84.61% <100%> (+26.92%) :arrow_up:
R/ods_print_query.R 93.25% <0%> (+13.48%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f6dab0b...f66e87f. Read the comment docs.

lintr-bot commented 5 years ago

tests/testthat/test_ods_print_query.R:1:2: style: Commented code should be removed.

​#context("ods_print_query")
 ^~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:3:2: style: Commented code should be removed.

​#expected_return_value1 <- "PREFIX qb: <http://purl.org/linked-data/cube#>"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:4:2: style: Commented code should be removed.

​#expected_return_value2 <- "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:5:2: style: Commented code should be removed.

​#expected_return_value3 <- "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:6:2: style: Commented code should be removed.

​#expected_return_value4 <- "select  \\?value where \\{ \\?data qb:dataSet <http://statistics\\.gov\\.scot/data/average-house-size>\\. \\?data  \\.  rdfs:label \\. \\?data  \\.  rdfs:label \\. \\?data \\?measureTypeURI \\?value\\. \\}"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:7:2: style: Commented code should be removed.

​#expected_return_value5 <- "select  \\?value where \\{ \\?data qb:dataSet <http://statistics\\.gov\\.scot/data/average-house-size>\\. \\?data  \\.  rdfs:label \\. \\?data  \\.  rdfs:label \\. FILTER \\(\\?refPeriod >= '2017'\\^\\^xsd:date && \\?refPeriod <= '2018'\\^\\^xsd:date\\) \\?data \\?measureTypeURI \\?value\\. \\}"
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:9:2: style: Commented code should be removed.

​#printed_query <- ods_print_query("average-house-size")
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:15:4: style: Commented code should be removed.

​#  skip_on_cran()
   ^~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:16:4: style: Commented code should be removed.

​#  expect_match(printed_query, expected_return_value1)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:17:4: style: Commented code should be removed.

​#  expect_match(printed_query, expected_return_value2)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:18:4: style: Commented code should be removed.

​#  expect_match(printed_query, expected_return_value3)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:19:4: style: Commented code should be removed.

​#  expect_match(printed_query, expected_return_value4)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:23:4: style: Commented code should be removed.

​#  skip_on_cran()
   ^~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:24:4: style: Commented code should be removed.

​#  expect_match(printed_query_with_filter, expected_return_value1)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:25:4: style: Commented code should be removed.

​#  expect_match(printed_query_with_filter, expected_return_value2)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:26:4: style: Commented code should be removed.

​#  expect_match(printed_query_with_filter, expected_return_value3)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test_ods_print_query.R:27:4: style: Commented code should be removed.

​#  expect_match(printed_query_with_filter, expected_return_value5)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~