Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extraction API integrieren #1546

Open
7 tasks
tschumpr opened this issue Sep 26, 2024 · 2 comments
Open
7 tasks

Extraction API integrieren #1546

tschumpr opened this issue Sep 26, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@tschumpr
Copy link
Contributor

tschumpr commented Sep 26, 2024

  • Extraction-API in unsere Entwicklungsumgebung einbinden
  • TODO in LabelingPanel (triggerDataExtraction -> catch) anschauen: Werden alle Fehler korrekt dargestellt?
    • Konkrete Fehler wie "Coordinate not found." müssen auch so angezeigt werden (Translations ergänzen)
    • Allgemeine Fehler ebenfalls handlen
  • e2e-Test "can extract data from image" in labeling.cy.js aktivieren (setzt voraus, dass Zeichnen bei bereits geöffnetem Panel funktioniert nicht #1545 behoben ist)
    • Test-Expectations für Koordinaten anpassen (sollen nun mit Nachkommastellen kommen)
    • Test flicken: pointer-Tiggers nach Rotieren&Zoom funktioniert nicht und evt. brauchts noch Anpassungen damit der Test in der CI läuft

--> Alle TODOs sind im Code mit TODO: https://github.com/swisstopo/swissgeol-boreholes-suite/issues/1546 markiert

@tschumpr tschumpr added this to the AI Integration milestone Sep 26, 2024
@tschumpr tschumpr added the enhancement New feature or request label Sep 26, 2024
@tschumpr
Copy link
Contributor Author

Das Extraction-API konnte lokal mit folgenden Anpassungen eingebunden werden. Inzwischen gabe es noch Anpassungen, weshalb evt. nicht mehr alle Schritte notwendig sind:

  • Repo auschecken und folgende Anpassungen im Code machen (evt. inzwischen veraltet)

config.py

# TODO: check how this is used on the VM
aws_access_key_id: str = os.environ.get("AWS_ACCESS_KEY_ID")
aws_secret_key_access: str = os.environ.get("AWS_SECRET_ACCESS_KEY")
# aws_session_token = os.environ.get("AWS_SESSION_TOKEN")
aws_endpoint: str = os.environ.get("AWS_ENDPOINT")

aws.py

# Initialize the S3 client
# AWS S3 Configuration
s3_client = boto3.client(
    "s3",
    endpoint_url=config.aws_endpoint,
    aws_access_key_id=config.aws_access_key_id,
    aws_secret_access_key=config.aws_secret_key_access,
)

...

# -> filename war hier (und an diversen anderen Stellen) als path drin, wird aber als string erwartet
def load_data_from_aws(filename: str, prefix: str = "") -> bytes:
    key = f"{prefix}/{filename}" if prefix else f"{filename}"
    try:
        png_object = s3_client.get_object(Bucket=config.bucket_name, Key=key)
    except s3_client.exceptions.NoSuchKey:
        raise HTTPException(
            status_code=404,
            detail=f"Document {key} not found in S3 bucket.", # -> {prefix + filename} ist nicht valid
        ) from None
  • Image mit docker build -t borehole-api . -f Dockerfile erstellen
  • docker-compose.yml mit folgendem Code ergänzen:
  dataextraction:
    image: borehole-api
    restart: unless-stopped
    ports:
      - 8000:8000
    environment:
      AWS_ENDPOINT: http://minio:9000
      AWS_ACCESS_KEY_ID: REDSQUIRREL
      AWS_SECRET_ACCESS_KEY: YELLOWMONKEY
      AWS_S3_BUCKET: "cannonflea"

@MiraGeowerkstatt
Copy link
Contributor

Mit der aktuellen Version des Dockerimages musste ich die Anpassung filename: Path => filename: str nicht mehr vornehmen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants