LASUCA Shared Endpoint
This micro-endpoint exposes the historian snapshot consumed by both the desktop dashboard and the factory display clients. It returns a normalised JSON payload so updates happen in one place.
Project layout
shared-endpoint/
├── config.php # Connection + cache settings (override with env vars in production)
├── public/
│ └── index.php # JSON endpoint (`/shared-endpoint/public/index.php`)
└── src/
└── Database.php # `fetchLatestItems()` helper wrapping the `items` table
Running locally
- Set the required environment variables (optional if you reuse the on-prem credentials):
LASUCA_DB_HOSTLASUCA_DB_USERLASUCA_DB_PASSWORDLASUCA_DB_NAMELASUCA_CACHE_TTL(seconds, defaults to 1)
- Serve the project (from one level above
shared-endpoint):
php -S localhost:8081 shared-endpoint/public/index.php
The endpoint will respond with:
{
"status": "ok",
"metadata": {
"generatedAt": "2025-10-16T14:22:00+00:00",
"count": 321
},
"items": [
{
"tagId": 1,
"name": "RUNHRSTODAY",
"value": 12,
"rounded1": 12.0,
"rounded2": 12.00,
"timestamp": "2025-10-16 09:20:31"
}
]
}
Integrating with the dashboards
- Move this folder so it sits alongside
overviews/(both projects can then include../shared-endpoint/public/index.php). - Update the existing UI code to call
fetchLatestItems()through the endpoint instead of includingincludes/items.phpdirectly:- Server-side PHP can
file_get_contents('http://localhost:8081')andjson_decodethe result. - Front-end polling can swap
data/main.phpfor the JSON feed if you add a thin adapter.
- Server-side PHP can
- When you edit tag metadata, change it once in the database—every consumer will see it on the next poll.
Tip: keep the endpoint repo in its own workspace or git submodule so both the control room and display teams can update it without stepping on each other.