Skip to content

Commit

Permalink
rework of wikidata file processing
Browse files Browse the repository at this point in the history
  • Loading branch information
stuchalk committed Jun 23, 2024
1 parent 8fec1f4 commit be14118
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions dashboard/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,11 @@
# load current file
rsid = 7
data = getrepsystemdata(rsid)

hits = json.loads(data)
# analyze data to remove entries that have SI unit (or equivalent) as quantity
hits = []
print(len(data['results']['bindings']))
for hit in data['results']['bindings']:
if hit['subclass1Label']['value'].startswith("unit of "):
hits.append(hit)
print(len(hits))
exit()

for hit in hits:
for hit in hits['results']['bindings']:
# check the hits for any that are not useful
if "http://www.wikidata.org/entity/Q" not in hit['unit']['value']:
continue
elif hit['unitLabel']['value'].startswith('Q'):
continue
else:
print(hit['unit']['value'])
print(hit['unit']['value'])

quant = None
# for unitless only
Expand Down

0 comments on commit be14118

Please sign in to comment.