Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions app/models/freereg1_csv_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class Freereg1CsvEntry
field :film, type: String
field :film_number, type: String
field :suffix, type: String
field :alternate_forenames, type: Array

#new common fields
field :image_file_name, type: String
field :notes_from_transcriber, type: String


#original baptism fields
field :baptism_date, type: String #actual date as written
field :birth_date, type: String #actual date as written
Expand Down Expand Up @@ -123,6 +123,7 @@ class Freereg1CsvEntry
field :place_of_death, type: String
field :memorial_information, type: String
field :burial_parish, type: String
field :relative_occupation, type: String


#original marriage fields
Expand Down Expand Up @@ -915,18 +916,11 @@ def errors_in_fields
errors.add(:film_number, 'Invalid characters')

end
unless FreeregValidations.cleantext(consecrated_ground)
errors.add(:consecrated_ground, 'Invalid characters')

end


unless FreeregValidations.cleantext(suffix)
errors.add(:suffix, 'Invalid characters')

end
unless FreeregValidations.cleantext(burial_parish)
errors.add(:burial_parish, 'Invalid characters')

end

case
Expand Down Expand Up @@ -959,6 +953,7 @@ def errors_in_fields
errors.add(:bride_father_occupation, 'Invalid characters')

end

unless FreeregValidations.cleantext(bride_father_surname)
errors.add(:bride_father_surname, 'Invalid characters')

Expand Down Expand Up @@ -1417,6 +1412,16 @@ def errors_in_fields
unless FreeregValidations.cleanage(person_age)
errors.add(:person_age, 'Invalid age')
end
unless FreeregValidations.cleantext(burial_parish)
errors.add(:burial_parish, 'Invalid characters')
end
unless FreeregValidations.cleantext(consecrated_ground)
errors.add(:consecrated_ground, 'Invalid characters')

end
unless FreeregValidations.cleantext(relative_occupation)
errors.add(:relative_occupation, 'Invalid characters')
end
if check_embargo
rule = embargoes.where(record_type: 'bu', period_type: 'period').first
errors.add(:burial, 'Cannot compute end of embargo') if rule.present? && year.blank?
Expand Down
24 changes: 24 additions & 0 deletions lib/freereg1_translator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,24 @@ def self.translate_names_marriage(entry)
# first_name: bride_forename
# last_name: bride_surname
names << { :role => 'b', :type => 'primary', :first_name => entry.bride_forename, :last_name => entry.bride_surname }
if entry.alternate_forenames.present?
alternate_forenames = entry.alternate_forenames
alternate_forenames.each{ |alt_fn|
names << { role: 'b', type: 'primary', first_name: alt_fn, last_name: entry.bride_forename }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last_name: entry.bride_surname

}
end
# - role: g
# type: primary
# fields:
# first_name: groom_forename
# last_name: groom_surname
names << { :role => 'g', :type => 'primary', :first_name => entry.groom_forename, :last_name => entry.groom_surname }
if entry.alternate_forenames.present?
alternate_forenames = entry.alternate_forenames
alternate_forenames.each{ |alt_fn|
names << { role: 'g', type: 'primary', first_name: alt_fn, last_name: entry.groom_surname }
}
end
#
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation:
Marriage Record: Jane Doe married John Don
If Jane has alternate forename: Yane Doe
alternate_forenames: ['Yane']
We are translating this alternate name as searchable names: Yane Doe and Yane Don

If Jane and John both have altername forenames Yane and Yohn
alternate_forenames: ['Yane', 'Yohn']
We will add the following as searchable names:
Yane Doe and Yane Don
Yohn Doe and Yohn Don

# - role: gf
# type: other
Expand Down Expand Up @@ -171,6 +183,12 @@ def self.translate_names_burial(entry)
names << { role: 'bu', type: 'primary', first_name: entry.burial_person_forename||"", last_name: entry.female_relative_surname }
when entry.burial_person_surname.present?
names << { role: 'bu', type: 'primary', first_name: entry.burial_person_forename||"", last_name: entry.burial_person_surname }
if entry.alternate_forenames.present?
alternate_forenames = entry.alternate_forenames
alternate_forenames.each{ |alt_fn|
names << { role: 'bu', type: 'primary', first_name: alt_fn, last_name: entry.burial_person_surname }
}
end
end

# names << { :role => 'bu', :type => 'primary', :first_name => entry.burial_person_forename||"", :last_name => entry.burial_person_surname.present? ? entry.burial_person_surname : alternate_surname }
Expand Down Expand Up @@ -227,6 +245,12 @@ def self.translate_names_baptism(entry)
names << { role: 'ba', type: 'primary', first_name: entry.person_forename||"", last_name: entry.mother_surname }
when entry.person_surname.present?
names << { role: 'ba', type: 'primary', first_name: entry.person_forename||"", last_name: entry.person_surname }
if entry.alternate_forenames.present?
alternate_forenames = entry.alternate_forenames
alternate_forenames.each{ |alt_fn|
names << { role: 'ba', type: 'primary', first_name: alt_fn, last_name: entry.person_surname }
}
end
end
#forename = entry.person_forename || ""
#entry.person_surname.present? ? surname = entry.person_surname : surname = nil
Expand Down
4 changes: 2 additions & 2 deletions lib/freereg_options_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module FreeregOptionsConstants
'witness6_surname', 'witness7_forename', 'witness7_surname', 'witness8_forename', 'witness8_surname'];

ADDITIONAL_BURIAL_FIELDS = ['death_date', 'burial_person_title', 'male_relative_title', 'female_relative_surname', 'female_relative_title',
'cause_of_death', 'burial_location_information', 'place_of_death', 'memorial_information'];
'cause_of_death', 'burial_location_information', 'place_of_death', 'memorial_information', 'relative_occupation'];

ADDITIONAL_MARRIAGE_FIELDS = ['contract_date', 'bride_title', 'bride_marked', 'bride_father_title', 'bride_mother_forename',
'bride_mother_surname', 'bride_mother_title', 'bride_mother_occupation', 'groom_title', 'groom_marked', 'groom_father_title',
Expand Down Expand Up @@ -242,7 +242,7 @@ module FreeregOptionsConstants
'burial_person_surname', 'burial_person_title', 'relationship','person_occupation', 'consecrated_ground', 'male_relative_forename', 'relative_surname',
'male_relative_title', 'female_relative_forename', 'female_relative_surname', 'female_relative_title', 'person_age',
'burial_person_abode', 'cause_of_death', 'burial_location_information', 'place_of_death', 'memorial_information',
'notes', 'notes_from_transcriber', 'film', 'film_number', 'image_file_name'];
'notes', 'notes_from_transcriber', 'film', 'film_number', 'image_file_name', 'relative_occupation'];

EXTENDED_MARRIAGE_LAYOUT = ['register_entry_number', 'marriage_date', 'contract_date', 'marriage_by_licence', 'groom_forename', 'groom_surname', 'groom_title', 'groom_age',
'groom_parish', 'groom_condition', 'groom_occupation', 'groom_abode', 'groom_marked', 'groom_father_forename', 'groom_father_surname', 'groom_father_occupation',
Expand Down
1 change: 1 addition & 0 deletions lib/new_freereg_csv_update_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,7 @@ def process_burial_data_fields(csvrecords,csvfile,project,line)
@data_record[:relative_surname] = Unicode::upcase(@data_record[:relative_surname]) unless @data_record[:relative_surname].nil?
@data_record[:burial_person_surname] = Unicode::upcase( @data_record[:burial_person_surname]) unless @data_record[:burial_person_surname].nil?
@data_record[:female_relative_surname] = Unicode::upcase( @data_record[:female_relative_surname]) unless @data_record[:female_relative_surname].nil?
@data_record[:alternate_forenames] = @data_record[:alternate_forenames].split(",").map(&:strip)
@data_record[:processed_date] = Time.now
csvfile.data[line] = @data_record

Expand Down