Class DrugBankReader

java.lang.Object
org.episteme.natural.medicine.loaders.DrugBankReader
All Implemented Interfaces:
ResourceIO<Medication>, ResourceReader<Medication>

public class DrugBankReader extends Object implements ResourceReader<Medication>
Loader for Drug/Medication Database (e.g. DrugBank or similar API).
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • DrugBankReader

      public DrugBankReader()
  • Method Details

    • getCategory

      public String getCategory()
      Description copied from interface: ResourceIO
      Returns the category for grouping. MUST be implemented with I18N support.
      Specified by:
      getCategory in interface ResourceIO<Medication>
      Returns:
      the category name
    • getDescription

      public String getDescription()
      Description copied from interface: ResourceIO
      Returns a short description of this resource handler. MUST be implemented with I18N support.
      Specified by:
      getDescription in interface ResourceIO<Medication>
      Returns:
      the description
    • getResourceType

      public Class<Medication> getResourceType()
      Description copied from interface: ResourceIO
      Returns the type of resource.
      Specified by:
      getResourceType in interface ResourceIO<Medication>
    • getResourcePath

      public String getResourcePath()
      Description copied from interface: ResourceIO
      Returns the base path where this resource is located.
      Specified by:
      getResourcePath in interface ResourceIO<Medication>
    • load

      public Medication load(String resourceId) throws Exception
      Description copied from interface: ResourceReader
      Loads a resource by its identifier.
      Specified by:
      load in interface ResourceReader<Medication>
      Throws:
      Exception
    • fetchById

      public Optional<Medication> fetchById(String id)
      Fetches medication details by Drug ID.
      Parameters:
      id - the DrugBank ID or equivalent
      Returns:
      the medication entry
    • searchByName

      public List<Medication> searchByName(String name)
      Searches drugs by name using the API.
      Parameters:
      name - search term
      Returns:
      list of matching drugs
    • loadFromResource

      public List<Medication> loadFromResource(String resourcePath)
      Loads medications from a JSON resource (dump).
      Parameters:
      resourcePath - classpath to json file
      Returns:
      list of medications
    • getName

      public String getName()
      Description copied from interface: ResourceIO
      Returns the display name of this resource handler. MUST be implemented with I18N support.
      Specified by:
      getName in interface ResourceIO<Medication>
      Returns:
      the display name
    • getLongDescription

      public String getLongDescription()
      Description copied from interface: ResourceIO
      Returns a long description of this resource handler. MUST be implemented with I18N support.
      Specified by:
      getLongDescription in interface ResourceIO<Medication>
      Returns:
      the long description
    • getSupportedVersions

      public String[] getSupportedVersions()
      Description copied from interface: ResourceIO
      Returns the supported versions of the format this reader/writer handles.

      Each implementation MUST override this method to declare which versions of the underlying format are supported. The returned array should contain version strings in the format's standard notation (e.g., "3.0", "2.1", "Level 3 Version 2").

      Examples:

      • MathML: {"3.0", "2.0"}
      • SBML: {"Level 3 Version 2", "Level 3 Version 1", "Level 2 Version 5"}
      • PhyloXML: {"1.10", "1.00"}

      Specified by:
      getSupportedVersions in interface ResourceIO<Medication>
      Returns:
      array of supported version strings, never null (empty array if version-agnostic)