# GRAFO D V46 — API field mapping correction

## Correction

The API ingestion mapper now normalizes common API-center and ISS payload fields into the canonical SQLite event schema.

### Timestamp/date

Unix epoch timestamps in seconds or milliseconds are converted to UTC calendar dates before writing to SQLite.

Example:

```json
{"timestamp": 1780595323}
```

is written as:

```text
date_text = 2026-06-04
date_year = 2026
date_month = 6
date_day = 4
```

### ISS position

Payloads containing `iss_position`, `latitude`/`longitude`, `lat`/`lon`, `location`, `coordinates`, or equivalent nested fields are mapped to:

```text
place = Low Earth Orbit / lat <latitude>, lon <longitude>
who = ISS
brief_description = ISS live location telemetry. Latitude ..., longitude .... Timestamp UTC: ...
```

### Cleanup

At startup, the server removes malformed generic ISS events produced by the previous mapper when they have:

```text
empty place
date_year > 9999
ISS-LIVE-LOCATION in event_name/api_text/who
```

This cleanup does not delete historical `ISS_POS_*` rows with valid dates and place fields.
