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

include Market_Code and Negear codes #14

Open
andybeet opened this issue Jun 7, 2021 · 8 comments · Fixed by #53
Open

include Market_Code and Negear codes #14

andybeet opened this issue Jun 7, 2021 · 8 comments · Fixed by #53
Labels
enhancement New feature or request

Comments

@andybeet
Copy link
Member

andybeet commented Jun 7, 2021

Can we include MARKET_CODE in the final product as well as NEGEAR codes?
MARKET_CODE is a column in stock efficiency table whereas MKTCAT is integer code in cfspp
Then aggregate as needed

@andybeet andybeet added the enhancement New feature or request label Jun 7, 2021
@slucey
Copy link
Member

slucey commented Jun 14, 2021

Are MARKET_CODE and MKTCAT the same?

@andybeet
Copy link
Member Author

No MKTCAT is integer, unsure what each digit represents.
MARKET_CODE is character, representing size eg "LG","XL","UN" etc.
I'm sure they are mapped but unsure how.
I can check ADIOS docs

@slucey
Copy link
Member

slucey commented Jun 14, 2021

OK...we can definitely map those codes. MKTCAT is currently carried over in get_comland_data on Sean_overhaul branch.

@andybeet
Copy link
Member Author

We might also want to think about pulling directly from stockeff tables. Will speed up the pull time greatly.

@slucey
Copy link
Member

slucey commented Jun 14, 2021

Unfortunately the stockeff table is missing the sppvalue field. But maybe that is a simple fix if SSB has a look up table of prices.

@andybeet
Copy link
Member Author

andybeet commented Nov 9, 2021

So there is a table in stockeff called mv_cf_species_c which maps NESPP4 (MKTCAT) to MARKET_CODE.
The only potential problem is that each individual may need permissions to access this table, which would make it useless in a package for general use. Looking into that

Edit: a better solution comlandr::get_species_itis pulls data from SPECIES_ITIS_NE table which maps NESPP4 codes with MARKET_CODE. Just need to adjust the function to be able to search using NESPP4 codes

@andybeet
Copy link
Member Author

andybeet commented Feb 15, 2022

@slucey

Can now pull MARKET_CODE from SPECIES_ITIS_NE table based on NESPP4 code

comlandr::get_species_itis(channel, species = 814, nameType = "NESPP4")
comlandr::get_species_itis(channel, species = "0814", nameType = "NESPP4")

Result:

$data
# A tibble: 1 x 15
  NESPP4 SPECIES_ITIS COMMON_NAME  SCIENTIFIC_NAME UNIT_OF_MEASURE GRADE_CODE GRADE_DESC  MARKET_CODE MARKET_DESC CF_LNDLB_LIVLB CF_RPTQTY_LNDLB
  <chr>  <chr>        <chr>        <chr>           <chr>           <chr>      <chr>       <chr>       <chr>                <dbl>           <dbl>
1 0814   164712       COD,ATLANTIC GADUS MORHUA    LB              23         GUTTED, HE~ SK          SCROD                 1.17               1
# ... with 4 more variables: MIN_PRICE <dbl>, MAX_PRICE <dbl>, PARTNER_ID <chr>, NESPP4_FLAG <chr>

Just need to incorporate into comlandr data pull/aggregation code

@slucey
Copy link
Member

slucey commented Feb 15, 2022

I'll add this into the main work flow for comlandr

@andybeet andybeet linked a pull request Oct 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants