Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve Value Order of Multi-Valued Elements #15

Closed
alexanderkiel opened this issue Jun 10, 2019 · 5 comments
Closed

Preserve Value Order of Multi-Valued Elements #15

alexanderkiel opened this issue Jun 10, 2019 · 5 comments
Assignees
Milestone

Comments

@alexanderkiel
Copy link
Member

alexanderkiel commented Jun 10, 2019

In JSON multi-values elements are represented by lists. That lists have an order. In Datomic multi-values elements are sets. We have to create our own list implementation here to revere order. Also keep an eye on performance.

For most data elements the order of its values has no meaning. Only in case ElementDefinition.orderMeaning is present, the order has a meaning. So we might mostly ok with not preserving the order. But for example HumanName.given has an orderMeaning.

@dspiteself
Copy link

Currently for HumanName.given we make it cardinality 1 and use a ascii null as a separator. Then we split and join as it gets to the edge of the database.
We were planning to use homogeneous-tuples for some cases and a tuple with order and value for other cases.

@alexanderkiel
Copy link
Member Author

In R4 there are only 5 data elements with an orderMeaning:

Element Data Type orderMeaning
Address.line string The order in which lines should appear in an address label
HumanName.given string Given Names appear in the correct order for presenting the name
HumanName.prefix string Prefixes appear in the correct order for presenting the name
HumanName.suffix string Suffixes appear in the correct order for presenting the name
Bundle.entry BackboneElement For bundles of type 'document' and 'message', the first resource is special (must be Composition or MessageHeader respectively). For all bundles, the meaning of the order of entries depends on the bundle type

I expected more. Do I miss some? So we have only two cases, string typed elements and the Bundle.entry element.

FHIR discourages one from using the null char in strings:

Strings SHOULD not contain Unicode character points below 32, except for u0009 (horizontal tab), u0010 (carriage return) and u0013 (line feed).

So the use of the null char as separator is a valid idea.

Using tuples with order and value might be a good fit for Bundle.entry. But we can't use tuples in the Free edition. I don't really need to store bundles for my use cases.

Independent of orderMeaning there is the value set List Order Codes which also gives order meaning to List.entry, Composition.section.entry and others. What should be do here? I'll ask in the FHIR chat whether orderMeaning should be present for that elements.

@alexanderkiel
Copy link
Member Author

Thread in #implementers is here.

@dspiteself
Copy link

you can do an :order attribute if the type was a :db.type/ref like bundle

@alexanderkiel
Copy link
Member Author

Is solved by switching to RocksDB.

@alexanderkiel alexanderkiel self-assigned this Jun 2, 2020
@alexanderkiel alexanderkiel added this to the v0.8 milestone Jun 2, 2020
@alexanderkiel alexanderkiel modified the milestones: v0.8, v0.8-beta.3 Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants