Skip to content

Commit

Permalink
updated uat file structure and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugdha Polimera authored and Mugdha Polimera committed Dec 20, 2023
1 parent db1ac40 commit 4cdf905
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion adsdata/file_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
'extra_values': {'link_type': 'DATA', 'property': ['DATA']}, 'multiline': True,
'subparts': ['link_sub_type', 'item_count', ['url'], ['title']]}
data_files['gpn'] = {'path': 'links/gpn/all.links', 'default_value': [], 'multiline': True}
data_files['uat'] = {'path': 'links/uat/all.links', 'default_value': [], 'multiline': False}
data_files['uat'] = {'path': 'links/uat/all.links', 'default_value': [], 'multiline': True}

# file properties definitions required to generate metrics for CitationCapture records
# use dict to hold each input files and their properties and idiosycrasies
Expand Down
4 changes: 2 additions & 2 deletions adsdata/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ def read_value_for(self, bibcode):
# at this point, we have the first line with the bibcode in it
# roll up possible other values on adjacent lines in file
value = []
if self.file_info['path'] == 'links/gpn/all.links':
if 'gpn/' in self.file_info['path'] or 'uat/' in self.file_info['path']:
value.append("/".join(self._get_rest(current_line).split("\t")))
else:
value.append(self._get_rest(current_line))
current_line = self._readline()
while self.file_info.get('multiline', False) and (current_line not in [None, '']) and (bibcode == self._get_bibcode(current_line)):
if self.file_info['path'] == 'links/gpn/all.links':
if 'gpn/' in self.file_info['path'] or 'uat/' in self.file_info['path']:
value.append("/".join(self._get_rest(current_line).split("\t")))
else:
value.append(self._get_rest(current_line))
Expand Down
26 changes: 16 additions & 10 deletions adsdata/tests/data1/config/links/uat/all.links
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
2020AJ....160..175S antapex stellar classification galaxy stellar disks stellar interiors zenith distance
2020ApJ...892..106M cosmic microwave background radiation radio continuum emission subgiant stars x-ray telescopes two-point correlation function galaxy quenching solid matter physics comet nuclei astronomy education horizon
2020ApJS..247...19M f giant stars origin of the universe solar coronal radio emission field stars photodissociation reactions
2020ApJS..249....7B exoplanet evolution gravitational instability mesopause nebulae supernova evolution astronomy data visualization indigenous astronomy
2021ApJ...909..204F relativistic binary stars stellar types
2021ApJ...911..101D astronomical sextants celestial sphere interstellar magnetic fields lyman limit systems m stars plate tectonics solar coronal streamers center to limb observations
2021ApJ...922..164M lunar transient phenomena protogalaxies rapid stellar oscillations
2022ApJ...934L...4T proper motions two-spectrum binary stars stellar evolutionary models
2022ApJ...941...95W r stars space observatories spiral galaxies three-body problem virgo supercluster
2023ApJ...954..108T dust continuum emission interstellar synchrotron emission photoheliographs protoplanetary nebulae supergalactic longitude chemical thermodynamics
2020AJ....160..175S solar physics/solar motion/antapex 123
2020AJ....160..175S observational astronomy/astronomical research/classification systems/stellar classification 123
2020AJ....160..175S galactic and extra galactic astronomy/galaxy physics/galaxy disks/galaxy stellar disks 1523
2020AJ....160..175S stellar astronomy/stellar physics/stellar structures/stellar interiors 1606
2020ApJ...892..106M cosmology/origin of the universe/early universe/recombination (cosmology)/cosmic background radiation/cosmic microwave background radiation 322
2020ApJ...892..106M cosmology/origin of the universe/big bang theory/recombination (cosmology)/cosmic background radiation/cosmic microwave background radiation 322
2020ApJ...892..106M observational astronomy/astronomical methods/radio astronomy/cosmic noise/cosmic background radiation/cosmic microwave background radiation 322
2020ApJ...892..106M cosmology/astronomical radiation sources/radio sources/radio continuum emission 5
2020ApJ...892..106M interstellar medium/interstellar emissions/radio continuum emission 5
2020ApJ...892..106M stellar astronomy/stellar types/stellar evolutionary types/evolved stars/subgiant stars 1646
2021ApJ...911..101D observational astronomy/astronomical instrumentation/early astronomical instruments/astronomical sextants 93
2021ApJ...911..101D observational astronomy/astronomical techniques/astrometry/astronomical coordinate systems/equatorial coordinate system/celestial sphere 467
2021ApJ...922..164M solar system astronomy/lunar science/selenology/lunar features/lunar transient phenomena 976
2021ApJ...922..164M galaxies/protogalaxies 573
2021ApJ...922..164M stellar astronomy/stellar physics/stellar properties/stellar oscillations/rapid stellar oscillations 1363
2021ApJ...922..164M stellar astronomy/astroseismology/stellar oscillations/rapid stellar oscillations 1363
7 changes: 6 additions & 1 deletion adsdata/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ def test_read(self):
self.assertEqual(d['pub_openaccess'], {'pub_openaccess': False})
self.assertEqual(d['refereed'], {'refereed': False})
self.assertFalse(d['gpn'])
self.assertEqual(d['uat'], ['cosmic microwave background radiation', 'radio continuum emission', 'subgiant stars', 'x-ray telescopes', 'two-point correlation function', 'galaxy quenching', 'solid matter physics', 'comet nuclei', 'astronomy education', 'horizon'])
self.assertEqual(d['uat'], ['cosmology/origin of the universe/early universe/recombination (cosmology)/cosmic background radiation/cosmic microwave background radiation/322',
'cosmology/origin of the universe/big bang theory/recombination (cosmology)/cosmic background radiation/cosmic microwave background radiation/322',
'observational astronomy/astronomical methods/radio astronomy/cosmic noise/cosmic background radiation/cosmic microwave background radiation/322',
'cosmology/astronomical radiation sources/radio sources/radio continuum emission/5',
'interstellar medium/interstellar emissions/radio continuum emission/5',
'stellar astronomy/stellar types/stellar evolutionary types/evolved stars/subgiant stars/1646'])

with Processor(compute_metrics=False) as processor, patch('adsputils.load_config', return_value={'INPUT_DATA_ROOT': './test/data1/config/'}):
d = processor._read_next_bibcode('2024Icar..40815837G')
Expand Down
8 changes: 6 additions & 2 deletions adsdata/tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ def test_planetary_names(self):

def test_uat(self):
f = reader.NonbibFileReader('uat', data_files['uat'])
self.assertEqual({'uat': ['astronomical sextants', 'celestial sphere', 'interstellar magnetic fields', 'lyman limit systems', 'm stars', 'plate tectonics', 'solar coronal streamers', 'center to limb observations']}, f.read_value_for('2021ApJ...911..101D'))
self.assertEqual({'uat': ['lunar transient phenomena', 'protogalaxies', 'rapid stellar oscillations']}, f.read_value_for('2021ApJ...922..164M'))
self.assertEqual({'uat': ['observational astronomy/astronomical instrumentation/early astronomical instruments/astronomical sextants/93',
'observational astronomy/astronomical techniques/astrometry/astronomical coordinate systems/equatorial coordinate system/celestial sphere/467']}, f.read_value_for('2021ApJ...911..101D'))
self.assertEqual({'uat': ['solar system astronomy/lunar science/selenology/lunar features/lunar transient phenomena/976',
'galaxies/protogalaxies/573',
'stellar astronomy/stellar physics/stellar properties/stellar oscillations/rapid stellar oscillations/1363',
'stellar astronomy/astroseismology/stellar oscillations/rapid stellar oscillations/1363',]}, f.read_value_for('2021ApJ...922..164M'))

0 comments on commit 4cdf905

Please sign in to comment.