diff --git a/find_brand_names.py b/find_brand_names.py index 4265e73..7f1b1fd 100755 --- a/find_brand_names.py +++ b/find_brand_names.py @@ -78,18 +78,25 @@ for mp_preferred_term in sorted(brand_names.keys()): for i in range(1, len(words)): short_name = ' '.join(words[0:i]) + # Conflict if ambiguous brand name prefix if any(b.startswith(short_name) for m in brand_names.keys() if m != mp_preferred_term for b in brand_names[m]): - # Conflict continue # Exceptions if short_name == 'Coloxyl with': - continue + continue # Looks strange to cut off here + if short_name == 'Magnesium': + continue # Disambiguates Magnesium Forte # Can shorten + if brand_name in brand_names[mp_preferred_term]: brand_names[mp_preferred_term].remove(brand_name) - brand_names[mp_preferred_term].add(short_name) + + # Don't list brand name if it is same as generic + if short_name.lower() != mp_preferred_term.lower(): + brand_names[mp_preferred_term].add(short_name) + break # Add to database diff --git a/import_pbs_xml.py b/import_pbs_xml.py index 9f449da..bc389b7 100755 --- a/import_pbs_xml.py +++ b/import_pbs_xml.py @@ -141,7 +141,10 @@ for mpp_id in sorted(list(mpps_to_parse)): mp = root.find('pbs:drugs-list', ns).find('pbs:mp[@xml:id="' + mp_id + '"]', ns) mp_code = mp.find('pbs:code[@rdf:resource="http://pbs.gov.au/Drug/MP"]', ns).text # Must look this up because the in is only SNOMED - # Manual fixups for metoprolol + # ------------- + # Manual fixups + + # Metoprolol if 'METOPROLOL' in mpp_preferred_term: # Incorrect capitalisation mpp_preferred_term = mpp_preferred_term.replace('METOPROLOL SUCCINATE Tablet', 'metoprolol succinate') @@ -156,6 +159,11 @@ for mpp_id in sorted(list(mpps_to_parse)): mp_id = None mp_code = '432PBSC' + # Magnesium + if mpp_preferred_term.startswith('magnesium 37.4 mg'): + # Specify form + mpp_preferred_term = mpp_preferred_term.replace('magnesium 37.4 mg', 'magnesium (as aspartate) 37.4 mg') + cur.execute('INSERT INTO pbs_mpp (code, mp_code, preferred_term) VALUES (?, ?, ?)', (mpp_code, mp_code, mpp_preferred_term)) # Queue the MP for parsing @@ -179,6 +187,10 @@ for mp_id in sorted(list(mps_to_parse)): # Specified as all uppercase in PBS XML for some reason mp_preferred_term = 'metoprolol' + if mp_code == '686PBSC': + # Specify form + mp_preferred_term = 'magnesium aspartate' + cur.execute('INSERT INTO pbs_mp (code, preferred_term) VALUES (?, ?)', (mp_code, mp_preferred_term)) # Parse TPPs diff --git a/non_pbs.csv b/non_pbs.csv index 5810fb9..a7b6e15 100644 --- a/non_pbs.csv +++ b/non_pbs.csv @@ -22,6 +22,8 @@ ferrous sulfate + folic acid,"ferrous sulfate 270 mg (iron 87.4 mg) + folic acid ferrous sulfate + folic acid,"ferrous sulfate 270 mg (iron 87.4 mg) + folic acid 300 microgram capsule, 60",Fefol,https://www.mimsonline.com.au.acs.hcn.com.au/Search/AbbrPI.aspx?ID=2850001_2,2023-02-04, iron polymaltose,"iron (as polymaltose) 100 mg tablet, 30",Maltofer,https://www.mimsonline.com.au.acs.hcn.com.au/Search/AbbrPI.aspx?ID=6800001_2,2023-02-04, lactulose,"lactulose 0.67 g/mL oral liquid, 500 mL",Actilax,https://amhonline.amh.net.au.acs.hcn.com.au/chapters/gastrointestinal-drugs/laxatives/osmotic-laxatives/lactulose,2023-02-18, +magnesium oxide + magnesium phosphate + magnesium amino acid chelate,"magnesium (as oxide) 337 mg + magnesium (as phosphate) 36 mg + magnesium (as amino acid chelate) 27 mg (total magnesium 400 mg) capsule, 30",Magnesium Forte,https://www.chemistwarehouse.com.au/buy/113879,2023-02-24, +magnesium oxide + magnesium phosphate + magnesium amino acid chelate,"magnesium (as oxide) 337 mg + magnesium (as phosphate) 36 mg + magnesium (as amino acid chelate) 27 mg (total magnesium 400 mg) capsule, 100",Magnesium Forte,https://www.chemistwarehouse.com.au/buy/111599,2023-02-24, melatonin,"melatonin 2 mg modified release tablet, 30",Circadin,https://amhonline.amh.net.au.acs.hcn.com.au/chapters/psychotropic-drugs/drugs-anxiety-sleep-disorders/other-drugs-anxiety-sleep-disorders/melatonin,2023-02-10, melatonin,"melatonin 2 mg modified release tablet, 60",Circadin,https://amhonline.amh.net.au.acs.hcn.com.au/chapters/psychotropic-drugs/drugs-anxiety-sleep-disorders/other-drugs-anxiety-sleep-disorders/melatonin,2023-02-10, montelukast,"montelukast 10 mg tablet, 14",Singulair,https://amhonline.amh.net.au.acs.hcn.com.au/chapters/respiratory-drugs/drugs-asthma-chronic-obstructive-pulmonary-disease/other-drugs-asthma/montelukast,2023-02-06,