Obtaining information contained within TSV export of data model via JSON and XML

Outline

I have started working on a script that will take a data-schema download from our Specify 7 and split it up into the relevant tables that we use so that these tables can be added to the documentation. I noticed that there are three formats that the data is available in:

My conundrum is that these formats seem to have different data exposed, and I am interested in some of the fields that are only contained in the TSV. Text1 in Collection Object is used as the example

JSON

{
name: "text1",
column: "Text1",
indexed: false,
unique: false,
required: false,
type: "text",
length: 65535
}

XML

<field column="Text1" name="text1" type="text" length="65535" 
updatable="true" required="false" unique="false" indexed="false" 
partialDate="false"/>

TSV

Table Label Is System Is Hidden Table ID Name Label_1 Description Is Hidden_2 Read-only Is Required Relationship Type Length Database Column Related Model Other side name Dependent
CollectionObject Collection Object No No 1 text1 Other number User definable. No No No No text 65535 Text1

As outlined above, both the JSON and XML can be accessed through a url, but the TSV seems to be generated by a function instead.

<Button.Info
    className="print:hidden"
       onClick={(): void =>
         void downloadFile(
            `${schemaText.schemaExportFileName()} - v${
              getSystemInfo().schema_version
            }.tsv`,
              schemaToTsv()
            ).catch(softFail)
          }
        >
    {schemaText.downloadAsTsv()}
</Button.Info>

Question

Is there a way for us to expand the information that is included in the JSON or the XML datamodel? This way, all the information contained within the tsv format could be fetched for all collections with one run, instead of 11 (switch collection, hit button to download, rinse and repeat)

1 Like

What about using a SQL DB to JSON exporter?
You would connect the tool directly to the Specify SQL DB and then export table definitions, or data, or whatever in JSON form… Some SQL tools have this built in, some do not.

A great idea! I will give this a method a go!