summary / application.py
Roland Ding
10.9.26.75 updated ui, data, features, and backend
004db8a
import os
import json
'''
shared environment variables
'''
aws_access_key_id = os.getenv('AMRA_AWS_ACCESS_KEY_ID')
aws_secret_access_key = os.getenv('AMRA_AWS_SECRET_ACCESS_KEY')
openai_api_key = os.getenv('AMRA_OPENAI_API_KEY')
default_region = "Spine"
device_options={
"secondary extraction":False,
"secondary extraction count":0
}
default_s3_bucket = "amra-studies"
'''
ui equivalent environment variables
'''
ec_options={
"Equivalent Comparator":False,
"Equivalent Comparator require SD":False,
"Equivalent Comparator count":0
}
anatomic_domains=[
# "Dental/CMF",
"Extremity",
"Spine"
]
'''
dynamodb tables structure
'''
logic_keywords = {
"groups":["group"],
"preoperatives":["preoperative","preop","pre-op"]
}
source_format = "<column 1 field>\n<value 1>\n<value 2>...<value n>\n<column 2 field>\n<value 1>\n<value 2>...<value n>\n...<column n field>\n<value 1>\n<value 2>...<value n>\n"
anatomic_list = ["Spinal","Extremities"]
tables_inst=[
f"extract tables from the system text. the tables are mostly in the following format: {source_format}",
f"reformat the returned tables into a markdown table syntax.",
f"if applicable, remove the standard deviation after the mean and round all the numbers to one decimal places.",
f"include all table titles."
]
article_prompts = {
"Authors": '''extract all of the authors of the article from the above text.\n
Return the results on the same line separated by commas as Authors: Author A, Author B...
''',
"Acceptance Year": '''extract the acceptance year of the article from the above text.\n
Return the results on a single line as Accepted Year: <year>.
''',
"Acceptance Month":'''extract the acceptance month of the article from the above text.\n
Return the results on a single line as Accepted Month: <month>.
'''
}
# overview_prompts = clinical_prompts = radiological_prompts = other_prompts = {}
# # populate the prompts from .prompt/overview/ folder
# def update_prompts_from_dir(prompts,path):
# for file in os.listdir(path):
# with open(f"{path}/{file}","r") as f:
# prompts[file.split(".")[0]] = f.read()
# update_prompts_from_dir(overview_prompts,".prompts/overview")
# update_prompts_from_dir(clinical_prompts,".prompts/clinical")
# update_prompts_from_dir(radiological_prompts,".prompts/radiologic")
# update_prompts_from_dir(other_prompts,".prompts/other")
'''
application default data
'''
app_data = {
"current article":{},
"articles":{},
"prompts":{},
"terms":[],
"summary":{},
"user":{
"summary":{"articles":[]},
"performance outcome #1":{"assessment_step":"Clinical"},
"performance outcome #2":{"assessment_step":"Clinical"},
"safety outcome #1":{},
"safety outcome #2":{},
}
}
with open(".data/defaults.json","r") as f:
defaults = json.load(f)