Chant model - DDMAL/CantusDB GitHub Wiki

Chant (code) is a model in the main_app app. It is defined in /main_app/models/chant.py (view file).

Chant inherits from the abstract BaseChant model: both the Chant model and the Sequence model must have the same fields. The reason is that we want both chants and sequences to appear in chant-search results and thus have to do a union operation on two querysets from the two models. Django allows us to do that only if they have the exact same fields. Thus, all fields, properties and attributes for both Chants and Sequences are declared in BaseChant in order to keep the two models' fields harmonized, even when only one of the two models uses a particular field.

Views

Chant has many views:

Fields

  • inherited from BaseChant:
    • visible_status
    • title
    • incipit
    • siglum
    • folio
    • sequence
    • sequence_number
    • genre
    • rubrics
    • analecta_hymnica
    • indexing_notes
    • date
    • col1
    • col2
    • col3
    • ah_volume
    • source
    • cantus_id
    • image_link
    • json_info
    • marginalia
    • office
    • position
    • feast
    • mode
    • differentia
    • differentia_id
    • finalis
    • extra
    • chant_range
    • addendum
    • manuscript_full_text_std_spelling
    • manuscript_full_text_std_proofread
    • manuscript_full_text
    • manuscript_full_text_proofread
    • manuscript_syllabized_full_text
    • volpiano
    • volpiano_proofread
    • volpiano_notes
    • volpiano_intervals
    • cao_concordances
    • proofread_by
    • melody_id
    • search_vector
    • content_structure
    • next_chant
    • is_last_chant_in_feast
    • date_created
    • date_updated
    • created_by
    • last_updated_by

Methods

  • get_ci_url(): i.e. "get Cantus Index url". Returns a link (as a string) to the Cantus Index page that corresponds to the chant's Cantus ID.
  • index_components(): gathers infomation on a chant/sequence's incipit, full_text, full_text_std_spelling, source, genre, feast and office, packaging it into a dictionary. It is used in the update_chant_search_vector() function in signals.py (code).
  • related_chants_by_cantus_id(): Returns a Queryset of all chants in the database with the same Cantus ID as the current chant.
  • get_next_chant(): Returns the chant that immediately follows the current chant in its manuscript, based on the chants' Source, folio and sequence_number. Whereas this method used to be used to calculate several in the operation of CantusDB on the fly, these views/functions have been refactored to use chants' next_chant method so as to run more quickly. Now, get_next_chant() is mostly used to populate this field, within the populate_next_chant_fields (code) management command
  • inherited from BaseChant:
    • save()
    • display_name (property)
    • get_absolute_url()
    • get_verbose_name()
    • get_verbose_name_plural()
    • get_fields_and_properties()