Skip to content

add support for :_include modifier #6

@simonvadee

Description

@simonvadee

Description

The search is not yet able to handle the _include modifier which allows to "join" resources between them.
For instance, the query string /Observation?category=laboratory&_include=Observation:encounter which is equivalent to

search_context = SearchContext(engine, "Observation")
params = (("category", "laboratory"), ("_include", "Observation:encounter"))
fhir_search = Search(search_context,  params=params)

should output a Bundle like:

{
    "id": "1",
    "meta": {},
    "entry": [
        {
            "fullUrl": "Observation/123",
            "resource": {
                "...": "...",
                "resourceType": "Observation"
            },
            "search": {
                "mode": "match"
            }
        },
        {
            "fullUrl": "Encounter/456",
            "resource": {
                "...": "...",
                "resourceType": "Encounter"
            },
            "search": {
                "mode": "include"
            }
        }
    ],
    "link": [
        {
            "relation": "self",
            "url": "https://some.url"
        }
    ],
    "total": 1,
    "type": "searchset",
    "resourceType": "Bundle"
}

I'm not sure how we should implement "relations" between documents but the parent-child relationship using the join datatype seems to be a good fit.
A first implementation could also consist in running multiple ES queries and construct a bundle from multiple results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions