isabelrem / 2023-Software-Development-Assessment

MIT License
2 stars 1 forks source link

6 dropdown menu for users #10

Closed jess789550 closed 10 months ago

jess789550 commented 10 months ago

Added a script called select.py to allow users to search for genetic diseases and select one for the API search. Also modified requirements.txt.

Warning: may have merge conflicts as venv was created locally and path to XLSX file may differ.


This change is Reviewable

jess789550 commented 10 months ago

https://github.com/isabelrem/2023-Software-Development-Assessment/issues/6

isabelrem commented 10 months ago

This code imports the national testing directory from the url, might be better than a set path stored locally. I was specifically cleaning it up to search for the clinical indication via the R code, but should be able to use pandas to pull out any information, more or less.

import pandas as pd import xlrd

pip install openpyxl --upgrade

def import_directory(): url = "https://www.england.nhs.uk/wp-content/uploads/2018/08/Rare-and-inherited-disease-national-genomic-test-directory-version-5.1.xlsx"

# import second sheet of genomics test directory - first contains version information, second contains info
data = pd.read_excel(url, sheet_name = 1)

# set first row as header
data.columns = data.iloc[0]

# get rid of the first row which contains the text which are now the headers
data = data.iloc[1:]
data.reset_index(drop=True, inplace = True)

return data

def Rcode_to_Clin_Imp(Rcode):

# import directory data
data = import_directory()

# cleaning the input:

# remove any dashes
Rcode = Rcode.replace('-','')

# Add R prefix to code
if not Rcode.startswith("R"):
    Rcode = "R" + Rcode

CI = data.loc[data['Clinical indication ID'] == Rcode, 'Clinical Indication'].iloc[0]

print(CI)

# should add errors excepts here too

return CI

Rcode_to_Clin_Imp(input("Please enter the Rcode"))

jess789550 commented 10 months ago

Logging and Testing will need to be added in future