Customised

Customise a LIXI2 Schema using the LIXI Python Package

Customise a LIXI2 Schema using the LIXI Python Package

Posted on: February 21, 2020


The LIXI2 standard is a very comprehensive standard, with over 700 elements and more than 3000 attribute. It covers many types of credit products, multiple types of borrowers, and numerous transactions that occur along the lending chain. A huge number of scenarios are covered by the standards. But, no single use case will ever require all the schema items.

Our customisation by restriction framework allows you to create a LIXI2 schema that is specifically tailored to your particular use case. The custom schema will only include the items you use, restrict the accepted data to your specific requirements, and generate custom HTML schema documentation.

Features of the Customisation by Restriction framework include:

  • Exclude unnecessary items from the schema
  • Restrict the data each attribute can accept
  • Control the number of repeating elements
  • Set custom value ranges for numeric attributes
  • Inject custom documentation into the schema
  • Generate customised HTML documentation

How to create your Customised Schema

1) Install the LIXI Python package

pip install lixi

2) Download the LIXI2 schema you intend to customise.

Links to download LIXI2 schemas can be found here: LIXI standards Release History.

3) Create a customisation instructions file

Details of the types of customisation instructions can be found in LIXILab in the project CustomisationByRestriction (available to logged in LIXI members).

Here is an example customisation instructions file:

<Customisations LIXICode="TRAINING"
               CustomisationCode="DEMO"
               CustomHeading="LIXI Blog 2020">
 
<!-- Example 1: Exclude from Schema -->
 
<CustomiseItem Exclude="Yes">
    <Path>Package.Content.Application.CompanyApplicant</Path> 
</CustomiseItem>
 
<!-- Example 2: Customised Documentation -->
 
<CustomiseItem>
    <Path>Package.Publisher</Path>
    <CustomDocumentation>LIXI Blog 2020</CustomDocumentation>
</CustomiseItem>
 
<!-- Example 3: Optional to Mandatory -->
 
<CustomiseItem OptionalToMandatory="Yes">
    <Path>Package.Publisher.CompanyName</Path>
    <CustomDocumentation>Mandatory Attribute.</CustomDocumentation>
</CustomiseItem>
 
<!-- Example 4: String to List -->
 
<CustomiseItem StringToList="Yes">
    <Path>Package.Publisher.CompanyName</Path>
    <Enumeration Definition="LIXI Limited">LIXI</Enumeration>
    <Enumeration Definition="CUA">CUA</Enumeration>
</CustomiseItem>
 
<!-- Example 5: String to Pattern -->
 
<CustomiseItem StringToPattern="Yes">
    <Path>Package.Content.Application.LoanDetails.ProductCode</Path>
    <CustomDocumentation>Must be a 6 digit number.</CustomDocumentation>
    <Pattern>\d{6}</Pattern>
</CustomiseItem>
 
<!-- Example 6: Min and Max Occurences -->
 
<CustomiseItem CustomMaxOccurs="Yes" CustomMinOccurs="Yes">
    <Path>Package.Content.Application.LoanDetails</Path>
    <CustomDocumentation>One loan per application.</CustomDocumentation>
    <CustomMaxOccurs>1</CustomMaxOccurs>
    <CustomMinOccurs>1</CustomMinOccurs>
</CustomiseItem>
 
<!-- Example 7: Include in the Schema -->
 
<CustomiseItem Include="Yes">
    <Path>absLendingPurposeCodeList</Path>
    <CustomDocumentation>Only accepting applications for:
 
- Travel and holidays
- Purchase of household and personal goods
    </CustomDocumentation>
    <Enumeration>ABS-241</Enumeration>
    <Enumeration>ABS-237</Enumeration>
</CustomiseItem>
 
<!-- Example 8: Custom Currency Range -->
 
<CustomiseItem CustomCurrencyRange="Yes">
    <Path>Package.Content.Application.LoanDetails.AmountRequested</Path>
    <CustomDocumentation>Loan amount must be from 1000 to 1 million dollars.</CustomDocumentation>
    <MinCurrency>1000.00</MinCurrency>
    <MaxCurrency>1000000.00</MaxCurrency>
</CustomiseItem>
 
<!-- Example 9: Custom Percentage Range -->
 
<CustomiseItem CustomPercentageRange="Yes">
    <Path>Package.Content.Application.LoanDetails.RateComposition.IntroductoryMargin</Path>
    <CustomDocumentation>Introductory margin must be from 0.5 to 1 percent.</CustomDocumentation>
    <MinPercentage>0.50</MinPercentage>
    <MaxPercentage>1.00</MaxPercentage>
</CustomiseItem>
   
</Customisations>

4) Perform the customisation.

Execute the following Python code (making sure to provide the correct path and filename to the schema you wish to customise).

import lixi
 
custom_schema = lixi.get_custom_schema(
    schema_path="LIXI-CAL-2_6_25-Annotated.xsd",
    instructions_path="instructions.xml",
    output_folder=".",
    output_name="custom_schema"
)
 
lixi.get_schema_documentation(
    schema_string=custom_schema,
    output_folder=".",
    output_name="custom_docs"
)

This code will execute the customisation on the LIXI CAL 2.26.25 annotated schema. The customised schema will be saved to the working directory with the name custom_schema.xsd and the customised documentation will output to the directory custom_docs. Custom documentation can be viewed locally in your browser by openeing the index.html file.


Related Blogs

Written by:
John Matthews, LIXI Technical Lead
First Published: February 21, 2020