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

Error Populating Slices on Observation.component #122

Closed
markkramerus opened this issue Jan 22, 2020 · 7 comments · Fixed by #137
Closed

Error Populating Slices on Observation.component #122

markkramerus opened this issue Jan 22, 2020 · 7 comments · Fixed by #137
Assignees
Labels
bug Something isn't working released Available in an official SUSHI release

Comments

@markkramerus
Copy link
Collaborator

The CancerGeneticVariant profile needs to slice Observation.component. SUSHI seems to be OK with populating the slices in-line, but the IG Publisher crashes with this message:

Caused by: org.hl7.fhir.exceptions.DefinitionException: Attempt to a slice an element that does not repeat: Observation.component.code/Observation.component.code from http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab in http://hl7.org/fhir/us/mcode/StructureDefinition/CancerGeneticVariant

The offending lines are currently commented out so we can build the IG, but look for these lines in CancerGenomics.fsh:

* component[GeneStudied] ^short = "Gene studied [ID]"
* component[GeneStudied].code = LNC#48018-6
* component[GeneStudied].value[x] only CodeableConcept
* component[GeneStudied].valueCodeableConcept 1..1
* component[GeneStudied].valueCodeableConcept from http://www.genenames.org/geneId (extensible)
* component[VariationCode] ^short = "Discrete genetic variant"
* component[VariationCode].code = LNC#81252-9
* component[VariationCode].value[x] only CodeableConcept
etc.
@cmoesel
Copy link
Member

cmoesel commented Jan 22, 2020

I'm not sure if this is it, but this:

* component ^slicing.discriminator.type = #value

should probably be:

* component ^slicing.discriminator.type = #pattern

@cmoesel
Copy link
Member

cmoesel commented Jan 22, 2020

That doesn't fix it. This feels like a Publisher error to me. Aside from the discriminator type, I don't see anything wrong with this -- and I certainly don't see any cases of trying to slice Observation.component.code.

@markkramerus
Copy link
Collaborator Author

markkramerus commented Jan 22, 2020

What is the next step on this? It's pretty serious if we can't slice Observation.component. It is extremely common thing to do. If it were the IG Publisher, it wouldn't have gone unnoticed.

@cmoesel
Copy link
Member

cmoesel commented Jan 22, 2020

Ideally we'd post a message to Zulip and ask if anyone has any idea what's going on. That said, it's harder without being able to point to IG source that they understand (not FSH). We should consider pushing up fsh-mcode IGs on a branch of the HL7 mCODE repo.

While I understand your point about it going unnoticed, the publisher is changing all the time -- and sometimes with unintended consequences. If this is a bug that was introduced in last night's build, it might go unnoticed.

Either way, I just don't see anything wrong with it, so I could use some extra eyes on it.

@cmoesel
Copy link
Member

cmoesel commented Jan 23, 2020

We figured this out due to some good (tedious) debugging from @markkramerus. Here is a fuller picture of the FSH in question:

* component contains
    GeneStudied 0..* MS and
    VariationCode 0..* MS and
    GenomicDNAChange 0..1 MS and
    GenomicSourceClass 0..1 MS and
    AminoAcidChange 0..1 MS and
    AminoAcidChangeType 0..1 MS and
    CytogeneticLocation 0..* MS and
    CytogeneticNomenclature 0..1 MS
* component[GeneStudied] ^short = "Gene studied [ID]"
* component[GeneStudied].code = LNC#48018-6
* component[GeneStudied].value[x] only CodeableConcept
* component[GeneStudied].valueCodeableConcept 1..1
* component[GeneStudied].valueCodeableConcept from http://www.genenames.org/geneId (extensible)
* component[VariationCode] ^short = "Discrete genetic variant"
* component[VariationCode].code = LNC#81252-9
* component[VariationCode].value[x] only CodeableConcept
* component[VariationCode].valueCodeableConcept 1..1
* component[VariationCode].valueCodeableConcept from http://www.ncbi.nlm.nih.gov/clinvar (preferred)
* component[GenomicDNAChange] ^short = "Genomic DNA change (gHGVS)"
* component[GenomicDNAChange].code = LNC#81290-9
* component[GenomicDNAChange].value[x] only CodeableConcept
* component[GenomicDNAChange].valueCodeableConcept 1..1
* component[GenomicDNAChange].valueCodeableConcept from http://varnomen.hgvs.org (required)
* component[GenomicSourceClass] ^short = "Genomic source class [Type]"
* component[GenomicSourceClass].code = LNC#48002-0
* component[GenomicSourceClass].value[x] only CodeableConcept
* component[GenomicSourceClass].valueCodeableConcept 1..1
* component[GenomicSourceClass].valueCodeableConcept from http://fhir.loinc.org/vs/LL378-1 (required)
* component[AminoAcidChange] ^short = "Amino acid change (pHGVS)"
* component[AminoAcidChange].code = LNC#48005-3
* component[AminoAcidChange].value[x] only CodeableConcept
* component[AminoAcidChange].valueCodeableConcept 1..1
* component[AminoAcidChange].valueCodeableConcept from http://varnomen.hgvs.org (required)
* component[AminoAcidChangeType] ^short = "Amino acid change [Type]"
* component[AminoAcidChangeType].code = LNC#48006-1
* component[AminoAcidChangeType].value[x] only CodeableConcept
* component[AminoAcidChangeType].valueCodeableConcept 1..1
* component[AminoAcidChangeType].valueCodeableConcept from http://fhir.loinc.org/vs/LL380-7 (required)
* component[CytogeneticLocation] ^short = "Cytogenetic (chromosome) location"
* component[CytogeneticLocation].code = LNC#48001-2
* component[CytogeneticLocation].value[x] 1..1 // CG Reporting IG does not constrain the CytogeneticLocation value type.
* component[CytogeneticNomenclature] ^short = "Variant ISCN"
* component[CytogeneticNomenclature].code = LNC#81291-7
* component[CytogeneticNomenclature].value[x] 1..1 // CG Reporting IG does not constrain the CytogeneticLocation value type.

The culprits are the AminoAcidChange and AminoAcidChangeType slices. If you comment out either one, everything works fine. When they're both present, the IG Publisher crashes. Looking at the generated StructureDefinition, the elements are being generated out of order. The problem is when you get to the AminoAcidChange element. You see something like this order:

Observation.component:AminoAcidChange
// NOTE: the Observation.component:AminoAcidChange.* children SHOULD be here but aren't
Observation.component:AminoAcidChangeType
Observation.component:AminoAcidChangeType.id
// etc, Observation.component:AminoAcidChangeType.*
// NOTE: now we find the Observation.component:AminoAcidChange.* children, in the wrong place
Observation.component:AminoAcidChange.id
// etc, Observation.component:AminoAcidChange.*

when it should be:

Observation.component:AminoAcidChange
Observation.component:AminoAcidChange.id
// etc, Observation.component:AminoAcidChange.*
Observation.component:AminoAcidChangeType
Observation.component:AminoAcidChangeType.id
// etc, Observation.component:AminoAcidChangeType.*

It appears that this happens because AminoAcidChange is a substring of AminoAcidChangeType. So whatever function is trying to find where to unfold those AminoAcidChange elements must be using a substring function that is resulting in unfolding into the wrong place.

@cmoesel cmoesel self-assigned this Jan 24, 2020
@cmoesel cmoesel added the bug Something isn't working label Jan 24, 2020
cmoesel added a commit that referenced this issue Jan 24, 2020
In cases where the element id is a substring of another element id (but the same number of parts), it was possible for the element to be placed in the wrong location (after the element with the id its own id is a substring of).  This fixes that.

Fixes #122
kjmahalingam pushed a commit that referenced this issue Jan 24, 2020
In cases where the element id is a substring of another element id (but the same number of parts), it was possible for the element to be placed in the wrong location (after the element with the id its own id is a substring of).  This fixes that.

Fixes #122
@cmoesel cmoesel added the merged label Jan 24, 2020
@cmoesel
Copy link
Member

cmoesel commented Jan 24, 2020

Re-opening until it is released

@cmoesel cmoesel reopened this Jan 24, 2020
@cmoesel
Copy link
Member

cmoesel commented Jan 24, 2020

Fixed in 0.6.2

@cmoesel cmoesel closed this as completed Jan 24, 2020
@cmoesel cmoesel added the released Available in an official SUSHI release label Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Available in an official SUSHI release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants