XSD Designer and Dynamic Data - LabWare · XSD Design Considerations Key Fields – LIMS key fields...
Transcript of XSD Designer and Dynamic Data - LabWare · XSD Design Considerations Key Fields – LIMS key fields...
XSD Designer and Dynamic DataData
XSD Designer - Introduction
Provides LIMS the ability to define an XSD y(XML Schema Definition) file.
The XSD file is provided to an external system. The external system generates a XML data file conforming to the XSD definitiondefinition.
LIMS is able to import and process the XML data file to create or update LIMS data e to c eate o update Sobjects without additional coding.
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [22]]
XSD Designer - Topics
Working with XSD Designerg g XSD Design Considerations XML Data File Definition XML Data File Definition Importing Dynamic Data from XML Data
File
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [33]]
Working with XSD Designer – Table Manager
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [44]]
Working with XSD Designer – Table Explorer
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [55]]
Working with XSD Designer – Interface
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [66]]
Working with XSD Designer – Element Definition
Construct the XSD element definitions by yselecting the desired table and fields with the respective browser of XSD Configure DialogDialog.
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [77]]
Working with XSD Designer – Element Attributes
Optional – Designates the element as p goptional
Close Tag – Defines end of Table element. Key Field – Designates field as key.
Composite keys may be specified. Data Type – Determined from Table Master
field definition.
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [88]]
Working with XSD Designer – Structure Definition
Define the XSD structure with buttons on bottom right side.
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [99]]
Working with XSD Designer – Structure Definition Operations
Insert - Inserts a new element. Delete - Deletes selected element. Demote/Promote - Moves selected element Demote/Promote Moves selected element
one indentation to the left or right. Move Up/Down - Moves selected element p
one row up or down. Build Schema - Generates the XSD file. Close - Closes the interface.
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1010]]
XSD Design Considerations
Key Fields – LIMS key fields can not be y ydefined as the key of an XSD, e.g. sample_number of sample.
Common to create a user-defined field with key passed in from external system.O l t bl d fi ld d fi d ithi T bl Only tables and fields defined within Table Master are available for adding to XSD definition.de t o
Data types specified in XSD file are determined by Table Master definition.
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1111]]
XSD Designed File
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="CEC_SAMPLE_TEST"> <xs:complexType> <xs:sequence>
< l t "SAMPLE" t "SAMPLE" i O "1" O " b d d"/> <xs:element name="SAMPLE" type="SAMPLE" minOccurs="1" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="SAMPLE"> <xs:sequence> <xs:element name="TEMPLATE" type="SAMPLE_TEMPLATE.NAME" minOccurs='1' maxOccurs="1"/> <xs:element name="TEST" type="TEST" minOccurs="1" maxOccurs="unbounded"/>
</ s seq ence> </xs:sequence> </xs:complexType> <xs:complexType name="TEST"> <xs:sequence> <xs:element name="ANALYSIS" type="ANALYSIS.NAME" minOccurs='1' maxOccurs="1"/> <xs:element name="STATUS" minOccurs='1' maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string">
<xs:maxLength value="1"/> <xs:maxLength value="1"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> <xs:simpleType name="SAMPLE_TEMPLATE.NAME"> <xs:restriction base="xs:string">
<xs:maxLength value="20"/> <xs:maxLength value= 20 /> </xs:restriction> </xs:simpleType> <xs:simpleType name="ANALYSIS.NAME"> <xs:restriction base="xs:string"> <xs:maxLength value="20"/> </xs:restriction> </xs:simpleType>
</xs:schema>
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1212]]
</xs:schema>
XML Data Definition
XSD Definition record name required in XML as root element. During import, LIMS g p ,uses to record name to build the dynamic data.
XML data structure must match structure defined by XSD.E t l t i ibl f External system is responsible for populating XML data per XSD definition.
External system is responsible for External system is responsible for translating data to LIMS format, e.g. LIMS test names.
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1313]]
XML Data
<?xml version="1.0" encoding="UTF-8"?> <CEC SAMPLE TEST>CEC_SAMPLE_TEST <SAMPLE> <LABEL_ID>GV=9452-01-20-2012</LABEL_ID> <TEMPLATE>INCOMPLETE</TEMPLATE> <TEST> <ANALYSIS>CEC-A</ANALYSIS> <ANALYSIS>CEC-A</ANALYSIS> <STATUS>I</STATUS> </TEST> </SAMPLE> </CEC_SAMPLE_TEST>
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1414]]
Dynamic Data Import with XML Data
Dynamic data from XML is done in two ways: file or table based with LIMS Basic function, ImportXML.
status = ImportXML(xml)
xml is a string that contains the XML data to import. After import, all dynamic data is in context.
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1515]]
Dynamic Data Import with XML Data- File Based Example Code
External application places the XML message in a staging areaa staging area
xml = FileContents(fileName) status = ImportXML(xml) status ImportXML(xml)
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1616]]
Dynamic Data Import with XML Data- Table Based Example Code
External application places the XML message in a tablea table
qry = select XML_MESSAGE from X_EXTERNAL_MSGS where STATUS = ‘INSERTED’‘INSERTED’
status = SQL(qry,”xmlArr”) xml = xmlArr[1 1] xml = xmlArr[1,1] status = ImportXML(xml)
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1717]]
Dynamic Data Import with XML Data –Miscellaneous
Context – All objects created by the import operation are in context for further processingoperation are in context for further processing.
Templates – LIMS templates (Order, Sample, etc.) will be used to create LIMS objects when
ifi d ithi th XSD d XMLspecified within the XSD and XML. Statuses – Status field values specified in XML
data will update current status of LIMS object. p j
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1818]]
Dynamic Data Import with XML Data –Common Errors
Invalid XML – most common issue is malformed XMLXML.
Could not create object – the object specified within XML does not exist, e.g. Test: CEC_2013 i ifi d b t d t i t i LIMSis specified, but does not exist in LIMS
Missing key value for field: field was defined as key in XSD definition but XML does not contain ya value.
ODBC error: Syntax in WHERE Clause – no key field is specified in XSDkey field is specified in XSD
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [1919]]
XSD Demostration
Create a XSDExamine the XSD file Examine the XSD file
Import XML message Examine XML Examine LIMS Objects
Import XML message with additional test
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [2020]]
XSD Designer - Module Installation
Module 479 – XSD Designerg No pre-requisites Includes – Installation Database, Module, Includes Installation Database, Module,
NLS Module contains no access functions, ,
automation scripts or window menus. Recommend adding reference to module
Sas last entry in !BINDLAST.TXT
Results Count www.labware.com© LabWare 2012 [© LabWare 2012 [2121]]