From 515ad7d9f6727e9888604b0adacbb1ee4bf86bd5 Mon Sep 17 00:00:00 2001 From: Mau Zsofia Abraham Date: Fri, 29 Nov 2024 09:57:08 +0100 Subject: [PATCH] Secondary data type fix --- composables/use-tei-headers.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/composables/use-tei-headers.ts b/composables/use-tei-headers.ts index 95d1a19..35f77fe 100644 --- a/composables/use-tei-headers.ts +++ b/composables/use-tei-headers.ts @@ -67,7 +67,6 @@ const extractMetadata = function ( "@hasTEIw": "false", teiHeader: item.teiHeader, } as simpleTEIMetadata; - template.id = item["@id"] ? item["@id"] : item.teiHeader.fileDesc.publicationStmt.idno?.$ @@ -137,23 +136,26 @@ const extractMetadata = function ( template.person = extractPersons(item, corpusMetadata); if (template.dataType === "CorpusText" && corpusMetadata) { - const subtype = item.teiHeader.profileDesc?.textClass?.catRef + const categoryId = item.teiHeader.profileDesc?.textClass?.catRef ? item.teiHeader.profileDesc.textClass.catRef["@target"] : ""; + + const subtype = categoryId?.split(".").at(2); + switch (subtype) { - case "corpus:textClass.ST": + case "ST": template.secondaryDataType = "Sample Text"; break; - case "corpus:textClass.FL": + case "FL": template.secondaryDataType = "Feature List"; break; - case "corpus:textClass.FS": - template.secondaryDataType = "Free Speech"; + case "UMS": + template.secondaryDataType = "Unmonitored Speech"; break; - case "corpus:textClass.TUN": + case "TUN": template.secondaryDataType = "Tunocent Questionnaire"; break; - case "corpus:textClass.WAD": + case "WAD": template.secondaryDataType = "WAD Questionnaire"; break; default: