myfreight-assessment/README.md

42 lines
1.4 KiB
Markdown

# MyFreight Assessment
## Receiving Tracking information
When receiving Tracking information, the following steps need to be completed to process the data
```mermaid
flowchart TD
receiveTracking(["Receive Tracking"])
findContainerAndShipment["SELECT container JOIN Shipment"]
updateShipment[/Update shipment\]
isArrivingSoon{{"Is arrival estimate between now and now + 24h?"}}
hasArrived{{"Is arrival estimate <=now?"}}
isDelayed{{Is arrival estimate > original arrival + 24h?}}
sendNotification[/Send notification\]
receiveTracking -- "`
**Tracking data**
carrierName:**string**
destinationUnLoCode:**string**
departureDate:**string[_datetime_]**
arrivalDateEstimate:**string[_datetime_]**
containerNumber:**string**
`" --> findContainerAndShipment
findContainerAndShipment --> |WHERE containers.containerNumber = :trackingData.containerNumber| updateShipment
updateShipment --> isArrivingSoon & hasArrived & isDelayed
isDelayed -->|set delayed flag| sendNotification
hasArrived --> |set has arrived flag| sendNotification
isArrivingSoon -->|set is arriving soon flag| sendNotification
%% isArrivingSoon -->|yes| sendArriveSoon
```
## Possible improvements
- Sending the actual notification, there should be a more general way to setup notifiers
- Moving some variables to config files
- when is a shipment "arriving soon"
- database credentials (via an .env)
- mock date
-