We use ITK-dev docker setup or DDEV and Task for development:
task site:installSet
TASK_USE_DDEV=truein .env.local to make task use ddev rather than docker compose for running commands.
task site:update
task site:openRun task to see what cool task are available.
Takes an open-data set, converts it to NGSI-LD, and upserts it into the context broker.
source feed (JSON)
→ SourceInterface implementation maps fields, fixes quirks, picks the data model
→ NgsiEntity normalized NGSI-LD: Property / GeoProperty / Relationship
→ NgsiLdBroker POST /ngsi-ld/v1/entityOperations/upsert
→ context broker
task import # list the available sources
task import -- mtm_spatialmaps-handicap-parking # import one
task import -- mtm_spatialmaps-handicap-parking --dry-run --limit 5 # print the payload insteadAdding a data source means adding a SourceInterface implementation. The easiest way
to do this is by extending AbstractSource, e.g.:
<?php
use App\Source\AbstractSource;
final readonly class MySource extends AbstractSource
{
public function __construct(
) {
parent::__construct(
id: 'my-source',
title: 'My source with some cool data',
description: '',
publisher: 'Me',
contact: 'me@example.com',
landingPage: 'https://my-data.example.com',
accessUrl: 'https://my-data.example.com/data',
mediaType: 'application/geo+json',
crs: 'EPSG:4326',
model: 'MyModel',
contextUrl: '',
updateFrequency: 'daily',
);
}
…
}Run
php bin/console app:source:listlist all data sources.
Design decisions are recorded in docs/adr.
A Scorpio Broker is part of the development setup.
docker compose exec phpfpm curl --silent http://scorpio.local:9090/ngsi-ld/v1/types | jqIf you're using the ITK-dev docker setup, the broker can also be accessed on http://scorpio.enter.local.itkdev.dk/, e.g.
curl --silent http://scorpio.enter.local.itkdev.dk/ngsi-ld/v1/types | jq