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 while saving Annotations.authorReference #376

Closed
yazver opened this issue Apr 8, 2021 · 4 comments
Closed

Error while saving Annotations.authorReference #376

yazver opened this issue Apr 8, 2021 · 4 comments
Labels

Comments

@yazver
Copy link

yazver commented Apr 8, 2021

Returns an error while saving the extension:

               "extension": [
                    {
                        "valueId": "sample-annotation-id-2",
                        "url": "annotation",
                        "valueAnnotation": {
                            "authorReference": {
                                "reference": "Patient/new-patient-2"
                            },
                            "time": "2011-03-04T11:45:25+11:00",
                            "text": "Everything's fine"
                        }
                    }
                ]

Error:

{
    "resourceType": "OperationOutcome",
    "text": {
        "div": "Transaction failed at entry[3]. Response status is 422. Response body is {\"resourceType\":\"OperationOutcome\",\"text\":{\"status\":\"generated\",\"div\":\"Invalid resource\"},\"issue\":[{\"severity\":\"fatal\",\"code\":\"invalid\",\"expression\":\"DiagnosticReport.extension.0.valueAnnotation.authorReference\",\"diagnostics\":\"extra property\"}]}."
    },
    "issue": [
        {
            "severity": "fatal",
            "code": "invalid",
            "expression": "DiagnosticReport.extension.0.valueAnnotation.authorReference",
            "diagnostics": "extra property"
        }
    ],
    "id": "361"
}

FHIR spec:

{
  // from Element: extension
  // author[x]: Individual responsible for the annotation. One of these 2:
  "authorReference" : { Reference(Practitioner|Patient|RelatedPerson|Organization) },
  "authorString" : "<string>",
  "time" : "<dateTime>", // When the annotation was made
  "text" : "<markdown>" // R!  The annotation  - text content (as markdown)
}
@KGOH
Copy link
Contributor

KGOH commented Apr 8, 2021

You provided only request body, please provide full request (url, method, headers)

@yazver
Copy link
Author

yazver commented Apr 13, 2021

{
    "type": "transaction",
    "entry": [
        {
            "resource": {
                "resourceType": "Patient",
                "id": "new-patient-2",
                "active": true,
                "name": [
                    {
                        "family": "Окакьев",
                        "given": [
                            "Джон",
                            "Никифорович"
                        ]
                    }
                ],
                "gender": "male",
                "birthDate": "1932-09-24"
            },
            "request": {
                "method": "POST",
                "url": "/Patient"
            }
        },
        {
            "resource": {
                "id": "sample-image-id-2",
                "subject": {
                    "reference": "Patient/new-patient-2"
                },
                "status": "completed",
                "type": {
                    "text": "Image"
                },
                "createdDateTime": "2011-03-04T11:45:25+11:00",
                "content": {
                    "contentType": "image/png",
                    "data": "dG9vIGJpZyB0b28gaW5jbHVkZSB0aGUgd2hvbGU="
                }
            },
            "request": {
                "method": "POST",
                "url": "/Media"
            }
        },
        {
            "resource": {
                "id": "sample-document-id-2",
                "subject": {
                    "reference": "Patient/new-patient-2"
                },
                "status": "completed",
                "type": {
                    "text": "Document"
                },
                "createdDateTime": "2011-03-04T11:45:25+11:00",
                "content": {
                    "contentType": "application/pdf",
                    "data": "dG9vIGJpZyB0b28gaW5jbHVkZSB0aGUgd2hvbGU="
                }
            },
            "request": {
                "method": "POST",
                "url": "/Media"
            }
        },
        {
            "resource": {
                "id": "sample-report-id-2",
                "code": {
                    "text": "Sample name"
                },
                "effectiveDateTime": "2011-03-04T11:45:25+11:00",
                "category": [
                     {
                        "text": "OSL"
                    }
                ],
                "status": "final",
                "subject": {
                    "reference": "Patient/new-patient-2"
                },
                "media": [
                    {
                        "link": {
                            "reference": "Media/sample-image-id-2"
                        }
                    },
                    {
                        "link": {
                            "reference": "Media/sample-document-id-2"
                        }
                    }
                ],
                "extension": [
                    {
                        "url": "annotation",
                        "valueAnnotation": {
                            "authorReference": {
                                "reference": "Patient/new-patient-2"
                            },
                            "time": "2011-03-04T11:45:25+11:00",
                            "text": "Everything's fine"
                        }
                    }
                ]
            },
            "request": {
                "method": "POST",
                "url": "/DiagnosticReport"
            }
        }
    ]
}

@KGOH
Copy link
Contributor

KGOH commented Apr 15, 2021

Your'e posting FHIR data to aidbox format endpoint. You need like this POST /fhir/ instead of POST / Related doc https://docs.aidbox.app/modules-1/fhir-resources/aidbox-and-fhir-formats

@KGOH KGOH closed this as completed Apr 15, 2021
@KGOH KGOH reopened this Apr 15, 2021
@KGOH
Copy link
Contributor

KGOH commented Apr 15, 2021

The problem is that you need to define extension in aidbox and this will solve the problem https://docs.aidbox.app/modules-1/first-class-extensions
(note, here I use extension url different from that you use, "urn:extension:DiagnosticReport.annotation" vs "annotation", I recommend you to use more expressive extension urls)

PUT /Attribute/DiagnosticReport.annotation

{
  "path": [
  "annotation"
 ],
 "type": {
  "id": "Annotation",
  "resourceType": "Entity"
 },
 "resource": {
  "id": "DiagnosticReport",
  "resourceType": "Entity"
 },
 "extensionUrl": "urn:extension:DiagnosticReport.annotation",
 "resourceType": "Attribute",
}

@KGOH KGOH closed this as completed Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants