Welcome to TinyLink: the friendly lab middleware that never sleeps, rarely panics, and keeps your results moving even when downstream systems are having a bad day.
## What TinyLink Can Do
TinyLink sits between laboratory instruments and CLQMS, then handles the heavy lifting:
- Receives messages from instruments over three connector types:
-`http-json` (HTTP endpoint)
-`hl7-tcp` (TCP socket)
-`astm-serial` (physical serial port/COM)
- Parses incoming payloads and normalizes them into one canonical JSON format.
- Stores raw and normalized data in SQLite for durability.
- Deduplicates repeated payloads using a hash key.
- Sends results to CLQMS with automatic retry and backoff.
- Moves non-deliverable payloads to dead letter for review.
- Exposes operational endpoints for health and metrics.
Think of it as a reliable translator + traffic controller for instrument data.
- HTTP `400` and `422` are treated as non-retriable and moved to dead letter immediately.
## Health, Readiness, and Metrics
Use these to check system status:
-`GET /health`: connector status + queue counts (`pending`, `retrying`, `deadLetters`).
-`GET /health/ready`: confirms SQLite readiness.
-`GET /metrics`: Prometheus-style metrics, including attempts, latency, and success timestamp.
## Daily Operations (Quick Checklist)
- Start app: `npm start`
- Validate instrument files: `npm run instrument:check`
- Run migrations manually: `npm run migrate`
- Backup DB: `npm run maintenance -- backup`
- Vacuum DB: `npm run maintenance -- vacuum`
- Prune old delivery logs: `npm run maintenance -- prune --days=30`
## Troubleshooting New Instrument Onboarding
### Instrument returns `404`
- Confirm exact `instrument_id` spelling and casing.
- Verify the instrument exists in `middleware/config/app.yaml` as its own top-level key (`inst1`, `inst2`, ...).
- Verify that instrument has `connector.type`, connector settings, and `translator.parser`.
### Data is not flowing
- Confirm instrument has `enabled: true`.
- Confirm connector matches incoming protocol.
- Confirm match rules fit connector metadata (`localPort`, `remoteAddress`, `remotePort`, or `comPort`).
- Check `/health` and `/health/ready`.
### Backlog or dead letters are growing
- Check `/metrics` for queue and delivery trends.
- Validate CLQMS URL/token/timeouts and downstream availability.
## Final Tip
If you are adding many instruments, standardize your naming (for example: `LAB1_XN1000`, `LAB1_COBAS_E411`) and keep connector mappings documented. Future-you will send present-you a thank-you card.