on4kjm / FLEcli

Multi-platform "Fast Log Entry"(FLE) processing tool
MIT License
32 stars 9 forks source link

Fix POTA reference validation #111

Closed jmMeessen closed 11 months ago

jmMeessen commented 11 months ago

Despite the successive corrections, the POTA validation routine/regexp still fails on valid references (see test file provided by @yu3fms in issue #108 )

jmMeessen commented 11 months ago

@w1mt , @thomasrussellmurphy : FYI

jmMeessen commented 11 months ago

I used the list of POTA prefixes provided by @yu3fms to add an automated test of the validation routine. To my surprise, the test didn't fail as expected (maybe because you shouldn't code when tired).

I will review this again at the end of the day/WE.

w1mt commented 11 months ago

I believe that the park list in the sample is incomplete. Just because a country doesn't have any parks in the POTA system now does not mean it won't in the future...

jmMeessen commented 11 months ago

Good point @w1mt . So if I understand it well (I am not a POTA participant (yet)), the prefix has the structure of (part) of a call-sign. Could you help me get such unlisted prefix? I will experiment with the regexp and the list. I can also try to approach the POTA organizers for prefix rules and/or and exhaustive list of prefix (as they are validating the reference when parsing the submission). I can also contact the people active in POTA here in Belgium.

On the other side, I could relax the validation rules: (need the maximum length of a prefix though) But there also there are pros & cons. I need to clearly differentiate (with a regexp) a SOTA, a WWFF, and a POTA reference. I also want to protect the user against possible typos during entry.

Opinions ?

w1mt commented 11 months ago

I've attached a parklist (technically a parkPrefixList) that I've pulled from https://pota.app/#/parklist

One idea would be to simply see if the park in the log is a member of parklist. I'm sure pota has some code somewhere that handles this - not sure if they are keen to share it...

parklist.txt

k0emt commented 11 months ago

I came across this endpoint: https://pota.app/all_parks_ext.csv on the POTA Discord channel pota-public-api it will give you a full CSV of all the current parks.

jmMeessen commented 11 months ago

Making a lookup of the park reference in a database or list would add a brittle and unecessary level of complexity to the program. I went on the simplification of the Pota prefix parsing rule. This is the updated rule "The syntax is: AA-CCCCC: AA = national prefix, CCCCC = 4 or 5-digit numeric code (e.g. ON-00001). The national prefix is composed of letters and digits and is of at least 1 char and at most 5 char length."

yu3fms commented 11 months ago

Making a lookup of the park reference in a database or list would add a brittle and unecessary level of complexity to the program. I went on the simplification of the Pota prefix parsing rule. This is the updated rule "The syntax is: AA-CCCCC: AA = national prefix, CCCCC = 4 or 5-digit numeric code (e.g. ON-00001). The national prefix is composed of letters and digits and is of at least 1 char and at most 5 char length."

This is most reasonable. This program is mearly a tool, parser.. It should not do the job of other services i.e. full pota reference validation. If the POTA log parser throws an error of invalid park reference, it is up to the operator to fix that and reupload. This is just for "you forgot a dash in park reference"......

w1mt commented 11 months ago

Completely reasonable solution. Thanks!