nilanjanchatterjee / move_summary

Summary of the movement dataset downloaded from movebank
MIT License
0 stars 2 forks source link

Sensor_type_id not intuitive to user #5

Open aklohr opened 6 months ago

aklohr commented 6 months ago

When running the new move2 version of this app, I noticed the sensor type attribute uses "sensor_type_id", which is a numerical value that is not immediately intuitive to the user (probably corresponds to the various sensor types in the backend of the Movebank database). image

The previous version of the app displayed the actual sensor type, e.g. 'GPS'. image

Is it possible to change this from a numerical ID to the actual sensor type so users can more easily tell which sensors are being used in the output?

sarahcd commented 5 months ago

@smthfrmn @andreakoelzsch any tips on how to find the sensor name in the move2 object?

It looks like the graphic is showing the sensor_type_id from the move2 object. This should be translated to the name (sensor_type_name??). Using Movebank's REST API you can see the translation between the numbers ("id") and names ("name") here. The request is https://www.movebank.org/movebank/service/direct-read?entity_type=tag_type

I would think this is joined somewhere in the move2 object.

smthfrmn commented 5 months ago

@sarahcd @nilanjanchatterjee okay so the issue is here that we are pulling sensor_type_id from the events data on the move2 object, which gives the internal number object. If instead we pull sensor_type_ids from the track_data, I think we'll get what we're looking for.

For example:

> head(data$sensor_type_id)
integer64
[1] 653 653 653 653 653 653
> head(mt_track_data(data)$sensor_type_ids)
[1] "gps" "gps" "gps" "gps" "gps" "gps"
sarahcd commented 5 months ago

Thanks, this would work! I think the object has the external_id (better for coding) rather than the name (better for display). I wonder how we got the name ("GPS" rather than "gps") before?

image

smthfrmn commented 5 months ago

We can use the package snakecase, but will have to handle the gps case specially because it needs to be all caps:

> library(snakecase)
> snakecase::to_title_case("radio-transmitter")
[1] "Radio Transmitter"
> snakecase::to_title_case("solar-geolocator-twilight")
[1] "Solar Geolocator Twilight"