Proposed Solution to Mappings
For the sake of making the argument easy to understand, I decided to represent the data as simple maps and assert facts about them based on what we know. If I'm assuming something that I'm not sure about then I marked them, so we can verify or investigate them separately.
For this to work let's forget about MedicationRequest, R3, R4, etc. All we care about is the raw data (like json) and the type after decoding it.
For example, a
STU3 version can be represented as type
A. Mixing the actual resource name with its version only
makes understanding the problem harder without any contribution to the solution.
Raw data and Profile
Here is an example of an input data: