Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sticky column is reversed #279

Closed
boshek opened this issue Aug 13, 2021 · 0 comments
Closed

sticky column is reversed #279

boshek opened this issue Aug 13, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@boshek
Copy link
Collaborator

boshek commented Aug 13, 2021

bcdc_describe_feature had the sticky column values reversed. For example:

library(bcdata)
#> 
#> Attaching package: 'bcdata'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

## All the columns that are "not" sticky
bcdc_describe_feature("bc-airports") %>%
  filter(!sticky)
#> Warning: It is advised to use the permanent id ('76b1b7a3-2112-4444-857a-afccf7b20da8') rather than the name of the record ('bc-airports') to guard against future name changes.
#> # A tibble: 9 x 5
#>   col_name                      sticky remote_col_type local_col_type column_comments
#>   <chr>                         <lgl>  <chr>           <chr>          <chr>          
#> 1 id                            FALSE  xsd:string      character      <NA>           
#> 2 CUSTODIAN_ORG_DESCRIPTION     FALSE  xsd:string      character      CUSTODIAN_ORG_~
#> 3 BUSINESS_CATEGORY_CLASS       FALSE  xsd:string      character      BUSINESS_CATEG~
#> 4 BUSINESS_CATEGORY_DESCRIPTION FALSE  xsd:string      character      BUSINESS_CATEG~
#> 5 OCCUPANT_TYPE_DESCRIPTION     FALSE  xsd:string      character      OCCUPANT_TYPE_~
#> 6 SOURCE_DATA_ID                FALSE  xsd:string      character      SOURCE_DATA_ID~
#> 7 SUPPLIED_SOURCE_ID_IND        FALSE  xsd:string      character      SUPPLIED_SOURC~
#> 8 AIRPORT_NAME                  FALSE  xsd:string      character      AIRPORT_NAME i~
#> 9 SEQUENCE_ID                   FALSE  xsd:decimal     numeric        SEQUENCE_ID co~


fw <- bcdc_query_geodata("bc-airports")

## we don't drop any columns that are supposedly "not-sticky"
fw %>%
  select(AIRPORT_NAME)
#> Querying 'bc-airports' record
#> * Using collect() on this object will return 455 features and 9 fields
#> * At most six rows of the record are printed here
#> --------------------------------------------------------------------------------
#> Simple feature collection with 6 features and 9 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 833323.9 ymin: 381604.1 xmax: 1198292 ymax: 1054950
#> Projected CRS: NAD83 / BC Albers
#> # A tibble: 6 x 10
#>   id       CUSTODIAN_ORG_DES~ BUSINESS_CATEGO~ BUSINESS_CATEGO~ OCCUPANT_TYPE_D~
#>   <chr>    <chr>              <chr>            <chr>            <chr>           
#> 1 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 2 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 3 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 4 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 5 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 6 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> # ... with 5 more variables: SOURCE_DATA_ID <chr>,
#> #   SUPPLIED_SOURCE_ID_IND <chr>, AIRPORT_NAME <chr>, SEQUENCE_ID <int>,
#> #   geometry <POINT [m]>


## All cols that are supposed to be sticky
bcdc_describe_feature("bc-airports") %>%
  filter(sticky)
#> # A tibble: 33 x 5
#>    col_name         sticky remote_col_type local_col_type column_comments       
#>    <chr>            <lgl>  <chr>           <chr>          <chr>                 
#>  1 DESCRIPTION      TRUE   xsd:string      character      "DESCRIPTION describe~
#>  2 PHYSICAL_ADDRESS TRUE   xsd:string      character      "PHYSICAL_ADDRESS con~
#>  3 ALIAS_ADDRESS    TRUE   xsd:string      character      "ALIAS_ADDRESS contai~
#>  4 STREET_ADDRESS   TRUE   xsd:string      character      "STREET_ADDRESS is a ~
#>  5 POSTAL_CODE      TRUE   xsd:string      character      "POSTAL_CODE is the C~
#>  6 LOCALITY         TRUE   xsd:string      character      "LOCALITY is the name~
#>  7 CONTACT_PHONE    TRUE   xsd:string      character      "CONTACT PHONE contai~
#>  8 CONTACT_EMAIL    TRUE   xsd:string      character      "CONTACT_EMAIL contai~
#>  9 CONTACT_FAX      TRUE   xsd:string      character      "CONTACT FAX contains~
#> 10 WEBSITE_URL      TRUE   xsd:string      character      "WEBSITE_URL contains~
#> # ... with 23 more rows

## all cols dropped except that one selected and non-sticky ones!
fw %>%
  select(DESCRIPTION)
#> Querying 'bc-airports' record
#> * Using collect() on this object will return 455 features and 10 fields
#> * At most six rows of the record are printed here
#> --------------------------------------------------------------------------------
#> Simple feature collection with 6 features and 10 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 833323.9 ymin: 381604.1 xmax: 1198292 ymax: 1054950
#> Projected CRS: NAD83 / BC Albers
#> # A tibble: 6 x 11
#>   id       CUSTODIAN_ORG_DES~ BUSINESS_CATEGO~ BUSINESS_CATEGO~ OCCUPANT_TYPE_D~
#>   <chr>    <chr>              <chr>            <chr>            <chr>           
#> 1 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 2 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 3 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 4 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 5 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> 6 WHSE_IM~ "Ministry of Fore~ airTransportati~ Air Transportat~ BC Airports     
#> # ... with 6 more variables: SOURCE_DATA_ID <chr>,
#> #   SUPPLIED_SOURCE_ID_IND <chr>, AIRPORT_NAME <chr>, DESCRIPTION <chr>,
#> #   SEQUENCE_ID <int>, geometry <POINT [m]>

The issue is here:

xml_df$nillable = ifelse(xml_df$nillable == "true", TRUE, FALSE)

@boshek boshek added the bug Something isn't working label Aug 13, 2021
@boshek boshek self-assigned this Aug 13, 2021
@boshek boshek closed this as completed in 8ef27b7 Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant