r-spacex / SpaceX-API

:rocket: Open Source REST API for SpaceX launch, rocket, core, capsule, starlink, launchpad, and landing pad data.
Apache License 2.0
10.52k stars 938 forks source link

⚠️ Launch Time Updates ⚠️ #226

Closed jakewmeyer closed 4 years ago

jakewmeyer commented 5 years ago

Going to pin this issue for the time being, as a better way to direct people when launch times need updating.

Updating Times

Currently the API grabs the date from the r/SpaceX wiki launch manifest every 10 minutes, so by updating the time in the wiki, the API will automatically poll for changes and update itself.

Note: To ensure the quality of updates to the subreddit wiki, the account used to update must be >180 days old, and the account must have >500 subreddit comment or link karma.

Long Term Solution

This is a work in progress, but will likely involve a mix of wiki updates and possible updates from trusted users directly to the API, but the details still need to be fleshed out.

marcozambi commented 5 years ago

Sorry, I know that must be very late in the US, but the STP-2 launch date/time was updated twice last night although it remained the same (3:30 UTC) in the SpaceXAPI. I use the launch date/time from SpaceX API to re-publish automatically a timeline at every update, and of course at the moment everything is outdated :/ Don't take me wrong, I totally understand this is voluntary work, but rather than relying only on the Reddit launch manifest (which has also not been updated) then why not hook with other APIs out there, at least for some data (e.g. Launch Library API), where a large group of editors spread all over the world is keeping these info up-to-date very quickly? :angel:

jakewmeyer commented 5 years ago

I think a hybrid solution might be best. The wiki is generally the better source until a day or so before the launch, when most people focus on keeping the launch thread up to date instead of the wiki.

Maybe within a certain time threshold, we can cut over to launch library for last minute time updates.

mathisbeauty commented 5 years ago

Hi, I have tried to create a solution that checks if the launch is close (with a hard coded threshold) and updates the launches that lag behind Launch Library.

It works by adding two fields to each launch in the database, one for tracking the last time it was updated and another for tracking whether it was updated from the wiki or LL.

You can check the code in this commit here, I'll be glad to receive any suggestions and improve the code further. Is something like this what you had in mind?

Also, I didn't add any tests because the code is in a script not in the core API.

Cheers!

jakewmeyer commented 5 years ago

@mathisbeauty Go ahead and open the pull request, and I'll take a closer look at it tonight 👍

AlbericTrancart commented 5 years ago

@jakewmeyer the import script from the manifest seems to be broken, for instance all Starlink launches were added in the manifest but are not in the API yet.

jakewmeyer commented 5 years ago

Not broken, they needed to be manually added. Some things need to be tweaked in the updater first before I can add them.

timisenman commented 5 years ago

@jakewmeyer I noticed the current Starlink 2 mission's date has also changed. When dates change to TBD, am I correct in that the unix date fallback to the 1st of the month? This seems inconvenient for the apps that consume this, since it can put a launch in the past and create a confusing UI. My thinking is that leaving the date as the last recorded launch date, and resetting the TBD bool to true might be better for apps. That way, we can preface our UIs to note that the time/date has changed or is TBD, without creating a really large time error. (Also, I apologize if this is the wrong place to suggest this-- I'm new to discussing things here, and open source in general.)

Edit: I just realized this may be a design of the Wiki or decision of the reddit community. Let me know if that's the case. Thanks 🙏🏼

jakewmeyer commented 5 years ago

Correct, it's one solution to showing partial dates.

It would certainly be confusing if the UI was sorted by dates only, but the launches are better sorted by flight number. This corresponds with the order on the wiki manifest, and automatically adjusts as things move around over there.

tdb is true until the date has a day or time set.

is_tentative is true until an time has been set

tentative_max_precision indicates the precision of the dates, with potential values of quarter, half, year, month, day, hour

From what I've seen, most people have a pre-set date format for each value in tentative_max_precision, and depending on the value, display the date to the precision level included.

I think displaying in flight number order is the best solution here, because it leads to more reliable sorting compared to date. For example, say Starlink 2 stays TBD into November, and Starlink 3 actually ends up launching first. This order would be updated in the wiki close to launch, but you would be stuck with the last non TBD date, and the order would be incorrect.

timisenman commented 5 years ago

@jakewmeyer Brilliant response. Extremely helpful. I'll do that, and I'll work with my designer to find an elegant way to display launch times as tentative.

jesusrp98 commented 5 years ago

@jakewmeyer New details about the upcoming Starlink mission hasn't been added to the API yet. Is there something wrong?

jakewmeyer commented 5 years ago

Nothing wrong, just missed the date change and it snuck up on me

jesusrp98 commented 5 years ago

@jakewmeyer there are a couple missing data points:

jakewmeyer commented 5 years ago

All updated except orbit data. That gets pulled in automatically once NORAD id's are assigned. Usually takes day or two.

garyjacobs commented 5 years ago

I'm going to have a go at defining what these mean, if I get them incorrect can I please get clarification of the following:

• Quarter = Anytime between 1 Jan - 30 Apr • Half = Anytime between 1 Jan - 30 Jun • Year = Anytime between 1 Jan - 31 Dec • Month = Anytime between 1 Jan - 31 Jan • Day = Anytime on 1 Jan • Hour = Anytime on 1 Jan between 9am-10am

I tried to find the explanation in the docs but couldn't see them anywhere. Apologies if they do exist.

jakewmeyer commented 4 years ago

All appears to be correct

jesusrp98 commented 4 years ago

@jakewmeyer This is the presskit of CRS-19: https://www.spacex.com/sites/spacex/files/crs-19_mission_press_kit.pdf . Also, information about this mission's booster donesn't exists.

jakewmeyer commented 4 years ago

Closing since V4 release is imminent, and makes this a moot point.