Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Backend

zhibekbastian edited this page Jul 1, 2020 · 54 revisions

Backend-Documentation

Requirements:

  • redis
  • linux (tested on Debian)

Python requirements:

  • Python 3.7+
  • requests
  • redis
  • feedparser
  • ssl
  • pytz

XML-Structure for Request responses:

<?xml version="1.0" encoding="UTF-8"?>
<Request>
   <requestName>ISS-Pos</requestName>
   <data>
        <latitude>...</latitude>
        <longitude>...</longitude>
   </data>
</Request>

Python Object for ISS-position from BE to FE:

{
   "requestname": "ISSpos",
   "data":{
       "timestamp":"2012-12-15 01-21-05",
       "latitude": "-17.9617",
       "longitude": "162.6117"
    }
}

Return Object for get ISSpos (Intervall: [startTime, endTime]) from Database

[
ISSDBKey(timeValue='2020-06-05 14-25-04', key='longitude', value=b'1234'),
ISSDBKey(timeValue='2020-06-05 14-25-04', key='latitude', value=b'1234'),
...
]

ISSDBKey Object

class ISSDBKey:
    timeValue: str
    key: str
    Value: str

Data for coordinates in DB:

"GeoJson":<Countryname>:<index>:latitude
"GeoJson":<Countryname>:<index>:longitude

Request body for ISSDB call:

{
    "requestname": "ISSDB",
    "params": {
             "startTime": "2020-06-09 23-15-00",
             "endTime": "2020-06-09 23-59-00"
         }
}

Request body for GeocodingAddress-call:

{
    "requestname": "GeocodingAddress",
    "params": {
             "q": "postcode, country"
         }


}

Request body for GeoJson-call:
country = all returns GeoJson for every country, other wise the GeoJson for the specified country will be returned
```Json
{
    "requestname": "GeoJson",
    "params": {
             "country":"all"
         }
}

return Value for GeoJson-call for single Country:

{"countryname": "Brazil",
"0": {"latitude": "-57.62513342958296", "longitude": "-30.216294854454258"},
"1": {"latitude": "-56.29089962423908", "longitude": "-28.85276051200089"},
"2": {"latitude": "-55.16228634298457", "longitude": "-27.881915378533463"}}

return Value for GeoJson-call all countrys:

[{"countryname": "Uruguay",
    "0": {"latitude": "-57.62513342958296", "longitude": "-30.216294854454258"},
    "1": {"latitude": "-56.97602576356473", "longitude": "-30.109686374636127"},
    "2": {"latitude": "-55.97324459494093", "longitude": "-30.883075860316303"},
    "3": {"latitude": "-55.601510179249345", "longitude": "-30.853878676071393"}},
{"countryname": "Suriname",
    "0": {"latitude": "-57.14743648947688", "longitude": "5.973149929219161"},
    "1": {"latitude": "-55.9493184067898", "longitude": "5.772877915872002"},
    "2": {"latitude": "-55.841779751190415", "longitude": "5.953125311706059"},
    "3": {"latitude": "-55.033250291551774", "longitude": "6.025291449401664"}}]

return Value of script 'Requests/AstrosOnISS' (names are just examples):

['Chris Cassidy', 'Anatoly Ivanishin', 'Ivan Vagner', 'Doug Hurley', 'Bob Behnken']

return Value of AstrosOnISS Call :

[
Astronaut(name='Chris Cassidy', pic='https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/JohnCassidyv2.jpg/300px-JohnCassidyv2.jpg', flag='https://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/220px-Flag_of_the_United_States.svg.png', nation='USA'),

 Astronaut(name='Anatoly Ivanishin', pic='https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Anatoli_Ivanishin_2011.jpg/300px-Anatoli_Ivanishin_2011.jpg', flag='https://upload.wikimedia.org/wikipedia/en/thumb/f/f3/Flag_of_Russia.svg/255px-Flag_of_Russia.svg.png', nation='Russia'),

 Astronaut(name='Ivan Vagner', pic='https://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Ivan_Vagner_%28Jsc2020e014992%29.jpg/330px-Ivan_Vagner_%28Jsc2020e014992%29.jpg', flag='https://upload.wikimedia.org/wikipedia/en/thumb/f/f3/Flag_of_Russia.svg/255px-Flag_of_Russia.svg.png', nation='Russia'),

 Astronaut(name='Doug Hurley', pic='https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Douglas_Hurley.jpg/200px-Douglas_Hurley.jpg', flag='https://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/220px-Flag_of_the_United_States.svg.png', nation='USA'),

 Astronaut(name='Bob Behnken', pic='https://de.wikipedia.org/wiki/Datei:Robertbehnkenv2.jpg', flag='https://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/220px-Flag_of_the_United_States.svg.png', nation='USA')
]

Return value example of rssFeed and stationReportFeed:

{'rssFeedName':'spacetoground',
'items': 
[
{'title': 'Space to Ground: Round Three: 12/6/2019', 'summary': 'There is never a dull moment onboard the orbiting laboratory. There were three spacewalks to fix a cosmic particle detector and now two space cargo ships are on their way to the station.', 'published': 'Fri, 06 Dec 2019 11:19 EST', 'link': 'http://www.nasa.gov/mediacast/space-to-ground-round-three-1262019'},
{'title': 'Space to Ground: Keeping it Cool: 11/29/2019', 'summary': 'The Expedition 61 crew enjoyed a Thanksgiving feast ahead of another spacewalk set for this Monday. A European experiment also tests controlling a rover on Earth from the station.', 'published': 'Fri, 29 Nov 2019 08:00 EST', 'link': 'http://www.nasa.gov/mediacast/space-to-ground-keeping-it-cool-11292019'}
] 
}

Return value example of issCurrPos:

{'latitude': -16.1781, 'longitude': -165.9373, 'timestamp': '2020-06-14 18-40-07'}

Return value example of geocoder(address):

{'longitude': 8.567480100000001, 'latitude': 49.11733995}

Return value Country passes

{'numberOfPasses': 1,
'passes': [{'startTime': '2020-06-15 12-14-14', 'endTime': '2020-06-15 12-15-45'}]}

Return value of getRSS-Feed Call:

[
{'title': 'Space to Ground: Home at Last: 03/02/2018', 'summary': 'One crew is home safe, one crew is orbiting Earth and another crew is preparing for launch, this week on #SpaceToGround.', 'published': '2018-03-02 03-02-00', 'link': 'http://www.nasa.gov/mediacast/space-to-ground-home-at-last-03022018'},
{'title': 'Space to Ground: Tracking a Monster: 9/8/2017', 'summary': 'Three station crew members returned to Earth last week as Texas recovers from Hurricane Harvey. Another monstrous hurricane, Irma, was pictured from the space station.', 'published': '2017-09-08 12-00-00', 'link': 'http://www.nasa.gov/mediacast/space-to-ground-tracking-a-monster-982017'},
{'title': 'Space to Ground: Record Breaking: 07/3/15', 'summary': "On this week's #SpaceToGround, SpaceX loses a space freighter, Russia launches a Progress resupply ship and Commander Gennady breaks the record for cumulative time in space.", 'published': '2015-07-03 08-12-00', 'link': 'http://www.nasa.gov/mediacast/space-to-ground-record-breaking-07315'},
{'title': 'Space to Ground - 02/21/14', 'summary': "Space to Ground is your weekly update on what's happening on the station. Question or comment? Use #spacetoground to talk to us.", 'published': '2014-02-21 21-16-00', 'link': 'http://www.nasa.gov/content/space-to-ground-022114'}
]

Return value of issFuturePasses(params):

[{'futurePassDatetime': '2020-06-20 21-30-15', 'duration': 602}, {'futurePassDatetime': '2020-06-20 23-06-23', 'duration': 652}, {'futurePassDatetime': '2020-06-21 00-43-49', 'duration': 625}, {'futurePassDatetime': '2020-06-21 02-21-08', 'duration': 635}, {'futurePassDatetime': '2020-06-21 03-57-59', 'duration': 651}]

ISSfuturePasses parameters

{
    "params": {
        "latitude": 12,
        "longitude": 12,
        "number": 5
    }
}

Parameters for RSS-Feed call:

{
    "params": {
        "time": "2018-07-05 16-36-00",
        "numberOfItems": 5
    }
}

ISSpastPasses parameter:

"params": {
         "latitude": -2.1496,
         "longitude": -96.0077,
         "radius": 50
     }

ISSpastPasses return value

{'numberOfPasses': 1, 'passes': [{'startTime': '2020-06-19 22-55-21', 'endTime': '2020-06-19 22-55-26'}]}
Clone this wiki locally