Skip to content

Commit

Permalink
updates to services and dependencies
Browse files Browse the repository at this point in the history
1) update dependencies
2) remove warning for chalmers for now as they have reversed the decision after backlash
3) remove dignity from private services as they do not offer endocrinology
  • Loading branch information
beawitcht committed Dec 1, 2024
1 parent 2eeb3bd commit 23af373
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 90 deletions.
6 changes: 3 additions & 3 deletions app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
gunicorn==23.0.0
flask==3.0.3
docxtpl==0.18.0
flask==3.1.0
docxtpl==0.19.0
jinja2==3.1.4
convertapi==2.0.0
python-dotenv==1.0.1
Flask-WTF==1.2.2
email_validator==2.2.0
Flask-Limiter==3.8.0
Flask-Limiter==3.9.2
Flask-Caching==2.3.0
deepdiff==8.0.1
discord.py==2.4.0
Expand Down
154 changes: 77 additions & 77 deletions app/scripts/private_services.py
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
from dotenv import load_dotenv
from pathlib import Path
from deepdiff import DeepDiff
import discord
import os
import urllib
import bs4
import json

path = Path(__file__).parent.parent.resolve()
load_dotenv(path / '.env')

# setup discord client
discord_token = os.getenv("DISCORD_TOKEN")
discord_server = os.getenv("DISCORD_SERVER")
discord_channel = os.getenv("DISCORD_CHANNEL")
touch_path = os.getenv("TOUCH_PATH")
intents = discord.Intents.default()
client = discord.Client(intents=intents)
is_dev = os.getenv("IS_DEV")

@client.event
async def on_ready():
channel = client.get_channel(int(discord_channel))
await channel.send(discord_msg)
await client.close()


options = []
url = "https://genderkit.org.uk/resources/gender-services/"
soup = bs4.BeautifulSoup(urllib.request.urlopen(url).read(), "lxml")
# find the list of paid services
service_list = soup.find(string="Paid UK-based services").findNext('ul')
# extract name of each service
for li in service_list.findAll('li'):
options.append(li.find('a').text)

exclusions = ["Dr Lenihan", "Kelly Psychology", "GenderPlus"]
# remove services that don't include endocrinology or other criteria
options = [service for service in options if service not in exclusions]

# modify names where needed
if "Gender Identity SW" in options:
options.remove("Gender Identity SW")
options.append("Gender Identity South West")


# add other services not included in the list
options.append("GenderGP")

# sort options
options.sort()

# add other options
options.append("Other (UK Based, GMC Registered)")
options.append("Other (Non-UK Based)")

# output as json
options = {"Private Services": options}

with open(path / 'forms' / 'private_services.json') as f:
old_options = json.loads(f.read())

# on any change, write changes to file and send message of difference to discord
if old_options != options:

diff = json.dumps(DeepDiff(old_options["Private Services"], options["Private Services"], ignore_order=True), indent=4)
if len(str(diff)) > 1900:
discord_msg = "Private Services Changes too long check file"
elif is_dev == "1":
discord_msg = f"DEVLEOPMENT TEST: Private Services have changed!\n\nDifferences: \n\n{diff}"
else:
discord_msg = f"Private Services have changed!\n\nDifferences: \n\n{diff}"
with open(path / 'forms' / 'private_services.json', 'w') as f:
f.write(json.dumps(options))
client.run(discord_token)
Path(touch_path).touch()
from dotenv import load_dotenv
from pathlib import Path
from deepdiff import DeepDiff
import discord
import os
import urllib
import bs4
import json

path = Path(__file__).parent.parent.resolve()
load_dotenv(path / '.env')

# setup discord client
discord_token = os.getenv("DISCORD_TOKEN")
discord_server = os.getenv("DISCORD_SERVER")
discord_channel = os.getenv("DISCORD_CHANNEL")
touch_path = os.getenv("TOUCH_PATH")
intents = discord.Intents.default()
client = discord.Client(intents=intents)
is_dev = os.getenv("IS_DEV")

@client.event
async def on_ready():
channel = client.get_channel(int(discord_channel))
await channel.send(discord_msg)
await client.close()


options = []
url = "https://genderkit.org.uk/resources/gender-services/"
soup = bs4.BeautifulSoup(urllib.request.urlopen(url).read(), "lxml")
# find the list of paid services
service_list = soup.find(string="Paid UK-based services").findNext('ul')
# extract name of each service
for li in service_list.findAll('li'):
options.append(li.find('a').text)

exclusions = ["Dr Lenihan", "Kelly Psychology", "GenderPlus", "Dignity Gender Services"]
# remove services that don't include endocrinology or other criteria
options = [service for service in options if service not in exclusions]

# modify names where needed
if "Gender Identity SW" in options:
options.remove("Gender Identity SW")
options.append("Gender Identity South West")


# add other services not included in the list
options.append("GenderGP")

# sort options
options.sort()

# add other options
options.append("Other (UK Based, GMC Registered)")
options.append("Other (Non-UK Based)")

# output as json
options = {"Private Services": options}

with open(path / 'forms' / 'private_services.json') as f:
old_options = json.loads(f.read())

# on any change, write changes to file and send message of difference to discord
if old_options != options:

diff = json.dumps(DeepDiff(old_options["Private Services"], options["Private Services"], ignore_order=True), indent=4)
if len(str(diff)) > 1900:
discord_msg = "Private Services Changes too long check file"
elif is_dev == "1":
discord_msg = f"DEVLEOPMENT TEST: Private Services have changed!\n\nDifferences: \n\n{diff}"
else:
discord_msg = f"Private Services have changed!\n\nDifferences: \n\n{diff}"
with open(path / 'forms' / 'private_services.json', 'w') as f:
f.write(json.dumps(options))
client.run(discord_token)
Path(touch_path).touch()
18 changes: 9 additions & 9 deletions app/static/js/transinformed.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ function revealContentReferral() {

function gicsDropdownConditions() {
// add warnings to relevant gics
if ($("#gics option:selected").text().includes("Chalmers")) {
$("#gicWarning").html("<a target='blank_' href='https://transsafety.network/posts/chalmers-gic-pauses-gender-surgery-referrals-under-25s-cass-review/'> This GIC is not taking surgery referrals for under 25s</a>");
}
else {
$("#gicWarning").text("");
}
// if ($("#gics option:selected").text().includes("Chalmers")) {
// $("#gicWarning").html("<a target='blank_' href='https://transsafety.network/posts/chalmers-gic-pauses-gender-surgery-referrals-under-25s-cass-review/'> This GIC is not taking surgery referrals for under 25s</a>");
// }
// else {
// $("#gicWarning").text("");
// }
}

function revealContentSharedCare() {
Expand Down Expand Up @@ -271,7 +271,7 @@ function privateProviderConditions() {
privateProviderPreferredMessage.innerText = "";

}

else if (privateProviderList.value.includes("Other") || privateProviderList.value.includes("haven't chosen")) {
privateProviderList.classList.remove("is-invalid");
privateProviderList.classList.remove("is-valid");
Expand Down Expand Up @@ -348,12 +348,12 @@ function infoButtons(btn, btnLabel){
if (!currentState || currentState === "closed") {
btn.setAttribute("data-state", "opened");
btn.setAttribute("aria-expanded", "true");

btnLabel.setAttribute("aria-expanded", "true");
} else {
btn.setAttribute("data-state", "closed");
btn.setAttribute("aria-expanded", "false");

btnLabel.setAttribute("aria-expanded", "false");
}
});
Expand Down
Loading

0 comments on commit 23af373

Please sign in to comment.