Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Raheel Sayeed committed Jan 24, 2020
1 parent 81963ac commit 54618eb
Show file tree
Hide file tree
Showing 9 changed files with 301 additions and 165 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,7 @@ venv.bak/
*~
*.swp
*.swo


# Mac OS
*.DS_Store
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ This app is fully SMART on FHIR compliant and represents the concept of sending


Installation
-----------
------------

1. Clone this repository:
2. Install modules
2. Install modules `fhirclient`, `Flask`, `jwt`
3. Upload all ValueSets in `/fhirresources` into your FHIR Server to simulate a `PGHD Instrument Metadata Repository`
3. Edit `app.py` with the settings for the SMART on FHIR endpoints and SMART credentails
4. run app.py



```bash
$ git clone https://github.com/SMARTMarkers/practitioner-ehr-app.git
$ cd practitioner-ehr-app
$ pip3 install fhirclient
$ pip3 install fhirclient // make sure its FHIR R4
$ pip3 install pyjwt
$ pip3 install Flask
$ chmod +x app.py

//Edit app.py with settings for the SMART on FHIR endpoints
Expand All @@ -30,12 +34,15 @@ $ ./app.py

Notice
----------
This work is under further development and eventually will become a framework to support multiple SMART EHR apps.

[sf]: https://docs.smarthealthit.org
[ilist]: https://github.com/SMARTMarkers/smartmarkers-ios/tree/master/Sources/Instruments
[sm]: https://github.com/SMARTMarkers/smartmarkers-ios
1. **PROMIS** API service providers AssessmentCenter is undergoing migration. This repo will be updated to fetch PROMIS instruments directly from AC after the migration is completed. Please contact [AC](http://assessmentcenter.net) to more info and access to their FHIR endpoints.
2. This work is under further development and eventually will become a framework to support multiple SMART EHR apps.


License
-------
This work is [Apache 2](LICENSE.txt) licensed.


[sf]: https://docs.smarthealthit.org
[ilist]: https://github.com/SMARTMarkers/smartmarkers-ios/tree/master/Sources/Instruments
[sm]: https://github.com/SMARTMarkers/smartmarkers-ios
52 changes: 29 additions & 23 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,36 @@ def request_pgd():

instrument_type = request.args.get('instrumenttype')
instrument_id = request.args.get('instrumentid')
if instrument_id is None or instrument_type is None:
return msg('No')

instr = None
if instrument_type == 'webrepository':
instr = [instr for instr in smart.instrumentlist_devices if instr.identifier == instrument_id][0]
elif instrument_type == 'activity':
instr = [instr for instr in smart.instrumentList_activity if instr.identifier == instrument_id][0]
elif instrument_type == 'survey':
instr = [instr for instr in smart.instrumentlist_questionnaires if instr.identifier == instrument_id][0]
elif instrument_type == 'activetask':
instr = [instr for instr in smart.instrumentlist_activetasks if instr.identifier == instrument_id][0]
schedule_type = request.args.get('sch_type', 'instant')
start_date = request.args.get('start', None)
end_date = request.args.get('end', None)

if schedule_type != 'instant':
if not start_date or not end_date:
return jsonify(result={'result': 'fail', 'message': 'Please select a start and an end date'})

result = smart.dispatch_request(instrumenttype=instrument_type, instrumentidentifier=instrument_id, practitioner_resource=app.user_practitioner, schedule_type=schedule_type, start_date=start_date, end_date=end_date)
return jsonify(result={'result':'success', 'request_id': result.identifier, 'request_title': result.title})



print(f'selected instrument is {instr.identifier}')

if instr is None:
return msg('No')
# request_schedule = None
# if schedule_type != 'instant':
# if start_date is None or end_date is None:
# return jsonify(result={'result': 'fail', 'message': 'Please select a start and an end date'})
# request_schedule = PROSchedule()

success = smart.dispatchRequest(selected_instrument=instr, practitioner_resource=app.user_practitioner, selected_schedule=None)
print(success)
if success:
return jsonify(result={'result':'success', 'request_id': success.identifier, 'request_title': success.title})
else:
return jsonify(result={'result': 'fail'})

# if instr is None:
# return msg('No')

# success = smart.dispatchRequest(selected_instrument=instr, practitioner_resource=app.user_practitioner, selected_schedule=None)

# if success:
# return jsonify(result={'result':'success', 'request_id': success.identifier, 'request_title': success.title})
# else:
# return jsonify(result={'result': 'fail'})

@app.route('/index.html')
def app_main():
Expand All @@ -103,8 +109,8 @@ def app_main():
questionnaires=smart.instrumentlist_questionnaires,
promis=smart.instrumentlist_promis,
activetasks=smart.instrumentlist_activetasks,
activityInstruments=smart.instrumentList_activity,
healthkit=smart.instrumentlist_healthkit,
activityinstruments=smart.instrumentList_activity,
clinicalrecords=smart.instrumentlist_clinicalrecords,
devices=smart.instrumentlist_devices
)

Expand Down
Loading

0 comments on commit 54618eb

Please sign in to comment.