Is there a way that we can maintain a json in FHIR? - hl7-fhir

I wanted to store a JSON in FHIR. JSON can be anything, for example, it can be something like
{
assignee: "PCC OFF SHORE",
dueby: "30-03-1991",
description: "This will be assigned to PCC off shoure"
}

You can store any arbitrary data as a Binary resource in an Attachment data type (e.g. DocumentReference or in an extension). Technically, you could also put it in a string data type, but that wouldn't be terribly appropriate as strings are not expected to be parseable.

Certain FHIR resources accept elements of type value[x]. That type accepts variations like valueString or valueCode. For your case, valueBase64Binary may be a good alternative.
Read: https://www.hl7.org/fhir/extensibility.html#extension

Related

serialize an array of strings and null values

I'm using protobuf to serialize json from api for flutter app.
however I'm having an issue where I need to serialize this list for example:
"value_array": [ "",
"",
null
]
If I use the usual:
repeated string value_array = 6;
I get an exception during parsing the json.
and sadly I can't have the json changed from api. even worse I can't just manually remove the null from json before parsing it as this element in json is repeated in many different api calls.
PS. I don't need to differentiate the empty string from null, just want to avoid the exception.
thanks in advance for any help.
protobuf has a very opinionated view on JSON, and not all JSON concepts map cleanly to protobuf concepts; for example, protobuf has no notion of null
It might be fine and reasonable to use the protobuf JSON variant if you're always talking protobuf-to-protobuf and want readability (hence text over binary), but if you're working with an external (non-protobuf) JSON tool, honestly: don't use protobuf. Use any relevant JSON-specific tool for your platform - it will do a better job of handling the JSON and supporting your needs. You can always re-map that data to your protobuf model after you have deserialized it, if you need.

How to support patch rest request with protobuf 3

We often have use cases where we only want to update a subset fields on a resource. So if we have a resource Person:
type Person struct {
Age int
Name string
Otherfield string
}
Say the calling client only wants to update the Age field. How would an endpoint be normally set up to handle this?
I believe this should be done with a PATCH request, with only the fields being set as part of the payload, ie:
{
Age: 21
}
However, this won't work with proto3 because as far as I know there are no null fields, only default values. This won't work in many cases where the default value is valid.
Looking at Google own protobuf files (e.g. here), they use FieldMask for partial update.
FieldMask object is passed along with the request, and has the form (in JSON):
{
mask: "Person.Age"
}
This allows the client to tell the server which fields they wish to update, without counting on the partial message itself to figure this out.
I think this adds unnecessary complexity on (each!) client, but we couldn't find any other way to achieve partial updates with proto3.
You can see full documentation of FieldMask here.
Note that it can also be used to filter out responses if the client doesn't need the entire object.

Custom query parameter name in RAML

I'm trying to use RAML to describe following API call
PUT /api/v1/kv_store?{key}={value}
It's a simple key-value storage. I need to specify that key value can be any string, and API console should give users possibility to enter it as well as any other parameter.
Is it doable at all? I'm reading RAML 1.0 spec and can't find a way to do it, so small example will be really great.
Your are doing it completely wrong.
please read Documentation.
Correct way to implement QueryParameters by following code.
As this will cater your http://api/v1/kv_store/
/songs:
put:
queryParameters:
id: number
name: string
type: string
album: number

Is it possible to specify parameters which go into the post body with blueprint?

I'd like to be able to document the parameters as if they were URL parameters, since I like how that bit of documentation renders a handy table. However, in my API, I would like those paremeters to plug into the JSON body rather than the URL. Is there a way to achieve this?
The dedicated syntax for describing, discussing (and thus also validating) message-body is in the making.
It will be based on the Markdown Syntax for Object Notation, similar to the actual URI Parameters description syntax (eventually these two should converge).
Also see related How to specify an optional element for a json request object and Is it possible to document what JSON response fields are? questions.

Decode a YAML serialized object

I have serialized an object in YAML and send it to a remote worker.
The worker doesent have the object definition so i get a YAML::Object.
How can i access the field inside it?
A text field seems like that base64 encoded, how can i decode that? (no, decode64 not works).
you can pass the object as something "known between both sides" (like an openstruct or hash) or give the description to the client.
It would be interesting to have a serialization format that also serialized the class and its methods...I'll have to think about that one...
try c["bar"]
you can also see all the provided keys using c.keys

Resources