parent
16a47cbb3a
commit
b5fd01bd4f
@ -170,11 +170,18 @@
|
|||||||
span.innerText = '(' + restriction['num_criteria'] + ' criteria)';
|
span.innerText = '(' + restriction['num_criteria'] + ' criteria)';
|
||||||
li.appendChild(span);
|
li.appendChild(span);
|
||||||
|
|
||||||
|
// Render restriction content
|
||||||
|
let content = '';
|
||||||
|
if (restriction['treatment_phase']) {
|
||||||
|
content += '<p><i>' + restriction['treatment_phase'] + '</i></p>'
|
||||||
|
}
|
||||||
|
content += restriction['criteria_rendered'];
|
||||||
|
|
||||||
// Create popover for criteria
|
// Create popover for criteria
|
||||||
new bootstrap.Popover(span, {
|
new bootstrap.Popover(span, {
|
||||||
trigger: 'hover focus',
|
trigger: 'hover focus',
|
||||||
title: restriction['indication'],
|
title: restriction['indication'],
|
||||||
content: restriction['criteria_rendered'],
|
content: content,
|
||||||
html: true
|
html: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ cur.execute('DROP TABLE IF EXISTS pbs_item_restriction')
|
|||||||
cur.execute('CREATE TABLE pbs_item_restriction (item_code TEXT, restriction_code INTEGER)')
|
cur.execute('CREATE TABLE pbs_item_restriction (item_code TEXT, restriction_code INTEGER)')
|
||||||
|
|
||||||
cur.execute('DROP TABLE IF EXISTS pbs_restriction')
|
cur.execute('DROP TABLE IF EXISTS pbs_restriction')
|
||||||
cur.execute('CREATE TABLE pbs_restriction (code INTEGER PRIMARY KEY, treatment_of INTEGER, indication TEXT, criteria_operator TEXT, criteria_rendered TEXT)')
|
cur.execute('CREATE TABLE pbs_restriction (code INTEGER PRIMARY KEY, treatment_of INTEGER, indication TEXT, treatment_phase TEXT, criteria_operator TEXT, criteria_rendered TEXT)')
|
||||||
|
|
||||||
cur.execute('DROP TABLE IF EXISTS pbs_restriction_criteria')
|
cur.execute('DROP TABLE IF EXISTS pbs_restriction_criteria')
|
||||||
cur.execute('CREATE TABLE pbs_restriction_criteria (restriction_code INTEGER, criteria_code INTEGER)')
|
cur.execute('CREATE TABLE pbs_restriction_criteria (restriction_code INTEGER, criteria_code INTEGER)')
|
||||||
@ -194,6 +194,13 @@ for restriction_id in sorted(list(restrictions_to_parse)):
|
|||||||
code = restriction.find('pbs:code[@rdf:resource="http://pbs.gov.au/code/restriction"]', ns).text
|
code = restriction.find('pbs:code[@rdf:resource="http://pbs.gov.au/code/restriction"]', ns).text
|
||||||
treatment_of = restriction.find('pbs:code[@rdf:resource="http://pbs.gov.au/code/treatment-of"]', ns).text
|
treatment_of = restriction.find('pbs:code[@rdf:resource="http://pbs.gov.au/code/treatment-of"]', ns).text
|
||||||
|
|
||||||
|
# Get treatment phase if any
|
||||||
|
treatment_phase = None
|
||||||
|
if treatment_phase_reference := restriction.find('pbs:treatment-phase-reference', ns):
|
||||||
|
treatment_phase_id = treatment_phase_reference.get('{http://www.w3.org/1999/xlink}href').lstrip('#')
|
||||||
|
treatment_phase_elem = root.find('pbs:prescribing-texts-list', ns).find('pbs:treatment-phase[@xml:id="' + treatment_phase_id + '"]', ns)
|
||||||
|
treatment_phase = treatment_phase_elem.find('pbs:preferred-term', ns).text
|
||||||
|
|
||||||
# Build the name of the indication (episodicity, severity, condition)
|
# Build the name of the indication (episodicity, severity, condition)
|
||||||
indication_id = restriction.find('pbs:indication-reference', ns).get('{http://www.w3.org/1999/xlink}href').lstrip('#')
|
indication_id = restriction.find('pbs:indication-reference', ns).get('{http://www.w3.org/1999/xlink}href').lstrip('#')
|
||||||
indication = root.find('pbs:prescribing-texts-list', ns).find('pbs:indication[@xml:id="' + indication_id + '"]', ns)
|
indication = root.find('pbs:prescribing-texts-list', ns).find('pbs:indication[@xml:id="' + indication_id + '"]', ns)
|
||||||
@ -236,7 +243,7 @@ for restriction_id in sorted(list(restrictions_to_parse)):
|
|||||||
else:
|
else:
|
||||||
operator = None
|
operator = None
|
||||||
|
|
||||||
cur.execute('INSERT INTO pbs_restriction (code, treatment_of, indication, criteria_operator) VALUES (?, ?, ?, ?)', (code, treatment_of, ' '.join(indication_strings), operator))
|
cur.execute('INSERT INTO pbs_restriction (code, treatment_of, indication, treatment_phase, criteria_operator) VALUES (?, ?, ?, ?, ?)', (code, treatment_of, ' '.join(indication_strings), treatment_phase, operator))
|
||||||
|
|
||||||
# Parse criteria
|
# Parse criteria
|
||||||
for criteria_id in sorted(list(criteria_to_parse)):
|
for criteria_id in sorted(list(criteria_to_parse)):
|
||||||
|
Loading…
Reference in New Issue
Block a user