Skip to content

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpitts committed Aug 21, 2014
1 parent d98214a commit 5b36a39
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 27 deletions.
36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ Quick Setup:
* `bundle exec ruby app.rb`
* navigate your browser to 0.0.0.0:4567
* login with user: `admin` & password: `admin`
* a sample test file is included in the public folder
* check notes section
* files included in `public/test/`
* template file for using right away
* sample test files to test mapping and transformations


General Operation:
------------------
Expand All @@ -28,6 +30,19 @@ General Operation:
* The admin user may create logins and assign admin designations.
* The service allows multiple users to be logged in with each users own working space.
* All temp space is cleared upon service exit.
* User may reset tags to get new tag definitions and reset default associations

* sample template file
* a good starting point
* red columns are required and blue are repeatable
* other columns may be repeatable but probably not necessary
* only one name primary in mods
* mods validation will tell you if you created a problem, so experiment.
* due to heuristic obstacles some columns need to follow others
* name-personal-primary-date must follow name-personal-primary
* this will help illustrate the type of information found in mods format
* the red columns are typically top-level and required elements found in mods
* filename is not mods but required for naming the transformations

Transformation:
---------------
Expand All @@ -46,6 +61,8 @@ Ruby Requirements:
* bundler
* sinatra
* nokogiri
* gem download is compatible with nix systems.
* special installation with windows is required
* uuid
* data_mapper
* dm-sqlite-adapter
Expand All @@ -57,6 +74,9 @@ Other Requirements:
-------------------
* sqlite3
* a jvm
* installation works fine on nix systems
* windows installation may require some extra attention with gem builds
* personal experience with nokogiri on windows is not optimal

Reasons for this project
------------------------
Expand All @@ -66,7 +86,7 @@ Reasons for this project
* Transformer now uses xml node manipulation for creating the mods xml.

Notes - Issues - TODO
--------------------
---------------------
* New code changes uses mutex to solve resource problems.
* Ruby 1.9.3 has problems when multiple threads are both inside chdir blocks.
* Shared resources such as the included java app create conflicts
Expand All @@ -78,11 +98,5 @@ Notes - Issues - TODO
* Will use a nonce to stop this behavior
* Using a nonce is good in practice to prevent replay attacks also
* Work needed to mitigate this from the UI
* included test file
* the test file was created by one of our local libraries
* you will need to update the mods definitions from the gui in order to process the file
* this illustrates one of the types of errors that come from attempting a transformation
* I intend to upload a sample template excel file that can be used with this service
* it will have excel column headers similar to
* `filename IID title title-alternate etc...`

* TODO - improve node building heuristics
* TODO - check input size on mods associations and report problems to user
28 changes: 14 additions & 14 deletions lib/mod_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ def setTagsDefault
{
"filename" => ["Filename","file"], #used to associate with file
"title" => ["Title"],
"alternative" => ["Alternative_Title"],
"identifier" => ["IID"],
"alternative" => ["title-alternative","alternative_title"],
"identifier" => ["identifier-IID","identifier"],
"author" => ["Author"],
"artist" => ["Artist"],
"personal" => ["Personal"],
"personal-secondary" => ["Secondary"],
"personal" => ["name-personal-primary"],
"personal-secondary" => ["name-personal"],
"corporate" => ["Corporate"],
"dateIssued" => ["Date"],
"physicalDescription" => ["PhysicalDescription"],
"physicalDescription" => ["physical-form","format"],
"genre" => ["Genre"],
"typeOfResource" => ["TypeOfResource"],
"typeOfResource" => ["type_of_resource"],
"note" => ["Description"],
"topic" => ["Subject"],
"geographic" => ["Geographic"],
"topic" => ["subject-topic","subject","topic-subject"],
"geographic" => ["subject-geographic","geographic-subject"],
"physicalLocation" => ["PhysicalLocation"],
"lcsh" => ["subject-lcsh"],
"accessCondition" => ["Rights"],
"dateCreated" => ["Created"],
"namePartDate" => ["Creator_Dates"],
"lcsh" => ["subject-topic-lcsh","lcsh-subject"],
"accessCondition" => ["access_condition","rights"],
"dateCreated" => ["date_created","date-created"],
"namePartDate" => ["name-personal-primary-date","name-personal-date","creator_dates"],
"issuance" => ["Issuance"],
"place" => ["Place"],
"place" => ["place_of_publication"],
"publisher" => ["Publisher"],
"language" => ["Language"],
"iso-lang" => ["iso-lang"],
"nonSort" => ["non-sort"],
"nonSort" => ["title-nonsort"],
"tableOfContents" => ["tableOfContents"]
}
saveTags user
Expand Down
2 changes: 1 addition & 1 deletion lib/model/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Tag

property :id, Serial
property :tag_name, String
property :tag_assoc, String
property :tag_assoc, String, :length => 1..100

belongs_to :user
end
3 changes: 2 additions & 1 deletion lib/transformer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def transform doc, collection_id, institution
remove exceldoc.path

xmldoc.xpath("//Row").each do |node|
next if node.child.nil? #empty row
#get tags from xml
hash = getTags node

Expand All @@ -61,7 +62,7 @@ def transform doc, collection_id, institution

#make xml - transformation
xml = makeXML hashArray, institution

#validate xml against mods
if validate xml, uniqName
#puts "passes mods validation"
Expand Down

0 comments on commit 5b36a39

Please sign in to comment.