---
title: "AssayManagement"
canonical: "https://servicedesk.maxgeo.com/space/DataShed4/1270546433/AssayManagement"
format: markdown
---
![image-20240516-015514.png](media://e3cc4600-a377-4246-986f-95dfe86a2eca)


# Importing	

![image](media://c95ced82-3ed4-492f-97fc-197503fc6a6b)


To import a lab assay result file into the normalised assay system in DataShed an import layout must be created. This will allow the header information to be appended the Batch and Batch Details tables and create a normalised data structure for the assay results. .

DataShed supports SIF (space delimited, fixed width text file) and CSV laboratory files. The Import Layout allows all data to be captured including the lab meta data and all associated analytical information. The lab metadata from the header is stored in the **Assay Batch **and **Assay Batch Details **tables and the results are normalised and imported into the **Incoming Assay Data **table prior to being validated.

**Required Data:**

***AssayResult*****:	the results reported**

***Batch_No*****:	the lab reference number**

***LabElement*****:	the analytical element code used by the lab**

***OrigMethod*****:	the analytical method used by the lab**

***Sample ID*****:	the sample number**

***UnitCode*****:	the unit each element is reported in**

*Recommended Data*

*Lab_Job_Date:	the date the lab processed the assays (NB this is required for QAQCr batch selection) Lab_Received_Date:	 the date the lab received the assays*

*LimitLower:	the lower detection limit of the analytical method SourceFile:	 the file name*

*LimitUpper:	the upper detection limit of the analytical method*

Additional Data

Dispatch_No:	the reference dispatch number

Preparation:	the preparation used for analysis SampleCount:	the number of samples from the lab file


![image-20240516-015643.png](media://c8d0a74e-c949-468f-8269-d03cb4b0d702)

## Creating SIF Import Layout

**Step One:**

**Create New Layout**

In the System Administration Form Click on the Import Layouts Tab and click on the **NEW **button.

![image](media://a4e04b0e-ab80-4315-8423-0478370b47bc)

Create a new Layout with a logical name, i.e. Lab_SIF, in the Import Layouts tab. It is advisable to generate a new Layout and Import Mask for each laboratory.

![image](media://8f410add-95b3-42fc-8710-3751b877c4f2)

Once a new Layout is visible in the Import Layouts box, highlight the Layout and click **Modify**.

**Step Two:**

**File Type/Mask Setup**

- Setting up the File Type and Mask allows the import layout to be configured to files with different layouts. Each Layout is linked to a lab code.
- Select the **Import Type/Mask **format from the drop down list. If the File type is not listed, click the

**Add New Assay File Type**

![image](media://9d3dfbd8-a4c9-4a12-972d-38bca9a053fa)

<span style="color: #231f1f">Select the Import Type/Mask format from the drop down list. If the File type is not listed, click the </span><span style="color: #231f1f">**Add New Assay File Type **</span><span style="color: #231f1f">and enter the new file type and a description. The description is viewed in the drop down list. For a SIF import file, select the basic_type as MASK. The details_row is the row number where the actual results start.</span>

<span style="color: #0e6ba5">**Note:**</span>

<span style="color: #0e6ba5">**The details_row may be left blank and DataShed will populate this field when the file format is captured.**</span>

![image](media://b7e9851b-c6a1-4f9a-9f18-247a07807610)

<span style="color: #231f1f">Click the </span><span style="color: #231f1f">**Modify **</span><span style="color: #231f1f">button and the Assay File Format Editor will appear.</span>

**Step Three:**

**Assay File Format Editor**

The form shown below will be visible, click on the browse button to locate the assay file to base the import layout on.

- <span style="color: #231f1f">The file type being modified is highlighted in the Scheme Name.</span>
- <span style="color: #231f1f">Browse to a sample file in the Sample File Name box and open.</span>

![image](media://22d8ce54-8db5-4c55-9f40-cf92dd0cdad5)

In the Layout Definition, go to the **Data Item **drop down list. As each selection is made the appropriate data on the SIF file should be swiped and **Saved**.

#### <span style="color: #0f7ec1">NOTE</span>

<span style="color: #0f7ec1">**Only the first column of results and element metadata needs to be swiped as subsequent elements are automatically read.**</span>

- <span style="color: #231f1f">Select Read from file as the </span><span style="color: #231f1f">**Data Source**</span><span style="color: #231f1f">.</span>
- <span style="color: #231f1f">If a Data Item is not required select Not Used from the Data Source drop down list.</span>

**Assay Result**

![image](media://924d23c8-499c-4124-967e-5975f7019642)

**Batch Number**

![image](media://7927101b-ec87-4098-936b-b0411a5570af)

**Dispatch Number**

**Lab Job Date.**

If only one date is present in a file, select the data item Lab Job Date. This allows QAQCR program to select the batch. If this field is null, QAQCR will not be able to select the batch number. The date format is selected from the drop down list. If the date format is different, a new date format may be added.

![image-20240516-015957.png](media://3ec18878-b457-4a6b-a70b-b22e9b1bb5bf)

 If the date format is different, a new date format may be added. Click on the browse button circled in image above.

Select **Add**

![image](media://c46d4bfe-91f5-45c6-a9db-00b7580751bc)

![image](media://57b6883f-0f26-44a8-991f-99ec9b961e9b)

Add the format and click **OK**. The format created will be available to select from the dropdown list.

**Lab Element**

![image](media://02fcce2a-ef8d-4b8e-96db-3ab086f6a3c7)

**Limit Lower**

![image](media://5c13ab54-307b-4c20-9782-abbb1ee96227)

**Orig Method (Lab Method)**

![image](media://cc1c4f02-fa79-4a65-8d51-02c7c649ef38)

**Sample Id**

Make this field as wide as possible to allow for longer sample ids either in this file or in subsequent files.

![image](media://e8e46b02-dba7-4d7c-acd3-92e9257cea6d)

**Unit Code**

![image](media://a66c7ae9-7f71-49d8-a119-7438f6fa8eec)

#### <span style="color: #0f7ec1">NOTE</span>

<span style="color: #0f7ec1">**In a SIF file the Length should be consistent. In the example above, LabElement, Unit, LabMethod, AssayResult and LowerLimit should all have a length of 8.**</span>

<span style="color: #231f1f">**Substitution**</span>

- <span style="color: #231f1f">Substitution allows for the translation of a non-numeric code into a numeric code. For example X, or< or – which represents below detection values will be treated as below detection limit (BDL) on import.</span>
- <span style="color: #231f1f">Substitution values can be added using the </span><span style="color: #231f1f">**Substitution **</span><span style="color: #231f1f">button which will open the table tblSYSImportSubst.</span>
- <span style="color: #231f1f">There must be one entry for each Scheme Name.</span>
- <span style="color: #231f1f">Symbols used by each lab for substitution can be entered and given a substitution value or sysAssayStatus if required.</span>
- <span style="color: #231f1f">Make sure that when a substitution symbol is entered, it is followed by the * symbol, especially if ‘-‘is used. If a lab uses the ‘–‘symbol for a null value, then DataShed will interpret this as a less than detection limit and not a null value.</span>

![image](media://29d553c0-6a49-4993-9cac-fff33ff0f5d7)


<span style="color: #0e6ba5">**BDL**</span>**: **Below Detection. The sysresult will be calculated as 0.5*LLD or -1*LLD. This setting is configured in **System Administration > Assay Management > Special Value Options > Below Detection Treatment.**

<span style="color: #0e6ba5">**OR**</span>**: **Over Range. When a result is analysed at the upper range of the analytical method, the Upper detection limit is required to be reported by the laboratory.

<span style="color: #0e6ba5">**UP**</span>: Update – A substitution value is needed in the Subst_Value

<span style="color: #0e6ba5">**DEL**</span>**: **Delete – Delete the assay result from the incoming assay data.

#### <span style="color: #0e6ba5">NOTE:</span>

<span style="color: #0f7ec1">**At least one substitution value must be entered for each Import Layout. In a flat system DataShed will update the sysResult to the substitution value.**</span>

**Step 4**

<span style="color: #231f1f">**Buffer Modifications **</span><span style="color: #231f1f">tab. It is important to select a base table name for all assay Import Layouts. It is required to be a normalised assay table either tblAssay or tblSYSAssIncomingData.</span>

![image](media://4e59a587-fc4f-4446-9311-d907f57dad43)

**Step 5 **<span style="color: #231f1f">**Advanced **</span><span style="color: #231f1f">tab.</span>

<span style="color: #231f1f">Tick the Normalised box if the data is to be imported into a database with a normalised assay management system.</span>

![image](media://33cbba2d-e613-46b8-aef4-6c9636e06a1a)


- <span style="color: #231f1f">The Process Scheme is configured through the Assay Management Setup</span>
- <span style="color: #231f1f">(Import Post Processing Schemes) and is most typically set as Default.</span>
- <span style="color: #231f1f">Select the Laboratory supplying the results from the Laboratory drop down list.</span>

#### <span style="color: #0e6ba5">NOTE:</span>

<span style="color: #0e6ba5">**If an assay file is from a new lab, the lab must be added to the Lab library prior to the import layout being created. It is possible to copy a laboratory name and all the associated codes in the Lab Element and the Lab Method libraries.**</span>

![image-20240516-020249.png](media://a3fd0f33-b654-4780-a7e3-0f02d2de3ea5)

<span style="color: #0e6ba5">**Enter the name of the new lab in the Lab Code and a relevant description.**</span>

![image](media://a90465a5-0ad3-4826-8af4-9efb983fa705)

<span style="color: #231f1f">Click on </span><span style="color: #231f1f">**Check Config **</span><span style="color: #231f1f">tab and check the configuration of the new layout. This will check that all the required information is populated in the layout but it </span><span style="color: #231f1f">**will not **</span><span style="color: #231f1f">check the file format against the import layout.</span>

## Creating CSV Import Layout

A CSV file assay import layout differs from a SIF file as the position of the comma indicates the position of the data item and DataShed will read the data string until the next comma is reached. The setup of the CSV file import layout is similar to the SIF file but the capture of the **Data Item **in the **Assay File Format Editor **is different.

Create a new Layout with a logical name, i.e. Lab_CSV, in the Import Layouts tab. It is required to create a new layout for each lab as the Lab code is linked to the layout.

![image](media://f2c3aae5-1479-4f1e-be77-1dcd6b98a7df)

<span style="color: #231f1f">**Import File Type: **</span>Select the Import Mask format from the drop down list. If the File type is not listed, click the Add New Assay File Type and enter the new file type and a description. The description is viewed in the drop down list. For a CSV import file, enter CSV as the basic_type.

![image](media://c99d9d01-969e-4ae7-a02e-02eca25f1bf5)

<span style="color: #231f1f">**Assay File Format Editor**</span>

- Click the **Modify **button and the Assay File Format Editor will appear.
- The file type being modified is highlighted in the Scheme Name.
- Browse to the sample file and open.
- In the Layout Definition go to the Data Item drop down list and select a Data Item. Capture the item by placing the cursor to the left of the position of the data and clicking Save.

#### <span style="color: #0e6ba5">NOTE:</span>

<span style="color: #0e6ba5">**For any headers that are part of a string (i.e. space delimited) treat as a SIF file the Save button. For each, comma delimited field, click the mouse cursor at the start of each comma delimited section and click the Save button**</span>

<span style="color: #231f1f">**Substitutions**</span><span style="color: #231f1f">, </span><span style="color: #231f1f">**Buffer Modifications **</span><span style="color: #231f1f">and </span><span style="color: #231f1f">**Advanced **</span><span style="color: #231f1f">settings are configured the same way as in a SIF file import layout.</span>

# Import Assay Data

When the import layout is completed, the file may be imported in DataShed using the Import Data or the Import Data (multifile) tools.

![image](media://fd3d78c6-1a4d-4ed8-876f-f15e7a43decc)

<span style="color: #231f1f">The assays are loaded into an incoming buffer tables with the same format as assay batch, assay batch details and assay incoming data.</span>

## Import Multi File – SIF or CSV Lab files

1. <span style="color: #231f1f">Select Tools > Import Data (Multifile) or click the icon on the toolbar.</span>
2. <span style="color: #231f1f">From the File Lists box choose the </span><span style="color: #231f1f">**New **</span><span style="color: #231f1f">button to enter a new file list or select an existing one from the drop down list.</span>

![image](media://67b24c1a-36a4-41b3-a214-0dadd9be5b47)

1. <span style="color: #231f1f">In the </span><span style="color: #231f1f">**Default Values **</span><span style="color: #231f1f">box, enter the appropriate details. Make sure that the Layout is correct.</span>
2. <span style="color: #231f1f">Choose the destination folder for the original files to be moved to on import It is a good idea to have a folder for original files and a ‘Loaded’ folder, where the files are moved to upon completion of import</span>
3. <span style="color: #231f1f">Click the </span><span style="color: #231f1f">**Add File **</span><span style="color: #231f1f">button and select the files for import.</span>

![image](media://909991df-d663-4cfb-a476-557db5b3a168)

#### <span style="color: #0e6ba5">NOTES:</span>

<span style="color: #0e6ba5">**Use the single file import initially to check that the Import Layout is functioning as expected prior to using the multi file option.**</span>

<span style="color: #0e6ba5">**DataSet for SIF and Assay CSV imports is irrelevant as files from multiple DataSets can be loaded at the same time.**</span>

# Merging

When DataShed runs the assay import via the single file import or the multi-file import options the following steps are carried out.

1. The assays are loaded into an incoming buffer table so that checks can be made to ensure the integrity of the data. DataShed checks the lab method, element, unit and lab libraries to ensure that the data conforms to these libraries. The Generic Method is updated from the Original Lab Method and the Element and Repeat fields are populated from the Lab Element library.
2. The incoming sample ids are matched with the sample ids in each of the assay tables.
3. DataShed calculates the sysResult from the Assay Result. Any text fields are converted to the corresponding substitution value and the text equivalent is entered into the sysAssayStatus field.
4. DataShed automatically merges the records that have been successfully checked. To view the unsuccessful records go to the **Advanced Assay Tools **and any unmerged data is listed. Once the unmerged data has been sorted out, click the **Retry Merge **button. DataShed manually checks and merges the data.

#### <span style="color: #0e6ba5">NOTE:</span>

<span style="color: #0e6ba5">**After every import, open the appropriate tables and DataSet in DataShed and view the imported records to confirm they are correct**</span>


![image-20240516-020609.png](media://2526806c-e398-4fc8-a708-3a41115355a9)


## Viewing Unmerged Data 

<span style="color: #231f1f">After importing assays, DataShed retains any assays that have not merged into the main assay tables in the Incoming Assays table.</span>

<span style="color: #231f1f">To view the unmerged assay data go </span><span style="color: #231f1f">**to Tools>Advanced Assay Tools>Unmerged Assay Results **</span><span style="color: #231f1f">or click the shortcut icon. By clicking on the Data to View radio buttons, unmerged assays are listed by the various categories of: Missing library entries, No matching samples or Other as shown in the diagram above.</span>

<span style="color: #231f1f">To establish the reason for the data not merging, go through the process that DataShed follows in checking and validating each record.</span>

<span style="color: #231f1f">Each of the steps, with the associated error message if they fail, is described in detail below:</span>

## Missing Library Entries

<span style="color: #231f1f">If there are records in the missing library entries, the exception type is set to Missing Library Entry. The library tables are accessed from the </span><span style="color: #231f1f">**Assay Library **</span><span style="color: #231f1f">tab.</span>

![image](media://79171f63-8b32-46de-8a94-436a9e84aa64)

<span style="color: #0e6ba5">**Element Groups:	**</span>Names of the element groups

<span style="color: #0e6ba5">**Elements:	**</span>Names of the elements and their associated groups

<span style="color: #0e6ba5">**Method Priorities:	**</span>Ranking of generic methods for assay processing

<span style="color: #0e6ba5">**Generic Methods:	**</span>Translation of laboratory methods into standard methods

<span style="color: #0e6ba5">**Lab Methods Alias:	**</span>Analytical methods used by the laboratory

<span style="color: #0e6ba5">**Labs:	**</span>Analytical laboratory

<span style="color: #0e6ba5">**Lab Element Alias**</span>*:	*Element name used by the laboratory

<span style="color: #0e6ba5">**Units:	**</span>A list of the units of measurement

<span style="color: #0e6ba5">**Conversion Factors:	**</span>A list of conversions between measurement units

<span style="color: #231f1f">The Comment field gets populated with a list of the codes that are missing from the library tables.</span>

![image](media://03d7d43e-0c84-442c-bbbe-8e4870265fe2)

- <span style="color: #231f1f">Is there a Laboratory with the Code of the Incoming Assays?</span>
- <span style="color: #231f1f">Is there a method for that LabCode in the library that matches the “OrigMethod” of the assay?</span>
- <span style="color: #231f1f">Is there a LabElement for that LabCode that matches the LabElement of the assay?</span>

![image](media://69cf6f5c-6419-46af-a904-3f38c74b9433)

<span style="color: #231f1f">The Comments field will contain information about what library values are missing:</span>

- <span style="color: #231f1f">Missing Lab Element Alias; Unknown: The lab element does not have an element and repeat specified in the Lab Element Alias library</span>
- <span style="color: #231f1f">Original Lab Method; Missing Method Alias: the Lab method does not have a Generic method specified in the Lab Method Alias library.</span>

![image](media://33b59117-12ed-4d18-815e-d889e667a361)

<span style="color: #231f1f">Any missing library entries listed in the Unmerged Assay Results can be added via the Assay Libraries tab. To Add a Lab Element:</span>

- <span style="color: #231f1f">Click on the Lab Element Alias</span>
- <span style="color: #231f1f">Enter the Lab Code, this must be a lab that is in the Labs library</span>
- <span style="color: #231f1f">Enter the Lab Element code from the lab file</span>
- <span style="color: #231f1f">Assign an element and a repeat code. The Element must be a code in the Element Assay library.</span>

![image](media://3a9b2711-4ee5-46ae-9a3b-63978b97fa5f)

## No Matching Samples

DataShed references the sample register to match the assay results with a sample id in the database. This is commonly tblSampleRegister and is a table that is managed by triggers in the SQL database. A sample id must be present in this table before the assay result will be merged from the Incoming Assay table into the normalised assay table.

<span style="color: #231f1f">If there are records in the no matching samples, the exception type is updated to No Matching Samples. If the same sample Id has been used in different DataSets exception type is set to More Than One Sample Match.</span>

To manage the SampleIDs that are available to DataShed a DataSet must be “current” or “active”. This is managed in the **Active DataSets **tab. All DataSets on the right of this form have sample ids that are available to have assay merged.

![image](media://189d5ac3-08bd-41d0-8c71-7ddad3db7723)

## Other

<span style="color: #231f1f">If there are records listed, it often indicates that samples have a null result or a text result such as NL or SNR, which is not listed in the substitution table. There is no error message, but the sysResult field remains NULL.</span>

**Substitutions**

- <span style="color: #231f1f">If the assay result is 0 or NULL, then DataShed is unable to do a calculation on this record. If the Assay Result is NULL, then these records can be deleted. If the Assay Result is 0, check if it means that the sample was not assayed or whether it is below detection limits.</span>
- <span style="color: #231f1f">BDL substitutions ensure that the lower limit is populated and that the substitution for the import layout has been populated correctly. The sysAssayStatus will be populated with BDL if the substitutions table has been populated correctly. For example, a “<” before the results indicates that it is Below Detection Level for that method and “BDL” is inserted in the sysAssayStatus field.</span>
- <span style="color: #231f1f">OR substitution must have the upper limit populated so that the sysresult can be calculated.</span>

<span style="color: #231f1f">**Units:**</span>

<span style="color: #231f1f">The unit the result recorded in must be in the Units library</span>

![image](media://29a95652-0379-4d00-ad8c-3bc90dce0556)

<span style="color: #231f1f">There must be a conversion from the unit code reported to the preferred unit specified in the Elements library.</span>

![image](media://7faed793-c857-4084-9983-a5f00a17e11c)

Find out what the preferred unit for the element is from the Elements library. This information is stored in the elements library.

![image](media://78ad1476-45f1-4d1c-9081-347513875447)

Add the conversion from the unit the result was reported by that laboratory to the preferred unit in the elements table. In the example above, the conversion from Kg to g is added.

![image](media://fdc047f5-ae9a-4951-b886-6c1d4cfd09e5)

# Ranking

**Assess data to determine what fields need to be ranking and what method of populating the field is appropriate.**


1. **Go to Database Structures> RHNorm> Attributes and add selection criteria for fields.**
2. **Open SQL Management Studio and add new fields to tblAssayFlat. Save table.**
3. **Edit assay views and add the new assay fields. Save Views.**
4. **Relink DataShed.**
5. **Run ranking Engine for relevant samples.**

DataShed has a process by which the normalised assay values are pivoted so that they are in a “flat” table structure. This enables the assay results to be viewed in a format that related to a geological context with sample metadata associated with a sample result i.e. HoleI_ID, Depth_From and Depth_To.

This process takes the results from the normalised assay table and uses criteria specified by the user to populate the flat assay table, tblAssayFlat. The flat assay table can then be joined to the various sample tables in views to relate the assay result information with the sample metadata i.e. DHAssays (tblVWDHAssay).

Normalised assay table:

![image](media://5b64476b-ca8e-4850-8d3b-bfb563b42b41)

Flat Assay Table

![image](media://551b860e-7c3b-4348-8763-760db855325c)

DH Assay View

![image](media://adad9ad9-c93c-43f1-a1b7-aa4871b93871)

DataShed takes information to complete this process from the **System Administration>Database Structures**

form:

![image](media://25d1f25f-4f68-402e-9508-d5497b082d07)

There are 3 structure types:

**Assay**: Configures the normalised assay table (tblAssay)

**LHNorm**: Configures the sample metadata tables (tblDHSamp, tblDHSampQC etc) and links this to the assay table.

**RHNorm**: Links the flat assay table (tblAssayFlat) to the normalised assay table These structures are all preconfigured as part of the Maxwell Data Model.

## Database Structured - Assay Structure

1. Click **Add **Select type = ASSAY
2. **Type in a suitable name. It is Maxwell’s nomenclature to start all structures with AM (Assay**

Management) followed by the abbreviated structure type and table name. (AM_ASS_Assay)

1. Select the new entry in the list box and click **Modify**.
2. Select the name of the normalised Assay Results table in the pull down (tblAssay).
3. Select the name of the Sample Register in the pull down (tblSampleRegister).
4. Once the assay structure is completed and closed, it cannot be edited.

![image](media://26f018d0-9129-465b-8c3d-60366711489c)


## Database Structure – LH Structure


The LH table is the Sample details table where the identifying features of the sample are stored. For example, tblDHSamp, is the table where the hole id, metres from and to for each sample number are stored. The LH Structure is how the LH table is joined to the table containing the normalised data. There will be multiple LH structures configured, one structure for each table containing sample data.

1. Create a LH normalisation structure by selecting LH Norm and assign a logical name such as LH DH Sample.
2. Select the **Linked table **tab
3. Select the table which will be the LH table i.e. tblDHSample
4. Select the RH object i.e. tblAssay
5. Select the linking fields, usually DataSet and SampleID. This defines the relationship between the LH and RH tables.

![image](media://b6bbfd40-738e-4b77-b4fc-cdf8468c68ac)

## Database Structure – RH Structure

The Configuration of the RH structure controls how the flat assay table is populated.

1. Create a RH normalisation structure by selecting RH Norm and assign a logical name such as RH Assay. There should be one RH structure for every normalised assay table. .
2. <span style="color: #231f1f">Select the new structure and click </span><span style="color: #231f1f">**Modify**</span><span style="color: #231f1f">.</span>
3. <span style="color: #231f1f">In the </span><span style="color: #231f1f">**Main **</span><span style="color: #231f1f">tab, select the base name of the table which is the RH table i.e. tblAssay</span>
4. <span style="color: #231f1f">Set the static table options to SYS if the database is a SQL database</span>

![image](media://cbd9da29-676a-44ba-b4df-265f64b897b5)

## RH Attributes

The **Attributes **tab configures how the assay results are to be ranked. There are 3 ways to rank the assay values

- **Preferred Value Calculations**: Populates a field in the flat assay table based the generic methods priority for the element group the result’s element has been assigned to. This means the field defined will always be populated if there is a result for this element. This field **MUST **be added to the table tblAssayFlat in SQL Management Studio.
- **Static**: Populates a field in the flat assay table based on criteria defined in the database. This may is not always populated in the flat assay table. This field **MUST **be added to the table tblAssayFlat in SQL Management Studio.
- **Dynamic**: Can create a virtual field based on criteria specified, if the attribute is selected. Will attach the virtual field to the select LH sample table. In DataShed.

**Preferred Value Calculation Attributes**

The Assay Ranking Engine uses a generic method order for each element group to automatically rank and average assay results. The priorities of various methods are assigned on an element group. Every element group should have different methods assigned with different priorities.

<span style="color: #0e6ba5">**DataShed requires a field with the same field name as the name defined in the attribute to be present in the Flat Assay table (tblAssayFlat). This must be added in SQL Management Studio.**</span>

1. Enter the Attribute Name. This name must match exactly the name of the associated column name in the flat assay table in SQL.
2. Select the Preferred Value Calculation from the pull down list in the Mode column. Select sysResult in the Field Name column and Single for the Field Type column from the pull down lists. Enter the required Field Length. This relates to the number of decimal points of the sysResult. Up to five decimal points can be viewed.

In the bottom half of the form, select Element from the Definition Type pull down list. Select the Element being defined from the pull down list. Either type or select from the dropdown list the element

![image](media://153d954d-f4b0-449a-9b2d-5ba73526d7ef)

1. If the unit to view the result in is different to the sysresult then apply a conversion factor from the system units for that element. Select Conversion from the pull down list in the DefinitionType column and select or type in the conversion factor in Param1.
2. The name (highlighted in red) must be added to tblAssayFlat in SQL Management Studio.

**Static Attributes**

A Static Attribute presents the original data cached into the assigned left hand table. The criteria defined should identify one result to populate the field.

<span style="color: #0e6ba5">**DataShed requires a field with the same field name as the name defined in the attribute to be present in the Flat Assay table (tblAssayFlat). This must be added in SQL.**</span>

1. Enter the Attribute Name. This name must match exactly the name of the associated static table column in tblAssayFlat.
2. Select the Static option from the pull down list in the Mode column. Select sysResult in the Field Name column and Single for the Field Type column from the pull down lists. Enter the required Field Length. This relates to the number of decimal points of the sysResult. Up to five decimal points can be viewed.
3. In the bottom half of the form, select Field from the Definition Type pull down list. Select the Element being defined from the pull down list in the Param 1 column and enter the element in the Param 2 column. If you want to convert the standard units for that element, select Conversion from the pull down list. Select or type in the conversion factor in Param1.
4. The name (highlighted in red) must be added to tblAssayFlat in SQL Management Studio.

![image](media://98120efb-ca17-43f9-81ce-33a8111758af)

#### <span style="color: #0e6ba5">NOTE:</span>

<span style="color: #0e6ba5">**DataShed must be relinked before ranking so that the new table structure can be imported into DataShed. The message below will be returned if the Configuration is checked before the Relink process.**</span>

![image](media://7a230a5d-ff61-4baf-a14d-a591c674926e)

**Dynamic Attributes**

Dynamic attributes defined in the same way as a static attribute and can be viewed by attaching a virtual field option to the LH table. This is generally used for less commonly used elements or methods.

Assign a logical name, generally element_Method_units in the Attribute definition <span style="color: #231f1f">The top part of the form is filled in with the following:</span>

- <span style="color: #231f1f">Mode is Dynamic</span>
- <span style="color: #231f1f">Field name is sysResult</span>
- <span style="color: #231f1f">Field type is Single</span>
- <span style="color: #231f1f">Field length is 3</span>

To define the criteria for populating this dynamic view the bottom part of the form must be assigned. The user assigns the number of criteria. There must be enough criteria to describe a unique population of results. Generally, the criteria used are element, method (either original or generic), unit code and repeat.

![image](media://ddb4a650-7a1c-4421-8d6e-7ed46b3b8648)

Once the field has been defined, close the RH Attribute tab and **Modify **a LHNorm structure.

![image-20240516-021237.png](media://7bd71c8b-2076-439d-8f2d-ea424b302ac3)


1. Move the field to the right hand side.
2. Close the System Administration form.

## Viewing Dynamic Attributes

Highlight the LH table to attach the field to. In this example it is DH Sample. Right click to open menu and select **Change Optional Field**.

![image](media://96f32c83-b598-4b0c-b95a-bc396adf0dba)


Highlight the field to attach to the LH table and move to the Right hand side. Click **Apply**.

![image](media://1af44863-b9ae-483e-8a10-be990da8a8ff)


Open the DH Sample table and the virtual field will be visible on the far right hand side of the table.

![image](media://f76cf4fd-dab0-41b1-aa52-ecb2672a56f7)

## Ranking Customisation


Ranking Engine Options are setup in the Assay Management tab of DataShed under Advanced Config.

<span style="color: #0e6ba5">**Tag New Imported Samples for Ranking Engine**</span><span style="color: #0e6ba5">: </span>If this option is selected, the SampleID of samples which have been merged into the normalised assay table will be appended to a list so that the next time the ranking engine is run they will be ranked.

<span style="color: #0e6ba5">**Run Ranking Engine After Import**</span>: The Assay Ranking Engine runs automatically any time assay data is merged either during the import of a file or using the Retry Merge option.

The ranking process can utilise a stored procedure from the SQL database which improves performance. The standard MDS uses the stored procedure usp_DataAssayRankingProcess. If this box is unticked or there is no name in the box, DataShed will revert to the ranking process in the application.

![image](media://8811147e-9f87-4eaa-ab04-3220b5429245)

## Ranking Engine


The Ranking Engine may also be manually run in the Advanced Assay Tools.

Select the Table to process then choose one of the following options to select the SampleIDs to rank:

- Table to Process selected only. The SampleIDs that have been merged but not ranked previously will be ranked. The list of SampleIDs is found in the table tblSYSNormProcessStack.
- **Re-rank currently selected DataSets**. Sample to rank are all the sample ids in the DataSets currently selected in DataSet Manager.
- **Re-rank currently filtered Sample Register**. A DataShed filter is applied to the Sample register table and this is the list of sample ids to rank.

![image](media://79813daf-9b14-43cb-a3f4-07035cb581d9)

## Troubleshooting

**No Ranked Results**

There are a number of reasons why you may not get a ranked result when you expected one. Check the following:

- Are there assay results for that sample in the normalised Assay table?
- The Generic Method and Element Group combination for all results for that sample have a priority defined.

<span style="color: #0e6ba5">**Note: Adding a new Generic Method**</span>

<span style="color: #0e6ba5">**In the assay libraries click on the Generic Method box**</span>

![image](media://6df2f6cf-0467-4db0-91f8-345525b3b6f3)

- <span style="color: #0e6ba5">**Add the Generic Method and description.**</span>
- <span style="color: #0e6ba5">**Click on the Method Priorities box**</span>
- <span style="color: #0e6ba5">**Add the Generic Method in the relevant Element Group lists and assign a priority. This will ensure that if a preferred value calculation has been selected in the attribute, the result will be ranked.**</span>

![image](media://a0e0239d-16d8-4fbf-b3f3-4cbcbc77ba04)

DataSet and Sample ID combination does not appear in the processing stack – check that the assay import configuration entries have not been disabled.

![image-20240516-021433.png](media://7b22d5c9-f153-4adc-899c-a4dc7d091828)

- Then tick the Re-rank currently selected DataSets.
- Has an “attribute” been defined for the assay table?
- Is the preferred value calculation set to ‘0’?

**Error Messages**

**Error Adding Records to Flat Table:**

There is a sample Id in the list of samples to be ranked that does not exist in the normalised assay table.

![image](media://d6971b03-d91f-4119-a15e-0d98d620c150)

**Solution:**

The sample Ids will need to be deleted from the table, tblSYSNormProcessStack before the results can be ranked.

**Error processing table tblAssay**:

There is a field defined in the Database structure for the RHNorm structure that does not have a field in the SQL table tblAssayFlat.

**Solution:**

Add field to SQL table tblAssayFlat and relink DataShed before running ranking engine.

# Assay Management Configuration

## Import Post-Processing Schemes

<span style="color: #231f1f">An Import Post-Processing Scheme is a logical listing of tables that the incoming assays will be merged to. The Default Post Processing scheme is configured in the standard MDS</span>

<span style="color: #231f1f">Additional Import Post Processing schemes may need to be configured if multiple normalised assay tables are utilised.</span>

![image](media://21402b94-ce7b-472c-b2d6-65c48f625f9c)

## Advanced Config

The **Advanced Config **tab contains setting for the configuration of Importing and ranking functionality.

![image](media://9781711e-76e1-480e-9e6d-4a24caff50ac)

**Ranking Engine Options**

<span style="color: #0f7ec1">**T**</span><span style="color: #0e6ba5">**ag New Imported Samples for Ranking Engine**</span><span style="color: #231f1f">: DataShed will tag assays for ranking and each record will be added to the process stack. (tblSYSnormProcessStack)</span>

<span style="color: #0e6ba5">**Run Ranking Engine After Import**</span><span style="color: #231f1f">: When this is ticked, DataShed will automatically run the flattening and ranking process, after each assay file load. However, if large amounts of historic assays are loaded it is best to disable it and manually run the ranking process. Always check that all the samples have been merged.</span>

<span style="color: #0e6ba5">**Use Related Samples (duplicates) in Ranking Engine**</span><span style="color: #231f1f">: the ranking engine will use original samples and duplicate samples when calculating a ranked result. For example, field duplicates may need to be averaged with the original sample. The sample register must contain an OrigSampleID column for this option to be available and all related samples must be in the same DataSet. This setting will only be applied if the DataShed ranking engine is used.</span>

<span style="color: #0e6ba5">**Highest Repeat No to Use in Ranking**</span><span style="color: #231f1f">: Choose the number of repeats to average from the pull down list. The default is set to ‘0’. This setting will only be applied if the DataShed ranking engine is used.</span>

<span style="color: #231f1f">**Multi-File Import Option**</span>

<span style="color: #0e6ba5">**Run Append/Merge on Import**</span>

<span style="color: #231f1f">If this option is selected, the import process with include merging the results into the normalised assay table if all the validation criteria is fulfilled. If this option is not selected it allows the samples to be held in the incoming buffer until you are ready to merge them into the normalised assay table.</span>

<span style="color: #0e6ba5">**Post Import Action**</span>

<span style="color: #231f1f">This feature allows the system administrator to assign actions to run after imports.</span>

<span style="color: #231f1f">**Special Values Options **</span>

<span style="color: #0e6ba5">**Below Detection **</span><span style="color: #0f7ec1">**T**</span><span style="color: #0e6ba5">**reatment:**</span>

<span style="color: #231f1f">The detection limit can be set to either –1 times the lower detection limit or to half the lower detection limit.</span>

<span style="color: #0e6ba5">**WARNING: Do not change the handling of the BDL results unless you are prepared to update and re-rank the entire data- base.**</span>

<span style="color: #0e6ba5">**Max. No. Optional Fields**</span>

<span style="color: #231f1f">There is no limit to the number of dynamic fields that can be set up in DataShed; however databases have a recommended restriction on optional fields. For an Access database the number is fifteen and for a SQL database the number is twenty- five. The Database Administrator needs to take into account the database type, the speed of the server and the network when choosing the number of optional fields. The default value is set to zero.</span>

<span style="color: #231f1f">**Assay Stored Procedures**</span>

These options are configured to run the standard Maxwell Assay management stored procedures which are standard to the MDS. If it is required to use different stored procedures to Merge, Rank or process the lab QC data, then name of the stored procedure can be entered.

![image](media://e50f7e11-b018-41cf-9921-f9544f1461f3)

## Check Config

<span style="color: #0e6ba5">**Check Config**</span>

<span style="color: #231f1f">Select the ‘Check Config’ button to check the configuration of the assay table that has just been configured.</span>

<span style="color: #0e6ba5">**Check Config for all**</span>

<span style="color: #231f1f">Select the ‘Check Config for all’ button to check the configuration of all the left and right hand tables used in the normalisation process.</span>

<span style="color: #0e6ba5">**Save to file**</span>

<span style="color: #231f1f">Select the Save to File button to save the description and error messages. Choose the directory to store the DataShed Diagnostic file (*.dsd) and press the Open button. This will save the file and it can now be viewed as a text file.</span>

# Lab Checks and Standards

It is recommended that the labs report the checks and standards that they use for quality control and include the results in the results file. Most labs have a prefix or suffix which identifies lab standards and lab repeats

<span style="color: #231f1f">The stored procedures will process standards and lab QC samples by creating a unique SampleID if necessary and populating the appropriate sample tables with SampleIDs.</span>

<span style="color: #231f1f">The procedure references a library table, tblSYSIncomingDataMasks, which must be configured to suit the client, with the Labcodes, QC_Categories and StandardIDs that are relevant to the client.</span>


![image-20240516-021803.png](media://9191e1b1-d611-4012-a05c-7ec92f051f59)

**The Process has 3 steps:**

**Setting up Incoming Data Masks:**

This process identifies which records are lab QC results, and configures how the samples are to be processed.

**Updating libraries: Standards Reference and QC Category**

Adds the relevant records to the library tables so that the samples can be inserted into the standard sample table or the sample QC table

**Running the SP Data Driver**

Runs the process to update the sample ids in the incoming assay table and populate the relevant sample tables with the sample ID

## Setting up the Incoming Data Masks

<span style="color: #231f1f">The table tblSYSIncomingDataMasks is populated with the identifiers for the various QC data supplied by the lab. This information is generally supplied at the end of the lab file. The following notes detail how to populate this table.</span>

![image](media://beee18cb-7f3f-4344-8fdf-fcb83abcd1e1)

<span style="color: #231f1f">The % is the wild card for this stored procedure.</span>

<span style="color: #0e6ba5">**Identifier: **</span><span style="color: #231f1f">This uses wildcards to isolate the key identifier which will indicate that the sample is a lab dup or standard</span>.

<span style="color: #0e6ba5">**Lab Code: **</span><span style="color: #231f1f">The code of the lab as stated in the database library table tblSYSAssLab.</span>

<span style="color: #0e6ba5">**QC Category: **</span><span style="color: #231f1f">The QC_Category of the lab check as stated in the table tblLIBQCCategory. Do not populate for “identifiers” that relate to standards. Is Standard: Flag if it is a standard (0 = no, -1 = yes). If this is false then the stored procedure will assume that it is a QC sample.</span>

<span style="color: #0e6ba5">**StandardID: **</span><span style="color: #231f1f">Populate with the Standard ID for “identifiers” that related to standards. Leave blank for “identifiers” that are QCsamples. Not essential to populate.</span>

<span style="color: #0e6ba5">**Append batch no**</span><span style="color: #231f1f">: Flag (0 = no, -1 = yes) to append the Batch_No to the SampleID. If the standards in the lab file don’t have the Batch_No attached, then set flag to yes. This will prevent duplication of standard SampleIDs, which must be avoided. Only relates to standards, and must be set to no (0) for QC Samples.</span>

<span style="color: #0e6ba5">**Add Lab to BLANK**</span><span style="color: #231f1f">: Flag (0 = no, -1 = yes) to append the lab code to the StandardID where the StandardID = Blank. This enables the analysis (in QAQCR) of the Blanks from different labs on separate charts, rather than grouping all of the blanks from all labs together. This flag will add a new record to tblSYSQCReference where necessary (e.g., Blank_ALS_VAN, or Blank_SGS_VAN). Relates only to standard “BLANK”</span>

<span style="color: #0e6ba5">**STD nonUnique**</span><span style="color: #231f1f">: Flag (0 = no (SampleID is unique), -1 = yes (SampleID is not unique). If the standard SampleIDs in the lab file are not unique, then this flag generates a unique sample Id by adding the SourceRowNumber to the SampleID. This flag is typically set to no (0) for standard SampleIDs such as “ST01: ST02:” It is generally necessary to set this flag to yes (-1) for standard SampleIDs such as “ST:” without a unique number, or where SampleIDs = StandardID and do not have any prefix (such as “Blank”, “Sarm7B”), and are repeated in the laboratory file. Relates only to standard identifiers.</span>

## Setting up the Libraries


<span style="color: #0e6ba5">**Repeats. **</span><span style="color: #231f1f">The QC Category is linked to the library LIB QC Category (tblSYSQCCategory). Any code entered into the Incoming Data Masks table QC_Category must first be entered to QC Category.</span>

![image](media://9bd2f7a4-a5bb-47d4-986e-6d854afcb86f)

<span style="color: #0e6ba5">**Standards**</span><span style="color: #231f1f">: All Standard Ids need to be added to the library Standard reference (tblSYSQCStandardReference)</span>

![image](media://4eeccd7e-1c64-4690-a1a0-4978f4b8323e)

## The Stored Procedure

To run the stored procedure, go to the Unmerged Assay results and click **Run SP Data Driver**

![image-20240516-022033.png](media://e47ba22a-5609-4d99-ba76-988d1b2977f3)

#### <span style="color: #0e6ba5">NOTES</span>

<span style="color: #0f7ec1">**The sample tables will only be populated if some of the batch file is already appended into tblAssay. This is the only way that a DataSet can be located for the standards.**</span>

<span style="color: #0f7ec1">**Ensure that the StandardIDs are populated in the tblSYSQCReference.**</span>

<span style="color: #0f7ec1">**For the QC Samples ensure that the tblSYSQCCategory table is populated. In the SQL database there are 3 stored procedures:**</span>

- <span style="color: #0f7ec1">**usp_ProcessInComingDataDriver,**</span>
- <span style="color: #0f7ec1">**usp_ProcessLabChecksInComing and**</span>
- <span style="color: #0f7ec1">**usp_ProcessStandardsInComingData**</span>

<span style="color: #0f7ec1">**To run the process, usp_ProcessInComingDataDriver needs to be executed. This SP will run the other 2 SPs and process the data.**</span>

88