Skip to content

Instantly share code, notes, and snippets.

View fits_example.xml
<?xml version="1.0" encoding="UTF-8"?>
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="1.5.0" timestamp="9/24/20 8:56 PM">
<identification>
<identity format="JPEG File Interchange Format" mimetype="image/jpeg" toolname="FITS" toolversion="1.5.0">
<tool toolname="Droid" toolversion="6.4" />
<tool toolname="Jhove" toolversion="1.20.1" />
<tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" />
<version toolname="Droid" toolversion="6.4">1.01</version>
<externalIdentifier toolname="Droid" toolversion="6.4" type="puid">fmt/43</externalIdentifier>
</identity>
@kspurgin
kspurgin / csv_opt.txt
Created Oct 2, 2020
Exploring Ruby CSV standard library default handling of empty cell values
View csv_opt.txt
2.6.3 :001 > require 'csv'
=> true
2.6.3 :002 > csv = CSV.parse(File.read('required_field_empty.csv'), headers: true)
=> #<CSV::Table mode:col_or_row row_count:4>
2.6.3 :003 > rows = []
=> []
2.6.3 :004 > csv.each{ |r| rows << r.to_h }
=> #<CSV::Table mode:col_or_row row_count:4>
2.6.3 :024 > rows[1]['objectNumber']
=> nil
@kspurgin
kspurgin / hidden_ct_by_fieldgroup.txt
Created Oct 2, 2020
hidden field counts by fieldgroup
View hidden_ct_by_fieldgroup.txt
| field group | hidden field count |
|--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------|
| anthro_4_1_0/citation/citationRecordTypes | 1 |
| anthro_4_1_0/citation/citationTermGroupList > citationTermGroup | 2 |
| anthro_4_1_0/collectionobject/ | 8 |
| anthro_4_1_0/collectionobject/anthroOwnershipGroupList > anthroOwnershipGroup
@kspurgin
kspurgin / csv_column_report
Created Sep 30, 2020
csv_column_splitting_headache
View csv_column_report
I use a little awk oneliner derived from https://www.datafix.com.au/cookbook/structure1.html
to verify the structure of client-supplied CSVs (that I convert to TSVs) or TSVs. One client's
table of object data provided as TSV used CRLF row endings, AND included TAB, CRLF, CR, and LF
characters inside individual fields to format multiline notes.
The result of my check on this ONE FILE was as follows:
292 rows are broken into 82 columns
606 rows are broken into 1 columns
486 rows are broken into 0 columns
View accessionDateGroup_field_config.json
{ "accessionDateGroup": {
"[config]": {
"dataType": "DATA_TYPE_STRUCTURED_DATE",
"messages": {
"name": {
"id": "field.acquisitions_common.accessionDateGroup.name",
"defaultMessage": "Accession date"
}
},
"searchView": {
@kspurgin
kspurgin / core_sd_fields.json
Created May 4, 2020
Core structured date field config
View core_sd_fields.json
{
"structuredDate": {
"fields": {
"dateDisplayDate": {
"[config]": {
"extensionName": "structuredDate"
}
},
"dateAssociation": {
"[config]": {
@kspurgin
kspurgin / boris.xml
Created Mar 4, 2020
Complicated Test MODS (Boris the Guinea remix)
View boris.xml
<?xml version="1.0" encoding="UTF-8"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:drs="info://lyrasis/drs-admin/v1" xmlns:dc="http:://purl.org/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dwc="http://rs.tdwg.org/dwc/terms/" xmlns:edm="http://pro.europeana.eu/edm-documentation" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<titleInfo usage="primary">
<title>Boris the Guineafowl</title>
<subTitle>Portrait of a birb</subTitle>
</titleInfo>
<titleInfo type="abbreviated">
<title>Boris</title>
</titleInfo>
<titleInfo>
View concept_spec_docs.txt
rake spec SPEC=spec/collectionspace/converter/core/concept_spec.rb
/Users/spurgin/.rvm/rubies/ruby-2.5.3/bin/ruby -I/Users/spurgin/.rvm/gems/ruby-2.5.3/gems/rspec-core-3.9.0/lib:/Users/spurgin/.rvm/gems/ruby-2.5.3/gems/rspec-support-3.9.0/lib /Users/spurgin/.rvm/gems/ruby-2.5.3/gems/rspec-core-3.9.0/exe/rspec spec/collectionspace/converter/core/concept_spec.rb
CORE CONCEPT:
<?xml version="1.0" encoding="UTF-8"?>
<document name="concepts">
<ns2:concepts_common xmlns:ns2="http://collectionspace.org/services/concept" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<conceptTermGroupList>
<conceptTermGroup>
View person_spec_doc.xml
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<persons_common>
<personTermGroupList>
<personTermGroup>
<termDisplayName>John Mellon; J. T. Mellon</termDisplayName>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(descriptor)'descriptor'</termType>
<termSourceID>123</termSourceID>
<termSourceDetail>detail text</termSourceDetail>
<surName>Mellon</surName>
@kspurgin
kspurgin / CCT_q_1.md
Last active Oct 21, 2019
CSpace converter tool question
View CCT_q_1.md

Context -- I'm looking at OHC's skeletal data spreadsheet and wondering how it gets imported.

This question is specifically referring to Cataloging > Other Number field

We have (this is fake data – IRL it looks like only 2 columns at a time are filled in):

You can’t perform that action at this time.