FHIR Chat · xml2fsh · shorthand

Stream: shorthand

Topic: xml2fsh


view this post on Zulip ben (Jul 15 2020 at 06:08):

What is the correct fsh code of this XML?

        <!-- field - reverseByteSize -->
        <element id="reverseByteSize-extension-slice">
            <path value="Extension.extension"/>
            <sliceName value="reverseByteSize"/>
            <short value="Reverse file size in bytes"/>
            <min value="0"/>
            <max value="1"/>
        </element>
        <element id="reverseByteSize-extension-uri">
            <path value="Extension.extension.url"/>
            <fixedUri value="reverseByteSize"/>
        </element>
        <element id="reverseByteSize-extension-value">
            <path value="Extension.extension.valueDecimal"/>
            <min value="1"/>
            <type>
                <code value="decimal"/>
            </type>
        </element>

The following is not working:

* extension contains
    reverseByteSize 0..1 and

* extension[reverseByteSize] ^short = "Reverse file size in bytes"
* extension[reverseByteSize].valueNumber only number

view this post on Zulip ben (Jul 15 2020 at 06:10):

not even with Decimal, decimal

view this post on Zulip ben (Jul 15 2020 at 06:12):

@Jose Costa Teixeira can you point me to the right direction?

view this post on Zulip Jose Costa Teixeira (Jul 15 2020 at 06:36):

are you trying to declare or instantiate the extension?

view this post on Zulip ben (Jul 15 2020 at 06:40):

I want to decleare it, here is the full code, what I have:

Extension:      FastqPaired
Id:             FastqPaired
Title:          "Fastq Paired"
Description:    "Represents paired read data generated from sequencing performed on this specimen."

* extension contains
    forward 1..1 MS and
    forwardByteSize 0..1 and
    forwardChecksum 0..1 and
    reverse 1..1 MS and
    reverseByteSize 0..1 and
    reverseChecksum 0..1

* extension[forward] ^short = "Forward read file location"
* extension[forward].valueString only string

* extension[forwardByteSize] ^short = "Forward file size in bytes"
* extension[forwardByteSize].valueNumber only number

* extension[forwardChecksum] ^short = "Forward file MD5 checksum"
* extension[forwardChecksum].valueString only string

* extension[reverse] ^short = "Reverse read file location"
* extension[reverse].valueString only string

* extension[reverseByteSize] ^short = "Reverse file size in bytes"
* extension[reverseByteSize].valueNumber only number

* extension[reverseChecksum] ^short = "Reverse file MD5 checksum"
* extension[reverseChecksum].valueString only string

view this post on Zulip Jose Costa Teixeira (Jul 15 2020 at 07:05):

this is an extension on extension?

view this post on Zulip Jose Costa Teixeira (Jul 15 2020 at 07:06):

so you want your FastqPaired extension to have those other extensions?

view this post on Zulip Nick Freiter (Jul 15 2020 at 12:13):

Instead of doing something like valueString only string, you want to do value[x] only string, since the value[x] element is a choice, and you are constraining it to only be a string. The valueString element is already only a string. Additionally, you do want to use decimal, since that is the name of the type in FHIR. However, I think you've also come across a bug here. I tried to recreate your extension making the changes described above, and it still did not work completely correctly, and it seems the problem I was running into had to do with having multiple slices of extension starting with the same string (in this case "forward" and "reverse"). I was able to fix this by renaming the "reverseByteSize" and "forwardByteSize" extension names:

Id:             FastqPaired
Title:          "Fastq Paired"
Description:    "Represents paired read data generated from sequencing performed on this specimen."

* extension contains
    forward 1..1 MS and
    byteSizeForward 0..1 and
    forwardChecksum 0..1 and
    reverse 1..1 MS and
    byteSizeReverse 0..1 and
    reverseChecksum 0..1

* extension[forward] ^short = "Forward read file location"
* extension[forward].value[x] only string

* extension[byteSizeForward] ^short = "Forward file size in bytes"
* extension[byteSizeForward].value[x] only decimal

* extension[forwardChecksum] ^short = "Forward file MD5 checksum"
* extension[forwardChecksum].value[x] only string

* extension[reverse] ^short = "Reverse read file location"
* extension[reverse].value[x] only string

* extension[byteSizeReverse] ^short = "Reverse file size in bytes"
* extension[byteSizeReverse].value[x] only decimal

* extension[reverseChecksum] ^short = "Reverse file MD5 checksum"
* extension[reverseChecksum].value[x] only string

I think you may have to use a similar workaround until we fix that bug.

view this post on Zulip ben (Jul 15 2020 at 23:28):

thank you @Nick Freiter you saved my day!!!

view this post on Zulip Chris Moesel (Jul 16 2020 at 01:10):

Yeah, @Nick Freiter does that a lot. ;-)

view this post on Zulip ben (Jul 16 2020 at 01:55):

Created an issue: https://github.com/HL7/fhir-shorthand/issues/72


Last updated: Apr 12 2022 at 19:14 UTC