diff --git a/src/core/js/ext_data_analysis.js b/src/core/js/ext_data_analysis.js
index b9957debce091d31cdd1af143d7c4e20a3889c9c..3bdb46b619a866f6c56d269603f0bef8c4effcf3 100644
--- a/src/core/js/ext_data_analysis.js
+++ b/src/core/js/ext_data_analysis.js
@@ -1,29 +1,83 @@
 /*
- * ** header with license infoc
- * ...
+ * ** header v3.0
+ * This file is a part of the CaosDB Project.
+ *
+ * Copyright (C) 2021 Alexander Schlemmer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * ** end header
  */
 
 'use strict';
 
 /**
- * description of the module ...
+ * Module that adds data analysis buttons to records of a specified record type.
+ * These record types are configured in a file called data_analysis.json. The record type
+ * usually has Dataset as Parent and contains references to multiple datasets that are used
+ * as input for the data analysis script.
  *
- * @module ext_flight_preview
+ * Currently this module supports only one analysis script. It is planned to expand this for
+ * multiple configured analysis scripts.
+ *
+ * @module ext_data_analysis
  * @version 0.1
  *
- * @requires somelibrary
- * (pass the dependencies as arguments)
  */
-var ext_flight_preview = function (somelibrary) {
+var ext_data_analysis = function (somelibrary) {
 
     var init = function (toolbox) {
         /* initialization of the module */
+        this.add_ui();
     }
 
     /**
-     * doc string
+      * Add the analysis buttons to the correct records.
+      */
+    var add_ui = async function() {
+        // load configuration for data analysis module
+        var config = await load_config("data_analysis.json");
+
+        var ents = getEntities();
+        for (ent of ents) {
+            // Check parents for configured parent:
+            var parents = getParents(ent);
+            var found = false;
+            for (parent of parents) {
+                if (parents[0].name == config["supported_dataset_parent"]) {
+                    found = true;
+                    break;
+                }
+            }
+            if (found == true) {
+	            var button = $("<button>" + config["data_analysis_title"] + "</button>");
+                let entity_id = getEntityID(ent);
+                let analysis_script = config["analysis_script_file"];
+	            button.click(_=>runCorrAnalysis(entity_id, analysis_script));
+	            $(ent).find(".caosdb-v-entity-header-buttons-list").prepend(button);
+            }
+        }
+    }
+
+    /**
+     * Run the analysis script. This function is run by the
+     * analysis button and runs the configured python script in the background.
+     * The current entity id (which is usually a sub record type of a dataset is passed
+     * as argument "--entity" to the script file.
      */
-    var some_function = function (arg1, arg2) {
+    function runAnalysis(entity_id, analysis_script) {
+        connection.runScript(analysis_script, {"-Oentity": entity_id});
     }
 
     /* the main function must return the initialization of the module */
@@ -38,29 +92,7 @@ $(document).ready(function() {
     // use a variable starting with `BUILD_MODULE_` to enable your module
     // the build variable has to be enabled in the `build.properties.d/` directory.
     // Otherwise the module will not be activated.
-    if ("${BUILD_MODULE_EXT_BOTTOM_LINE}" === "ENABLED") {
-        caosdb_modules.register(ext_flight_preview);
+    if ("${BUILD_MODULE_EXT_DATA_ANALYSIS}" === "ENABLED") {
+        caosdb_modules.register(ext_data_analysis);
     }
 });
-
-// -------------------------
-
-
-
-function runCorrAnalysis(entity_id) {
-    console.log(entity_id);
-    connection.runScript("", {"-Oentity": entity_id});
-}
-
-var ents = getEntities();
-for (ent of ents) {
-    var parents = getParents(ent);
-    if (parents.length > 0 && parents[0].name == "") {
-	var button = $("<button>Data Analysis</button>");
-	button.click((function(entity_id){return()=>runCorrAnalysis(entity_id);})(getEntityID(ent)));
-	$(ent).find(".caosdb-v-entity-header-buttons-list").prepend(button);
-    }
-}
-
-// load configuration for data analysis module
-var config = await load_config("data_analysis.json");