New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional article properties #55
Additional article properties #55
Conversation
iirc some of these fields were intentionally omitted due to containing either misleading, redundant, or useless info. @jonnybazookatone could you confirm that that's still the case? If it is, maybe another ticket for adsabs/adsws? |
Yes, some are confusing and for internal use, such as I'll check which are relevant and get back to you. |
@vsudilov I'll gladly remove useless fields and instead leave a comment on why those were omitted for future reference. @jonnybazookatone could you also check if there are additional fields not included yet that may be useful? Regarding redundant fields, I noticed that the @vsudilov, any specific reason that the |
Ideally any fields that shouldn't be public facing would be hidden upstream at adsabs/adsws. From my recollection, That being said, I'm not sure how The document's All of that is probably worth confirming with the ADS directly. |
That also seems the most logic action to me and would also reduce bandwidth, as all those redundant/private fields are currently returned with a catch-all query for fields Regarding the citations, in further tests so far the list fetched via the |
Sorry for the delay, was double checking on our side. The The For self-consistency, and to remove some confusion for the user (as also the UI is using the operators), we're currently encouraging the use of the operators rather than the fields, and the fields may also be removed from the response in the future. I'm working on the list of fields that may be relevant, and I'll post it here when it's complete. |
I would remove:
Then you can also remove the changes for
Plus some others that might be useful:
There are several |
I updated the article properties accordingly and looked into the failing check. The test fails for Python 3 only because of Python 2 and 3 differences in the I think the equality operator for articles should be fixed to behave identical for both Python 2 and 3. |
I found another issue: In the article method |
Yeah, I agree. I was having a think, how about something like: def __eq__(self, other):
try:
this = getattr(self, 'bibcode', None)
other = getattr(other, 'bibcode', None)
except APIResponseError:
raise TypeError("Cannot compare articles without ids")
else:
if this is None or other is None:
raise TypeError("Cannot compare articles without bibcodes")
return this == other Or the As per def __unicode__(self):
try:
first_author = getattr(self, 'first_author', 'Unknown author')
author = getattr(self, 'author', None)
if author is not None and len(author) > 1:
first_author += " et al."
return u"<{author} {year}, {bibcode}>".format(
author=first_author,
year=self.year,
bibcode=self.bibcode,
)
except APIResponseError:
return self.__repr__() This is if we want to keep the current behaviour of raising an APIError when there is no Feels a bit like celetaping the problem though, anyone else got better ideas? |
I'm in favour of the proposed equality operator modification, I also had something very similar in mind. Changing the getter would IMHO introduce an inconsistency with the other getters and is harder to maintain... Regarding Additionally, I think Finally, |
Good discussions, here's my preference: Fix the tests by explicitly defining bibcode. |
Several new on-demand getters for fields that I encountered in articles. I guess there are many more to be added. A different approach could maybe use
__getattr__
instead of explicitly defining each field.One of the newly supported fields,
link_data
, is a list of strings that contain JSON. I added a value processor to automatically parse those accordingly during the Article constructor (and hence implicitly for the getter).There are other fields for which additional parsing may be useful, notably all date-related fields that are RFC 3339 encoded and could easily be processed using
dateutil.parse
.