Assumptions
The incoming message contains the following:
Container type (plate / tube type)
Container well position (if sample is on a plate) eg G:2
Sample user-defined fields (UDFs) / custom fields
Main Logic
Does the project exist?
if NO: create it
Does the container exist?
if NO: create it
Create sample
Create a Sample:
POST to https://your_server/api/v2/samples:
<?xml version="1.0" encoding="UTF-8"?>
<smp:samplecreation xmlns:smp="http://genologics.com/ri/sample" xmlns:udf="http://genologics.com/ri/userdefined">
<name>20140909-1</name>
<project uri="https://your_server/api/v2/projects/ROS210"></project>
<location>
<container uri="https://your_server/api/v2/containers/27-195"></container>
<value>1:1</value>
</location>
<udf:field name="Reference Genome">Cane Toad</udf:field>
</smp:samplecreation>
We receive something like the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smp:sample uri="https://your_server/api/v2/samples/ROS210A14" limsid="ROS210A14">
<name>20140909-1</name>
<date-received>2014-09-10</date-received>
<project limsid="ROS210" uri="https://your_server/api/v2/projects/ROS210" />
<submitter uri="https://your_server/api/v2/researchers/1">
<first-name>System</first-name>
<last-name>Administrator</last-name>
</submitter>
<artifact limsid="ROS210A14PA1" uri="https://your_server/api/v2/artifacts/ROS210A14PA1?state=4262" />
<udf:field type="String" name="Reference Genome">Cane Toad</udf:field>
</smp:sample>
Create a Project:
POST to https://your_server/api/v2/projects
<?xml version="1.0" encoding="UTF-8"?>
<prj:project xmlns:udf="http://genologics.com/ri/userdefined" xmlns:ri="http://genologics.com/ri" xmlns:file="http://genologics.com/ri/file" xmlns:prj="http://genologics.com/ri/project">
<name>Week 39</name>
<open-date>2014-09-10</open-date>
<researcher uri="https://your_server/api/v2/researchers/1"/>
</prj:project>
We receive something like the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<prj:project uri="https://your_server/api/v2/projects/ADM372" limsid="ADM372">
<name>Week 39</name>
<open-date>2014-09-10</open-date>
<researcher uri="https://your_server/api/v2/researchers/1" />
</prj:project>
Create a Container (tube):
POST to https://your_server/api/v2/containers:
<?xml version="1.0" encoding="UTF-8"?>
<con:container xmlns:con="http://genologics.com/ri/container">
<name>Example Container 20140910</name>
<type uri="https://your_server/api/v2/containertypes/2" name="Tube"/>
</con:container>
We receive something like the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<con:container uri="https://your_server/api/v2/containers/27-1869" limsid="27-1869">
<name>Example Container 20140910</name>
<type uri="https://your_server/api/v2/containertypes/2" name="Tube" />
<occupied-wells>0</occupied-wells>
<state>Empty</state>
</con:container>
Create a Container (96 well plate):
POST to https://your_server/api/v2/containers:
<?xml version="1.0" encoding="UTF-8"?>
<con:container xmlns:con="http://genologics.com/ri/container">
<name>Example Plate 20140910</name>
<type uri="https://your_server/api/v2/containertypes/1" name="96 well plate"/>
</con:container>
We receive something like the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<con:container uri="https://your_server/api/v2/containers/27-1870" limsid="27-1870">
<name>Example Plate 20140910</name>
<type uri="https://your_server/api/v2/containertypes/1" name="96 well plate" />
<occupied-wells>0</occupied-wells>
<state>Empty</state>
</con:container>
Create a Sample in the 96 Well Plate Rreated, and the Project Created:
POST to https://your_server/api/v2/samples:
<?xml version="1.0" encoding="UTF-8"?>
<smp:samplecreation xmlns:smp="http://genologics.com/ri/sample" xmlns:udf="http://genologics.com/ri/userdefined">
<name>20140909-1</name>
<project uri="https://your_server/api/v2/projects/ADM372"></project>
<location>
<container uri="https://your_server/api/v2/containers/27-1870"></container>
<value>G:2</value>
</location>
<udf:field name="Reference Genome">Cane Toad</udf:field>
</smp:samplecreation>
We receive something like the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smp:sample uri="https://your_server/api/v2/samples/ADM372A2" limsid="ADM372A2">
<name>20140909-1</name>
<date-received>2014-09-10</date-received>
<project limsid="ADM372" uri="https://your_server/api/v2/projects/ADM372" />
<submitter uri="https://your_server/api/v2/researchers/1">
<first-name>System</first-name>
<last-name>Administrator</last-name>
</submitter>
<artifact limsid="ADM372A2PA1" uri="https://your_server/api/v2/artifacts/ADM372A2PA1?state=4264" />
<udf:field type="String" name="Reference Genome">Cane Toad</udf:field>
</smp:sample>
Confirm the Project Exists
GET: https://your_server/api/v2/projects?name=Week%2039
If the project exists, we receive something like the following:
<prj:projects xmlns:prj="http://genologics.com/ri/project">
<project uri="https://your_server/api/v2/projects/ADM372" limsid="ADM372">
<name>Week 39</name>
</project>
</prj:projects>
If the project does not exist, we receive something like the following:
<prj:projects xmlns:prj="http://genologics.com/ri/project"/>
Confirm the Container Exists
GET: https://your_server/api/v2/containers?name=Example%20Container%2020140910
If the container exists, we receive something like the following:
<con:containers xmlns:con="http://genologics.com/ri/container">
<container uri="https://your_server/api/v2/containers/27-1869" limsid="27-1869">
<name>Example Container 20140910</name>
</container>
</con:containers>
If the container does not exist, we receive something like the following:
<con:containers xmlns:con="http://genologics.com/ri/container"/>
Last updated