Skip to content

RabbitInAHat fails to load a custom model if BOM is set #411

@BillCM

Description

@BillCM

Describe the bug
I created a custom model in Excel (XLSX) and exported to CSV. This file failed to load and resulted in this error

java.lang.IllegalArgumentException: Mapping for table not found, expected one of [table, field, required, type, schema, description] at org.apache.commons.csv.CSVRecord.get(CSVRecord.java:121) at org.ohdsi.rabbitInAHat.dataModel.Database.generateModelFromCSV(Database.java:117) at org.ohdsi.rabbitInAHat.RabbitInAHatMain.doSetTargetCustom(RabbitInAHatMain.java:465) at org.ohdsi.rabbitInAHat.RabbitInAHatMain.lambda$createMenuBar$9(RabbitInAHatMain.java:268)

The problem is that CSV parsing does not account for the Byte Order Mark (BOM).

To Reproduce
Steps to reproduce the behavior:

  1. Create a custom model in Excel (XLSX)
  2. Export the model to CSV
  3. Use Edit -> Set Target Database -> Load Custom
  4. Select the exported CSV, receive a popup error that the column headers were not found.

Expected behavior
CSV opens correctly.

Workaround
Open the exported CSV in a text editor and change the encoding from "UTF-8 with BOM" to "UTF-8"

Desktop (please complete the following information):

  • OS: OSX 14.4.1
  • Java: 11.0.21
  • Rabbit Version : 10.8a

Additional context
The issue

Metadata

Metadata

Assignees

Labels

Rabbit-In-A-HatIssue concerning the specification of mapping rulesbug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions