Skip to content

Conversation

@bpeng
Copy link
Contributor

@bpeng bpeng commented May 6, 2025

Ticket https://github.com/GeoNet/tickets/issues/17374

Update event type in validation and add tests for new event types

Deployed on dev, try

curl -X GET -I "http://tf-dev-fdsn-web-1308277073.ap-southeast-2.elb.amazonaws.com/fdsnws/event/1/query?starttime=2022-01-01T00:00:00&endtime=2025-04-28T22:00:00&format=text&eventtype=volcano-tectonic"

@bpeng bpeng requested a review from junghao May 6, 2025 03:45
@elidana elidana requested a review from salichon May 6, 2025 20:38
@elidana
Copy link

elidana commented May 6, 2025

also adding @salichon for awareness

Copy link
Contributor

@junghao junghao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add the test cases to the routes test, see how querying other events and volcano-tectonic parameter works?

Thanks.

var nslcReg = regexp.MustCompile(`^([\w*?,]+|--)$`)
var eventTypeReg = regexp.MustCompile(`^([\w*?, ]+|--)$`) // space allowed
// nslcReg: FDSN spec allows all ascii, but we'll only allow alpha, number, _,-, ?, *, "," and "--" (exactly 2 hyphens only)
var nslcReg = regexp.MustCompile(`^([\w*?,]+(?:-[\w*?,]+)*|--)$`) // space not allowed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nslcReg is used to verify network/station/location/channel identifiers, is not for event type.
We don't have any identifiers containing -.

However, it's fine to add this since it's in FDSN specification.

var eventTypeReg = regexp.MustCompile(`^([\w*?, ]+|--)$`) // space allowed
// nslcReg: FDSN spec allows all ascii, but we'll only allow alpha, number, _,-, ?, *, "," and "--" (exactly 2 hyphens only)
var nslcReg = regexp.MustCompile(`^([\w*?,]+(?:-[\w*?,]+)*|--)$`) // space not allowed
var eventTypeReg = regexp.MustCompile(`^([\w*?, ]+(?:[ -][\w*?,]+)*|--)$`) // space allowed
Copy link
Contributor

@junghao junghao May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure which cases are this change aim to deal with?

If it's for -, then I think adding a \- to existing regex is sufficient.
^([\w*?,\- ]+|--)$

Copy link
Contributor Author

@bpeng bpeng May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to allow - in the middle, and it needs to be multiple times, yes adding a - to existing regex is simpler, may be it doesn't matter if - is in the start, but it also allow more than 2 hyphens (---)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless the specification says "no hyphen at the start" (though people won't do it) otherwise we don't need to make sure it's in the middle.

@bpeng bpeng force-pushed the seiscomp-update branch 11 times, most recently from 4a0469d to 5b6516e Compare May 7, 2025 01:22
Copy link
Contributor

@junghao junghao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@bpeng bpeng force-pushed the seiscomp-update branch from 5b6516e to 8e15cf5 Compare May 14, 2025 00:52
@salichon
Copy link

salichon commented May 14, 2025

@bpeng Update event type in validation and add tests for new event types

I am interested to see an example this looks good as a process thanks
(sorry from afar)

Copy link

@salichon salichon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with regards to check with examples :)

@bpeng
Copy link
Contributor Author

bpeng commented May 14, 2025

Thanks @salichon

I am interested to see an example this looks good as a process thanks

The additional types should be already working for scml processing and the event types can be added to the database, but I haven't seen any events with the volcanic types in s3://seiscompml07 yet (is there any?)

The updates in this PR is to allow queries by the new event types like the following (currently it returns 400 error) after deployment (probably get 204 response if there is not such event with the specified type in the DB).

curl -X GET -I "https://service.geonet.org.nz/fdsnws/event/1/query?starttime=2022-01-01T00:00:00&endtime=2025-04-28T22:00:00&format=text&eventtype=volcano-tectonic"

@sue-h-gns sue-h-gns merged commit cfbf56e into main May 14, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants