You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Overview

The DDSC import function (<importType>DDSC</importType>) imports from the following REST service: https://api.ddsc.nl/api/v1/

Configuring the Import

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

<?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="ImportDDSC">
		<moduleId>TimeSeriesImportRun</moduleId>
	</moduleInstanceDescriptor>


...
</moduleInstanceDescriptors>

 

An example of the DDSC import configuration will be given here. The importType is named DDSC which should be configured in the general section of the import. De URL to the rest service should be configured here as well.
Time is assumed to be specified in GMT and data is assumed to be UTF-8 encoded.

<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesImportRun 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/timeSeriesImportRun.xsd">
	<import>
		<general>
			<importType>DDSC</importType>
			<serverUrl>https://api.ddsc.nl/api/v1/timeseries</serverUrl>
			<user>user</user>
			<password>pw</password>
			<relativeViewPeriod unit="day" start="-14" end="0" startOverrulable="true" endOverrulable="false"/>
			<idMapId>IdImportDDSC</idMapId>
			<unitConversionsId>ImportUnitConversions</unitConversionsId>
			<missingValue>-9999</missingValue>
			<dataFeedId>DDSC</dataFeedId>
			<convertDatum>true</convertDatum>
		</general>
		<timeSeriesSet>
			<moduleInstanceId>ImportDDSC</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>SH</parameterId>
			<locationSetId>DAM_SUB</locationSetId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
			<synchLevel>1</synchLevel>
		</timeSeriesSet>
	</import>


</timeSeriesImportRun>

The IdMapping configuration idImportDDSC.xml is very important because this maps the internal FEWS Id's to the REST Id's. An example IdMapping file for the DDSC importer is shown below.

<?xml version="1.0" encoding="UTF-8"?>
<idMap version="1.1" 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/idMap.xsd">
	....
	<parameter external="SH" internal="SH"/>
	<parameter external="TEMP" internal="T_meting_grondwater"/>
	<parameter external="WSP" internal="Waterspanning"/>
	<locationIdFunction internalLocationSet="DAM_SUB" externalLocationFunction="@DDSC_LOC@"/>

	....
</idMap>

Example JSON file for timeseries

 

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 14978,
      "url": "https://api.ddsc.nl/api/v1/timeseries/157a6c92-cf4b-422f-8d5a-6aeceb01b43c",
      "uuid": "157a6c92-cf4b-422f-8d5a-6aeceb01b43c",
      "name": "GREB_BK_A1_SH",
      "location": {
        "uuid": "60d69cff-9ba1-4a4b-988e-7f9a0821948d",
        "name": "GREB_BK_A1"
      },
      "latest_value_timestamp": "2015-06-01T07:01:11.000000Z",
      "latest_value": 6.212,
      "events": "https://api.ddsc.nl/api/v1/events/157a6c92-cf4b-422f-8d5a-6aeceb01b43c",
      "value_type": "float",
      "parameter": "STIJGHTE",
      "unit": "m",
      "annotations": 0,
      "owner": "Grebbedijk",
      "source": {
        "uuid": "76d9314f-0ddf-4fa6-a6b2-5b0e8cec9d78",
        "name": "GREB_BK_A1"
      }
    }
  ]
}

 

Example JSON events

 

{
  "count": 168,
  "next": "https://api.ddsc.nl/api/v1/events/157a6c92-cf4b-422f-8d5a-6aeceb01b43c?start=2015-01-09T18%3A00%3A00.000Z&end=2015-01-19T18%3A00%3A00.000Z&page=2&format=json",
  "previous": null,
  "results": [
    {
      "flag": "-1",
      "value": 6.520999908447266,
      "datetime": "2015-01-09T19:01:11.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.568999767303467,
      "datetime": "2015-01-09T21:01:12.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.586999893188477,
      "datetime": "2015-01-09T23:01:11.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.586999893188477,
      "datetime": "2015-01-10T00:01:12.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.580999851226807,
      "datetime": "2015-01-10T02:01:11.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.580999851226807,
      "datetime": "2015-01-10T03:01:10.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.580999851226807,
      "datetime": "2015-01-10T05:01:10.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.579999923706055,
      "datetime": "2015-01-10T06:01:33.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.578000068664551,
      "datetime": "2015-01-10T07:01:10.000000Z"
    },
    {
      "flag": "-1",
      "value": 6.579999923706055,
      "datetime": "2015-01-10T09:01:13.000000Z"
    }
  ]
}

 

 

Java source code

DdscTimeSeriesServerParser.java

 

 

 

  • No labels