RegisterMTDPart - CMSROMA/MTDDB GitHub Wiki
If you receive a new package from a manufacturer, you must record in the DB the parts inside the package.
In the following, [this]
represents some text that you should know how to identify. See the corresponding links to get further help. If [this]
contains blanks, it must be written in single quotes: e.g., 'Test Batch'
.
N.B.: for safety reasons, we did not include the mandatory -w
among the switch. -w
causes the data to be automatically loaded into the production DB. Omitting -w
creates a local XML file, but does not send it to the dbloader.
For general help, see below.
-
Preliminary operations
- Know your location (
[location]
) - Identify the producer (
[producer]
) - Identify the batch number (
[batch]
) - Get the part type (
[type]
)
- Know your location (
-
The parcel contains one part
- Attach the barcode on the part (
[barcode]
) python3 registerMTDPart.py -b [batch] -x [barcode] -p [producer] -t '[type]' -l [location]
-
EXAMPLE
python3 registerMTDPart.py -b TestBatch -x 1024 -p 3 -t 'LYSOMatrix #2' -l Roma
- Attach the barcode on the part (
-
The parcel contains more than one parts from the same producer, from the same batch, and of the same type. We assume that they will get consecutive barcode numbers.
- Count the parts (
[nparts]
) - Attach the barcodes to all the parts (
[first barcode]
) python3 registerMTDPart.py -b [batch] -x [barcode] -p [producer] -t '[type]' -l [location] -n [nparts]
-
EXAMPLE
python3 registerMTDPart.py -b TestBatch -x 1024 -p 3 -t 'LYSOMatrix #2' -l Roma -n 10
- Count the parts (
-
The parcel contains more than one parts, from possibly different producers, and/or types, from the same batch.
-
Prepare a CSV file containing the data of the parts to be registered (
[csv filename]
) python3 registerMTDPart.py -b [batch] -f [csv filename] -l [location]
-
EXAMPLE
python3 registerMTDPart.py -b TestBatch -f myLastCSVFile.csv -l Roma
-
Prepare a CSV file containing the data of the parts to be registered (
-
The parcel contains parts from different batches.
- Sort the parts per batch
- For each batch apply one of the above recipes
A more complex use case consists in registering parts with a custom prefix and attributes. An example of this is the following
python3 registerMTDPart.py -b 'TestBatch' -x 2000000 -p 3 -t 'singleCrystal #1' -l VirtualLab -D -P FK -n 5 -a '[{"NAME": "Ingot Region", "VALUE": "Top"}]' -o 'aComplexExample.xml'
This create a aComplexExample.xml
file with the XML needed to register 5 parts, made by producer 3, in location VirtualLab
. Parts are of type singleCrystal #1
and belong to batch TestBatch
. Their barcode is something like FK0000200000X where X is either 0, 1, 2, 3 or 4. FK is the prefix (-P
) and the base barcode number is 2000000 (-x
). X is automatically assigned. -D
switch on the debug mode. To each part we assign a single attribute whose name is 'Ingot Region' and whose value is 'Top'.
registerMTDPart.py
has several switch. Using it without options just prints a help message, as well as if you use the -h
switch.
By default, registerMTDPart.py
does not register parts into the DB, unless the -w
switch is used. You can add -D
to make it verbose. Other useful switches are:
-s
: add a serial number to the part (can only be used if registering a single part)
-o
: by default the output XML file name is registerMTDPart.xml
. You can override it using -o [xml filename]
, if you want to keep it for future references
-u
: force the username of the operator to be the one provided after the switch (e.g. -u organtin
). The username is taken from your operating system, by default
-d
: provides additional data to the part (e.g. -d batch3020-no-doping
)
-c
: provides some comment from the operator (e.g. -c 'a few scratches on the surface'
)
-i
: use the test database instead of the production one (use this switch to perform your tests)