Skip to content
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

Add source_value to the describe function in regtap #492

Merged
merged 11 commits into from
Oct 4, 2023
Merged
22 changes: 22 additions & 0 deletions pyvo/registry/regtap.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ class RegistryResource(dalq.Record):
"res_description",
"reference_url",
"creator_seq",
"created",
"updated",
"rights",
"content_type",
"source_format",
"source_value",
Expand Down Expand Up @@ -551,6 +554,25 @@ def creators(self):
"""
return self.get("creator_seq", default="", decode=True).split(";")

@property
def created(self):
"""Date of creation of the resource."""
return self.get("created", decode=True)

@property
def updated(self):
"""Date of last modification of the resource."""
return self.get("updated", decode=True)

@property
def rights(self):
"""Rights information about the content of the resource.
ManonMarchand marked this conversation as resolved.
Show resolved Hide resolved

This information is often incomplete in the registry, you
might get more information with the ``reference_url``.
ManonMarchand marked this conversation as resolved.
Show resolved Hide resolved
"""
return self.get("rights", decode=True)

@property
def content_types(self):
"""
Expand Down
8 changes: 4 additions & 4 deletions pyvo/registry/tests/data/regtap.xml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions pyvo/registry/tests/test_regtap.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,11 @@ def test_record_fields(rt_pulsar_distance):
assert rec.source_value == "1993ApJS...88..529T"
assert rec.region_of_regard is None
assert rec.waveband == ['radio']
assert rec.created == "1999-03-02T10:21:53"
# updated might break when regenerating data/regtap.xml,
# replace by the new date
assert rec.updated == "2021-10-21T00:00:00"
assert rec.rights == "https://cds.unistra.fr/vizier-org/licences_vizier.html"
# access URL, standard_id and friends exercised in TestInterfaceSelection


Expand Down
6 changes: 6 additions & 0 deletions pyvo/registry/tests/test_rtcons.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ def test_expected_columns(self):
"res_description, "
"reference_url, "
"creator_seq, "
"created, "
"updated, "
"rights, "
"content_type, "
"source_format, "
"source_value, "
Expand All @@ -387,6 +390,9 @@ def test_group_by_columns(self):
"res_description, "
"reference_url, "
"creator_seq, "
"created, "
"updated, "
"rights, "
"content_type, "
"source_format, "
"source_value, "
Expand Down