Length data export doesn't always work
Expected Behavior Export generates all fields, regardless of filters used
Current Behavior What I have learned so far: searching for encounters assigned to user "crohner" yields encounter results with encounters such as 7db29b97-5b11-48ef-98a9-e6bfd1bb8a1e. When you export the standard format, you see metrics such as length.
HOWEVER, when you search for encounters with a location keyword, "Mafia", which also has the same encounter 7db29b97-5b11-48ef-98a9-e6bfd1bb8a1e, the length column is missing.
Community Link https://community.wildme.org/t/length-data-not-exporting-in-certain-cases-on-whale-shark/1041/13 https://community.wildme.org/t/length-estimates-missing-from-sharkbook-data-export/4794
I have more detail for this ticket, and it affects EncounterAnnotationExportExcelFile and EncounterSearchExportMetadataExcel.
There are a few reasons this has been tricky to pin down.
- EncounterAnnotationExportExcelFile and EncounterSearchExportMetadataExcel use two different libraries to render Excel data, with EncounterAnnotationExportExcelFile using the more modern version.
- Measurements are exported after MediaAssets.
- High numbers of media assets on Encounters can cause the sheer number of columns exported to hit an upper limit (256 for EncounterSearchExportMetadataExcel) and theoetically 16k for EncounterAnnotationExportExcelFile but this export adds annotations as well)
The net result is that for some exports the code will get through all the media assets and have room for Measurements. For other exports, the code errors out when it hits the column limit and has no room for measurement columns.
My recommendation is:
- Export MediaAssets last and move Measurement blocks before media assets to ensure they get exported.
- Migrate EncounterSearchExportMetadataExcel to the newer Apache POI library for more columns (and fewer code dependencies)
- OR switch to CSV to export everything without column limits.