Stream: shorthand
Topic: slicing and incrementing
John Moehrke (May 13 2021 at 16:43):
I may have found a bug in sushi around instances using slicing indexes plus the incremental indexing. That is to say I have used the names of slices to fill some entries, and then wanted to add others and those others overwrote.
John Moehrke (May 13 2021 at 16:43):
Here is the sushi example https://github.com/IHE/ITI.MHD/blob/master/input/fsh/ex-ProvideBundles.fsh
John Moehrke (May 13 2021 at 16:44):
* entry[SubmissionSet].fullUrl = "urn:uuid:593cd04e-b696-45c1-bc32-39e55a340a44"
* entry[SubmissionSet].resource = 593cd04e-b696-45c1-bc32-39e55a340a44
* entry[SubmissionSet].request.url = "List"
* entry[SubmissionSet].request.method = #POST
* entry[Folders].fullUrl = "urn:uuid:593cd04e-b696-45c1-bc32-39e55a340a45"
* entry[Folders].resource = 593cd04e-b696-45c1-bc32-39e55a340a45
* entry[Folders].request.url = "List"
* entry[Folders].request.method = #POST
* entry[DocumentRefs].fullUrl = "urn:uuid:593cd04e-b696-45c1-bc32-39e55a340a46"
* entry[DocumentRefs].resource = 593cd04e-b696-45c1-bc32-39e55a340a46
* entry[DocumentRefs].request.url = "DocumentReference"
* entry[DocumentRefs].request.method = #POST
* entry[+].fullUrl = "urn:uuid:593cd04e-b696-45c1-bc32-39e55a340a49"
* entry[=].resource = 593cd04e-b696-45c1-bc32-39e55a340a49
* entry[=].request.url = "Patient"
* entry[=].request.method = #POST
John Moehrke (May 13 2021 at 16:45):
the [+] operation seems to have not indexed beyond the previous populated entries... so the Patient resource got put into the first slot, overwriting the SubmissionSet
Elliot Silver (May 13 2021 at 16:56):
I recall seeing discussion of something similar, and I think a release addressing it, where [+] assumed it was starting from 0, rather than grab the next available index.
Chris Moesel (May 13 2021 at 17:41):
We have fixed some things around [+]
in recent releases, but... I don't remember addressing this specific use case. TBH, I'm not sure we've specified what the behavior should be in this case. I think that what you expect, @John Moehrke, seems like the intuitive approach -- so I'd lean toward implementing it that way (assuming it is still broken).
For now, you might need to explicitly set that first index (after the slices) to a an explicit number. Then after that you can use [+]
to increment the index. @Julian Carter -- what do you think?
John Moehrke (May 13 2021 at 17:53):
I have sushi 1.3.2
John Moehrke (May 13 2021 at 17:54):
ah, so where I have the [+], I could have put [4], and from that point could use [=] and [+]?
John Moehrke (May 13 2021 at 17:59):
another question related.... in my example there can be many "DocumentRefs"... how do I do multiple instances of the same slice?
John Moehrke (May 13 2021 at 20:32):
John Moehrke said:
another question related.... in my example there can be many "DocumentRefs"... how do I do multiple instances of the same slice?
figured the indexing multiple slices out
* entry[DocumentRefs][+].fullUrl = "urn:uuid:593cd04e-b696-45c1-bc32-39e55a340a46"
* entry[DocumentRefs][=].resource = 593cd04e-b696-45c1-bc32-39e55a340a46
* entry[DocumentRefs][=].request.url = "DocumentReference"
* entry[DocumentRefs][=].request.method = #POST
* entry[DocumentRefs][+].fullUrl = "urn:uuid:593cd04e-b696-45c1-bc32-39e55a340a47"
* entry[DocumentRefs][=].resource = 593cd04e-b696-45c1-bc32-39e55a340a47
* entry[DocumentRefs][=].request.url = "DocumentReference"
* entry[DocumentRefs][=].request.method = #POST
Last updated: Apr 12 2022 at 19:14 UTC