SNEWS2 / SNEWS_Publishing_Tools

Publishing Tool for SNEWS
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

full integration #82

Closed KaraMelih closed 10 months ago

KaraMelih commented 1 year ago

The spt-message-classes branch introduces a new module with several message building classes.

These work as a standalone script at the moment, i.e. one can import the script, create messages and send them to server. However, this script needs to replace the existing SNEWSTierPublisher class. Necessarry changes in the test scripts and other places where SNEWSTierPublisher is used needs to be done.

Furthermore, the new module still has missing is_valid() functionalities for various message classes.

KaraMelih commented 1 year ago

I started writing the is_valid function of the coincidence tier class where it checks if the detector name is valid, and (if not a test message) if the neutrino times are within the last 48 hours.

I'm not sure if is_valid() should also check if there are non-required fields and if so, check if they are also valid.
e.g. if the user also passes p_val="apple" this would still be passed to server.

We might still send it, and ignore it later in the server, but it might be nicer to tell the user that they have something "invalid" in their data.

KaraMelih commented 1 year ago

I cleaned up the code, and replaced all snews_pub.SNEWSTierPublisher usages with the new version which also required a little tweaking around.

Message validations for all types are defined and self-validated upon construction.

All test scripts have been modified, and new scripts have been added.

Message construction from a JSON file has been fixed and turned into a classmethod.

message schema display is fixed within the CLI tools.

Some markdown representations are improved.

TimeTier was also taking the neutrino time as an input, and if nothing was passed it was by default appending the current time as neutrino_time which introduced a major confusion, I just removed it completely.

message data and meta data are created separately, however, when sending the message to snews, it appends the meta fields that do not belong any of the other selected tiers in the same message.

KaraMelih commented 1 year ago

@sybenzvi Could you please have a look at the changes? I made this PR to your branch first.
I'd be in favor of changing the scripts name from messages.py tp snews_pub.py again for obvious reasons. However, if I did that at this stage, github starts comparing this new script with the old snews_pub.py thus, it becomes impossible to compare the changes. That's why I kept the name, but I think after merging this PR to your "spt-message-classes" branch we can do the renaming.