wanghaisheng / fhir-cn

FHIR中文版 the Chinese translation of FHIR
https://github.com/FHIR-CN/fhir-spec-ZhCN
72 stars 23 forks source link

compartment #38

Open wanghaisheng opened 9 years ago

wanghaisheng commented 9 years ago

To search a compartment, either all possible resources, or for a particular resource type, respectively:

GET [base]/[Compartment]/[id]/{*?[parameters]{&_format=[mime-type]}} GET [base]/[Compartment]/[id]/[type]{?[parameters]{&_format=[mime-type]}}

For example, to retrieve all the observation resources for a particular LOINC code associated with a particular encounter:

GET [base]/Encounter/23423445/Observation?code=2951-2 {&_format=[mime-type]}

Note that there are a specific operations defined to support fetching an entire patient record or all record for an encounter.

Finally, it's possible to search all resources at once:

GET [base]?[parameters]{&_format=[mime-type]}

When searching all resources at once, only the parameters defined for all resources can be used.

wanghaisheng commented 9 years ago

1.14.0 Compartment Based Access 1.14.0.1 Compartments

Each resource may belong to one or more logical compartments. A compartment is a logical grouping of resources which share a common property. Compartments have two principal roles:

Function as an access mechanism for finding a set of related resources quickly
Provide a definitional basis for applying access control to resources quickly

Compartment definitions describe how particular compartment instances are named and identified, and how systems know which resources are in the compartment. The following compartments are defined by this specification: URI Title Description Identity Membership http://hl7.org/fhir/compartment/patient Patient The set of resources associated with a particular patient There is an instance of the patient compartment for each patient resource, and the identity of the compartment is the same as the patient. When a patient is linked to another patient, all the records associated with the linked patient are in the compartment associated with the target of the link. The patient compartment includes any resources where the subject of the resource is the patient, and some other resources that are directly linked to resources in the patient compartment http://hl7.org/fhir/compartment/encounter Encounter The set of resources associated with a particular encounter There is an instance of the encounter compartment for each encounter resource, and the identity of the compartment is the same as the encounter The encounter compartment includes any resources where the resource has an explicitly nominated encounter, and some other resources that them selves link to resources in the encounter compartment. Note that for many resources, the exact nature of the link to encounter can be ambiguous (e.g. for a DiagnosticReport, is it the encounter when it was initiated, or when it was reported?) http://hl7.org/fhir/compartment/relatedPerson RelatedPerson The set of resources associated with a particular 'related person' There is an instance of the relatedPerson compartment for each relatedPerson resource, and the identity of the compartment is the same as the relatedPerson The relatedPerson compartment includes any resources where the resource is explicitly linked to relatedPerson (usually as author) http://hl7.org/fhir/compartment/practitioner Practitioner The set of resources associated with a particular practitioner There is an instance of the practitioner compartment for each Practitioner resource, and the identity of the compartment is the same as the Practitioner The practitioner compartment includes any resources where the resource is explicitly linked to a Practitioner (usually as author, but other kinds of linkage exist) http://hl7.org/fhir/compartment/device Device The set of resources associated with a particular device There is an instance of the practitioner compartment for each Device resource, and the identity of the compartment is the same as the Device The device compartment includes any resources where the resource is explicitly linked to a Device (mostly subject or performer)

As an example of compartment usage, to retrieve a list of a patient's conditions, use the URL:

GET [base]/Patient/[id]/Condition

The details of this usage are described under the search operation. As a search related operation, the assignment of resources to compartments is only based on the current version of any of the resources involved. Note that contained patient resources cannot create a patient compartment of their own.

Compartments may be used explicitly, like this, but can also be used implicitly. For instance, if a FHIR server is providing a patient view of a record, the authorized user associated with use of the FHIR RESTful API may be limited to accessing records from the compartment instance(s) logically associated with their identity. Irrespective of whether compartments are being used explicitly or implicitly, servers will need to make arrangements to make some resources with no direct link to a patient available to the client (medications, substances, etc.).

Note that resources may cross between compartments, or interlink them. Examples of this would be where a Diagnostic Report identifies a subject, but an Observation it references identifies a different subject, or where a List resource references items that identify different subjects. Such cross-linking may arise for many valid reasons, including:

Cases where subject records are inter-linked - Transplants, Perinatal care, family therapy etc.
Workflow management where action lists link multiple patients and/or practitioners

Given the wide variety of use cases and contexts in which FHIR is used, compartments do not define how cross-linking is handled. Systems may reject resources, remove them from both compartments, or place them in both, or act in some other fashion.

It is at the discretion of the server whether to include resources in a compartment when the reference to the resource that establishes the compartment is in an extension.

wanghaisheng commented 9 years ago

为什么只有这么几类才能使用compartment 其他的要使用的话要怎么扩展 对于practitioner的话 如果要查找与之关联的所有organization的话 是使用compartment呢 GET [base]/Practitioner/23423445/Organization?name=aaa &&Organization?name=bbb{&_format=[mime-type]}

还是说 GET [base]/Practitioner?organization.reference=1111&&organization.reference=2222 {&_format=[mime-type]} GET [base]/Practitioner?organization.display=aaaa&&organization.display=bbbb {&_format=[mime-type]}