Skip to content

removeBrokenSpeciesListLinks filter not working properly #59

Open

Description

@nmprista

removeBrokenSpeciesListLinks is filtering only on SLspeciesListName. Needs to filter based on SLyear, SLcatchFraction and SLcountry.

Activity

  1. added
    2_preparationGenerating probabilities and Zero's, subsetting species
    on Oct 12, 2022
  2. changed the title [-]removeBrokenSpeciesListLinks[/-] [+]removeBrokenSpeciesListLinks filter not working properly[/+] on Oct 12, 2022
  3. davidcurrie2001 commented on Oct 13, 2022

    @davidcurrie2001
    Contributor

    I will create an example

  4. davidcurrie2001 commented on Oct 13, 2022

    @davidcurrie2001
    Contributor
    library(icesRDBES)
    
    # Get some test data - if you get errors or an emptry object check your wd
    myLohr <- importRDBESDownloadData('data-raw/WGRDBES-EST_TEST_LOHR_eg_3_2_3_6.zip')
    
    # Test 1) removeBrokenSpeciesListLinks() works ok - it doesn't remove any SS rows  valid data
    
    # Check number of SS rows before removing broken species list links (300)
    nrow(myLohr[["SS"]])
    # Try removing any broken links
    test1 <- removeBrokenSpeciesListLinks(myLohr)
    # Check number of SS rows after removing broken species list links - no broken links so shoudl be the same (300)
    nrow(test1[["SS"]])
    
    
    # Test 2) removeBrokenSpeciesListLinks() works ok.  Let's try removing all species lists from SL and check all SS rows are removed.
    test2 <- filterRDBESDataObject(myLohr,c("SLspeclistName"),c("xxx"))
    
    # Check number of SS rows before removing broken species list links (300)
    nrow(test2[["SS"]])
    # Try removing any broken links
    test3 <- removeBrokenSpeciesListLinks(test2)
    # Check number of SS rows after removing broken species list links - we've removed all SL rows so all SS entries shoudl be broken - number of SS rows shoudl now be zero - it is :-)
    nrow(test3[["SS"]])
    
    
    # Test 3) removeBrokenSpeciesListLinks() does not work correctly.  Change all SL entries to relate to "Dis" rather than "Lan" - the current removeBrokenSpeciesListLinks() function thinks everything is ok so doesn't remove any SS rows - however the correct behaviour should be to remove all SS rows
    test4 <- myLohr
    test4[["SL"]]$SLcatchFrac <- "Dis"
    # Note that all SS rows are Lan but all SL rows are Dis - we now have a mis-match between SL and SS
    unique(test4[["SS"]]$SScatchFra)
    unique(test4[["SL"]]$SLcatchFrac)
    
    # Check number of SS rows before removing broken species list links (300)
    nrow(test4[["SS"]])
    # Try removing any broken links
    test5 <- removeBrokenSpeciesListLinks(test4)
    # Check number of SS rows after removing broken species list links - we shoudl have zero rows because we don't have an SL entry that matches on Species List Name, catch fraction, country, and year - however we still have 300 rows :-(
    nrow(test5[["SS"]])
    
    
    
  5. removed their assignment
    on Oct 13, 2022
  6. nicholascarey commented on Oct 19, 2023

    @nicholascarey
    Contributor

    Revised and should be working now but needs tested.

  7. added
    10_priorityChairs-label - priority issue (work on these when you can)
    on Oct 22, 2023
  8. removed
    10_priorityChairs-label - priority issue (work on these when you can)
    on Nov 17, 2023
  9. rix133 commented on Oct 14, 2024

    @rix133
    Contributor

    test-removeBrokenSpeciesListLinks needs the 4 use cases see above implemented as tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

2_preparationGenerating probabilities and Zero's, subsetting species9_needs_human_reviewPlease add more tests or review code some other way

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions