PIFSCstockassessments / ageproR

Prototype R package interface for AGEPRO (Age Structure Projection Model) using the JSON data format.
GNU General Public License v3.0
1 stars 0 forks source link

AGEPRO keyword parameter format #10

Closed efletcherPIFSC closed 9 months ago

efletcherPIFSC commented 1 year ago

@JonBrodziak To maintain compatibility with the original AGEPRO INF file format, keyword parameter field names for the json file format will adhere as much as possible to the "Table of AGEPRO input file keywords" (Table 2) in the AGEPRO Reference Manual.

The json file keyword parameter field names format will have a snake_case format, different from ALL_CAPS format in the original INF file format:

INF_FIELD json_field
GENERAL general
CASEID case_id
BOOTSTRAP bootstrap
HARVEST harvest
RETROADJUST retro_adjust
NATMORT nat_mort
BIOLOGICAL biological
MATURITY maturity
STOCK_WEIGHT stock_weight
MEAN_WEIGHT mean_weight
FISHERY fishery
DISCARD discard
CATCH_WEIGHT catch_weight
DISC_WEIGHT disc_weight
discard_weight
RECRUIT recruit
BOUNDS bounds
OPTIONS options
SCALE scale
PERC perc
REFPOINT refpoint
REBUILD rebuild
PSTAR pstar

Questions

How will the "snake_case" format changes effect the AGEPRO calculation engine?

JonBrodziak commented 1 year ago

Eric, The use of snake_case may affect the logical test for string equality. It would be useful to motivate any changes to the calculation engine. Why is snake_case needed for the json input format ? Jon

On Tue, Mar 14, 2023 at 1:41 PM efletcherPIFSC @.***> wrote:

@JonBrodziak https://github.com/JonBrodziak To maintain compatibility with the original AGEPRO INF file format, parameter field names for the json file format will adhere as much as possible to the "Table of AGEPRO input file keywords" (Table 2) in the AGEPRO Reference Manual.

The json file parameter field names format will have a snake_case format, different from ALL_CAPS format in the original INF file format: INF_FIELD json_field GENERAL general CASEID case_id BOOTSTRAP bootstrap HARVEST harvest RETROADJUST retro_adjust NATMORT nat_mort BIOLOGICAL biological MATURITY maturity STOCK_WEIGHT stock_weight MEAN_WEIGHT mean_weight FISHERY fishery DISCARD discard CATCH_WEIGHT catch_weight DISC_WEIGHT disc_weight discard_weight RECRUIT recruit BOUNDS bounds OPTIONS options SCALE scale PERC perc REFPOINT refpoint REBUILD rebuild PSTAR pstar Questions

How will the "snake_case" format changes effect the AGEPRO calculation engine?

— Reply to this email directly, view it on GitHub https://github.com/PIFSCstockassessments/ageproj/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVXIZS33CKRBKMPBU4WHBDW4D637ANCNFSM6AAAAAAV3CZU6M . You are receiving this because you were mentioned.Message ID: @.***>

-- Jon Brodziak, Ph.D. NOAA Inouye Regional Center Pacific Islands Fisheries Science Center 1845 Wasp Boulevard, Building 176, NMFS/PIFSC/FRMD Mail Room 2247 Honolulu, Hawaii 96818 USA Phone: 808-725-5617 Email: @.***

“Wherever my travels may lead, paradise is where I am.” ~ Voltaire

The views expressed in this message are my own and do not necessarily reflect any position of NOAA.

efletcherPIFSC commented 1 year ago

@JonBrodziak

snake_case is not required. JSON does not have a standard naming convention, but it depend on the back-end/front-end it is associated with. snake_case is the popular R naming convention, typically the naming convention for R coding style. However, R has other naming conventions (UpperCamel a.k.a PascalCase, camelCase) is used. C/C++ varies, but recommended to stick to one naming convention for a project.

We can use same keyword variables as verbatim in Table 2 of the AGEPRO reference manual for the JSON input file.

The R package could do some intermediate steps to translate one format to another before sending it to the calculation engine. However, we end up having having 2 naming conventions for each keyword parameter 👎.

Part of this motivation is to provide consistency with keyword parameters. The original keyword parameters also has inconsistencies with the ALL_CAPS formatting: For example, NATMORT and RETROADJUST vs. the "_WEIGHT" keyword parameters.

JonBrodziak commented 1 year ago

Hi Eric,

I agree that it would be useful to eliminate inconsistencies in keyword naming and use a single convention. That said, this is an important but Not Urgent aspect of modifying and revising the AGEPRO system to add new behaviors. These new behaviors include: (i) produce AGEPRO output file in json format (ii) add new features requested by SAP users to AGEPRO calculation engine and associated input and output files (iii) add capacity to use json format input file, in addition to or to supplant existing plain text input file format (iv) add and improve documentation of AGEPRO system including reference manual (in markdown or quatro), examples, github information for calculation engine and other software components (v) and there's usually more ...

Would like to meet with you on Friday morning to discuss doing the above in an efficient manner so that the steps (i) and (ii) are adequately addressed as soon as possible. How about 10:30AM Firday? I'll send an invite, thanks Jon

On Tue, Mar 14, 2023 at 3:56 PM efletcherPIFSC @.***> wrote:

@JonBrodziak https://github.com/JonBrodziak

snake_case is not required. JSON does not have a standard naming convention, but it depend on the back-end/front-end it is associated with. snake_case is the popular R naming convention, typically the naming convention for R coding style. However, R has other naming conventions (UpperCamel a.k.a PascalCase, camelCase) is used. C/C++ varies, but recommended to stick to one naming convention for a project.

We can use same keyword variables as verbatim in Table 2 of the AGEPRO reference manual for the JSON input file.

The R package could do some intermediate steps to translate one format to another before sending it to the calculation engine. However, we end up having having 2 naming conventions for each keyword parameter 👎.

Part of this motivation is to provide consistency with keyword parameters. The original keyword parameters also has inconsistencies with the ALL_CAPS formatting: For example, NATMORT and RETROADJUST vs. the "_WEIGHT" keyword parameters.

— Reply to this email directly, view it on GitHub https://github.com/PIFSCstockassessments/ageproj/issues/10#issuecomment-1469173693, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVXIZV7MUIBDHEDDHKLNWLW4EOSVANCNFSM6AAAAAAV3CZU6M . You are receiving this because you were mentioned.Message ID: @.***>

-- Jon Brodziak, Ph.D. NOAA Inouye Regional Center Pacific Islands Fisheries Science Center 1845 Wasp Boulevard, Building 176, NMFS/PIFSC/FRMD Mail Room 2247 Honolulu, Hawaii 96818 USA Phone: 808-725-5617 Email: @.***

“Wherever my travels may lead, paradise is where I am.” ~ Voltaire

The views expressed in this message are my own and do not necessarily reflect any position of NOAA.