Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

The DDSC Export export exports timeseries to the Dijkdata Service Center (DDSC).

...

The DDSC export function (<exportType>DDSC<<exportType>DdscExport</exportType>) imports  exports timeseries from FEWS to the following REST service: https://api.ddsc.nl/api/v2v3/.

The export can be used to export timeseries from FEWS or for exporting images from DAM live.

For documentation on the API see: https://ddsc.lizard.net/doc/api.html.

Configuring the time series export

To make the export known to FEWS, the export module has to be declared in the moduleInstanceDescriptors.xml in the RegionConfigFiles directory of the FEWS configuration:

Code Block
xml
xml
<?xml version="1.0" encoding="UTF-8"?>
<moduleInstanceDescriptors xmlns="http://www.wldelft.nl/fews"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://www.wldelft.nl/fews
		http://fews.wldelft.nl/schemas/version1.0/moduleInstanceDescriptors.xsd" version="1.0">
...
	<moduleInstanceDescriptor id="ExportDDSC">
		<moduleId>TimeSeriesExportRun</moduleId>
	</moduleInstanceDescriptor>
...
</moduleInstanceDescriptors>

 


An example of the DDSC import export configuration will be given here. The exportType is named DdscExport which should be configured in the general section of the export. De URL to the rest service should be configured here as well.
Time is assumed to be specified in GMT.

To identify the timeseries to export the unique uuid of the timeseries have to be specified. This is done in the properties sections where parameterId and locationId are mapped to a uuid value (the uuid's have to be created using the REST functions. See later in the documentation). The relative view period of a timeSeriesSet determines the timeSeries to export to the DDSC.

Code Block
xml
xml
<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesExportRun xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews
http://fews.wldelft.nl/schemas/version1.0/timeSeriesExportRun.xsd">
	<export>
		<general>
			<exportType>DdscExport</exportType>
			<serverUrl>https://api.ddsc.nl/api/v2v3/timeseries/</serverUrl>
			<user>deltares<user>dummy_ddsc<user</user>
			<password>r2OJMYJC4a<<password>dummy_password</password>
			<unitConversionsId>ImportUnitConversions</unitConversionsId>
		</general>
		 <properties>
			 <!-- -map parameter,location combinations to unique timeseries uuid's of ddsc -->
			<string key="Q.observed,Brasilia28_0" value="f9295f20-de55-40d4-a356-61f6f142a36f"/>
		</properties>
		<timeSeriesSet>
			<moduleInstanceId>ImportDDSC</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>Q.observed</parameterId>
			<locationId>Brasilia<<locationId>28_0</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<relativeViewPeriod unit="day" start="-300" end="0" startOverrulable="true" endOverrulable="false"/>
			<readWriteMode>add originals</readWriteMode>
			<synchLevel>1</synchLevel>
		</timeSeriesSet>
	</export>
</timeSeriesExportRun>

...


Configuring

...

the DAM Live images export

To make the export known to FEWS, the export module has to be declared in the moduleInstanceDescriptors.xml in the RegionConfigFiles directory of the FEWS configuration:

Code Block
xml
xml
<?xml version="1.0" encoding="UTF-8"?>
<moduleInstanceDescriptors xmlns="http://www.wldelft.nl/fews"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://www.wldelft.nl/fews
		http://fews.wldelft.nl/schemas/version1.0/moduleInstanceDescriptors.xsd" version="1.0">
...
	<moduleInstanceDescriptor id="ExportDDSCImages">
		<moduleId>TimeSeriesExportRun</moduleId>
	</moduleInstanceDescriptor>
...
</moduleInstanceDescriptors>


An example of the DDSC image export configuration will be given here. The exportType is also named DdscExport which should be configured in the general section of the export. De URL to the rest service should be configured here as well.
Time is assumed to be specified in GMT.

To identify the image timeseries to export the unique uuid of the image timeseries have to be specified. This is done in the properties sections where parameterId and locationId are mapped to a uuid value (the uuid's have to be created using the REST functions. See later in the documentation). The relative view period of a timeSeriesSet determine the image to export to the DDSC. Only images for timesteps inside the relativeViewPeriod, will be exported to the DDSC Service.

To export images, the following property has to be configured: image.folder. This will point to the folder with the DAM live output where the images are stored. The filename of the images is assumed to be in the format:

Dik(dike)_Loc(location_id)_Mdl(Model)_yyyy-MM-ddTHH_mm_ss.jpg . For example: Dik(dike)_Loc(28_0)_Mdl(Bishop)_2014-08-01T08_00_00.jpg

N.B.: the timeseries uuid for the images are NOT the same as for the float timeseries. They are linked together by DDSC by mapping them to the same location.

Code Block
xml
xml
<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesExportRun xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews
http://fews.wldelft.nl/schemas/version1.0/timeSeriesExportRun.xsd">
	<export>
		<general>
			<exportType>DdscExport</exportType>
			<serverUrl>https://api.ddsc.nl/api/v3/timeseries/</serverUrl>
			<user>dummy_user</user>
			<password>dummy_password</password>
			<unitConversionsId>ImportUnitConversions</unitConversionsId>
		</general>
		 <properties>
			 <!-- -map parameter,location combinations to unique timeseries uuid's of ddsc of the image type-->
			<string key="Q.observed,28_0" value="f1f21747-8a5c-4e6c-bd8d-f39adad9439c"/>
			<!-- image folder is specified, we assume that we export images and not time series. Only images that match a timestep in the relative view period will be exported. -->
			<string key="image.folder" value="d:\fews\dam-live\Voorbeeld output DAM-Live\" />
		</properties>
		<timeSeriesSet>
			<moduleInstanceId>ImportDDSC</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>Q.observed</parameterId>
			<locationId>28_0</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<relativeViewPeriod unit="day" start="-1000" end="0" startOverrulable="true" endOverrulable="false"/>
			<readWriteMode>add originals</readWriteMode>
			<synchLevel>1</synchLevel>
		</timeSeriesSet>
	</export>
</timeSeriesExportRun>


Configuring DDSC Locations and TimeSeries

Before timeseries from FEWS can be exported to the DDSC, locations and timeseries have to be created manually first. (Using a REST tool like "Advanced REST Client" can do the job).

Creating locations:


Code Block
languagetext
POST https://api.ddsc.nl/api/v3/locations/ HTTP/1.1
Host: api.ddsc.nl
username: dummy_username
password: dummy_password
Content-Type: application/json
Accept: application/json


{
    "name": "28_5",
    "organisation": "a73d02c3280047a89d4d362df1914352",
    "organisation_code": "28_5",
    "geometry": null,
    "access_modifier": 0,
    "ddsc_icon_url": "",
    "ddsc_show_on_map": false,
    "extra_metadata": null
}


The location is returned:

Code Block
{
"url": "https://api.ddsc.nl/api/v3/locations/73fd0765

Before timeseries from FEWS can be exported to the DDSC, locations and timeseries have to be created manually first. (Using a REST tool like "Advanced REST Client" can do the job).

Creating locations:

 

Code Block
languagetext
POST https://api.ddsc.nl/api/v2/locations/ HTTP/1.1
Host: api.ddsc.nl
username: ddsc_username
password: ddsc_password
Content-Type: application/json
Accept: application/json


{
    "name": "28_5",
    "organisation": "a73d02c3280047a89d4d362df1914352",
    "organisation_code": "28_5",
    "geometry": null,
    "access_modifier": 0,
    "ddsc_icon_url": "",
    "ddsc_show_on_map": false,
    "extra_metadata": null
}

 

The location is returned:

Code Block
{
"url": "https://api.ddsc.nl/api/v2/locations/73fd0765-86fb-40b9-a917-ecb59f5dc14b/"
"uuid": "73fd0765-86fb-40b9-a917-ecb59f5dc14b"
"name": "28_5"
"organisation": "a73d02c3280047a89d4d362df1914352"
"organisation_code": "28_5"
"geometry": null
"access_modifier": "Public"
"ddsc_icon_url": ""
"ddsc_show_on_map": false
"extra_metadata": null
"last_modified": "2016-02-19T16:01:17.699333"
"last_modified_by": "deltares_ddsc"
}

 


Creating a new timeseries for storing events"

Code Block
POST https://api.ddsc.nl/api/v2v3/timeseries/
Host: api.ddsc.nl
username: ddscdummy_username
password: ddscdummy_password
Content-Type: application/json
Accept: application/json
{
    "name": "timeserie_28_0",
    "description": "timeserie_28_0",
    "location": "b8db040c-4edc-4983-81df-32b2f3216bfc",
    "organisation_code": "timeserie_28_0",
    "device": "",
    "supplier": null,
    "supplier_code": null,
    "access_modifier": "Public",
    "value_type":1,
    "parameter_referenced_unit": "H.meting",
    "threshold_min_soft": null,
    "threshold_min_hard": null,
    "threshold_max_soft": null,
    "threshold_max_hard": null
}


 


The result of this post returns the uuid of this timeseries.

Code Block
{
"url": "https://api.ddsc.nl/api/v2v3/timeseries/414c320b-d965-4888-8b9c-cf587a82dacb/"
"id": 40314
"uuid": "414c320b-d965-4888-8b9c-cf587a82dacb"
"name": "timeserie_28_0"
"description": "timeserie_28_0"
"location": "b8db040c-4edc-4983-81df-32b2f3216bfc"
"organisation_code": "timeserie_28_0"
"device": ""
"supplier": null
"supplier_code": null
"access_modifier": "Public"
"value_type": "float"
"parameter_referenced_unit": "H.meting"
"threshold_min_soft": null
"threshold_min_hard": null
"threshold_max_soft": null
"threshold_max_hard": null
"last_modified": "2016-02-19T16:20:56.768927"
"last_modified_by": "deltares_ddsc"
"extra_metadata": null
}

 

 


Posting events to the timeseries the timeseries is done by the DdscExport module, but can be done manually as well with:

POST https://api.ddsc.nl/api/v2v3/timeseries/f9295f20-de55-40d4-a356-61f6f142a36f/data/

Where uuid f9295f20-de55-40d4-a356-61f6f142a36f is the uuid of the timeseries. 

The POST content can be JSON according the following format:

Code Block
[
  {"value": "2.0123", "datetime": "2013-02-12T09:56:12Z"},
Code Block
[
  {"value": "2.0123", "datetime": "2013-02-12T0913T09:56:12Z"},
  {"
]


This will return the following response:

Code Block
[{"datetime":"2013-02-12T09:56:12Z","value": "2.0123"}, {"datetime": "2013-02-13T09:56:12Z:12Z","value":"2.0123"}
]


 

This will return the following response:

Code Block
[{"datetime":"2013-02-12T09:56:12Z","value":"2.0123"},{"datetime":"2013-02-13T09:56:12Z","value":"2.0123"}]

 

For posting to image a new timeseries of value type 5 has to be created where the uuid of the location is specified. This way they can be related to each other.

Creating an "image" time series can be done as follows: 


For posting images to DDSC a new timeseries of value type 5 has to be created where the uuid of the location is specified. This way they can be related to each other.

Creating an "image" time series can be done as follows: 

Code Block
POST https://api.ddsc.nl/api/v3/timeseries/
Host: api.ddsc.nl
username: dummy_username
password: dummy_password
Content-Type: application/json
Accept: application/json
{
    "name": "timeserie_image_28_0",
    "description": "timeserie_28_0",
    "location": "b8db040c-4edc-4983-81df-32b2f3216bfc",
    "organisation_code": "timeserie_image_28_0",
    "device": "",
    "supplier": null,
    "supplier_code": null,
    "access_modifier": "Public",
    "value_type":5,
    "parameter_referenced_unit": "H.meting
Code Block
POST https://api.ddsc.nl/api/v2/timeseries/
Host: api.ddsc.nl
username: ddsc_username
password: ddsc_password
Content-Type: application/json
Accept: application/json
{
    "name": "timeserie_image_28_0",
    "descriptionthreshold_min_soft": null,
    "timeseriethreshold_28min_0hard": null,
    "locationthreshold_max_soft": "b8db040c-4edc-4983-81df-32b2f3216bfc"null,
    "organisationthreshold_max_codehard": "timeserie_image_28_0",
    "device": "",
    "supplier": null,
    "supplier_code": null,
    "access_modifier": "Public",
    "value_type":5,
    "parameter_referenced_unit": "H.meting",
    "threshold_min_soft": null,
    "threshold_min_hard": null,
    "threshold_max_soft": null,
    "threshold_max_hard": null
}

The uuid of this series is returned in the response:

Code Block
{
"url": "https://api.ddsc.nl/api/v2/timeseries/9d7dbcdc-e6a7-41e9-8870-eacdf80e18fc/"
"id": 40315
"uuid": "9d7dbcdc-e6a7-41e9-8870-eacdf80e18fc"
"name": "timeserie_image_28_0"
"description": "timeserie_28_0"
"location": "b8db040c-4edc-4983-81df-32b2f3216bfc"
"organisation_code": "timeserie_image_28_0"
"device": ""
"supplier": null
"supplier_code": null
"access_modifier": "Public"
"value_type": "image"
"parameter_referenced_unit": "H.meting"
"threshold_min_soft": null
"threshold_min_hard": null
"threshold_max_soft": null
"threshold_max_hard": null
"last_modified": "2016-02-19T16:23:46.071265"
"last_modified_by": "deltares_ddsc"
"extra_metadata": null
}

 

The images can now be posted to:

POST 
null
}

The uuid of this series is returned in the response:

Code Block
{
"url": "https://api.ddsc.nl/api/v3/timeseries/9d7dbcdc-e6a7-41e9-8870-eacdf80e18fc/"
"id": 40315
"uuid": "9d7dbcdc-e6a7-41e9-8870-eacdf80e18fc"
"name": "timeserie_image_28_0"
"description": "timeserie_28_0"
"location": "b8db040c-4edc-4983-81df-32b2f3216bfc"
"organisation_code": "timeserie_image_28_0"
"device": ""
"supplier": null
"supplier_code": null
"access_modifier": "Public"
"value_type": "image"
"parameter_referenced_unit": "H.meting"
"threshold_min_soft": null
"threshold_min_hard": null
"threshold_max_soft": null
"threshold_max_hard": null
"last_modified": "2016-02-19T16:23:46.071265"
"last_modified_by": "deltares_ddsc"
"extra_metadata": null
}


Storing Images in the DDSC is done by the DDSC Export module. 

Images can now be posted manually as well to:

POST https://api.ddsc.nl/api/v3/timeseries/(uuid: uuid)/data/

In the header user name and password should be specified and datetime header as well. Only one image per datetime can be posted. Here an example with curl.

Code Block
curl -X
POST -H "Accept: application/json" -H 'username: dummy_username'
-H 'password: dummy_password' -H 'Content-Type: image/jpg' -H 'datetime:
2016-02-22T11:18:38.683Z' --data-binary "@plaatje.jpg" http:
https:
//api.ddsc.nl/api/
v2
v3/timeseries/
(uuid: uuid)/data/

In the header user name and password should be specified and datetime as well. Only one image per datetime can be posted.

Code Block
 

 

 

Code Block
 

 

 

 
3d43f739-bb6f-459c-a089-7ec1f13d4fb3/data/