This
page
is
part
of
the
FHIR
Specification
(v3.0.2:
(v4.0.1:
R4
-
Mixed
Normative
and
STU
3).
)
in
it's
permanent
home
(it
will
always
be
available
at
this
URL).
The
current
version
which
supercedes
this
version
is
5.0.0
.
For
a
full
list
of
available
versions,
see
the
Directory
of
published
versions
.
Page
versions:
R5
R4B
R4
R3
R4
R3
R2
FHIR
Infrastructure
Work
Group
|
Maturity
Level
:
|
|
Security Category : Not Classified | Compartments : Not linked to any defined compartments |
|
|
This
page
has
been
approved
as
part
of
an
ANSI
standard.
See
the
Infrastructure
Package
for
further
details.
|
A
binary
resource
that
represents
the
data
of
a
single
raw
artifact
as
digital
content
accessible
in
its
native
format.
A
Binary
resource
can
contain
any
content,
whether
text,
image,
pdf,
zip
archive,
etc.
There
are
situations
where
it
is
useful
or
required
to
handle
pure
binary
content
using
the
same
framework
as
other
resources.
Typically,
this
is
when
the
binary
content
is
referred
to
from
other
FHIR
Resources.
Using
the
same
framework
means
that
the
existing
servers,
security
arrangements,
code
libraries
libraries,
etc.
can
handle
additional
related
content.
Typically,
Binary
resources
are
used
for
handling
content
such
as:
Documents
(i.e.
with
XDS)
A
binary
resource
can
contain
any
content,
whether
text,
image,
pdf,
zip
archive,
etc.
These
resources
are
served
in
their
native
form
on
the
rest
interface,
but
can
also
be
represented
in
XML
or
XML,
JSON,
or
other
formats,
such
as
when
including
these
resources
in
a
bundle
Bundle
(used
when
it
is
convenient
to
include
these
in
the
feed
response
directly
rather
than
leaving
them
by
reference).
This
resource
is
generally
used
as
the
target
of
a
Document
Reference
or
an
Attachment
,
when
When
a
FHIR
server
finds
it
convenient
to
manage
the
content
within
the
same
overall
REST
framework
as
the
other
resources,
the
Binary
resource
is
generally
used
as
the
target
in
the
Attachment
data
type
to
reference
content
via
the
.url
element,
such
as
in
the
DocumentReference
and
Media
resources.
Consequently,
the
Binary
resource
can
be
a
target
wherever
the
Attachment
data
type
is
used
such
as
in
the
DocumentReference
resource.
The
DocumentReference
and
Media
resources
allow
conveying
binary
content
(via
attachment)
or
pointing
to
one
(as
a
Binary
or
non-FHIR
URI)
along
with
the
metadata
around
that
resource,
and
as
such
are
searchable.
Binary
resources
do
not
support
'search'.
While CDA and PDF documents are conveyed as Binary (because they cannot be expressed natively in FHIR), FHIR Documents do not need to be similarly encoded and can be sent natively in FHIR using Bundle . However, in some situations FHIR Documents may be sent as a Binary if there is a need to treat them the same as other types of documents or binary files.
The Binary resource does not convey context of the file. If the context (information such as author, procedure, technique, etc.) should be conveyed, Media or DocumentReference resources are appropriate. The Binary resource may be used to convey actual binary file content conveyed by those resources.
The
Media
resource
is
preferred
for
handling
images,
but
this
is
not
possible
when
the
content
is
already
binary
(e.g.
in
some
uses
of
IHE
XDS
).
This resource is referenced by CatalogEntry and ImplementationGuide
Structure
| Name | Flags | Card. | Type |
Description
&
Constraints
|
|---|---|---|---|---|
|
N | Resource |
Pure
binary
content
defined
by
a
format
other
than
FHIR
Elements defined in Ancestors: id , meta , implicitRules , language |
|
|
Σ | 1..1 | code |
MimeType
of
the
binary
content
MimeType ( Required ) |
|
Σ | 0..1 | Reference ( Any ) |
|
|
|
0..1 | base64Binary | The actual content |
Documentation
for
this
format
|
||||
UML Diagram ( Legend )
XML Template
<<Binary xmlns="http://hl7.org/fhir"><!-- from Resource: id, meta, implicitRules, and language -->
< <</securityContext> <<contentType value="[code]"/><!-- 1..1 MimeType of the binary content --> <securityContext><!-- 0..1 Reference(Any) Identifies another resource to use as proxy when enforcing access control --></securityContext> <data value="[base64Binary]"/><!-- 0..1 The actual content --> </Binary>
JSON Template
{
"resourceType" : "",
"resourceType" : "Binary",
// from Resource: id, meta, implicitRules, and language
"
"
"
"contentType" : "<code>", // R! MimeType of the binary content
"securityContext" : { Reference(Any) }, // Identifies another resource to use as proxy when enforcing access control
"data" : "<base64Binary>" // The actual content
}
Turtle Template
@prefix fhir: <http://hl7.org/fhir/> .![]()
[ a fhir:;[ a fhir:Binary; fhir:nodeRole fhir:treeRoot; # if this is the parser root # from Resource: .id, .meta, .implicitRules, and .language fhir:Binary.contentType [ code ]; # 1..1 MimeType of the binary contentfhir: fhir:fhir:Binary.securityContext [ Reference(Any) ]; # 0..1 Identifies another resource to use as proxy when enforcing access control fhir:Binary.data [ base64Binary ]; # 0..1 The actual content ]
Changes
since
DSTU2
R3
| Binary | |
|
|
|
| Binary.data |
|
See the Full Difference for further information
This analysis is available as XML or JSON .
See
R2
<-->
R3
<-->
R4
Conversion
Maps
(status
=
2
tests
that
all
execute
ok.
All
tests
pass
round-trip
testing
and
all
r3
resources
are
valid.).
valid.)
Structure
| Name | Flags | Card. | Type |
Description
&
Constraints
|
|---|---|---|---|---|
|
N | Resource |
Pure
binary
content
defined
by
a
format
other
than
FHIR
Elements defined in Ancestors: id , meta , implicitRules , language |
|
|
Σ | 1..1 | code |
MimeType
of
the
binary
content
MimeType ( Required ) |
|
Σ | 0..1 | Reference ( Any ) |
|
|
|
0..1 | base64Binary | The actual content |
Documentation
for
this
format
|
||||
XML Template
<<Binary xmlns="http://hl7.org/fhir"><!-- from Resource: id, meta, implicitRules, and language -->
< <</securityContext> <<contentType value="[code]"/><!-- 1..1 MimeType of the binary content --> <securityContext><!-- 0..1 Reference(Any) Identifies another resource to use as proxy when enforcing access control --></securityContext> <data value="[base64Binary]"/><!-- 0..1 The actual content --> </Binary>
JSON Template
{
"resourceType" : "",
"resourceType" : "Binary",
// from Resource: id, meta, implicitRules, and language
"
"
"
"contentType" : "<code>", // R! MimeType of the binary content
"securityContext" : { Reference(Any) }, // Identifies another resource to use as proxy when enforcing access control
"data" : "<base64Binary>" // The actual content
}
Turtle Template
@prefix fhir: <http://hl7.org/fhir/> .![]()
[ a fhir:;[ a fhir:Binary; fhir:nodeRole fhir:treeRoot; # if this is the parser root # from Resource: .id, .meta, .implicitRules, and .language fhir:Binary.contentType [ code ]; # 1..1 MimeType of the binary contentfhir: fhir:fhir:Binary.securityContext [ Reference(Any) ]; # 0..1 Identifies another resource to use as proxy when enforcing access control fhir:Binary.data [ base64Binary ]; # 0..1 The actual content ]
Changes
since
DSTU2
Release
3
| Binary | |
|
|
|
| Binary.data |
|
See the Full Difference for further information
This analysis is available as XML or JSON .
See
R2
<-->
R3
<-->
R4
Conversion
Maps
(status
=
2
tests
that
all
execute
ok.
All
tests
pass
round-trip
testing
and
all
r3
resources
are
valid.).
valid.)
Alternate
See
the
Profiles
&
Extensions
and
the
alternate
definitions:
Master
Definition
(
XML
,
+
JSON
),
,
XML
Schema
/
Schematron
(for
)
+
JSON
Schema
,
ShEx
(for
Turtle
)
&
the
dependency
analysis
| Path | Definition | Type | Reference |
|---|---|---|---|
| Binary.contentType | The mime type of an attachment. Any valid mime type is allowed. | Required |
|
Binary.data
is
optional
because
it
is
excluded
when
a
summary
view
of
the
Binary
resource
is
requested
(this
can
be
useful
when
the
binary
resource
is
part
of
a
wider
request
e.g.
a
search
_include).
Otherwise, the data is not optional; a binary resource without any specified content it not useful.
Binary
resources
behave
slightly
differently
to
from
all
other
resources
on
the
RESTful
API.
Specifically,
API:
application/fhir+xml
"
or
"
application/fhir+json
")
the
Binary
resource
is
returned
in
the
requested
FHIR
format.
This
applies
even
when
the
binary
data
itself
has
a
FHIR
mime
type
Accept
header
(e.g.
"application/fhir+xml"
or
"application/fhir+json")
the
binary
resource
Accept
header,
then
the
content
should
be
returned
Content-Type
header.
E.g.
if
the
content
type
in
the
resource
is
Binary
,
including
when
the
content
type
is
Binary
resource.
contentType
is
vnd.xacml+json).
Note
that
in
the
_summary
parameter
does
not
apply
when
native
binary
representation,
the
mime
type
normal
resource
metadata
is
not
one
available
directly,
though
some
of
it
is
replicated
in
the
stanard
HTTP
response
headers.
Specifically,
the
following
elements
of
the
resource
have
matching
HTTP
Headers:
Last-Modified
ETag
header
Content-Type
X-Security-Context
-
this
is
a
FHIR
specific
extension,
primarily
intended
to
allow
the
security
context
for
a
Binary
resource
to
be
specified
when
it
is
posted
in
native
form.
The
content
Binary.securityContext.reference
Binary
resources
are
not
constrained,
constrained
to
any
list
of
safe
content
types
(content
types
without
active
elements
such
as
scripting
or
executable
code),
and
therefore
can
be
of
any
content
type
and
encoding.
Therefore
Therefore,
extra
care
needs
to
be
taken
to
validate
the
content
of
the
Binary
resource
against
malicious
or
malformed
content.
For
more
details
see
Security
of
Narrative
.
,
since
the
security
issues
are
similar.
Very
often,
the
content
of
a
binary
Binary
resource
is
sensitive,
and
the
server
should
apply
appropriate
access
control
to
the
content.
When
the
server
itself
generates
the
content,
it
implicitly
knows
what
access
control
to
apply.
When
the
client
provides
the
binary
to
the
server
itself,
it
uses
the
securityContext
element
(or
the
matching
X-Security-Context
HTTP
header)
to
inform
the
server
that
the
Binary
resource
should
be
treated
as
if
it
was
the
other
resource.
Typically,
the
other
resource
is
a
DocumentReference
or
similar
resource
that
refers
directly
to
the
Binary
resource,
but
that
is
not
mandatory.
Search
parameters
This
specification
makes
no
rules
concerning
advanced
read
functionality
for
the
Binary
resource,
such
as:
Servers are free to support these features, but they are not required.
This specification does not support searching on Binary resources.
The
semantics
of
the
binary
content
Binary.contentType
a
PATCH
operation
on
a
Binary
resource
are
not
currently
specified.