about summary refs log tree commit diff
path: root/gn3/llms/response.py
diff options
context:
space:
mode:
authorAlexander Kabui2024-09-06 11:17:18 +0300
committerGitHub2024-09-06 11:17:18 +0300
commitcfeb54b776e95194381d26cff02ea738ad4fd3e0 (patch)
tree1a7cf011bbeb61df90963d79237643bc9f8611f5 /gn3/llms/response.py
parent8e28770342b65cff78441670f1841e0130dc9c4b (diff)
parent8cb85c8f8c12180702cfc3a257bf9a513ac4da3d (diff)
downloadgenenetwork3-cfeb54b776e95194381d26cff02ea738ad4fd3e0.tar.gz
Merge pull request #188 from genenetwork/chores/merge-gnqa-api
Chores/merge gnqa api
Diffstat (limited to 'gn3/llms/response.py')
-rw-r--r--gn3/llms/response.py75
1 files changed, 0 insertions, 75 deletions
diff --git a/gn3/llms/response.py b/gn3/llms/response.py
deleted file mode 100644
index 11cbd94..0000000
--- a/gn3/llms/response.py
+++ /dev/null
@@ -1,75 +0,0 @@
-
-# pylint: skip-file
-import string
-import json
-import os
-
-
-basedir           = os.path.abspath(os.path.dirname(__file__))
-
-
-class DocIDs():
-    def __init__(self):
-        # open doc ids for GN refs
-        self.doc_ids = self.loadFile("doc_ids.json")
-        # open doc ids for Diabetes references
-        self.sugar_doc_ids = self.loadFile("all_files.json")
-        # format is not what I prefer, it needs to be rebuilt
-        self.formatDocIDs(self.sugar_doc_ids)
-
-    def loadFile(self, file_name):
-        file_path = os.path.join(basedir, file_name)
-        if os.path.isfile(file_path):
-            f = open(file_path, "rb")
-            result = json.load(f)
-            f.close()
-            return result
-        else:
-            raise Exception("\n{0} -- File does not exist\n".format(file_path))
-    
-    def formatDocIDs(self, values):
-        for _key, _val in values.items():
-            if isinstance(_val, list):
-                for theObject in _val:
-                    docName = self.formatDocumentName(theObject['filename'])
-                    docID   = theObject['id']
-                    self.doc_ids.update({docID: docName})
-                    
-    def formatDocumentName(self, val):
-       result = val.removesuffix('.pdf') 
-       result = result.removesuffix('.txt') 
-       result = result.replace('_', ' ')
-       return result
-
-
-    def getInfo(self, doc_id):
-        if doc_id in self.doc_ids.keys():
-            return self.doc_ids[doc_id]
-        else:
-            return doc_id
-
-class RespContext():
-    def __init__(self, context):
-        self.cntxt = context
-        self.theObj = {}
-
-    def parseIntoObject(self, info):
-        # check for obj, arr, or val
-        for key, val in info.items():
-            if isinstance(val, list):
-                self.parseIntoObject(val)
-            elif isinstance(val, str) or isinstance(val, int):
-                self.theObj[key] = val
-            self.theObj[key] = self.val
-
-
-def createAccordionFromJson(theContext):
-    result = ''
-    # loop thru json array
-    ndx = 0
-    for docID, summaryLst in theContext.items():
-        # item is a key with a list
-        comboTxt = ''
-        for entry in summaryLst:
-            comboTxt += '\t' + entry['text']
-    return result
\ No newline at end of file