Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better support for related resources via include/revinclude #17

Open
ruscoder opened this issue Mar 15, 2019 · 1 comment
Open

Add better support for related resources via include/revinclude #17

ruscoder opened this issue Mar 15, 2019 · 1 comment
Labels
enhancement New feature or request To discuss

Comments

@ruscoder
Copy link
Member

ruscoder commented Mar 15, 2019

When we use revinclude or include we have a bundle with multiple types of resources, but fetch/fetch_all returns only main resource.

We can add fetch_raw/fetch_all_raw that should always return a dict with fetched resources.

Example:

client.resources('Schedule').revinclude('Slot', 'schedule').fetch_all_raw()

returns

{'Slot': [SlotResource, SlotResource, ...],
'Schedule': [ScheduleResource, ScheduleResource, ...],}

And

client.resources('Schedule').fetch_all_raw()

returns

{'Schedule': [ScheduleResource, ScheduleResource, ...],}

TBD

@ruscoder ruscoder added the enhancement New feature or request label Mar 15, 2019
@ruscoder
Copy link
Member Author

We can also change revinclude/include behaviour for this purposes, for example, if we use include after fetch/fetch_all we should have a list of main resources but with already resolved resources into the particular fields.
For example:

client.resources('Patient').include('Practitioner', 'generalPractitioner', include=True)

should return

[PatientResource, PatientResource...]

Where PatientResource.generalPractitioner[x] is a related Practitioner resource.

An the same for revinclude:

# Here we pass name inside resource where we want to include them
client.resources('Schedule').revinclude('Slot', 'schedule', include='slots')

should return

[ScheduleResource, ScheduleResource...]

Where ScheduleResource.slots is a list of related Slots

TBD

@ruscoder ruscoder changed the title Add an ability to specify a resource type(or types) for fetch and fetch_all Add better support for related resources via include/revinclude Mar 15, 2019
ir4y added a commit that referenced this issue Nov 17, 2019
ir4y added a commit that referenced this issue Nov 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request To discuss
Projects
None yet
Development

No branches or pull requests

1 participant