metadata - UW-Libraries/druw GitHub Wiki

Domain == druw:File

Edit the following files (in roughly this order, running the test suite after every edit):

  • spec/models/generic_file_spec.rb
  • app/models/generic_file.rb
  • spec/presenters/my_generic_file_presenter_spec.rb
  • app/presenters/my_generic_file_presenter.rb
  • spec/forms/my_file_edit_form_spec.rb
  • spec/forms/my_batch_edit_form_spec.rb
  • app/forms/my_file_edit_form.rb
  • config/locales/sufia.en.yml

Domain == druw:Collection

Edit the following files (in roughly this order, running the test suite after every edit):

  • spec/models/collection_spec.rb
  • app/models/collection.rb
  • spec/presenters/my_collection_presenter_spec.rb
  • spec/forms/my_collection_edit_form_spec.rb
  • app/presenters/my_collection_presenter.rb
  • app/forms/my_collection_edit_form.rb (This file does not need to be edited unless ... its a required field.)
  • config/locales/sufia.en.yml

Domain == druw:File + druw:Collection

Edit the following files (in roughly this order, running the test suite after every edit):

  • spec/models/generic_file_spec.rb
  • spec/models/collection_spec.rb
  • app/models/concerns/common_metadata.rb
  • spec/presenters/my_generic_file_presenter_spec.rb
  • app/presenters/my_generic_file_presenter.rb
  • spec/presenters/my_collection_presenter_spec.rb
  • app/presenters/my_collection_presenter.rb
  • spec/forms/my_file_edit_form_spec.rb
  • spec/forms/my_batch_edit_form_spec.rb
  • app/forms/my_file_edit_form.rb (inherits from MyGenericFilePresenter, change if field required.)
  • spec/forms/my_collection_edit_form_spec.rb
  • app/forms/my_collection_edit_form.rb (inherits changes from MyFileEditForm.)
  • config/locales/sufia.en.yml

Library staff only fields / hidden from depositor

Edit the following files (in roughly this order, running the test suite after every edit):

???

  • spec/models/generic_file_spec.rb

  • spec/models/collection_spec.rb

  • app/models/concerns/common_metadata.rb

???

Btw re: the description of accrual periodicity (config/locales/sufia.en.yml), you could copy the text used by DC as a default: http://dublincore.org/documents/dcmi-terms/#terms-accrualPeriodicity

Required fields: you set fields to be required in the form class by adding a symbol corresponding to the property into the list of required fields. If they're not required, don't add them to that list.

Repeatability: properties are repeatable by default. If you want a field to be single-valued, you can add "multiple: false" to the property declaration. Example here: https://github.com/aic-collections/aicdams-lakeshore/blob/76869cc626a672a4264c56f9654e5883e993a6fd/app/models/concerns/resource_metadata.rb#L7

Public/hidden: if you don't want a field displayed, I believe you can remove it from the presenter class.

Seen by depositor: so in the current DRUW, there's not much of a distinction between the depositor and any other user, so if you want to hide a field from the depositor, remove it from the edit form class.

Searchability question. Mike note: For searchable, it might be good to have more info for searchable like whether something should be tokenized or just parsed as a single token. A URL, for instance, should be dealt with the latter way, and a title or name should be dealt with the former way (though feel free to disagree!). Another field for the spreadsheet might also be sortable Y/N, though I will note that only single-valued fields are possible to be sorted.

Workflow

  • Indicate on Druw Data Dictionary (googledoc) which term you are working on
  • Fork and branch uwlib/druw. See Git_notes
  • On branch repo, start docker rails container. See docker_sufia README.md
  • Enter rails container sudo docker exec -it rails bash
  • run rake spec to make sure all tests pass before editing anything
  • Edit files listed above depending on the 'Domain' column in the DRUW Data Dictionary
  • Edit spec file first, run rake spec in container, edit necessary file(s), run rake spec to see that your changes pass.
  • Then see Git_notes

References

https://github.com/projecthydra/sufia/wiki/Customizing-Metadata


Spec Test Isolation

  • Run the whole suite: rspec
  • Run tests in a single file: rspec spec/models/generic_file_spec.rb
  • Run all tests in a directory: rspec spec/models/
  • Run all tests in a couple directories: rspec spec/models/ spec/controllers/
  • Run a single test within a file: rspec spec/forms/my_collection_edit_form_spec.rb:34 (where 34 is the line number, and that line number can be a single test or a describe or context block to run the whole block)

Note that "rspec" and "rake spec" are almost the same thing -- both will run your entire test suite -- but they have slightly different syntaxes for doing the above, where rspec's syntax is simpler.


git notes have been moved to Git_notes.md