Skip to content

Instantly share code, notes, and snippets.

View PiotrZakrzewski's full-sized avatar

Piotr Zakrzewski PiotrZakrzewski

View GitHub Profile
@PiotrZakrzewski
PiotrZakrzewski / psql.sh
Last active October 26, 2015 15:07
Connect to Transmart postgres DB
psql -U tm_cz -h localhost transmart
sudo -u postgres psql transmart
@PiotrZakrzewski
PiotrZakrzewski / vect_comphr.py
Created October 30, 2015 10:15
Vector comprehension in python numpy
numpy.fromiter((<some_func>(x) for x in <something>),<dtype>,<size of something>)
import numpy as np
import pandas as pd
matrix = np.zeros((10,10))
def bla(m):
print(m.dot())
bla(matrix))
@PiotrZakrzewski
PiotrZakrzewski / SOAPClientSAAJ.java
Created April 13, 2016 13:27
PoC of OpenClinica SOAP service use. Will print out proper XML input for listing studies available on the server and subsequently query OC3.6 and print out XML response .
import javax.xml.namespace.QName;
import javax.xml.soap.*;
public class SOAPClientSAAJ {
public static void main(String args[]) throws Exception {
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
String url = "http://ocdu-openclinica-dev.thehyve.net/OpenClinica-ws/ws/study/v1";
StringWriter sw = new StringWriter();
Transformer t = TransformerFactory.newInstance().newTransformer();
t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
t.transform(new DOMSource(faultNode), new StreamResult(sw));
String content = sw.toString();
System.out.println("Fault children: " + content);
import networkx as nx
players = [1,2,3,4]
def optimal_claim(_game_map, _player):
"""find single tile increasing total synergy bonus"""
x_positions, y_positions = np.where(_game_map == 0)
positions = zip(x_positions, y_positions)
hiscore = None
best = None
for x, y in positions:
@PiotrZakrzewski
PiotrZakrzewski / getMetadataRequest.xml
Created April 28, 2016 15:12
Request to OpenClinica 3.6 to get study metadata
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:beans="http://openclinica.org/ws/beans" xmlns:v1="http://openclinica.org/ws/study/v1">
<SOAP-ENV:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
SOAP-ENV:mustUnderstand="1">
<wsse:UsernameToken
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="UsernameToken-27777511">
<wsse:Username>piotr</wsse:Username>
<wsse:Password
@PiotrZakrzewski
PiotrZakrzewski / getMetadataResponse.xml
Created April 28, 2016 15:14
Response to getMetadata request to OC 3.6
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<createResponse xmlns="http://openclinica.org/ws/study/v1">
<result xmlns="http://openclinica.org/ws/study/v1">Fail</result>
<error xmlns="http://openclinica.org/ws/study/v1">No study identifier was provided</error>
</createResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

#Patient Registration

  • presence of required fields. Taken from Study parameters.
  • Study exists in OC,
  • Site exist in the study
  • uniqueness of Study Subject ID (SSID) within file
  • width of SSID max 30 characters
  • gender is either "m" or "f"
  • uniqueness of PersonID in the Study
  • date format of Date of Enrollment
  • Width of Secondary ID max 30 characters
#!/bin/python
import click
from os import walk, makedirs
from os.path import join
from shutil import copy
@click.command()
@click.option('--source', help="""Path to the grails 2 project""", type=file)
@click.option('--destination',
help="""Path to the bootstrapped grails 3 project""", type=file)