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

Fermi #199

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Fermi #199

wants to merge 18 commits into from

Conversation

shb46
Copy link
Contributor

@shb46 shb46 commented Sep 20, 2024

Fermi GBM Schema for a single schema, "ALERT" - Initial Version

@shb46 shb46 marked this pull request as draft September 25, 2024 14:56
@shb46 shb46 self-assigned this Sep 25, 2024
@shb46 shb46 requested a review from jracusin October 1, 2024 00:56
"type": "string",
"description": "Date and time of notice creation [UTC, ISO 8601], ex YYYY-MM-DDTHH:MM:SS.ssssssZ"
},
"alert_tense": {
Copy link
Member

@Vidushi-GitHub Vidushi-GitHub Oct 2, 2024

Choose a reason for hiding this comment

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

It's already present in core schema, you just have to ref the schema.
Same for most of the properties below, rate_snr, trigger_time etc.

@Vidushi-GitHub
Copy link
Member

We have planned a mission page, where you can keep the content present at readme file.

@Vidushi-GitHub
Copy link
Member

Hi @shb46, sorry for the delayed response due to travel and vacation. Most of the stuff looks fine.
My main confusion about schema is why strict schema there and why you are re-writing core properties, instead of ref?

@shb46
Copy link
Contributor Author

shb46 commented Oct 2, 2024

Hi @Vidushi-GitHub,

Hope everything is well! Here are my replies:

We have planned a mission page, where you can keep the content present at readme file.

  • Can we have an instrument page as well? the lat and the GBM instruments are run by separate teams.
  • Can notice type have its own page?

Hi @shb46, sorry for the delayed response due to travel and vacation. Most of the stuff looks fine. My main confusion about schema is why strict schema there and why you are re-writing core properties, instead of ref?

Those are two independent schemas intended to describe the same notice type:

  • The "Kafka" one: fermi/gbm/FermiGBMAlert.schema.json

    • Makes $ref-s to the core schema.
    • Doesn't $ref the strict schema.
    • Validates new notices received by the Kafka server.
    • More permissive compared to the strict schema.
  • The "strict" schema: fermi/gbm/strict/FermiGBMAlert.schema.json:

    • Doesn't $ref the core schema, nor the "Kafka" schema.
    • Is less permissive than the Kafka schema.
    • Clarifies what to expect in a notice, incl. which core fields are not used.
    • Used by the producer, in addition to the Kafka schema.

[Edit:] I should rename the strict schema file so it has a different name.

@Vidushi-GitHub
Copy link
Member

Hi Boyan,
Could you please change the filename?
fermi/gcn/notices/fermi/gbm/FermiGBMAlert.schema.json to fermi/gcn/notices/fermi/gbm/alert.schema.json?

As it's already in fermi/gbm folder, again fermiGBM is redundant.

@Vidushi-GitHub
Copy link
Member

We have planned a mission page, where you can keep the content present at readme file.

  • Can we have an instrument page as well? the lat and the GBM instruments are run by separate teams.
  • Can notice type have its own page?

For Fermi mission page, we have information for GCN Classic Notices at https://gcn.nasa.gov/missions/fermi, and would move forward with updating it.
@jracusin shall we separate out GBM, LAT content into two mission pages as available at https://gcn.nasa.gov/missions/fermi Or, just update the existing one as single page?

@Vidushi-GitHub
Copy link
Member

Those are two independent schemas intended to describe the same notice type:

  • The "Kafka" one: fermi/gbm/FermiGBMAlert.schema.json

    • Makes $ref-s to the core schema.
    • Doesn't $ref the strict schema.
    • Validates new notices received by the Kafka server.
    • More permissive compared to the strict schema.
  • The "strict" schema: fermi/gbm/strict/FermiGBMAlert.schema.json:

    • Doesn't $ref the core schema, nor the "Kafka" schema.
    • Is less permissive than the Kafka schema.
    • Clarifies what to expect in a notice, incl. which core fields are not used.
    • Used by the producer, in addition to the Kafka schema.

[Edit:] I should rename the strict schema file so it has a different name.

I am trying to understand why do you wanna create two schemas for same notice types? What is advantage of not referring $ref or kafka schema? Would you produce same notices from two schemas?
Definitions/clarifications shouldn't be problem, that can be added in alert schema as well.

@lpsinger, @jracusin do you have comments on the same notices from different schemas, alert ($ref to core) and strict (own definitions)?

@shb46
Copy link
Contributor Author

shb46 commented Oct 10, 2024

@jracusin:
Re. separate GBM/LAT pages.
Please let me know if it is possible. If yes, we should get the consensus of the GBM and LAT teams before we make a change. I think it will work with or without a "mission" page, i.e. either one of:

  • Missions
  • Fermi
  • GBM
  • LAT

or

  • Missions
  • FermiGBM
  • FermiLAT

@shb46
Copy link
Contributor Author

shb46 commented Oct 10, 2024

@Vidushi-GitHub: File renamed. The JPG and MD files removed.

@shb46
Copy link
Contributor Author

shb46 commented Oct 11, 2024

@jracusin: P.S.: I'm not planning to change the mission page at this time.

@dakota002
Copy link
Contributor

Hi @shb46 , I have a couple additional requests for this update:

Can you rename the strict schema and examples as well:

  • gcn/notices/fermi/gbm/strict/FermiGBMStrictAlert.schema.json -> gcn/notices/fermi/gbm/strict/alert.schema.json
  • gcn/notices/fermi/gbm/strict/FermiGBMAlert1.example.json -> gcn/notices/fermi/gbm/strict/alert.FermiGBMAlert1.example.json
  • gcn/notices/fermi/gbm/strict/FermiGBMAlert2.example.json -> gcn/notices/fermi/gbm/strict/alert.FermiGBMAlert2.example.json
  • gcn/notices/fermi/gbm/strict/FermiGBMStrictAlert1.example.json -> gcn/notices/fermi/gbm/strict/alert.FermiGBMStrictAlert1.example.json
  • gcn/notices/fermi/gbm/strict/FermiGBMStrictAlert2.example.json -> gcn/notices/fermi/gbm/strict/alert.FermiGBMStrictAlert2.example.json

The schema name change reason is the same as the other schema as @Vidushi-GitHub mentioned, as the path already gives the name. As for the examples, the pattern of: alert.[any specific name for the example].example.json is recognized in our schema browser and parsers, and will help automate our docs.

Once this is all set, could you then squash your commits down to 1 single commit? I can assist in this if you have questions before doing so.

@shb46
Copy link
Contributor Author

shb46 commented Oct 11, 2024

Hi, @dakota002,

Please check the new file names before squashing.

@dakota002
Copy link
Contributor

Hi, @dakota002,

Please check the new file names before squashing.

The names look good to me!

@shb46
Copy link
Contributor Author

shb46 commented Oct 11, 2024

@dakota002: Did I squash it enough?

@dakota002
Copy link
Contributor

@dakota002: Did I squash it enough?

I don't believe so, I see 52 commits now. You may have pulled the history back into your branch before pushing it out. You should just run the command git push -f to assert that the new history is correct

@shb46
Copy link
Contributor Author

shb46 commented Oct 14, 2024

@dakota002: Can't figure it out. I'm going to need your help with this.

"on"
],
"event_name": ["GRB240824A"],
"hitl": false,
Copy link
Member

Choose a reason for hiding this comment

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

Please make the example field name consistent with schema.
Additionally, validate the schema against examples, in case any change is left out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Vidushi-GitHub: Changed. Thank you for the reminder!

Copy link
Member

@Vidushi-GitHub Vidushi-GitHub left a comment

Choose a reason for hiding this comment

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

@jracusin please have a look, and provide your feedback/approval.

"properties": {
"notice_type": {
"type": "string",
"description": "Notice title"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be an enum? How many options are there for notice title? Are you always going to refer back to GCN Classic notice types? You don't need to be tied to those.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added "const": "FERMI_GBM_ALERT". This is redundant with $schema and the topic. Thanks for pointing out.

},
"human_in_the_loop": {
"type": "boolean",
"description": "Someimes abbreviated as \"HITL\". When false, the notice was generated entirely automatically. A value of true means that a human had an input, while the notice was being prepared. The latter includes notices, which weren't altered by the human input, but a human was given the option to make an input, or asked to confirm, or approve before further processing."
Copy link
Contributor

Choose a reason for hiding this comment

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

Is HITL also a notice type? This description could also be much more concise. For example:
"True when a human had input or confirmed before further processing; False when the process was fully automated."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shorter and better. Thanks for the suggestion.

},
"trigger_algorithm_number": {
"type": "number",
"description": "The number identifying the algorithm that detected the gamma-ray burst and caused the trigger. \"Trigger algorithm\" here is a moniker for a method or a criterion that watches for significant rate increase in the observed rate. Multiple \"trigger algorithms\" are active simultaneously and any one can trigger independently. The trigger_algorithm_number, tells which one did."
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these trigger algorithms described somewhere in a document or paper. Can you just reference that document with something like the following. There's too much extra information in this description.
"The instrument flight software algorithm that triggered on this event, dependent on timescale, energy, and significance as described in ...".

"id": ["745121685", "bn240812094"],
"instrument": "GBM",
"latitude": 23.83,
"light_curve_url": "http://heasarc.gsfc.nasa.gov/FTP/fermi/data/gbm/triggers/2024/bn240812094/quicklook/glg_lc_medres34_bn240812094.gif",
Copy link
Contributor

Choose a reason for hiding this comment

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

These don't need to be alphabetical, and it seems strange to separate latitude and longitude. In general, these examples should be in some logical order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alphabetical order helps bookkeeping. I'd like to keep it this way.

"detectors_status": {
"type": "array",
"items": {
"$ref": "../../core/DetectorStatus.schema.json"
Copy link
Contributor

Choose a reason for hiding this comment

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

These can be referenced by name rather than indexed, which would then not require this detectors schema at all. See https://github.com/nasa-gcn/gcn-schema/blob/main/gcn/notices/burstcube/alert.example.json or https://github.com/nasa-gcn/gcn-schema/blob/main/gcn/notices/glowbug/Alert.schema.json, which you previously came up with.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we are discussing two design points here:

  1. Array vs. names;
  2. To $ref or not to $ref the core/DetectorStatus.

Thanks for suggesting an alternative to the array. The two choices were discussed at our pipeline meeting (1 vote for names) and the IOTL meeting. The 14-array won. Consider that it is a bit mask in the data products, in which the bits are indexed 0-13. The same is in the classic notes, incl. the text ones. Also the old and the new GBM tools use straight arrays. In retrospect, I should had used an array for Glowbug as well.

On point (2), if you would like to remove the $ref, I'll be happy to replace it with the enum. just let me know.

Copy link
Member

@Vidushi-GitHub Vidushi-GitHub Nov 26, 2024

Choose a reason for hiding this comment

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

Hi @shb46, Could you please implement the detectors schema within alert.schema.json?
I understand the logic of making it a library and calling it. But it's just a few lines field and would make alert.schema.json look like a self-consistent schema.

Are you planning to add more topics in the future and wanna call detectors.schema.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Vidushi-GitHub: The detectors schema, if we keep it, will be shared with another topic. Do you still want me to make it inline?

Copy link
Member

Choose a reason for hiding this comment

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

@shb46 Ok, thanks. If you plan to have more topics related to Fermi/GBM, then that's fine.
Please remember to limit topics per mission to simplify user subscriptions to new Notices. The new Schema allows multiple Notices using a single Schema since fields are not mandatory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Vidushi-GitHub: Our intent was for GBM to have 5 topics. Hope that is not too much. I suspect we might need a 6th one. Separately, there might be topics for internal distribution only but this hasn't been discussed yet.

My plan is to have a 1-to-1-to-1 correspondence of classic notice types, schemas and topics. I think it is a little too late to steer towards making a single schema. We are ahead with approving the ALERT schema and it will set us back. My deadline is Dec 12.

"$id": "https://gcn.nasa.gov/schema/main/gcn/notices/fermi/gbm/strict/alert.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "GCN Schema for Fermi GBM Alert Notices",
"description": "This schema is a stricter version of the more permissive main schema, https://gcn.nasa.gov/schema/main/gcn/notices/fermi/gbm/alert.schema.json. The Kafka server uses the main schema for new notices. Each Alert notice (classic numeric type 110) must validate against the main schema and should also validate against this one. Examples in this directory come in two versions referencing the main and the strict schemas respectively. The intent of the strict schema is to help understanding the Alert notice, since it better describes what content to be expected.",
Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't understand the purpose or use of this strict schema. Each schema is a Kafka topic, though you are welcome to multiple examples. The GBM topic will be gcn.notices.fermi.gbm.alert, so what is the use case for gcn.notices.fermi.gbm.strict.alert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't planning on having a gcn.notices.fermi.gbm.strict.alert topic, only the gcn.notices.fermi.gbm.alert. The same way the server functionality doesn't depend on the examples, it should ignore the strict schemas. If the server does notice validation, it should use only the .../gbm/alert.schema.json. All I want the strict schema to do, is will just be there in addition to the examples and will serve a similar illustrative/documentation purpose.

The JSON objects described by the strict schema are a subset of the objects described by the "non-sctrict" one. If, by looking at the examples, one has doubts about what to expect, then the strict schema will help clear it up. This will become more so with the other notice types.

Copy link
Member

Choose a reason for hiding this comment

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

@shb46, I looked at a diff between gcn/notices/fermi/gbm/alert.schema.json and gcn/notices/fermi/gbm/strict/alert.schema.json. It looks like the only difference is that in the former, you include types from core schema, whereas in the latter, you hardcode the definitions of the fields from the core schema that you are actually using. Please don't do that! Please remove the "strict" schema directory from your PR.

I think that this exposes an interesting issue, that when you include a core schema, it is not clear to users which of its many optional fields you actually intend to populate. That affects all GCN notice types, not just Fermi. @jracusin, let's open another issue to study that problem and come up with options.

Copy link
Contributor Author

@shb46 shb46 Nov 26, 2024

Choose a reason for hiding this comment

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

@jracusin, @lpsinger: Done.

IMHO, having up to a web page per topic (notice type) would help with the issue. For Fermi GBM it is also possible to have a single page with a field vs. notice type matrix.

@@ -0,0 +1,34 @@
{
"$schema": "https://gcn.nasa.gov/schema/main/gcn/notices/fermi/gbm/alert.schema.json",
"additional_info": "*** ABOUT THIS EXAMPLE: This is an example of a Fermi GBM Alert GCN notice. Only stricly necessary fields are present. This 'about' note is not going to be part of streamed/real notices. This field may be missing or empty in case of no comments. An example of a typical notice comment follows. ***\n\nLightcurve and other quicklook files will not be created until about 15 minutes after the trigger.",
Copy link
Contributor

Choose a reason for hiding this comment

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

What is different between these examples, please add some info about their difference rather than number them in their name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree and done. Thanks!

@shb46
Copy link
Contributor Author

shb46 commented Nov 19, 2024

@Vidushi-GitHub: Are we ready to close this PR? Who is going to close it?

@Vidushi-GitHub
Copy link
Member

Vidushi-GitHub commented Nov 19, 2024

@Vidushi-GitHub: Are we ready to close this PR? Who is going to close it?

No, we need approvals for the latest feedbacks. I will remind Judy.

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