pbs-assess / gfiphc

:fishing_pole_and_fish: An R package for data extraction and analysis of groundfish data from the IPHC Longline Survey in British Columbia
3 stars 0 forks source link

SQL query for number of observed hooks per skate from first 20 deployed hooks #12

Open andrew-edwards opened 6 years ago

andrew-edwards commented 6 years ago

Original email to Elise (copying here because I want to make an issue I can refer to as I'll have to update some code):

I also need the observed hooks per skate from the first 20 deployed hooks, in the get-iphc-skate-info.sql query.

So I'm guessing something extra based on line 19 of

https://github.com/pbs-assess/gfplot/blob/master/inst/sql/get-iphc-skate-info.sql

with the extra condition that it's only from the first 20 deployed hooks (the result will be mostly 20 – all 20 deployed hooks get observed).

Hmm… but the hook numbering system changed in 2009 [actually 2007 now] so it might not be that easy. And you'd have to look at hook-level data anyway.

That may be easier – just a new hook-level query that sums the number of observed hooks from first 20 deployed hooks for each skate. Then we can just save that number, call it obsHooksPerSkate20, and each skateID.

andrew-edwards commented 5 years ago

Or could I just do the hook-level species query with the HOOK_YIELD_CODE being 'Hook not observed'? And just count them in the first 20. May be much simpler.

I also need 'Bait on hook' but can do that the same way.