Skip to content

Commit

Permalink
completed code for wdquants
Browse files Browse the repository at this point in the history
  • Loading branch information
stuchalk committed Nov 21, 2024
1 parent d249d75 commit 2cb75a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "pypi"
attrs = ">=24.2.0"
bs4 = ">=0.0.2"
charset-normalizer = ">=3.4.0"
django = ">=5.1.0"
django = ">=5.1.3"
GTC = ">=1.5.1"
gunicorn = ">=23.0.0"
html5 = ">=0.0.9"
Expand All @@ -17,7 +17,7 @@ owlready2 = ">=0.47"
pnglatex = ">=1.1"
pylatexenc = ">=2.10"
pymysql = "==1.1.1"
pytz = ">=2024.2"
pytz = ">=2024.1"
pyyaml = ">=6.0.2"
qwikidata = ">=0.4.2"
rdflib = ">=7.1.0"
Expand Down
13 changes: 7 additions & 6 deletions dashboard/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,18 +732,19 @@
quant['sect'] = None
if 'isq' in keys:
isq = q['isq']['value']
tmp = re.findall(r'alttext="\{(.+?)}"', isq)
isq = (tmp[0].replace("\\displaystyle", '').replace("\\mathsf", '').replace(' ', '').
replace('{{', '').replace('}}', ''))
quant['isq'] = isq
if 'merror' in isq:
quant['isq'] = None
else:
tmp = re.findall(r'alttext="\{(.+?)\}"', isq)
isq = (tmp[0].replace("\\displaystyle", '').replace("\\mathsf", '').replace(' ', '').
replace('{{', '').replace('}}', ''))
quant['isq'] = isq
else:
quant['isq'] = None
qnt = None
if quant['source'] and quant['sect']:
num = re.findall(r'([A-Z]{3}) 80000-(\d+?):', str(quant['source']))
isocode = num[0][0] + '-80000-' + num[0][1]
print(isocode)

# search the quantities table for quantity based on the source and section
found = Quantities.objects.filter(iso_source=isocode, iso_item=quant['sect'])
if found:
Expand Down
2 changes: 1 addition & 1 deletion static/umis_quants_query_112024.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
{
"qntid": "http://www.wikidata.org/entity/Q11376",
"quant": "acceleration",
"isq": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\" alttext=\"{\\displaystyle {\\mathsf {L}}{\\mathsf {T}}^{-2}}\">\n <semantics>\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mstyle displaystyle=\"true\" scriptlevel=\"0\">\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mi mathvariant=\"sans-serif\">L</mi>\n </mrow>\n </mrow>\n <msup>\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mi mathvariant=\"sans-serif\">T</mi>\n </mrow>\n </mrow>\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mo>&#x2212;<!-- − --></mo>\n <mn>2</mn>\n </mrow>\n </msup>\n </mstyle>\n </mrow>\n <annotation encoding=\"application/x-tex\">{\\displaystyle {\\mathsf {L}}{\\mathsf {T}}^{-2}}</annotation>\n </semantics>\n</math>",
"isq": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\" alttext=\" \">\n <semantics>\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mstyle displaystyle=\"true\" scriptlevel=\"0\">\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mi mathvariant=\"sans-serif\">L</mi>\n </mrow>\n </mrow>\n <msup>\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mi mathvariant=\"sans-serif\">T</mi>\n </mrow>\n </mrow>\n <mrow class=\"MJX-TeXAtom-ORD\">\n <mo>&#x2212;<!-- − --></mo>\n <mn>2</mn>\n </mrow>\n </msup>\n </mstyle>\n </mrow>\n <annotation encoding=\"application/x-tex\">{\\displaystyle {\\mathsf {L}}{\\mathsf {T}}^{-2}}</annotation>\n </semantics>\n</math>",
"source": "ISO 80000-3:2019 Quantities and units — Part 3: Space and time",
"sect": "3-9.1"
},
Expand Down

0 comments on commit 2cb75a0

Please sign in to comment.