Comments (4)
I see that you're using the NewAnalyticsMarshaller
. This constructor is used specifically for generating a JSON object that conforms to the SQL on FHIR proposal https://github.com/FHIR/sql-on-fhir/blob/master/sql-on-fhir.md. It seems our godocs could be improved here.
To generate FHIR conformant JSON you'll want to use the default NewMarshaller
.
output := &task_go_proto.Task_Output{
Type: &datatypes_go_proto.CodeableConcept{
Text: &datatypes_go_proto.String{
Value: "generated",
},
},
Value: &task_go_proto.Task_Output_ValueX{
Choice: &task_go_proto.Task_Output_ValueX_Reference{
Reference: &datatypes_go_proto.Reference{
Reference: &datatypes_go_proto.Reference_QuestionnaireResponseId{
QuestionnaireResponseId: &datatypes_go_proto.ReferenceId{
Value: "1",
},
},
},
},
},
}
m, err := jsonformat.NewMarshaller(true, "", " ", fhirversion.R4)
if err != nil {
panic(err)
}
data, err := m.MarshalElement(output)
if err != nil {
panic(err)
}
fmt.Printf("output: %s", data)
prints
{
"type": {
"text": "generated"
},
"valueReference": {
"reference": "QuestionnaireResponse/1"
}
}
from fhir.
Hey @nikklassen, thank you, that solved the issue with the marshalling!
However, the output contains a new entry resourceType
which is not accepted in FHIR PATCH calls. Is there a way to workaround this? This was our reasoning for using the AnalyticsMarshaller
but since you mentioned its for SQL we will have to make this change on our end.
output: {
"resourceType": "Output",
"type": {
"text": "generated"
},
"valueReference": {
"reference": "QuestionnaireResponse/1"
}
from fhir.
Did you use the MarshalElement
function? As you can see in my sample output, this function does not output the resourceType
field.
from fhir.
It looks like our version of the library has to be updated because we can't see a reference to MarshalElement
. Thanks for the help @nikklassen, I'll close this issue now.
from fhir.
Related Issues (20)
- Patient Id is not accepting string expecting type object
- Consider tagging submodule "go"? HOT 2
- [Go] How to parse profile HOT 3
- Unmarshaller support for R5 versions HOT 3
- Canonical FHIR Resource Enum HOT 2
- go: module source tree too large HOT 1
- R5 support
- py/ subtree accidentally deleted? HOT 1
- Idiomatic way of dealing with unknown fields? [golang] HOT 3
- No need to require backports.zoneinfo on Python 3.9+ HOT 2
- Python 3.10 + 3.11 support HOT 2
- Python: Upgrade to abseil-py v1.0.0
- [Urgent] Need help with issue using jsonformat NewMarshaller
- Missing GoalAchievementStatus code system
- FHIR 4.3.0 / R4B support
- protobuf 4.21 support HOT 1
- Building under Windows using MSVC HOT 1
- FR: Exposing a list of maven deps HOT 1
- Example for Generating Protos Using the scripts seems broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fhir.