inbo / reporting-rshiny-grofwildjacht

Rshiny app for grofwildjacht
https://grofwildjacht.inbo.be/
MIT License
1 stars 1 forks source link

[BUG] Biotoop beschrijving & linked outputs not available for 2024 #483

Open SanderDevisscher opened 3 weeks ago

SanderDevisscher commented 3 weeks ago

Describe the bug The Biotoop beschrijving & linked outputs like Aantal/100ha, Aantal/100ha bos & natuur, etc... are not advailable for 2024 this while WBE_habitats_2024.csv was uploaded succesfully.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'wbe-dev.inbo.be'
  2. Select a wbe (I chose De Zwarte Beek & Tussen Voer & Yse)
  3. Click on '2024'
  4. Scroll down to 'Biotoop beschrijving' or 'Evolutie gerapporteerd afschot '
  5. See error

Expected behavior A Biotoop beschrijving graph is displayed like for other years. Evolutie gerapporteerd afschot graphs are extended to 2024.

Screenshots Biotoop beschrijving 2024 image Biotoop beschrijving 2023 image

Evolutie gerapporteerd afschot - Aantal image Evolutie gerapporteerd afschot - Aantal/100ha image Evolutie gerapporteerd afschot - Aantal/100ha bos en natuur image

Additional context I've switched from sp to sf in calculating the habitat_lists so maybe a switchup of classes may be the cause.

Git SHA (after 0.3.1) d6d14c6037ed6b3462988acbc0e282f4b8f0ae0f

mvarewyck commented 3 weeks ago

I see the file WBE_habitats_2024.csv is in the bucket, but the file habitatData.RData that is read in the app was not updated:

> tmpTable[tmpTable$Key == "habitatData.RData", "LastModified"]
[1] "2023-11-27T11:20:28.000Z"

So, I tried to create the habitatData.RData using createHabitatData() from my side, with some hickups:

@SanderDevisscher Can you check where/if the file habitatData.RData is updated at the backend?

I used the following code for this:

    bucket <- config::get("bucket", file = system.file("config.yml", package = "reportingGrofwild"))

    # List all available files on the S3 bucket
    tmpTable <- aws.s3::get_bucket_df(bucket = bucket)

    habitatFiles <- grep("habitats|wegdensiteit", tmpTable$Key, value = TRUE)
    for (iFile in habitatFiles)
      save_object(
        object = iFile, 
        bucket = bucket, 
        file = file.path(tempdir(), iFile)
      )

    createHabitatData(dataDir = tempdir(), bucket = bucket)
SanderDevisscher commented 2 weeks ago

Ok makes sense the habitats are not updated using createHabitatData() in the backend. They're uploaded as is to the bucket. I'll implement the necessary changes.