[Archivesspace_Users_Group] Accession CSV Subject Import

Maura Carbone mauraa at brandeis.edu
Wed Apr 8 14:08:05 EDT 2015


Here's the sample file; it worked before the changes (i.e. when the
subjects were just over-written until the last), but now when I import I
just get no subjects created. If I can figure it out I thought it would be
nice to implement for subjects and agents since our accessions often have
multiple of both.

Thanks!

On Wed, Apr 8, 2015 at 12:25 PM, Brian Hoffman <brianjhoffman at gmail.com>
wrote:

> What you have looks right to me. If you want to send me a sample CSV with
> a few rows filled in I’ll see if I can figure it out.
>
> Brian
>
>
> On Apr 8, 2015, at 10:24 AM, Maura Carbone <mauraa at brandeis.edu> wrote:
>
> Hi Brian,
>
> Hmm,  somewhat, but working on that base doesn't seem to work?
>
> If I wanted to copy how date is set up it seems it would look something
> like this:
>
>       'subject_1_source' => 'subject_1.source',
>       'subject_1_term' => 'subject_1.term',
>       'subject_1_term_type' => 'subject_1.term_type',
>
>   'subject_2_source' => 'subject_2.source',
>       'subject_2_term' => 'subject_2.term',
>       'subject_2_term_type' => 'subject_2.term_type',
>
>   'subject_3_source' => 'subject_3.source',
>       'subject_3_term' => 'subject_3.term',
>       'subject_3_term_type' => 'subject_3.term_type',
>
> and then
>
>      :subject_1 => {
> :record_type => :subject,
>         :on_create => Proc.new {|data, obj|
>           obj.terms = [{:term => data['term'], :term_type =>
> data['term_type'], :vocabulary => '/vocabularies/1'}]
>           obj.vocabulary = '/vocabularies/1'
>         },
>         :on_row_complete => Proc.new {|cache, this|
>           digital_object = cache.find {|obj| obj.class.record_type ==
> 'accession'}
>           digital_object.subjects << {'ref' => this.uri}
>         }
>       },
>
>    :subject_2 => {
> :record_type => :subject,
>         :on_create => Proc.new {|data, obj|
>           obj.terms = [{:term => data['term'], :term_type =>
> data['term_type'], :vocabulary => '/vocabularies/1'}]
>           obj.vocabulary = '/vocabularies/1'
>         },
>         :on_row_complete => Proc.new {|cache, this|
>           digital_object = cache.find {|obj| obj.class.record_type ==
> 'accession'}
>           digital_object.subjects << {'ref' => this.uri}
>         }
>       },
>
>    :subject_3 => {
> :record_type => :subject,
>         :on_create => Proc.new {|data, obj|
>           obj.terms = [{:term => data['term'], :term_type =>
> data['term_type'], :vocabulary => '/vocabularies/1'}]
>           obj.vocabulary = '/vocabularies/1'
>         },
>         :on_row_complete => Proc.new {|cache, this|
>           digital_object = cache.find {|obj| obj.class.record_type ==
> 'accession'}
>           digital_object.subjects << {'ref' => this.uri}
>         }
>       },
>
> Although I admit I'm not sure if I'd have to change some of the inner
> working of the subject_# fields in part two (it seems like on_create is
> building the subject object, and the on_row is then connecting it to the
> record so I shouldn't but I could be wrong).
>
> When I make the changes above and implement the plugin, subjects just stop
> being imported at all (although no errors, they're just ignored).
>
> -Maura
>
>
> On Tue, Apr 7, 2015 at 1:04 PM, Brian Hoffman <brianjhoffman at gmail.com>
> wrote:
>
>> Hi Maura,
>>
>> No, there’s nothing else. Generally the keys in the callbacks section
>> (:date_1 => etc) are used to tie things together with the schema. Where
>> there are multiple objects created per row, there’s an optional
>> :record_type key in the callback config that does the mapping (:record_type
>> => :date).
>>
>> Does that make sense?
>>
>> Brian
>>
>>
>>
>>
>>
>> On Apr 7, 2015, at 10:45 AM, Maura Carbone <mauraa at brandeis.edu> wrote:
>>
>> Hi Brian,
>> I found that one all right, but is there another file that would have to
>> be edited? Looking at that file I can't see where the 'labels' are linked
>> to the data types, so I was assuming there was another file that does that.
>> For example, the first half has labels for date_1:
>>
>> 'date_1_label' => 'date_1.label',
>> 'date_1_expression' => 'date_1.expression',
>> 'date_1_begin' => 'date_1.begin',
>> 'date_1_end' => 'date_1.end',
>> 'date_1_type' => 'date_1.date_type',
>>
>> and then the date object creator is:
>>
>>      :date_1 => {
>>         :record_type => :date,
>>         :defaults => date_defaults,
>>         :on_row_complete => Proc.new { |queue, date|
>>           queue.select {|obj| obj.class.record_type == 'accession'}.each
>> do |accession|
>>             accession.dates << date
>>           end
>>         }
>>
>> so I thought there must be a file mapping the date_1 labels to the date
>> object fields in the schema?
>>
>>
>> Thanks,
>> Maura
>>
>> On Mon, Apr 6, 2015 at 9:11 PM, brian <brianjhoffman at gmail.com> wrote:
>>
>>> Hi Maura,
>>>
>>> Here's the base converter file for accession csv.
>>>
>>>
>>> https://github.com/archivesspace/archivesspace/blob/master/backend/app/converters/accession_converter.rb
>>>
>>>
>>> Brian
>>>
>>>
>>>
>>> Sent from my T-Mobile 4G LTE Device
>>>
>>>
>>> -------- Original message --------
>>> From: Maura Carbone <mauraa at brandeis.edu>
>>> Date:04/06/2015 3:35 PM (GMT-05:00)
>>> To: Archivesspace Users Group <
>>> archivesspace_users_group at lyralists.lyrasis.org>
>>> Cc:
>>> Subject: Re: [Archivesspace_Users_Group] Accession CSV Subject Import
>>>
>>> Hi Chris,
>>> Any progress on that example? I actually tried to work on it myself, but
>>> I'm not entirely sure which files need to be altered (aside from
>>> accession_converter). Ideally, I want to be able to import multiple
>>> subjects and multiple agents -- I was hoping to copy the date setup (where
>>> there are multiple dates date1 date2 etc.) but I haven't found the file
>>> where the terms (such as date_label_1) are mapped to the date object (and
>>> so on for subject and agents etc.)
>>>
>>> Thanks!
>>> Maura
>>>
>>> On Tue, Mar 31, 2015 at 4:03 PM, Maura Carbone <mauraa at brandeis.edu>
>>> wrote:
>>>
>>>> What I was doing was:
>>>> subject_source,subject_term_type,subject_term,subject_source,subject_term_type,subject_term, Unspecified
>>>> ingested source,Topical,Pepperoni,Unspecified ingested
>>>> source,Topical,Cheese. Then only Cheese gets created and imported.
>>>>
>>>> Yeah, and I can take a look at how the importer works now as well, I
>>>> just wasn't sure if it was a known issue, or if there was a specific reason
>>>> for it.
>>>>
>>>> Thanks!
>>>> Maura
>>>>
>>>> On Tue, Mar 31, 2015 at 3:29 PM, Chris Fitzpatrick <
>>>> Chris.Fitzpatrick at lyrasis.org> wrote:
>>>>
>>>>>  Hi Maura,
>>>>>
>>>>>
>>>>> So, you're just adding more subject columns to the CSV? Yes, what you
>>>>> describe about overwriting is exactly what's happening...the CSV importer
>>>>> only allows for one subject per row.
>>>>>
>>>>>
>>>>> I have a plugin example I started working on last week to show how to
>>>>> tweak the CSV importer...I'll try and finish that up tomorrow and send it
>>>>> out for people to have a look...
>>>>>
>>>>>
>>>>> b,chris.
>>>>>
>>>>>
>>>>>   Chris Fitzpatrick | Developer, ArchivesSpace
>>>>> Skype: chrisfitzpat  | Phone: 918.236.6048
>>>>> http://archivesspace.org/
>>>>>    ------------------------------
>>>>> *From:* archivesspace_users_group-bounces at lyralists.lyrasis.org <
>>>>> archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of
>>>>> Maura Carbone <mauraa at brandeis.edu>
>>>>> *Sent:* Tuesday, March 31, 2015 7:06 PM
>>>>> *To:* Archivesspace Users Group
>>>>> *Subject:* [Archivesspace_Users_Group] Accession CSV Subject Import
>>>>>
>>>>>  Hi all,
>>>>> I've been working on importing accessions with CSV files, but I've
>>>>> noticed that on import only one subject ever gets brought in (the last
>>>>> one). Is this a bug, or just a current limitation? I'm not getting an
>>>>> error, it just appears that the subject field keeps being over-written
>>>>> until the last subject, then imported.
>>>>>
>>>>>  Thanks,
>>>>> Maura
>>>>>
>>>>>  --
>>>>>  Maura Carbone
>>>>> Digital Initiatives Librarian
>>>>> Brandeis University
>>>>> Library and Technology Services
>>>>> (781) 736-4659
>>>>> 415 South Street, (MS 017/P.O. Box 549110)
>>>>> Waltham, MA 02454-9110
>>>>> email: mauraa at brandeis.edu
>>>>>
>>>>> _______________________________________________
>>>>> Archivesspace_Users_Group mailing list
>>>>> Archivesspace_Users_Group at lyralists.lyrasis.org
>>>>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Maura Carbone
>>>> Digital Initiatives Librarian
>>>> Brandeis University
>>>> Library and Technology Services
>>>> (781) 736-4659
>>>> 415 South Street, (MS 017/P.O. Box 549110)
>>>> Waltham, MA 02454-9110
>>>> email: mauraa at brandeis.edu
>>>>
>>>
>>>
>>>
>>> --
>>> Maura Carbone
>>> Digital Initiatives Librarian
>>> Brandeis University
>>> Library and Technology Services
>>> (781) 736-4659
>>> 415 South Street, (MS 017/P.O. Box 549110)
>>> Waltham, MA 02454-9110
>>> email: mauraa at brandeis.edu
>>>
>>> _______________________________________________
>>> Archivesspace_Users_Group mailing list
>>> Archivesspace_Users_Group at lyralists.lyrasis.org
>>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>>>
>>>
>>
>>
>> --
>> Maura Carbone
>> Digital Initiatives Librarian
>> Brandeis University
>> Library and Technology Services
>> (781) 736-4659
>> 415 South Street, (MS 017/P.O. Box 549110)
>> Waltham, MA 02454-9110
>> email: mauraa at brandeis.edu
>>  _______________________________________________
>> Archivesspace_Users_Group mailing list
>> Archivesspace_Users_Group at lyralists.lyrasis.org
>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>>
>>
>>
>> _______________________________________________
>> Archivesspace_Users_Group mailing list
>> Archivesspace_Users_Group at lyralists.lyrasis.org
>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>>
>>
>
>
> --
> Maura Carbone
> Digital Initiatives Librarian
> Brandeis University
> Library and Technology Services
> (781) 736-4659
> 415 South Street, (MS 017/P.O. Box 549110)
> Waltham, MA 02454-9110
> email: mauraa at brandeis.edu
>  _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>
>
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>
>


-- 
Maura Carbone
Digital Initiatives Librarian
Brandeis University
Library and Technology Services
(781) 736-4659
415 South Street, (MS 017/P.O. Box 549110)
Waltham, MA 02454-9110
email: mauraa at brandeis.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150408/b0dfdb3c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_accession.csv
Type: text/csv
Size: 996 bytes
Desc: not available
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150408/b0dfdb3c/attachment.csv>


More information about the Archivesspace_Users_Group mailing list