Skip to content

Commit

Permalink
Add helmet component, write some API methods in readme, fix error in API
Browse files Browse the repository at this point in the history
  • Loading branch information
miksrv committed Feb 13, 2022
1 parent c871db8 commit 2594420
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 28 deletions.
200 changes: 200 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,206 @@ The observatory controller is based on Ardunio (AVR) and connects to the observa
- DHT22
- DS18B20

### API methods
The response format is JSON, the response structure is always the same, only payload will change in different APIs
```json
{
"status": true,
"payload": []
}
```

#### FITS files controller
``/api/get/file/list?object=${string}``
```json
{
"id": "fe03bc1c2cfd97de1f97edbdd57e3acb",
"name": "M33_Light_Red_300_secs_2020-08-27T03-45-00_010.fits",
"date": "2020-08-26 22:39:59",
"filter": "Red",
"exposure": 300,
"temp": -10,
"offset": 10,
"gain": 120,
"dec": 30.5457,
"ra": 23.4641
}
```
#### Photo controller
``/api/get/photo/list``
```json
{
"object": "NGC_896",
"date": "2022-02-09",
"file": "NGC_896-710m-2022.02.09",
"ext": "jpg",
"author": {
"name": "Author name",
"link": ""
}
}
```

``/api/get/photo/list?object=${string}``
```json
{
"object": "M_33",
"date": "2020-12-25",
"file": "M33-630m-2020.12.25",
"ext": "jpg",
"author": {
"name": "Author name",
"link": ""
},
"parameters": {
"date": "2020-08-26 23:10:55",
"exposure": 45367,
"frames": 214,
"filesizes": 7016,
"filters": {
"Luminance": {
"exposure": 13203,
"frames": 45
},
"Red": {
"exposure": 11138,
"frames": 75
},
"Green": {
"exposure": 8722,
"frames": 51
},
"Blue": {
"exposure": 7500,
"frames": 25
},
"Ha": {
"exposure": 4804,
"frames": 18
},
"OIII": {
"exposure": 0,
"frames": 0
},
"SII": {
"exposure": 0,
"frames": 0
}
}
}
}
```

#### Object controller
``/api/get/object/list``
```json
{
"name": "NGC_925",
"date": "2021-10-10 00:51:07",
"exposure": 51300,
"frames": 171,
"Luminance": 12900,
"Red": 14700,
"Green": 13500,
"Blue": 10200,
"Ha": 0,
"OIII": 0,
"SII": 0
}
```

``/api/get/object/names``
```json
[
"Vesta_A807_FA",
"V1405_Cas",
"UGC_6930",
"Sh2_132",
"Sh2_109",
"Sh2_103",
"Sh2-168"
]
```

``/api/get/object/item?object=${string}``
```json
{
"date": "2020-08-26 23:10:55",
"exposure": 45367,
"frames": 214,
"filesizes": 7016,
"filters": {
"Luminance": {
"exposure": 13203,
"frames": 45
},
"Red": {
"exposure": 11138,
"frames": 75
},
"Green": {
"exposure": 8722,
"frames": 51
},
"Blue": {
"exposure": 7500,
"frames": 25
},
"Ha": {
"exposure": 4804,
"frames": 18
},
"OIII": {
"exposure": 0,
"frames": 0
},
"SII": {
"exposure": 0,
"frames": 0
}
}
}
```

#### Catalog controller
``/api/get/catalog/list``
```json
[
{
"name": "V1405_Cas",
"title": "Новая Кассиопеи (V1405 Cas)",
"text": "Вспышка классической новой звезды, представляющая собой взрыв на поверхности белого карлика.",
"category": "Сверхновые",
"ra": 351.147,
"dec": 61.1585
}
]
```

``/api/get/catalog/item?object=${string}``
```json
{
"name": "V1405_Cas",
"title": "Новая Кассиопеи (V1405 Cas)",
"text": "Вспышка классической новой звезды, представляющая собой взрыв на поверхности белого карлика.",
"category": "Сверхновые",
"ra": 351.147,
"dec": 61.1585
}
```

#### Statistic controller
``/api/get/statistic/summary``
```json
{
"photos": 63,
"objects": 89,
"frames": 5987,
"exposure": 1785611,
"filesize": 196289
}
```

----------------------
### Project structure

Expand Down
22 changes: 6 additions & 16 deletions backend/app/Controllers/Weather.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ function month()
$period = $this->request->getGet('date', FILTER_SANITIZE_STRING);
$client = \Config\Services::curlrequest();

if (!$period) { $period = date('Y-m'); }

$start = $period . '-01';
$end = date('Y-m-t', strtotime($period));

Expand All @@ -41,24 +43,15 @@ function month()
$sunrise = $sunData['astronomical_twilight_end'];
$sunset = $sunData['astronomical_twilight_begin'];

if ($item->date > $sunset && $item->date < $sunrise)
{
continue;
}
if ($item->date > $sunset && $item->date < $sunrise) { continue; }

$day = date('Y-m-d', $item->date);

if (!isset($days[$day]))
{
$days[$day] = (object) ['count' => 0];
}
if (!isset($days[$day])) { $days[$day] = (object) ['count' => 0]; }

foreach ($item as $var => $val)
{
if ($var === 'date')
{
continue;
}
if ($var === 'date') { continue; }

if ($val === null)
{
Expand All @@ -82,10 +75,7 @@ function month()

foreach ($item as $var => $value)
{
if ($var === 'count')
{
continue;
}
if ($var === 'count') { continue; }

if ($value !== null)
{
Expand Down
Loading

0 comments on commit 2594420

Please sign in to comment.