Replies: 5 comments 5 replies
-
an updated sample, including a "cantus_id" column, and leaving out "mode_name":
|
Beta Was this translation helpful? Give feedback.
-
Better version of the sample, filtering by published status, making sure each has a finalis, dropping the volpiano column: from main_app.models import Chant
fifty_chants = Chant.objects.all().filter(source__published=True).filter(finalis__isnull=False).order_by("?")[:50]
print('"chant_id","incipit","genre","mode","finalis","composer",
"absolute_url","src_link","cantus_id"')
for chant in fifty_chants:
print(f'"{chant.id}","{chant.incipit}","{chant.genre.description}","{chant.mode}","{chant.finalis}","Anonymous","https://cantusdatabase.org/chant/{chant.id}","https://cantusdatabase.org/source/{chant.source.id}","{chant.cantus_id}"')
|
Beta Was this translation helpful? Give feedback.
-
An updated copy, with from main_app.models import Chant
def get_mode_name(abbr):
mapping = {
"1": "dorian",
"2": "hypodorian",
"3": "phrygian",
"4": "hypophrygian",
"5": "lydian",
"6": "hypolydian",
"7": "mixolydian",
"8": "hypomixolydian"
}
try:
return mapping[abbr]
except KeyError:
return None
fifty_chants = Chant.objects.all().filter(source__published=True).filter(finalis__isnull=False).order_by("?")[:50]
print('"chant_id","incipit","genre","mode","mode_name","finalis","composer","absolute_url","src_link","cantus_id"')
for chant in fifty_chants:
print(f'"{chant.id}","{chant.incipit}","{chant.genre.description}","{chant.mode}","{chant.finalis}","Anonymous","https://cantusdatabase.org/chant/{chant.id}","https://cantusdatabase.org/source/{chant.source.id}","{chant.cantus_id}"')
|
Beta Was this translation helpful? Give feedback.
-
Another sample:
|
Beta Was this translation helpful? Give feedback.
-
from main_app.models import Chant
def get_mode_name(abbr):
mapping = {
"1": "dorian",
"2": "hypodorian",
"3": "phrygian",
"4": "hypophrygian",
"5": "lydian",
"6": "hypolydian",
"7": "mixolydian",
"8": "hypomixolydian"
}
try:
return mapping[abbr]
except KeyError:
return None
def create_csv(chants):
print('"chant_id","incipit","genre","mode","mode_name","finalis","composer","absolute_url","src_link","cantus_id"')
for chant in chants:
print(f'"{chant.id}","{chant.incipit}","{chant.genre.description}","{chant.mode}","{get_mode_name(chant.mode)}","{chant.finalis}","Anonymous","https://cantusdatabase.org/chant/{chant.id}","https://cantusdatabase.org/source/{chant.source.id}","{chant.cantus_id}"')
fifty_chants = Chant.objects.all().filter(source__published=True).filter(finalis__isnull=False).order_by("?")[:50]
create_csv(fifty_chants)
|
Beta Was this translation helpful? Give feedback.
-
A few days ago, I created a CSV file with 50 random chants from CantusDB, with only a few columns, for reconciling with WikiData and SIMSSADB. Here are the contents of the file:
Some metadata (metametadata?):
1..8
in "mode" to the name of the church mode (anything that's not a number between 1 and 8, including transposed modes, is currently mapped toNone
)."Anonymous"
.For a list of other fields it would be possible to export, refer to https://github.com/DDMAL/CantusDB/wiki/BaseChant-Model. (we can also flatten things to pull out data on specific chants' sources/genres/offices, etc. - for a list of possibilities, refer to https://github.com/DDMAL/CantusDB/wiki/Models)
Beta Was this translation helpful? Give feedback.
All reactions