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

Implement star system data retrieval from Spansh? #2327

Open
Tkael opened this issue Feb 25, 2022 · 4 comments
Open

Implement star system data retrieval from Spansh? #2327

Tkael opened this issue Feb 25, 2022 · 4 comments
Assignees
Labels
5. painful Something is not fit for purpose but there is a workaround. significant work Just sayin'

Comments

@Tkael
Copy link
Member

Tkael commented Feb 25, 2022

What happens now

Star system data is sourced from EDSM. EDSM data is bound to user accounts and may not be retained for accounts deactivated due to inactivity. Further, the EDSM API is rate limited and rate limiting has a dramatic impact on service query search times.

What I'd like to happen

Consider transitioning from EDSM to a more comprehensive / more complete data source.

How it can happen

It is possible to access system data via the Spansh API using id64 / system address, e.g. https://www.spansh.co.uk/api/system/263303726260. The complementary user-friendly version of the page is at https://www.spansh.co.uk/system/263303726260.

Similarly, station data is available using market ID: https://www.spansh.co.uk/api/station/3707582976 and body data is available via body id64: https://www.spansh.co.uk/api/body/36029060322690228.

Body id64 is calculated from: (bodyId << 55) + systemAddress.

EDDI Version

4.0.1

@Tkael Tkael added low priority 10. work unit (user unaffected) A job that needs to be done but which doesn't affect the user. labels Feb 25, 2022
@Tkael
Copy link
Member Author

Tkael commented Apr 15, 2023

Buy/sell locations are available with a query like:
https://spansh.co.uk/api/commodity/sell/Sol/Platinum/100 or
https://spansh.co.uk/api/commodity/buy/Sol/Platinum/100
Where

  • Sol is a case sensitive reference system (results are ordered by distance to this location, id64 not accepted)
  • Platinum is the commodity we are seeking to sell or buy (case sensitive, ref. name from https://github.com/EDCD/FDevIDs/blob/master/commodity.csv)
  • 100 is the amount we wish to sell/buy

@Tkael
Copy link
Member Author

Tkael commented Apr 17, 2023

Type-ahead endpoint: https://spansh.co.uk/api/systems/field_values/system_names?q=sol
Quick search endpoint (returns systems, bodies, and stations with selective details): https://spansh.co.uk/api/search?q=sol (q is not case sensitive and may also be a system address, station name, or body name)
Dump endpoint (returns the complete data available from the line in the dump file, which includes all body and station (including outfitting and market) data but no additional data seeded from other sources): https://www.spansh.co.uk/api/dump/10477373803

@Tkael Tkael self-assigned this May 12, 2024
@Tkael
Copy link
Member Author

Tkael commented Jun 10, 2024

Searches (e.g. for station services) require a POST to https://www.spansh.co.uk/api/stations/search with a json payload defining desired filters. Payload example (for a manufactured materials trader near coordinates 6.25, -1.25, -5.75):

{
    "filters": {
        "services": {
            "value": ["Material Trader"]
        },
        "primary_economy": {
            "value": ["Industrial"]
        }
    },
    "sort": [{
            "distance": {
                "direction": "asc"
            }
        }
    ],
    "size": 10,
    "page": 0,
    "reference_coords": {
        "x": 6.25,
        "y": -1.28,
        "z": -5.75
    }
}

The server appears to respond ASAP with the result rather than returning a referral number that needs to be checked periodically.
Example response (conveniently already sorted by distance):

{
    "count": 811,
    "from": 0,
    "results": [
        {
            "controlling_minor_faction": "Sirius Corporation",
            "distance": 0.00124999999999997,
            "distance_to_arrival": 1024.068257,
            "economies": [
                {
                    "name": "Extraction",
                    "share": 30.0
                },
                {
                    "name": "Industrial",
                    "share": 70.0
                }
            ],
            "government": "Corporate",
            "has_large_pad": true,
            "has_market": true,
            "has_outfitting": true,
            "has_shipyard": true,
            "id": "ECmg_I8BSefGriDOBLba",
            "is_planetary": false,
            "large_pads": 9,
            "market": [ ... ],
            "market_id": 128136952,
            "market_updated_at": "2024-06-08 20:34:03+00",
            "material_trader": "Manufactured",
            "medium_pads": 18,
            "modules": [ ... ],
            "name": "Patterson Enterprise",
            "outfitting_updated_at": "2024-06-08 20:34:03+00",
            "power_state": "Contested",
            "primary_economy": "Industrial",
            "prohibited_commodities": [ ... ],
            "secondary_economy": "Extraction",
            "services": [ ... ],
            "ships": [ ... ],
            "shipyard_updated_at": "2024-06-08 20:34:03+00",
            "small_pads": 17,
            "system_id64": 121569805492,
            "system_name": "Sirius",
            "system_power": [
                "Edmund Mahon",
                "Zachary Hudson"
            ],
            "system_x": 6.25,
            "system_y": -1.28125,
            "system_z": -5.75,
            "type": "Coriolis Starport",
            "updated_at": "2024-06-08 21:15:56+00"
        },
        ...,
    ],
    "search": {
        "filters": {
            "primary_economy": {
                "value": [
                    "Industrial"
                ]
            },
            "services": {
                "value": [
                    "Material Trader"
                ]
            }
        },
        "page": 0,
        "reference_coords": {
            "x": 6.25,
            "y": -1.28,
            "z": -5.75
        },
        "size": 10,
        "sort": [
            {
                "distance": {
                    "direction": "asc"
                }
            }
        ]
    },
    "search_reference": "25F7C398-26EC-11EF-B109-EEC2E5B66F40",
    "size": 10
}

@Tkael Tkael added 5. painful Something is not fit for purpose but there is a workaround. and removed 10. work unit (user unaffected) A job that needs to be done but which doesn't affect the user. labels Jun 10, 2024
@Tkael Tkael added the significant work Just sayin' label Jul 29, 2024
@Tkael
Copy link
Member Author

Tkael commented Nov 23, 2024

Faction names:
https://spansh.co.uk/api/systems/field_values/minor_factions?q=Rat (minor factions containing "Rat")
https://spansh.co.uk/api/systems/field_values/controlling_minor_faction (all system controlling minor factions in the db)
https://spansh.co.uk/api/stations/field_values/controlling_minor_faction (all station controlling minor factions in the db)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5. painful Something is not fit for purpose but there is a workaround. significant work Just sayin'
Projects
None yet
Development

No branches or pull requests

1 participant