Browse Source

initial import

Andrej Studen 1 week ago
commit
713f8b23c9
3 changed files with 247 additions and 0 deletions
  1. 20 0
      config/module.xml
  2. 39 0
      queries/lists/importXML.js
  3. 188 0
      scripts/DCIS/dcisFcns.js

+ 20 - 0
config/module.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+    <bean id="moduleBean" class="org.labkey.api.module.SimpleModule">
+        <property name="name" value="DCIS"/>
+        <property name="requiredServerVersion" value="0.0"/>
+        <property name="moduleDependencies" value=""/>
+        <property name="buildUser" value="astuden"/>
+        <property name="buildTime" value="May 21 2025, 11:43 AM"/>
+        <property name="buildOS" value="Ubuntu"/>
+        <property name="buildPath" value=""/>
+        <property name="sourcePath" value=""/>
+        <property name="supportedDatabases" value=""/>
+        <property name="resourcePath" value=""/>
+        <property name="buildNumber" value="0"/>
+        <property name="enlistmentId" value="e1388c4c-18ab-432b-a8e0-f9f5d8193eac"/>
+    </bean>
+</beans>

+ 39 - 0
queries/lists/importXML.js

@@ -0,0 +1,39 @@
+let shared = require("DCIS/dcisFcns");
+var console = require("console");
+var LABKEY = require("labkey");
+var analysis = require("analysisModule/analysisFcns");
+
+//how routines implemented from java look in javascript:
+//https://docs.nativescript.org/runtimes/android/marshalling/java-to-js
+function init(event, errors) {
+   console.log("init() called in orgs.js with an event type of " + event);
+   console.log("Function in shared TriggerFcns.js script returns :" +  analysis.sampleFunc('echo'));
+}
+
+function complete(event, errors) {
+    console.log("complete() called in orgs.js with an event type of " + event);
+}
+
+function beforeInsert(row, errors){
+   console.log("beforeInsert() called in orgs.js with a row object of  " + row);
+   row.status=2;
+}
+
+function beforeUpdate(row, oldRow, errors){
+   console.log("beforeUpdate() called in orgs.js with a row object of  " + row + "  and an oldRow of " + oldRow);
+}
+
+function beforeDelete(row, errors){
+    console.log("beforeDelete() called in orgs.js with a row object of  " + row);
+}
+function afterInsert(row, errors){
+    console.log("afterInsert() called in orgs.js with a row object of  " + row);
+   shared.startImport(LABKEY,analysis,console,row);
+}
+
+function afterUpdate(row, oldRow, errors){
+    console.log("afterUpdate() called in orgs.js with a row object of  " + row + "  and an oldRow of " + oldRow);
+}
+function afterDelete(row, errors){
+    console.log("afterDelete() called in orgs.js with a row object of  " + row);
+}

+ 188 - 0
scripts/DCIS/dcisFcns.js

@@ -0,0 +1,188 @@
+function startImport(LABKEY,analysis,console,row){
+   console.log('startInsert');
+   let jobRow=new Object();
+
+//get the script by name
+   let selectRows=new Object();
+   selectRows.containerPath='Analysis/Run';
+   selectRows.schemaName='lists';
+   selectRows.queryName='scripts';
+   selectRows.filterArray=[LABKEY.Filter.create('name','importXML.py')];
+   let data=LABKEY.Query.selectRows(selectRows);
+   console.log('Scripts['+data.rows.length+']: '+data.rows[0].Key);
+   jobRow.script=data.rows[0].Key;
+
+//get the parameterFile by name
+   let sr1=new Object();
+   sr1.containerPath='Analysis/Run';
+   sr1.schemaName='lists';
+   sr1.queryName='parameterFiles';
+   sr1.filterArray=[LABKEY.Filter.create('parameterFile','importXML.json')];
+   let dataP=LABKEY.Query.selectRows(sr1);
+   console.log('Parameter file['+dataP.rows.length+']: '+dataP.rows[0].Key);
+   jobRow.parameterFile=dataP.rows[0].Key;
+
+   jobRow.runType='python';
+   jobRow.server='vangogh.fmf.uni-lj.si';
+   //jobRow.cpuList=undefined;
+   jobRow.parameterOverload="importXML.json:key="+row.Key+";importXML.json:seqNumOffset="+row.seqNumOffset;
+   analysis.startRun(LABKEY,console,jobRow);
+
+}
+
+exports.startImport=startImport;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+