Importing reports from xml files

LabKey Support Forum (Inactive)
Importing reports from xml files gkericks  2017-02-28 08:25
Status: Closed
 
Hi there,

I have been using the study import/reload functionality in Labkey extensively. I am integrating with an external system and I have been doing that by writing data out in the Labkey xml format and importing it as a study. I would like to do the same thing for reports (in particular R reports) so that when I import a study the reports are there already. Is there any way to do this? I know there is an xml specification for reports but I don't know how to connect them to a study.

Any tips or thoughts on this would be much appreciated. Thanks!
 
 
Jon (LabKey DevOps) responded:  2017-03-07 01:39
Hi,

Yes, you can actually import reports into your study similarly to how you were writing out data from your external system and putting them into your study zip file.

If you download our ImportableDemoStudy folder zip file here:

https://www.labkey.org/home/Documentation/wiki-page.view?name=setupDemoStudy

And then extract the contents of the zip file, you'll see a reports folder.

Within that reports folder you'll notice a few things:

1. A folder for the thumbnail image of your report as a graph if it is a graphical report.
2. The code for the report (in your case, you would have your code written in R and saved as a .R file)
3. The XML that corresponds with the R code to provide its metadata.

Basically, you'd just create the same thing within your own study import zip file you've been working with and build your reports that way. It automatically knows to connect to the correct study based on the schemaName and queryName values that you would provide that would already be within the same study used.

Regards,

Jon
 
gkericks responded:  2017-03-13 10:55
Thanks Jon that has guided me part of the way,

A related puzzle I'm trying to solve is where to find the xsd file that describes the folder.xml file found in the example study you shared. I need to produce a folder.xml file to load both the study and the reports. I have been using https://www.labkey.org/download/schema-docs/xml-schemas/ to get the xml schema files that describe how the various xml files I need for study serialization should look. The problem is that looking through the schema-docs that Labkey has online I cannot find one that describes the folder.xml object (folderType.xsd is the closest but that should be a member object of the folder object). Furthermore, the "http://labkey.org/folder/xml" namespace referenced in the folder.xml file does not appear to exist in the docs. Am I mis-interpreting what I am observing somehow? Can you please point me in the right direction?

Thanks
 
Steve responded:  2017-03-13 12:38
Hi,

You were right -- the folder.xsd was not being included in the docs.
This has now been corrected.
Docs are available here:

https://www.labkey.org/download/schema-docs/xml-schemas/schemas/folder_xsd/schema-summary.html

Thanks for catching this,
Steve
 
gkericks responded:  2017-03-27 14:52
Thanks,

I have made a lot of progress with this, but I have one more related question. I have been using the Data Pipeline functionality to actually load what I write into labkey. To automate this, I have been firing off a get request to a url of the following form:

<https://mydomain/labkey/study/STUDY-NAME/checkForReload.view?ui=1>

This works well for updating the dataset, but I have noticed that if I include a new report to an existing project it will not be imported. Is there a FOLDER specific url format I should be hitting? I also noticed that there are Study reload and Folder import Data Pipeline events. Is there a way to automate "Folder reloads"? Not sure if that exists or not.

Thanks again
 
Jon (LabKey DevOps) responded:  2017-03-28 11:47
Hello,

Coincidentally, another person asked the same question and there was a way to workaround this.

Please take a look at the following forum post. I think this might work for you as well.

https://www.labkey.org/home/Support/Developer%20Forum/announcements-thread.view?rowId=11385

Regards,

Jon
 
gkericks responded:  2017-04-05 10:15
Thanks Jon, I am working through the best way to use that solution and might have some follow-up questions in the future.

Steve, is it possible that the "http://labkey.org/list/xml" namespace is missing from the docs as well, or have those schemas been removed in a recent version? Thanks.
 
Jon (LabKey DevOps) responded:  2017-04-05 10:25
Hi,

Lists work off of the same data namespace, so http://labkey.org/data/xml would be the correct one to use.

https://www.labkey.org/download/schema-docs/xml-schemas/namespaces/http_labkey_org_data_xml/namespace-summary.html#

Regards,

Jon
 
gkericks responded:  2017-04-05 10:30
Hi Jon,

Yes, the http://labkey.org/data/xml namespace can describe the lists.xml files generated by exporting lists. However, there is also a "settings.xml" file generated by the export that references a "http://labkey.org/list/xml" namespace. I am using Labkey version 16.2.

Thanks
 
Jon (LabKey DevOps) responded:  2017-04-05 11:35
Hi,

Thanks for clarifying.

I did look into the code and found the lists.xsd, so there is a namespace for http://labkey.org/list/xml. However, it looks limited with only 17 attributes and a little old (last update was on April 12, 2013.)

Per the description:

"Describes the list settings, list-specific properties beyond those included in tableInfo.xsd. Used to generate and read settings.xml in list archives."

Full XML available here: https://hedgehog.fhcrc.org/tor/stedi/trunk/server/modules/list/schemas/lists.xsd (read-only username/password: cpas/cpas)

I'm not certain whether this was intentional or not, but I'll let our docs team run with this one.

Regards,

Jon