Skip to content

Functions Importer

Florian Fehring edited this page Oct 5, 2026 · 1 revision

Alle Importer haben die folgenden Eigenschaften:

Wichtigste Funktionalitäten:

  • Einfaches Interface zum Abspeichern von Messwerten
  • Ermöglicht den Zugriff auf die Konfiguration des Importvorgangs
  • Verarbeitet evtl. auftretende Fehler und generiert Meldungen daraus

Spezielle Importer bauen in der auf der Startseite dargestellten Reihenfolge aufeinander auf.

Der Importer erwartet beim Aufruf eine Konfigurationsdatei, in der eingestellt wird, was wohin importiert werden soll. Die folgenden Tabellen listet die verfügbaren Parameter auf. Es können beliebig viele Importkonfigurationen in einer Datei definiert werden. Bei den Konfigurationsdateien handelt es sich um eine JSON-Datei, welche zum Start des Importers an die Schnittstelle gesendet werden muss.

Wird der Import über die REST-Schnittstelle gestartet, muss dort eine Konfiguration mitgesendet werden.

Diese Seite beschreibt die Basiskonfiguration des Imports. Je nach Herkunft der Daten muss ein spezieller Importer verwendet werden. Die Dokumentation zu den dann nötigen weiteren Konfigurationseinträgen entnehmen Sie bitte den Unterseiten. Daten müssen in den meisten Fällen vor dem Import geparst werden. Es ist eine zusätzliche Konfiguration erforderlich für den Parser. Entsprechende Dokumentation finden Sie im Abschnitt Parser.

Eine Reihe von Beispielen befindet sich im Ordner /importscripts.

Data target configuration

Target for data import is allways a SmartData instance. The target is configured with following options:

Parameter Bedeutung Standard Optional
server URL des Servers, auf dem das SmartData läuft http://127.0.01 ja
smartdata Name der SmartData-Instanz über die Importiert wird SmartData ja
storage Name des Storage in den importiert wird nein
collection Name der Collection in die importiert wird nein
ignoreSSL If true communication certificate check is disabled yes
update Vorhandene Datensätze aktualisieren false = aus ja
simulation simulationsmodus an (0=aus, 1=parser, 2=DB rollback) 0 = aus ja
debugmode Debugmodus (erweiterte Status- und Fehlerausgaben) false=aus ja
save.blocksize Maximum count of datasets send to database at a time 100 yes

If the target collection does not exists, it will be automatically created on the information of the first available dataset.

Data source configuration

The datasource can vary in source space and source format. Adaption to the source space is done by choosing an importer. Adaption to the source format is done by choosing a parser.

Param Description Default Optional
importer Name of importer (HTTPimporter, FTPimporter,...) no
parser Name of the parser (csv, json, ...) no

Each importer and parser has it's own configuration posibilites. You can find them in the importers and parsers description.

Data modification

SmartDataPorter brings some possibilities to modify the data at import time.

Sourcemapping

The source mapping allows the assignment of datasets to tables based on the data source. This makes it possible, for example, to import data from files delivered in a ZIP, which contains multiple files, into a different table for each file.

Param Description Default Optional
sourcemapping Mapping from source to table yes

Example importing data from files ending on CmpSMS into table test_cmp:

    "sourcemapping": [
        {
            "namepattern": "^CmpSMS.*",
            "collection": "test_cmp"
        }
    ]

Attribute renameing

Attributes from source can be renamed to match names of attributes in collections.

Param Description Default Optional
save.rename.* Replace the * with name from source. Value is name in target yes

Example for additional configuration:

"save.rename.sourceattr": "targetattr"

Transformation for geospatial information

This allows import of geocoordinates that are given as latitude and longitude into database enhanced geoposition type for better performance and spatial requests.

Param Description Default Optional
geo.transform If true geotransformation is active false yes
geo.latAttr Attribut that originally contains the latitude lat yes
geo.lonAttr Attribut that originally contains the longitude lon yes
geo.srid Sources SRID 4326 yes
geo.dbattr Attribute in target table geom yes

Target attribut must exist in target collection and should have the same SRID. Recalculation of coordinates to another SRID is not supported by the importer and should be done with database tools, if needed.

Default values for missing values

This allows configuration of default values for values that are missing in the source.

Parameter Description Standard Optional
defaults Object containing the defaults configuration yes
enabled If true default values are activated false yes
values List of attributes an the corosponding default values - yes
"defaults": {
  "enabled": true,
  "values": {
      "spalte1": "standardwert1",
      "spalte2": "standardwert2"
   }
}

Configuration for decistion values

A decision value is used for deciding if a dataset should be imported or not. The most common case is to start importing of sets after the last allready imported dataset.

To get the decisition value from database the server, smartdata, storage and collection values are used from above configuration. Also the ignoreSSL flag is supported.

Param Description Default Optional
decisionattr Name of the attribute that's value is used for decistion null no
decisionorder Order in which the value should be get DESC no

Example for additional configuration:

   "decisionattr": "acquiretime",
   "decisionorder": "DESC",

Auto table creation

If the target collection (table) does not exists, SmartDataPorter creates it for local databases and in conjunction with SmartData for network (SmartData API) writing.

Bulk-Imports

Parameter Bedeutung Standard Optional
jndi Name der JNDI-Resource für bulk-Importe ja

Clone this wiki locally