Kosmorro / kosmorro

A program to calculate your ephemerides.
https://kosmorro.space
GNU Affero General Public License v3.0
60 stars 7 forks source link

Search for events #237

Open WinXaito opened 2 years ago

WinXaito commented 2 years ago

Currently kosmoro allows you to obtain a list of events from dates. The idea would be to be able to do the opposite, get dates from an event.

I think that it is necessary to define default ranges (we are not going to generate dates ad infinitum) and to be able to specify them. I think we should also indicate if we want future/past/both dates.

Deuchnord commented 2 years ago

This is really a good idea! It will need the Kosmorro/lib#43 to be implemented first, though.

nicfb commented 1 year ago

Hello! I would like to try to add this feature if it hasn’t already been started. I have the base functionality working, but I have a couple of questions.

Here is what I propose:

  1. Add 3 new command line parameters: --search, --start, and --end
    • ex: kosmorro --search apogee conjunction --start 2021-01-20 --end 2021-01-28
  2. Events are retrieved from search_events() if --search is provided, otherwise get_events() is called as normal
  3. Event dates must be formatted differently to include month, day and year when retrieved from search (still working on a clean way to do this)
  4. Should omitting the start/end dates search the next 24 hours? Or should they be required?
  5. Should moon phase hours still be included in search output?
  6. What do you think the maximum allowed date range should be?

image

Deuchnord commented 1 year ago

Hi! Thanks for your proposal! :smile:

Here is what I propose:

1. Add 3 new command line parameters: `--search`, `--start`, and `--end`

   * ex: `kosmorro --search apogee conjunction --start 2021-01-20 --end 2021-01-28`

Sound good to me, maybe the date arguments should be named --from and --to? Really cosmetic question :D

2. Events are retrieved from `search_events()` if `--search` is provided, otherwise `get_events()` is called as normal

This function is not released yet (will be available in Kosmorrolib 1.1, which I'd like to release once Kosmorro 1.0 is released). So, you can start making your development after updating the lib to features branch, but your PR won't be merged until then. Is it ok for you?

3. Event dates must be formatted differently to include month, day and year when retrieved from search (still working on a clean way to do this)

The proposed output in your screenshot seems good to me, just remove the seconds and we'll be fine :)

4. Should omitting the start/end dates search the next 24 hours? Or should they be required?

To me, searching for events without providing dates has no real sense, so we can require them.

5. Should moon phase hours still be included in search output?

I think the search mode should be considered as an special execution mode, so everything that is not related (ephemerides, moon phase) should be removed.

6. What do you think the maximum allowed date range should be?

Let's give freedom to the user, no maximum range here. There is no real need for that. Just make sure to catch the kosmorrolib.exceptions.OutOfRangeDateError to prevent calculation errors from the Skyfield library.

nicfb commented 1 year ago

Sound good to me, maybe the date arguments should be named --from and --to? Really cosmetic question :D

I agree! I think --from and --to are more readable than what I suggested.

This function is not released yet (will be available in Kosmorrolib 1.1, which I'd like to release once Kosmorro 1.0 is released). So, you can start making your development after updating the lib to features branch, but your PR won't be merged until then. Is it ok for you?

Yes, this sounds good to me.

I am working on implementing this and the other comments above now!