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

dpo_hydrophoneDataDiversionMode sometimes required, sometimes prohibited #4

Open
Jacob-Stevens-Haas opened this issue Dec 20, 2022 · 1 comment
Labels
backend This relates to the backend bugs or implementation

Comments

@Jacob-Stevens-Haas
Copy link
Collaborator

Jacob-Stevens-Haas commented Dec 20, 2022

(created from email ticket)

Description

Some hydrophone acoustic data requires dpo_hydrophoneDataDiversionMode, some prohibit it. It's impossible to tell from the API when it's required. This necessitates the workaround of sending the request once within a try, catching the exception, and then sending the slightly modified request in an except block.

Expected behavior

Hydrophones for which "dpo_hydrophoneDataDiversionMode" does not apply should accept "OD" or "All". Any other values ("HPF", "LPF"), should give the "no data" response (HTTP 400 w/error code: 33)

Actual behavior

from onc.onc import ONC
onc = ONC(<your token>)

Some hydrophones need the dpo_hydrophoneDataDiversionMode option, e.g.:

request = onc.requestDataProduct(
    filters={
        "dataProductCode": "AD",
        "extension": "wav",
        "dateFrom": "2016-06-20T12:00:00.000Z",
        "dateTo": "2016-06-20T12:01:00.000Z",
        "deviceCode": "ICLISTENHF1251",
        "dpo_audioDownsample": -1,
    }
)
...
Error 128: Missing Parameter.  Expected values: OD, LPF, HPF, All (parameter: dpo_hydrophoneDataDiversionMode)

Other hydrophones prohibit the option, e.g.:

request = onc.requestDataProduct(
    filters={
        "dataProductCode": "AD",
        "extension": "wav",
        "dateFrom": "2016-06-01T12:00:00.000Z",
        "dateTo": "2016-06-01T12:01:00.000Z",
        "deviceCode": "ICLISTENHF1351",
        "dpo_hydrophoneDataDiversionMode": "OD",
        "dpo_audioDownsample": -1,
    }
)
...
Error 129: Invalid parameter given (parameter: dpo_hydrophoneDataDiversionMode)

Discussion

Not the main point but FWIW, the error raised by _doRequest should be a ValueError, not the superclass Exception.

@kan-fu
Copy link
Collaborator

kan-fu commented Nov 22, 2023

Thank you for raising the issue. Just want to give you an update. I bring this topic up in the internal meeting and it is decided that the API call should be more forgiving on the user side. Our developer is working on changing the backend. Hopefully the new feature will be released in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend This relates to the backend bugs or implementation
Projects
Development

No branches or pull requests

2 participants