Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/models/entities/Drug.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import utils.db.DbJsonParser.fromPositionedResult

case class DrugReferences(source: String, ids: Seq[String])

case class DrugLabelAndSource(label: String, source: String)

case class Drug(
id: String,
name: String,
synonyms: Seq[String],
tradeNames: Seq[String],
synonyms: Seq[DrugLabelAndSource],
tradeNames: Seq[DrugLabelAndSource],
childChemblIds: Option[Seq[String]], // Gone?
drugType: String,
crossReferences: Option[Seq[DrugReferences]],
Expand All @@ -23,6 +25,7 @@ case class Drug(
object Drug {
implicit val getResult: GetResult[Drug] = GetResult(fromPositionedResult[Drug])
implicit val DrugXRefImpW: OFormat[DrugReferences] = Json.format[DrugReferences]
implicit val drugLabelAndSourceImpF: OFormat[DrugLabelAndSource] = Json.format[DrugLabelAndSource]
implicit val drugImplicitR: Reads[Drug] = Json.reads[Drug]
implicit val drugImplicitW: OWrites[Drug] = Json.writes[Drug]
}
17 changes: 15 additions & 2 deletions app/models/gql/Objects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1646,14 +1646,27 @@ object Objects extends OTLogging {
DocumentField("year", "Year when the warning was issued")
)

implicit val drugLabelAndSourceImp: ObjectType[Backend, DrugLabelAndSource] =
deriveObjectType[Backend, DrugLabelAndSource](
ObjectTypeDescription("Label with source information"),
DocumentField("label", "Label value (e.g., synonym, symbol)"),
DocumentField("source", "Source database of the label")
)

implicit lazy val drugImp: ObjectType[Backend, Drug] = deriveObjectType[Backend, Drug](
ObjectTypeDescription(
"Core annotation for drug or clinical candidate molecules. A drug in the platform is understood as any bioactive molecule with drug-like properties included in the EMBL-EBI ChEMBL database. All ChEMBL molecules fullfilling any of the next criteria are included in the database: a) Molecules with a known indication. b) Molecules with a known mechanism of action c) ChEMBL molecules included in the DrugBank database d) Molecules that are acknowledged as chemical probes"
),
DocumentField("id", "Drug or clinical candidate molecule identifier"),
DocumentField("name", "Generic name of the drug molecule"),
DocumentField("synonyms", "List of alternative names for the drug"),
DocumentField("tradeNames", "List of brand names for the drug"),
DocumentField(
"synonyms",
"List of alternative names for the drug, each with its source (e.g. ChEMBL, or AACT for names mined from clinical trials)"
),
DocumentField(
"tradeNames",
"List of brand names for the drug, each with its source"
),
DocumentField(
"drugType",
"Classification of the molecule's therapeutic category or chemical class (e.g. Antibody)"
Expand Down
Loading