LibreHealthIO / lh-ehr-fhir-api

FHIR API to LibreEHR Package for Laravel
MIT License
12 stars 6 forks source link

Be able to provide available slots to API client #3

Closed kchapple closed 7 years ago

kchapple commented 8 years ago

A client should be able to query available slots for a particular practice using the Appointment Slot resource, which needs to be implemented to close this issue.

Unit test required.

See https://www.hl7.org/fhir/appointment.html#5.27.1.1

Leo24 commented 8 years ago

fhir is a Laravel package for talking to a LibreEHR database via FHIR API How fhir communicates LibreEHR?

What methods implements fhir?

What kind of architecture should have fhir?

Leo24 commented 8 years ago

Now in this repository LibreEHR/LibreEHR the source code of the website OpenEMR. fhir will be communicating with this website? Or OpenEMR will be rewritten in laravel?

kchapple commented 8 years ago

There is a core package in the LibreEHR github, which the fhir package depends on. The core package contains the beginnings of a backend API for communicating to the EMR.

The core package contains a set of interfaces in core/src/Contracts which are the interfaces used by the fhir package.

The implementations of those interfaces are in the core/src/Emr directory. For example, src/Emr/Repositories/PatientRepository.php implements the create, and find operations for patients.

The REST controllers and mapping of FHIR models to LibreEHR interfaces and back are located in fhir/src/Http/Controllers and fhir/src/Adapters.

To create a new FHIR Resource endpoint, for Appointment for example, you would

  1. Create an adapter called FHIRAppointmentAdapter that implements BaseAdapterInterface in fhir/src/Adapters with stub methods for
    public function retrieve( $id );
    public function store( Request $request );
    public function collectionToOutput();
  1. Create an Appointment controller in fhir/src/Http/Controllers that extends AbstractController. Look at PatientController for example. The FHIRAppointmentAdapter can be type-hinted by the controllers constructor and automatically injected into the object.
  2. Create a resource route for [base-url]/fhir/Appointment(s) in fhir/src/Http/routes.php that routes the Appointment endpoint to the controller you created.
  3. finish implementing the FHIRAppointmentAdapter by mapping data that comes in through a json request into a libre-ehr/core model and into the database. You will utlize the FHIR models contained in fhir/src/PHPFHIRGenerated, which are automatically generated PHP models of the FHIR API. See fhir/src/Adapters/FHIRPatientAdapter.php to see how the request data is parsed into the PHP models in the method jsonToInterface( $data ){ ... };

The fhir package will communicate with the database in the LibreEHR/LibreEHR. So, if enhancements need to be made for the FHIR API, they will also need to be made to LibreEHR.

fhir api stack

Leo24 commented 8 years ago

I have a some questions on the implementation of the resource Slot and the Schedule. On the website of the openemr doctor can schedule an appointment with patient in the time interval from 8:00 to 6:00 the next day. Any day of the week even on Sunday. It was conceived because only the doctor can add calendar entries. FHIR API allows the patient to enter data in the calendar of the doctor. All the time which is not occupied by other appointments, will be considered free and may be scheduled to appointment (the selected Slot) even at night and on weekends. Also API will ignore that the doctor can have your schedule when he can appointment patients. So we need the ability to restrict the time interval. Otherwise, how can I implement the resources the Schedule and Slot?

kchapple commented 8 years ago

Slots are basically availability. Free times and busy time. In OpenEMR the provider sets his in and out of office times, and appointments. The Slot API would use the provider's in-office times and his existing appointments to provide the iPhone app available slots and unavailable slots. It is my understanding that you first query the Schedule resource for a given provider by provider ID and a time frame, then from that get the slots.

Ken

On Aug 9, 2016, at 9:19 AM, Leonid notifications@github.com wrote:

I have a some questions on the implementation of the resource Slot and the Schedule. On the website of the openemr doctor can schedule an appointment with patient in the time interval from 8:00 to 6:00 the next day. Any day of the week even on Sunday. It was conceived because only the doctor can add calendar entries. FHIR API allows the patient to enter data in the calendar of the doctor. All the time which is not occupied by other appointments, will be considered free and may be scheduled to appointment (the selected Slot) even at night and on weekends. Also API will ignore that the doctor can have your schedule when he can appointment patients. So we need the ability to restrict the time interval. Otherwise, how can I implement the resources the Schedule and Slot?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Leo24 commented 8 years ago

The resource Schedule needs to return the time frame size one day or several days?

kchapple commented 8 years ago

The search would be done by providing the API a Practitioner ID and period identified by a start and end time. See the Schedule FHIR documentation under search parameters. https://www.hl7.org/fhir/schedule.html#search

I would start with a Core API (in core package) that pulls schedule for a given provider ID in between two dates, then we can hook up the FHIR endpoint from there.

Ken

On Aug 9, 2016, at 10:35 AM, Leonid notifications@github.com wrote:

The resource Schedule needs to return the time frame size one day or several days?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Leo24 commented 8 years ago

What is the size of the slot should be? Should it be static or variable?

kchapple commented 8 years ago

Good question. Use the slot times that are illustrated on the wire frames for now. We can make them configurable later if necessary.

Ken

On Aug 9, 2016, at 10:51 AM, Leonid notifications@github.com wrote:

What is the size of the slot should be? Should it be static or variable?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

tmccormi commented 8 years ago

OpenEMR allows the slot times to be configured by appointment type. This information is in the calendar. The UI to access it is Adminstration->Other->Calendar:Duration field

Table is openemr_postcalendar_categories

Tony McCormick, CTO www.mi-squared.com Support: 866-735-0897, Direct: 713-574-6709 My Calendar: http://bit.ly/XznvDo "Genuinely evolved interfaces are transparent, so transparent as to be invisible" - William Gibson

On Tue, Aug 9, 2016 at 7:53 AM, Ken notifications@github.com wrote:

Good question. Use the slot times that are illustrated on the wire frames for now. We can make them configurable later if necessary.

Ken

On Aug 9, 2016, at 10:51 AM, Leonid notifications@github.com wrote:

What is the size of the slot should be? Should it be static or variable?

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LibreEHR/fhir/issues/3#issuecomment-238579128, or mute the thread https://github.com/notifications/unsubscribe-auth/AARciwGgZfuugQFMgbpYYOYv18PvQgr5ks5qeJSAgaJpZM4JYdSO .

Please be aware that e-mail communication can be intercepted in transmission or misdirected. Please consider communicating any sensitive information by telephone. The information contained in this message may be privileged and confidential. If you are NOT the intended recipient, please notify the sender immediately with a copy to hipaa-security@mrsb-ltd.com and destroy this message.