Skip to content

Commit

Permalink
Surfacing annotaiton group ID in CSV download
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimon committed Jan 19, 2022
1 parent 9c97ae1 commit d1078df
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ trait AnnotationsToCSV extends BaseSerializer with HasCSVParsing {

val placeTypes = maybePlace.map(_.subjects.map(_._1).mkString(","))

val groupId = a.bodies.find(_.hasType == AnnotationBody.GROUPING).flatMap(_.value)

// Helper to surface either the tag URI (if available) or the label otherwise
def tagLabelsOrURIs(): Seq[String] =
getTagBodies(a).flatMap(body => Seq(body.uri, body.value).flatten.headOption)
Expand All @@ -136,7 +138,8 @@ trait AnnotationsToCSV extends BaseSerializer with HasCSVParsing {
maybePlace.map(_.subjects.map(_._1).mkString(",")).getOrElse(EMPTY),
firstEntity.flatMap(_.status.map(_.value.toString)).getOrElse(EMPTY),
tagLabelsOrURIs().mkString("|"),
getCommentBodies(a).flatMap(_.value).mkString("|"))
getCommentBodies(a).flatMap(_.value).mkString("|"),
groupId.getOrElse(EMPTY))
}

val fAnnotationsByPart = Future.sequence {
Expand Down Expand Up @@ -224,7 +227,8 @@ trait AnnotationsToCSV extends BaseSerializer with HasCSVParsing {
"PLACE_TYPE",
"VERIFICATION_STATUS",
"TAGS",
"COMMENTS")
"COMMENTS",
"GROUP_ID")

val tmp = tmpFile.create(Paths.get(TempDir.get(), s"${UUID.randomUUID}.csv"))
val underlying = tmp.path.toFile
Expand Down

0 comments on commit d1078df

Please sign in to comment.