Closed bwalsh closed 4 years ago
My workaround for now is:
* extension[attachments][0].valueReference = Reference(DRSAttachmentExample)
The path:
* extension[attachments][0]
will get you to the AnvilDocumentReference
extension. As far as I can tell, this extension does not have any sub-extensions:
Extension: AnvilDocumentReference
Id: anvil-document-reference
Title: "AnVIL document reference"
Description: "An association to a document."
* value[x] only DRSAttachment
It has a value[x]
being set. So you would want a path to be something like:
* extension[attachments][0].value<DataType>
But I'm not sure I know what replaces <DataType>
there. That depends on what DRSAttachment
is. Is DRSAttachment
a profile on Attachment
? If that is the case I think the path you would want is:
* extension[attachments][0].valueAttachment
@ngfreiter Thanks for responding over the weekend!
The statement .value<DataType>
was insightful. I didn't gather that from the docs. As I learn more perhaps I'll create a PR for the docs...
Anyway, still not quite there: A complete example.
Profile: DRSAttachment
Parent: Attachment
Id: drs-attachment
Title: "DRS Attachment"
Description: "A FHIR Attachment extended with DRS Object attributes."
// simplification ... lets just make title mandatory
* title 1..1
Instance: DRSAttachmentExample
InstanceOf: DRSAttachment
Description: "An example representation of a DRSAttachment"
* title = "magna carta"
Extension: AnvilAttachment
Id: anvil-attachment
Title: "AnVIL attachment instance"
Description: "An association to an attachment."
* value[x] only DRSAttachment
Profile: AnvilResearchStudy
Parent: ResearchStudy
Id: anvil-research-study
Title: "AnVIL ResearchStudy"
Description: "An AnVIL ResearchStudy."
* extension contains
AnvilAttachment named attachments 0..*
Instance: AnvilResearchStudyExample
InstanceOf: AnvilResearchStudy
Description: "An example representation of an AnvilResearchStudy"
* id = "any-project-id"
* title = "my-project-title"
* status = #active
// * extension[attachments][0].valueAttachment = DRSAttachmentExample
// Cannot fix Attachment value: DRSAttachmentExample. Value does not match element type: Attachment
// * extension[attachments][0].valueAnvilAttachment = DRSAttachmentExample
// Cannot resolve element from path: extension[attachments].valueAnvilAttachment
// * extension[attachments][0].valueDRSAttachment = DRSAttachmentExample
// Cannot resolve element from path: extension[attachments].valueDRSAttachment
PRs are always welcome, and thanks for the detailed report!
It looks like you are now bumping up against a limitation of SUSHI. The first line:
* extension[attachments][0].valueAttachment = DRSAttachmentExample
is the line you would want to use, but if you use that line (with the latest version of SUSHI, 0.12.3), you should see an error that is a little more clear than the one you are getting, which says:
Instance DRSAttachmentExample of type Attachment is not an Instance of a Resource or Profile of a Resource. Only Instances of Resources or Profiles of Resources may be assigned to other Instances.
As the error states, SUSHI does not currently support setting Instances of non-Resources (such as Attachment) onto other Instances. We plan to remove this limitation at some point, but for now, you would have to set the values directly on the AnvilResearchStudyExample
Instance as follows:
Instance: AnvilResearchStudyExample
InstanceOf: AnvilResearchStudy
Description: "An example representation of an AnvilResearchStudy"
* id = "any-project-id"
* title = "my-project-title"
* status = #active
* extension[attachments][0].valueAttachment.title = "magna carta"
You should be able to set any field in Attachment
using the approach shown on the last line, but replacing title
with the name of the desired field.
This was fixed by #464
Problem
Following guide https://build.fhir.org/ig/HL7/fhir-shorthand/reference.html#extension-paths and comments in #108 and #136
All attempts to access the sub-extension fail with
Cannot resolve element from path:
See AnvilResearchStudyExample belowInput