Skip to content

Instantly share code, notes, and snippets.

View PiotrZakrzewski's full-sized avatar

Piotr Zakrzewski PiotrZakrzewski

View GitHub Profile
import numpy as np
import pandas as pd
matrix = np.zeros((10,10))
def bla(m):
print(m.dot())
bla(matrix))
#!/usr/bin/env python
import argparse
from numpy.random import random, choice, randint
from numpy import zeros, copyto
import matplotlib.pyplot as plt
plt.ion()
def main():
args = arguments()
@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)
@PiotrZakrzewski
PiotrZakrzewski / install_docker.sh
Created May 30, 2017 12:58
Install docker-engine Ubuntu 16.04
sudo apt-get update
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
apt-cache policy docker-engine
sudo apt-get install -y docker-engine