Skip to content
Open
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
11 changes: 11 additions & 0 deletions duui-taxon-resolver/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### IDE Files ###
.idea/
.vscode/

### Java Environment ###
target/

### Python Environment ###
__pycache__/
*.pyc
.venv/
21 changes: 21 additions & 0 deletions duui-taxon-resolver/DOCKERFILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.12.3

WORKDIR /app

RUN pip install --upgrade pip

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY src/main/python/*.py ./
COPY src/main/lua/communication_layer.lua ./
COPY src/main/resources/typesystem.xml ./

# Preload the backbone data to avoid doing it at runtime when the first request arrives
RUN python -c "import taxref_loader; taxref_loader.preload_backbone()"

ENV TAXON_RESOLVER_EXECUTION_MODE=production

EXPOSE 9714
ENTRYPOINT ["uvicorn", "taxon-resolver:app", "--host", "0.0.0.0", "--port", "9714"]
CMD ["--workers", "1"]
29 changes: 29 additions & 0 deletions duui-taxon-resolver/docker_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail

# set default values for build args if not provided
ANNOTATOR_NAME="${ANNOTATOR_NAME:-duui-taxon-resolver}"
ANNOTATOR_VERSION="${ANNOTATOR_VERSION:-1.0.0}"
LOG_LEVEL="${LOG_LEVEL:-INFO}"

# Check if BUILD_TOOL is set, otherwise check for podman or docker
if [ -n "${BUILD_TOOL:-}" ]; then
echo "⚙️ Using build tool: ${BUILD_TOOL}"
# Test if docker is available and can be used
elif (command -v docker > /dev/null 2>&1;) && (docker info > /dev/null 2>&1;) then
BUILD_TOOL="docker"
echo "⚙️ Using Docker as build tool"
elif (command -v podman > /dev/null 2>&1;) && (podman info > /dev/null 2>&1;) then
BUILD_TOOL="podman"
echo "⚙️ Using Podman as build tool"
else
echo "❌ Error: No build tool found or permissions missing. Please install Docker or Podman and ensure you have permission to run it."
exit 1
fi

${BUILD_TOOL} build \
--env TAXON_RESOLVER_ANNOTATOR_NAME="${ANNOTATOR_NAME}" \
--env TAXON_RESOLVER_ANNOTATOR_VERSION="${ANNOTATOR_VERSION}" \
--env TAXON_RESOLVER_LOG_LEVEL="${LOG_LEVEL}" \
-t "${ANNOTATOR_NAME}:${ANNOTATOR_VERSION}" \
-f DOCKERFILE \
94 changes: 94 additions & 0 deletions duui-taxon-resolver/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.texttechnologylab</groupId>
<artifactId>taxon-resolver</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<ttlab.duui.version>1.5.5</ttlab.duui.version>
<ttlab.typesystem.version>3.0.14</ttlab.typesystem.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>
--illegal-access=permit
--add-opens java.base/java.util=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>
--illegal-access=permit
--add-opens java.base/java.util=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies><dependency>
<groupId>com.github.texttechnologylab</groupId>
<artifactId>DockerUnifiedUIMAInterface</artifactId>
<version>${ttlab.duui.version}</version>
<exclusions>
<exclusion>
<groupId>com.github.texttechnologylab</groupId>
<artifactId>UIMATypeSystem</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.github.texttechnologylab</groupId>
<artifactId>UIMATypeSystem</artifactId>
<version>${ttlab.typesystem.version}</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>6.1.0-M1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.dkpro.core</groupId>
<artifactId>dkpro-core-io-xmi-asl</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
14 changes: 14 additions & 0 deletions duui-taxon-resolver/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
annotated-types==0.7.0
anyio==3.7.1
attrs==25.4.0
fastapi==0.104.1
ipykernel==7.2.0
pandas==3.0.3
pydantic==2.13.4
pydantic-settings==2.0.3
python-dotenv==1.2.2
requests==2.34.2
# Taxoniq resolves NCBI taxonomic identifiers
taxoniq==1.0.3
urllib3==2.6.3
uvicorn==0.46.0
Loading