-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into Aggregation-updates
- Loading branch information
Showing
4 changed files
with
47 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...former_calm/src/main/scala/weco/pipeline/transformer/calm/transformers/CalmSubjects.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package weco.pipeline.transformer.calm.transformers | ||
|
||
import weco.catalogue.internal_model.identifiers.IdState | ||
import weco.catalogue.internal_model.work.{Concept, Subject} | ||
import weco.catalogue.source_model.calm.CalmRecord | ||
import weco.pipeline.transformer.calm.NormaliseText | ||
import weco.pipeline.transformer.calm.models.CalmRecordOps | ||
import weco.pipeline.transformer.identifiers.LabelDerivedIdentifiers | ||
|
||
object CalmSubjects extends CalmRecordOps with LabelDerivedIdentifiers { | ||
def apply(record: CalmRecord): List[Subject[IdState.Unminted]] = | ||
record.getList("Subject").map { | ||
label => | ||
val normalisedLabel = | ||
NormaliseText(label, whitelist = NormaliseText.none) | ||
|
||
val labelDerivedId = identifierFromText( | ||
label = normalisedLabel, | ||
ontologyType = "Concept" | ||
) | ||
|
||
Subject( | ||
label = normalisedLabel, | ||
concepts = List( | ||
Concept( | ||
id = labelDerivedId, | ||
label = normalisedLabel | ||
) | ||
), | ||
id = labelDerivedId | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters