Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates GIC scripts/dependencies. fixes dropdowns #260

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/forms/GICs.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"GICs": [["Wales", "Welsh Gender Service - Cardiff - Wait time (months): 12-13"], ["England", "Nottingham Centre for Transgender Health - Wait time (months): 22"], ["Scotland", "Edinburgh Chalmers Centre - Wait time (months): 23"], ["Scotland", "Grampian - Wait time (months): 24"], ["Scotland", "Inverness Highland Sexual Health - Wait time (months): 33"], ["England", "Northants Northamptonshire Healthcare Trust - Wait time (months): 49"], ["Scotland", "Glasgow Sandyford - Wait time (months): 53"], ["England", "Leeds and York Partnership Trust - Wait time (months): 53"], ["Northern Ireland", "Belfast Brackenburn Clinic - Wait time (months): 59"], ["England", "London Tavistock and Portman Trust - Wait time (months): 59"], ["England", "Sheffield Porterbrook Clinic - Wait time (months): 60"], ["England", "Newcastle Northern Region Gender Dysphoria Service - Wait time (months): 62"], ["England", "Exeter Devon Partnership Trust - Wait time (months): 84"]]}
{"GICs": [["Wales", "Welsh Gender Service - Cardiff - Wait time (months): 12-13"], ["Scotland", "Edinburgh Chalmers Centre - Wait time (months): 23"], ["England", "Nottingham Centre for Transgender Health - Wait time (months): 23"], ["Scotland", "Grampian - Wait time (months): 24"], ["Scotland", "Inverness Highland Sexual Health - Wait time (months): 29"], ["England", "Leeds and York Partnership Trust - Wait time (months): 53"], ["England", "Northants Northamptonshire Healthcare Trust - Wait time (months): 53"], ["Scotland", "Glasgow Sandyford - Wait time (months): 55"], ["Northern Ireland", "Belfast Brackenburn Clinic - Wait time (months): 59"], ["England", "London Tavistock and Portman Trust - Wait time (months): 60"], ["England", "Sheffield Porterbrook Clinic - Wait time (months): 62"], ["England", "Exeter Devon Partnership Trust - Wait time (months): 87"]]}
4 changes: 2 additions & 2 deletions app/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Flask-WTF==1.2.0
email_validator==2.1.0.post1
Flask-Limiter==3.5.0
Flask-Caching==2.1.0
deepdiff==6.6.1
deepdiff==6.7.1
discord.py==2.3.2
pandas==2.1.1
pandas==2.1.3
bs4==0.0.1
feedparser==6.0.10
15 changes: 12 additions & 3 deletions app/scripts/gics.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,24 @@ async def on_ready():
country = "Scotland"
else:
country = "England"

options.append((country, f"{service} - Wait time (months): {to_be_seen}" if pd.notna(to_be_seen) else "Unknown"))

if "Not accepting new patients" not in to_be_seen:
options.append((country, f"{service} - Wait time (months): {to_be_seen}" if pd.notna(to_be_seen) else "Unknown"))

# Filter out under 18 services
youth_services = ["GIDS", "KOI", "Youth", "Hub"]
options = [gic for gic in options if all(service not in gic[1] for service in youth_services)]

# Filter services not taking referrals from GP/self
invalid_services = ["London TransPlus"]
options = [gic for gic in options if all(service not in gic[1] for service in invalid_services)]

# filter out < > from options
options = [(country, re.sub(r'<|>', '', option)) for country, option in options]


# Sort options by months remaining
options.sort(key=lambda x: int(x[1].split(': ')[1][-2:]) if x[1].split(': ')[1] != 'nan' else 9999)
options.sort(key=lambda x: int(re.search(r'\d+', str(x[1].split(': ')[1])).group()) if pd.notna(x[1].split(': ')[1]) and re.search(r'\d+', str(x[1].split(': ')[1])) else 9999)

new_options = {"GICs": options}
new_options = json.dumps(new_options)
Expand Down
13 changes: 9 additions & 4 deletions app/static/js/transinformed.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,19 @@ function checkboxStatus() {

function disableButtonsLogic(){
var countriesSelect = document.getElementById("countries");
let docx = document.getElementById("docx")
let pdf = document.getElementById("pdf")
// Only allow submission when a country is selected
if (countriesSelect.value !== "Choose...") {
document.getElementById("docx").disabled = false;
document.getElementById("pdf").disabled = false;
docx.disabled = false;
if (pdf.innerText !== "PDF Unavailable") {
pdf.disabled = false;
}

}
else {
document.getElementById("docx").disabled = true;
document.getElementById("pdf").disabled = true;
docx.disabled = true;
pdf.disabled = true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/static/js/transinformed.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ <h2>About you</h2>
<button class="btn btn-outline-primary btn-lg mr-3" id="docx" name="docx" type="submit"
value="docx" disabled>Generate Docx</button>
{% if not pdf_available %}
<button class="btn btn-outline-primary btn-lg disabled" name="pdf" type="submit"
value="pdf">PDF Unavailable</button>
<button class="btn btn-outline-primary btn-lg" id="pdf" name="pdf" type="submit"
value="pdf" disabled>PDF Unavailable</button>
{% else %}
<button class="btn btn-outline-primary btn-lg" id="pdf" name="pdf" type="submit" value="pdf"
disabled>Generate PDF</button>
Expand Down
Loading