diff --git a/webapp/api/api/views.py b/webapp/api/api/views.py index a98ffed8..5f2b0682 100644 --- a/webapp/api/api/views.py +++ b/webapp/api/api/views.py @@ -820,6 +820,24 @@ def generate_concept_filter(request): return HttpResponseBadRequest('Missing either cuis or cdb_id param. Cannot generate filter.') +@api_view(http_method_names=['POST']) +def cuis_to_concepts(request): + cuis = request.data.get('cuis') + cdb_id = request.data.get('cdb_id') + if cdb_id is not None: + if cuis is not None: + cdb = get_cached_cdb(cdb_id, CDB_MAP) + concept_list = [{'cui': cui, 'name': cdb.cui2preferred_name[cui]} for cui in cuis] + resp = {'concept_list': concept_list} + return Response(resp) + else: + cdb = get_cached_cdb(cdb_id, CDB_MAP) + concept_list = [{'cui': cui, 'name': cdb.cui2preferred_name[cui]} for cui in cdb.cui2preferred_name.keys()] + resp = {'concept_list': concept_list} + return Response(resp) + return HttpResponseBadRequest('Missing either cuis or cdb_id param. Cannot produce concept list.') + + @api_view(http_method_names=['GET']) def project_progress(request): projects = [int(p) for p in request.GET.get('projects', []).split(',')] diff --git a/webapp/api/core/urls.py b/webapp/api/core/urls.py index 1f6bc754..0b58b88e 100644 --- a/webapp/api/core/urls.py +++ b/webapp/api/core/urls.py @@ -54,9 +54,10 @@ path('api/concept-path/', api.views.cdb_concept_path), path('api/generate-concept-filter-json/', api.views.generate_concept_filter_flat_json), path('api/generate-concept-filter/', api.views.generate_concept_filter), - path('reset_password/', api.views.ResetPasswordView.as_view(), name ='reset_password'), - path('reset_password_sent/', pw_views.PasswordResetDoneView.as_view(), name ='password_reset_done'), - path('reset//', pw_views.PasswordResetConfirmView.as_view(), name ='password_reset_confirm'), - path('reset_password_complete/', pw_views.PasswordResetCompleteView.as_view(), name ='password_reset_complete'), + path('api/cuis-to-concepts/', api.views.cuis_to_concepts), + path('reset_password/', api.views.ResetPasswordView.as_view(), name='reset_password'), + path('reset_password_sent/', pw_views.PasswordResetDoneView.as_view(), name='password_reset_done'), + path('reset//', pw_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), + path('reset_password_complete/', pw_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), re_path('^.*$', api.views.index, name='index'), # Match everything else to home ] diff --git a/webapp/frontend/src/components/common/ClinicalText.vue b/webapp/frontend/src/components/common/ClinicalText.vue index b06fe68a..bda03094 100644 --- a/webapp/frontend/src/components/common/ClinicalText.vue +++ b/webapp/frontend/src/components/common/ClinicalText.vue @@ -1,8 +1,11 @@