Skip to content

feat(drug): expose synonyms/tradeNames as {label, source}#349

Merged
remo87 merged 2 commits into
masterfrom
drug-synonyms-label-source
Jun 17, 2026
Merged

feat(drug): expose synonyms/tradeNames as {label, source}#349
remo87 merged 2 commits into
masterfrom
drug-synonyms-label-source

Conversation

@d0choa

@d0choa d0choa commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Propagate the drug_molecule schema change into the API. synonyms and tradeNames changed from array<string> to array<struct<label, source>> (opentargets/pts#142, tracking issue opentargets/issues#4414), and the POS ClickHouse drug table now stores Array(Tuple(label String, source String)) (opentargets/pos#130). The API must read and expose the new shape.

What changed

  • app/models/entities/Drug.scalasynonyms/tradeNames: Seq[String]Seq[LabelAndSource] (the existing type Target already uses), plus an import for its JSON OFormat. The ClickHouse read path (fromPositionedResult) parses each row as JSON via Reads[Drug]; ClickHouse emits a named Tuple(label, source) as a {label, source} object, exactly how crossReferences (Tuple(source, ids)) already deserializes.
  • app/models/gql/Objects.scala — the Drug GraphQL type is deriveObjectType, so the synonyms/tradeNames field type auto-updates to [LabelAndSource] (which already has a documented ObjectType exposing label/source). The two DocumentField descriptions are updated to describe the provenance — mirroring the schema documentation added in ot_croissant (feat: document drug_molecule synonyms/tradeNames {label, source} subfields ot_croissant#47):
    • synonyms → "List of alternative names for the drug, each with its source (e.g. ChEMBL, or AACT for names mined from clinical trials)"
    • tradeNames → "List of brand names for the drug, each with its source"

No resolver, search, or other code references drug synonyms/tradeNames as strings (verified), so this is the whole change.

GraphQL impact

synonyms/tradeNames change from [String] to [LabelAndSource] ({ label source }). This is a breaking change for clients that select these as scalars — consumers must now request the subfields. It matches how Target.synonyms is already exposed, and lands with the new data in the 26.06 run.

Note

Based on master. I could not run sbt compile locally (this environment only has Java 17; the project targets Java 21 via sdkman) — the change is a direct reuse of the established LabelAndSource pattern, so CI compilation is the verification.

drug_molecule's `synonyms` and `tradeNames` changed from array<string> to
array<struct<label, source>> (opentargets/pts#142, tracking opentargets/issues#4414),
and the POS ClickHouse drug table now stores Array(Tuple(label, source))
(opentargets/pos#130).

Read both as Seq[LabelAndSource] (the existing type Target already uses) — the
ClickHouse JSON read path parses the named tuple as a {label, source} object, the
same way crossReferences (Tuple(source, ids)) already works. The Drug GraphQL type
is derived, so the field type auto-updates to [LabelAndSource]; the synonyms/
tradeNames field docs are updated to describe the provenance.
@remo87 remo87 merged commit 01b0306 into master Jun 17, 2026
2 checks passed
@remo87 remo87 deleted the drug-synonyms-label-source branch June 17, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants