Versions Compared

Key

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

...

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

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:

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="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.

To identify the timeseries to import 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.

Code Block
xml
xml
<?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://apiddsc.ddsclizard.nlnet/api/v2/v1timeseries/timeseries<</serverUrl>
			<user>user<<user>dummy_username</user>
			<password>pw<<password>dummy_password</password>
			<relativeViewPeriod unit="day" start="-14300" end="0" startOverrulable="true" endOverrulable="false"/>
			<idMapId>IdImportDDSC</idMapId>
			<unitConversionsId>ImportUnitConversions</unitConversionsId>
			<missingValue>-9999</missingValue>
			<dataFeedId>DDSC</dataFeedId>
			<convertDatum>true</convertDatum>
		</general>
		 <properties>
			 <!-- -map parameter,location combinations to unique timeseries uuid's of ddsc -->
			<string key="SH,Amsterdam" value="cc0a8831-7758-4dd6-999c-f607c026d176"/>
		</properties>
		<timeSeriesSet>
			<moduleInstanceId>ImportDDSC</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>SH</parameterId>
			<locationSetId>DAM_SUB<<locationId>Amsterdam</locationSetId>locationId>
			<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.Example JSON file for timeseries


Code Block
xml
xml
<?xml version="1.0" encoding="UTF-8"?>
<idMap version="1.1" xmlns="http{
url: "https://wwwddsc.wldelftlizard.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

 

Code Block
xmlxml
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 14978,
      "url"net/api/v2/timeseries/cc0a8831-7758-4dd6-999c-f607c026d176/",
id: 20339,
uuid: "cc0a8831-7758-4dd6-999c-f607c026d176",
name: "1468.0000",
organisation_code: "cc0a8831-7758-4dd6-999c-f607c026d176",
description: "Part of group Ten Cate Fiber Temperature",
value_type: "float",
location: {
url: "https://apiddsc.ddsclizard.nlnet/api/v1v2/timeserieslocations/157a6c92cc0a8831-cf4b7758-422f4dd6-8d5a999c-6aeceb01b43cf607c026d176/",
      "uuid"id: 10378,
uuid: "157a6c92cc0a8831-cf4b7758-422f4dd6-8d5a999c-6aeceb01b43cf607c026d176",
      "name": "GREB_BK_A1_SH1468.0000",
      "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"organisation_code: "cc0a8831-7758-4dd6-999c-f607c026d176",
geometry: {
type: "Point",
coordinates: [
4.8690924967,
52.1030364306,
0
]
},
organisation: {
url: "https://apiddsc.ddsclizard.nlnet/api/v2/v1organisations/events/157a6c92-cf4b-422f-8d5a-6aeceb01b43cc9c9dd6349ac4c7ebd434906dd90f671/",
      "value_type"name: "HDSR",
unique_id: "floatc9c9dd6349ac4c7ebd434906dd90f671",
      "parameter": "STIJGHTE",
      "unit": "m",
      "annotations": 0,
      "owner": "Grebbedijk",
      "source": {
        "uuid": "76d9314f-0ddf-4fa6-a6b2-5b0e8cec9d78",
        "name": "GREB_BK_A1"
      }
    }
  ]
}

 

Example JSON events

 

...

users_url: "https://ddsc.lizard.net/api/v2/organisations/c9c9dd6349ac4c7ebd434906dd90f671/users/"
},
access_modifier: "Common",
ddsc_show_on_map: false,
ddsc_icon_url: "/app/images/marker-dam-3.png",
extra_metadata: {
description: "Part of group Ten Cate Fiber Temperature",
ddsc: true
}
},
parameter_referenced_unit: {
url: "https://ddsc.lizard.net/api/v2/parameterreferencedunits/320/",
code: "WNS6529",
parameter_short_display_name: "Temperatuur",
referenced_unit_short_display_name: "oC",
description: "",
domain_values: null
},
device: "",
extra_metadata: {
compartment: "BS",
ddsc: true
},
access_modifier: "Common",
supplier: null,
supplier_code: null,
first_value_timestamp: 1366893402000,
last_value_timestamp: 1435907838000,
last_value: -28.9631,
threshold_min_soft: null,
threshold_min_hard: null,
threshold_max_soft: null,
threshold_max_hard: null,
created: 1364985111394,
last_modified: null,
last_modified_by: "",
events: [
{
timestamp: 1421817438000,
max: -34.2868,
min: -34.2868
},
{
timestamp: 1421821038000,
max: -34.2108,
min: -34.2108
},
{
timestamp: 1421824638000,
max: -34.3991,
min: -34.3991
},
]
}


Java source code

DdscTimeSeriesServerParser.java

...