Ir al contenido

Tutorial 1: Build export presets

Esta página aún no está disponible en tu idioma.

In this tutorial you build a tabular export preset that turns NAHPU mammal specimen records into a CSV file for the Specify WorkBench of the LSU Museum of Natural Science (LSUMZ) Mammalogy collection. The target is the collection's incoming-data sheet: one row per specimen, with each part written as a numbered preparation (PrepType1, PrepType1Count, PrepType1Location, PrepType2, …).

You start from an empty preset and add one kind of column at a time: plain fields, combined and blank columns, formatted values, and the specimen's parts. By the end you will have a preset named LSUMZ-mammalogy, a test export you have checked against your records, and a file the LSUMZ collection manager can map in the WorkBench.

You need:

  • A NAHPU project with a few complete mammal specimen records. Include at least one specimen with several parts, such as a skin, a skull, and a tissue with a freezer box position, so you can see how repeated values export.
  • The LSUMZ Mammalogy incoming-data sheet, or another collection's column list.
  • About 30 minutes.

Write down the columns before you open the editor. The WorkBench maps columns by name, so match the sheet's spelling exactly, including spaces and case.

ColumnNAHPU sourceHow it is built
Catalog Numberspecimen::museumIDSingle field
Class, Order, Family, Genus, Speciestaxonomy::taxonClass, taxonOrder, taxonFamily, genus, specificEpithetSingle fields
SexmammalAttribute::sexLabel instead of code
Continent—Blank column
Country, State, Countygeography::country, stateProvince, countySingle fields
Locality Namegeography::municipality + geography::localityList joined with ;
Elevationcoordinate::elevationInMeterSingle field
Elevation Unit—m when an elevation is recorded
Collector1LastNamepersonnel::nameRewritten as Last, First
Field Numberspecimen::fieldNumberSingle field
Start Datespecimen::collectionDateDate as dd/mm/yyyy
PrepType1, PrepType1Count, PrepType1Location, …specimenPart::type, count, storageLocationNumbered part columns
RemarksmammalAttribute::remarkSingle field
Latitude, Longitudecoordinate::decimalLatitude, decimalLongitudeSingle fields
MaxErrorDistancecoordinate::uncertaintyInMetersSingle field
OtherCollection OtherCollNumber—Blank column
Total Length, TailLength, HFLength, Ear, WeightmammalAttribute::totalLength, tailLength, hindFootLength, earLength, weightSingle fields

NAHPU has no continent or other-collection number, so those two columns are written blank for the collection to fill in. Keeping them means the file still matches the WorkBench sheet column for column.

  1. Open Settings > Tabular Data.
  2. Select the add button A, enter LSUMZ-mammalogy, and create it. Names may use letters, numbers, underscores, and dashes. On a phone, the new preset opens in the Edit Preset tab.
  3. Set Record type C to Specimen. Each specimen becomes one row.
  4. Set Specimen taxon group D to Mammals.
  5. Set Generated header format E to fieldName. You will name every column yourself, so this only matters for a column you forget to name.
  6. Type a description, for example LSUMZ Specify WorkBench sheet: one row per mammal specimen., and select Update B.

Settings save as you change them; only the name and description wait for Update. The columns themselves are set under Edit Fields F, and the eye button G previews the export. Both are used in the steps below.

Most columns copy one NAHPU field unchanged.

  1. Select Edit Fields. The Edit Preset Mappings screen lists source fields under Insert Source Field and your columns under Selected Mappings C. On a phone, these are the Available Fields and Selected Mappings tabs.
  2. Expand a group A and check B each field your plan marks as a single field: museumID under Specimen, the taxonomy fields under Taxonomy, the geography fields under Geography, the elevation, coordinates, and uncertainty under Coordinate, fieldNumber under Specimen, and remark and the measurements under Mammal Attribute.
  3. Select the pencil F on each mapping and type the sheet's header into Column name (optional), such as Catalog Number for museumID or HFLength for hindFootLength. Select Done to keep it.
  4. Drag each mapping by its handle G into the order of your plan. You can do this at the end, once every column exists.

The other controls in Selected Mappings come next: Add custom field D in steps 4 and 5, Add nested E in step 6, and Preview H in step 7.

Pick each field from the group that owns it. For example, startDate exists under both Project and Coll Event, and neither is the specimen's own collection date, which is collectionDate under Specimen.

Some columns are not a single field. Build them with custom fields, which use the mapping dialog shown here: Add field B, Add text C, and Add conditional text D build the value one segment at a time. The same dialog handles the parts in step 6.

Join the municipality and the specific locality with a semicolon, skipping whichever is empty.

  1. In Selected Mappings, select Add custom field. On a phone, it is the first icon beside the Selected Mappings heading.

  2. Set Mapping type A to List field.

  3. Open Advanced and paste this into Raw source expression:

    [geography::municipality]|[geography::locality]
  4. Set List output to One column and Separator to Semicolon (A; B).

  5. Enter Locality Name as the column name, then select Done.

A record exports as Passi Timur; Mt. Ambang, or Passi Timur alone when no specific locality was recorded. See Export expressions for more ways to join geography fields.

Write m only when the specimen has an elevation, so an empty elevation does not carry a stray unit.

  1. Add a custom field and select Add conditional text D.
  2. Set the condition to coordinate::elevationInMeter Is not empty.
  3. Enter m as Text when matched and leave Text otherwise (optional) empty.
  4. Check that Expression: E reads [[if][coordinate::elevationInMeter!=""]=>"m"]].
  5. Enter Elevation Unit as the Column name F, then select Done.
  1. Add a custom field and leave its value empty.
  2. Enter Continent as the Column name F and select Done. A named custom field with no segments is written as an empty column.
  3. Repeat for OtherCollection OtherCollNumber.

Three columns hold a NAHPU value in a different shape.

NAHPU stores sex as a code, such as 0 for male. Specify needs the word.

  1. Add a custom field, select Add field B, and choose mammalAttribute::sex.
  2. Select Show label on that segment. The expression becomes [mammalAttribute::sex#label].
  3. Enter Sex as the column name and select Done.

Use Show label the same way for any other coded field your collection imports, such as reproductiveStage. See Encoded field labels.

  1. Check collectionDate under Specimen and select its pencil.
  2. Set Value format to Date.
  3. Open Advanced and enter dd/mm/yyyy as the Raw format option.
  4. Enter Start Date as the column name and select Done.

A collection date of 17 February 2016 exports as 17/02/2016. Other options include yyyy-mm-dd, mm/dd/yyyy, and dd-month-yyyy.

NAHPU stores a person's full name, such as Heru Handika. The sheet wants the last name first: Handika, Heru.

  1. Check name under Personnel and select its pencil.
  2. Open Replace text G and select Add replacement.
  3. Set Match to Regex, Find to ^([^,]*[^\s,])\s+([^\s,]+)$, and Replace with to $2, $1.
  4. Enter Collector1LastName as the column name and select Done.

The rule moves the last word to the front. A name that already contains a comma is left as it is. Specify still matches the result against its agent list, so check unusual names, such as two-word family names, in the preview.

A specimen can have any number of parts. Write each part into its own group of columns, numbered from 1, so the WorkBench can map them to Preparation #1, #2, and so on.

  1. In Selected Mappings, select Add nested. On a phone, it is the second icon beside the Selected Mappings heading.
  2. Set Related records H to specimenPart.
  3. Open Choose child fields J and check type, count, and storageLocation, in that order. Checked fields appear under Selected child fields in column order.
  4. Set Nested output to Indexed columns.
  5. Under each child field, type its column name I with {n} where the part number goes:
    • type: PrepType{n}
    • count: PrepType{n}Count
    • storageLocation: PrepType{n}Location
  6. Check that the Output example shows PrepType1, PrepType1Count, PrepType1Location, PrepType2, …, then select Done.

A specimen with a skin, skull, and tissue now fills PrepType1 to PrepType3Location, with the tissue's freezer position, such as (127,B2), in its location column. The number of groups follows the specimen with the most parts in the export, and specimens with fewer parts leave the extra columns blank.

The parts form one block, so a column cannot sit between two preparation groups. Place Remarks before or after the block; the WorkBench maps by name, not position.

  1. Select Preview at the bottom of Selected Mappings, or the eye button beside Edit Fields on the preset.
  2. Select a few specimens, including the one with several parts.
  3. Check, column by column:
    • the headers match the sheet exactly;
    • Sex shows Male or Female, not a code;
    • Start Date reads dd/mm/yyyy and Collector1LastName reads Last, First;
    • the PrepType groups line up with the parts on the specimen record;
    • Continent and OtherCollection OtherCollNumber are empty.

Fix anything that looks wrong in Edit Fields, then preview again.

  1. Open the project menu and select Export records.
  2. Choose the LSUMZ-mammalogy preset and CSV as the format.
  3. Select Export records and open the file to confirm the row count.
  4. In Specify, open the WorkBench and import the CSV as a new data set.
  5. Create an upload plan with Collection Object as the base table, and map each column to its Specify field.
  6. Validate the data set, fix any reported cells, and upload.

Save the upload plan in Specify. Because the preset always writes the same headers in the same order, the next season's export maps with the same plan.

Back in Settings > Tabular Data, open the preset's row menu and choose Export this preset. Teammates import the file through Import, so every device in the field produces the same columns.

  • Record type decides what one row is. Use Specimen for one row per collection object.
  • Single fields copy a value; Column name (optional) renames its header.
  • List fields join several fields and skip the empty ones.
  • Conditional text writes a value, such as a unit, only when a field is filled.
  • A named custom field with no value writes a blank column.
  • Show label, Date, and Replace text reshape values into what the receiving database expects.
  • Nested records with indexed columns spread repeated parts across numbered column groups, and {n} in a child field's column name sets each name.