Tuesday, July 3, 2018

What is a CRI file?

There appears to be some confusion about the PCS import/export file format.

When you export a match a sub-directory is created in the target directory containing a file with the name formatted as home v away + date.CRI

Many people have asked if they can use this file in the same way as the TCS export for putting data on their own websites. The answer is yes, but it requires a little more work.

The first thing to understand is that the format of a CRI file is XML.
There have been suggestions that one day there will be a CRI to XML translator - this of course is daft, it is not required, at least in the basic sense.

Anyone who has tried to open one will find that it is unreadable via a text editor or browser. This is because the file is compressed using a mechanism called gzip, short for GNU zip - an open source technology.

There are many utilities available to decompress gzipped files, for example,  WinZip, 8 Zip and a command line version from gzip.org.

Having decompressed the file and added an XML file extension you will be able to open it in a text editor eg notepad or a browser. Note that each XML element doesn't have a nice line feed or indentation so you may want to use an XML editor. The little utility which comes with Windows 10 called Code Writer is good for this.

What you will see is something like this:





All data entities in PCS Pro have an identifier known as a GUID ( globally unique identifier) which is simply a stonkingly big number. It uses 128 bits of storage and is almost guaranteed to be globally unique if not universally unique.

The use of GUIDs as identifiers of database records is considered to be very bad practice. For each record you are carrying an overhead of 128 bits rather than  the more usual 16 or 32 bits, however it is unlikely that your PCS database is going to get very large even over several years of scoring and the GUID does have the advantage of being portable - you can import a match into an existing database without, for example, any reasonable fear of there being any duplicate players.

In a subsequent post I will explain what you can do with the XML data.

2 comments:

  1. May be worth mentioning that changing the filetype from .cri to .gz will allow WinZip to recognise it as a gzip archive

    ReplyDelete
  2. Richard thank you. I guess that I am the daft person, sorry but I am not in IT and when you search for what is a .cri file type, the one item that looks to be possible is Crystal Reports which is owned by SAP. Therefore, I did not know that the file type is a compression type or a variant of .zip.

    ReplyDelete