Import data from xlsx to senaite 2

Hello everyone,

I really need to import data from xlsx in senaite 2. I know that the introduction of setup data by that sheet is obsolete. But I have to use it.
I also know that the best practice is to divide the sheets in logical sections as it is recommended here: https://www.bikalims.org/manual/setup-and-configuration/import-bika-setup-data/import-bika-and-senaite-open-source-lims-setup-data
So, I do the same. I have a problem in the module 3, 6 and 7. I think that it’s in the Preservations sheet in the module 3 because I get this error:
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 156, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 338, in publish_module
Module ZPublisher.WSGIPublisher, line 256, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 62, in call_object
Module senaite.core.exportimport.dataimport, line 108, in call
Module senaite.core.exportimport.load_setup_data, line 119, in call
Module senaite.core.exportimport.setupdata, line 111, in call
Module senaite.core.exportimport.setupdata, line 1142, in Import
KeyError: ‘RetentionPeriod’

I see that the exportimport is here: https://github.com/Lunga001/bika.lims/tree/BC-Instruments/bika/lims/exportimport
But the problem is that how to edit it?
I have already read theses documentations:
How to customize SENAITE for researching laboratory?
http://plone-documentation.s3-website-us-east-1.amazonaws.com/latest/en/develop/addons/helloworld/extend/addon.html

So, I’ve created my own add-on. But I’m stuck at how to edit the code in senaite.core like adding fields, debugging, edit the exportimport to make it work… There is no more explanation and examples. Someone can help me?

The xlsx importer for setup data still works or at least the setupdata I use for my test environments.

The code you shared is from the user “Lunga001” and it is 3 years old and also, it is a fork from the user “rockfruit”!

Better to stick to the official repos to be suer that you are running tested and maintained code; and create you addon for them.

Thanks @elirabalison and @Espurna for discussing this. I’m using the official setupdata for my dev testing whilst integrating with a MRS. I can see already on my running instance(Senaite 1.3.4) that Analysis Profiles specified on the AT Template's sheet are not actually associated with the AT Template on this instance I’ve loaded the data on. This is somewhat an unexpected a behaviour I would think, implying a potential bug could be causing this.

For example, I’d expect Borehole 12 Hardness template to specify the Total Hardness profile according to the setupdata.

1 Like