microsoft / fhir-server

A service that implements the FHIR standard
MIT License
1.2k stars 516 forks source link

Enum conversion is inconsistent between data storage types #1181

Closed LTA-Thinking closed 4 years ago

LTA-Thinking commented 4 years ago

Describe the bug When enums are stored in SQL they can be a different value than when stored in Cosmos DB

To Reproduce In the EnumLiteralJsonConverter.cs the FHIR Utility method GetLiteral is used to try to get a value for an enum in JSON data. This converter is used in the SQL data store, but not in the Cosmos DB data store. The GetLiteral method will attempt to map an enum value to its linked primitive value if it has one, while Cosmos DB persists the string representation of the enum value's name.

Expected behavior The two data stores have the same data persisted.

Actual behavior In SQL the value could be parsed to a primitive value, while in Cosmos DB the name of the enum value is persisted.

An additional question is whether we should be using the GetLiteral method from the FHIR Utility for non-FHIR enums. While the method is written to work on non-FHIR enums, it will error on enums set up in certain ways (most notably those without a 1 to 1 mapping).

CaitlinV39 commented 4 years ago

closing a we won't prioritize this right now.